Re: [PATCH] af9005: use generic_bulk_ctrl_endpoint_response

2010-06-20 Thread Michael Krufky
On Mon, Jun 21, 2010 at 1:29 AM, Michael Krufky  wrote:
> Could somebody please test this patch and confirm that it doesn't
> break the af9005 support?
>
> This patch removes the af9005_usb_generic_rw function and uses the
> dvb_usb_generic_rw function instead, using
> generic_bulk_ctrl_endpoint_response to differentiate between the read
> pipe and the write pipe.
>
> Also found in the mercurial repository:
>
> http://kernellabs.com/hg/~mkrufky/af9005
>
> Cheers,
>
> Mike Krufky

(patch inline this time)

# HG changeset patch
# User Michael Krufky 
# Date 1277095782 14400
# Node ID 8d43c09cfe26655166e7ab039f765223bc87f3c5
# Parent 723e03a57ef335a4e005ac57e49fa50d2c66a010
af9005: use generic_bulk_ctrl_endpoint_response

From: Michael Krufky 

Priority: normal

Signed-off-by: Michael Krufky 

--- a/linux/drivers/media/dvb/dvb-usb/af9005.c  Sun Jan 31 19:06:10 2010 -0500
+++ b/linux/drivers/media/dvb/dvb-usb/af9005.c  Mon Jun 21 00:49:42 2010 -0400
@@ -54,50 +54,6 @@
int led_state;
 };

-static int af9005_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen,
- u8 *rbuf, u16 rlen, int delay_ms)
-{
-   int actlen, ret = -ENOMEM;
-
-   if (wbuf == NULL || wlen == 0)
-   return -EINVAL;
-
-   if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
-   return ret;
-
-   deb_xfer(">>> ");
-   debug_dump(wbuf, wlen, deb_xfer);
-
-   ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
-   2), wbuf, wlen,
-  &actlen, 2000);
-
-   if (ret)
-   err("bulk message failed: %d (%d/%d)", ret, wlen, actlen);
-   else
-   ret = actlen != wlen ? -1 : 0;
-
-   /* an answer is expected, and no error before */
-   if (!ret && rbuf && rlen) {
-   if (delay_ms)
-   msleep(delay_ms);
-
-   ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
-   0x01), rbuf,
-  rlen, &actlen, 2000);
-
-   if (ret)
-   err("recv bulk message failed: %d", ret);
-   else {
-   deb_xfer("<<< ");
-   debug_dump(rbuf, actlen, deb_xfer);
-   }
-   }
-
-   mutex_unlock(&d->usb_mutex);
-   return ret;
-}
-
 static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
  int readwrite, int type, u8 * values, int len)
 {
@@ -146,7 +102,7 @@
obuf[8] = values[0];
obuf[7] = command;

-   ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 17, 0);
+   ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 17, 0);
if (ret)
return ret;

@@ -537,7 +493,7 @@
buf[6] = wlen;
for (i = 0; i < wlen; i++)
buf[7 + i] = wbuf[i];
-   ret = af9005_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0);
+   ret = dvb_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0);
if (ret)
return ret;
if (ibuf[2] != 0x27) {
@@ -584,7 +540,7 @@

obuf[6] = len;
obuf[7] = address;
-   ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 14, 0);
+   ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 14, 0);
if (ret)
return ret;
if (ibuf[2] != 0x2b) {
@@ -885,7 +841,7 @@
obuf[2] = 0x40; /* read remote */
obuf[3] = 1;/* rest of packet length */
obuf[4] = st->sequence++;   /* sequence number */
-   ret = af9005_usb_generic_rw(d, obuf, 5, ibuf, 256, 0);
+   ret = dvb_usb_generic_rw(d, obuf, 5, ibuf, 256, 0);
if (ret) {
err("rc query failed");
return ret;
@@ -1077,6 +1033,9 @@
.rc_key_map_size = 0,
.rc_query = af9005_rc_query,

+   .generic_bulk_ctrl_endpoint  = 2,
+   .generic_bulk_ctrl_endpoint_response = 1,
+
.num_device_descs = 3,
.devices = {
{.name = "Afatech DVB-T USB1.1 stick",
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] af9005: use generic_bulk_ctrl_endpoint_response

2010-06-20 Thread Michael Krufky
Could somebody please test this patch and confirm that it doesn't
break the af9005 support?

This patch removes the af9005_usb_generic_rw function and uses the
dvb_usb_generic_rw function instead, using
generic_bulk_ctrl_endpoint_response to differentiate between the read
pipe and the write pipe.

Also found in the mercurial repository:

http://kernellabs.com/hg/~mkrufky/af9005

Cheers,

Mike Krufky


8d43c09cfe26.patch
Description: Binary data


[PATCH] soc_camera_platform: add set_fmt callback

2010-06-20 Thread Baruch Siach
This allows the platform camera to arrange a change in the capture format.

Signed-off-by: Baruch Siach 
---
 drivers/media/video/soc_camera_platform.c |3 +++
 include/media/soc_camera_platform.h   |2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/soc_camera_platform.c 
b/drivers/media/video/soc_camera_platform.c
index 248c986..208fd42 100644
--- a/drivers/media/video/soc_camera_platform.c
+++ b/drivers/media/video/soc_camera_platform.c
@@ -61,6 +61,9 @@ static int soc_camera_platform_try_fmt(struct v4l2_subdev *sd,
 {
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
 
+   if (p->try_fmt)
+   return p->try_fmt(p, mf);
+
mf->width   = p->format.width;
mf->height  = p->format.height;
mf->code= p->format.code;
diff --git a/include/media/soc_camera_platform.h 
b/include/media/soc_camera_platform.h
index 0ecefe2..0558ffc 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -22,6 +22,8 @@ struct soc_camera_platform_info {
struct v4l2_mbus_framefmt format;
unsigned long bus_param;
struct device *dev;
+   int (*try_fmt)(struct soc_camera_platform_info *info,
+   struct v4l2_mbus_framefmt *mf);
int (*set_capture)(struct soc_camera_platform_info *info, int enable);
 };
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv4 1/3] mx2_camera: Add soc_camera support for i.MX25/i.MX27

2010-06-20 Thread Baruch Siach
This is the soc_camera support developed by Sascha Hauer for the i.MX27.  Alan
Carvalho de Assis modified the original driver to get it working on more recent
kernels. I modified it further to add support for i.MX25. This driver has been
tested on i.MX25 and i.MX27 based platforms.

Signed-off-by: Baruch Siach 
---
 arch/arm/plat-mxc/include/mach/memory.h  |4 +-
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig  |   13 +
 drivers/media/video/Makefile |1 +
 drivers/media/video/mx2_camera.c | 1493 ++
 5 files changed, 1555 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c

diff --git a/arch/arm/plat-mxc/include/mach/memory.h 
b/arch/arm/plat-mxc/include/mach/memory.h
index c4b40c3..5803836 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -44,12 +44,12 @@
  */
 #define CONSISTENT_DMA_SIZE SZ_8M
 
-#elif defined(CONFIG_MX1_VIDEO)
+#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_MX2_VIDEO)
 /*
  * Increase size of DMA-consistent memory region.
  * This is required for i.MX camera driver to capture at least four VGA frames.
  */
 #define CONSISTENT_DMA_SIZE SZ_4M
-#endif /* CONFIG_MX1_VIDEO */
+#endif /* CONFIG_MX1_VIDEO || CONFIG_MX2_VIDEO */
 
 #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h 
b/arch/arm/plat-mxc/include/mach/mx2_cam.h
new file mode 100644
index 000..3c080a3
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h
@@ -0,0 +1,46 @@
+/*
+ * mx2-cam.h - i.MX27/i.MX25 camera driver header file
+ *
+ * Copyright (C) 2003, Intel Corporation
+ * Copyright (C) 2008, Sascha Hauer 
+ * Copyright (C) 2010, Baruch Siach 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __MACH_MX2_CAM_H_
+#define __MACH_MX2_CAM_H_
+
+#define MX2_CAMERA_SWAP16  (1 << 0)
+#define MX2_CAMERA_EXT_VSYNC   (1 << 1)
+#define MX2_CAMERA_CCIR(1 << 2)
+#define MX2_CAMERA_CCIR_INTERLACE  (1 << 3)
+#define MX2_CAMERA_HSYNC_HIGH  (1 << 4)
+#define MX2_CAMERA_GATED_CLOCK (1 << 5)
+#define MX2_CAMERA_INV_DATA(1 << 6)
+#define MX2_CAMERA_PCLK_SAMPLE_RISING  (1 << 7)
+#define MX2_CAMERA_PACK_DIR_MSB(1 << 8)
+
+/**
+ * struct mx2_camera_platform_data - optional platform data for mx2_camera
+ * @flags: any combination of MX2_CAMERA_*
+ * @clk: clock rate of the csi block / 2
+ */
+struct mx2_camera_platform_data {
+   unsigned long flags;
+   unsigned long clk;
+};
+
+#endif /* __MACH_MX2_CAM_H_ */
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index bdbc9d3..47bf6e6 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -969,6 +969,19 @@ config VIDEO_OMAP2
---help---
  This is a v4l2 driver for the TI OMAP2 camera capture interface
 
+config MX2_VIDEO
+bool
+
+config VIDEO_MX2
+   tristate "i.MX27/i.MX25 Camera Sensor Interface driver"
+   depends on VIDEO_DEV && SOC_CAMERA && (MACH_MX27 || ARCH_MX25)
+   select VIDEOBUF_DMA_CONTIG
+   select MX2_VIDEO
+   ---help---
+ This is a v4l2 driver for the i.MX27 and the i.MX25 Camera Sensor
+ Interface
+
+
 #
 # USB Multimedia device configuration
 #
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index cc93859..b08bd2b 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -162,6 +162,7 @@ obj-$(CONFIG_SOC_CAMERA)+= soc_camera.o 
soc_mediabus.o
 obj-$(CONFIG_SOC_CAMERA_PLATFORM)  += soc_camera_platform.o
 # soc-camera host drivers have to be linked after camera drivers
 obj-$(CONFIG_VIDEO_MX1)+= mx1_camera.o
+obj-$(CONFIG_VIDEO_MX2)+= mx2_camera.o
 obj-$(CONFIG_VIDEO_MX3)+= mx3_camera.o
 obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
 obj-$(CONFIG_VIDEO_SH_MOBILE_CEU)  += sh_mobile_ceu_camera.o
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
new file mode 100644
index 000..79ad522
--- /dev/null
+++ b/drivers/media/video/mx2_camera.c

[PATCHv4 3/3] mx25: add support for the CSI device

2010-06-20 Thread Baruch Siach
Signed-off-by: Baruch Siach 
---
 arch/arm/mach-mx25/clock.c|   14 --
 arch/arm/mach-mx25/devices.c  |   22 ++
 arch/arm/mach-mx25/devices.h  |1 +
 arch/arm/plat-mxc/include/mach/mx25.h |2 ++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index 1550149..7a98d18 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -129,6 +129,11 @@ static unsigned long get_rate_lcdc(struct clk *clk)
return get_rate_per(7);
 }
 
+static unsigned long get_rate_csi(struct clk *clk)
+{
+   return get_rate_per(0);
+}
+
 static unsigned long get_rate_otg(struct clk *clk)
 {
return 4800; /* FIXME */
@@ -174,6 +179,8 @@ DEFINE_CLOCK(cspi3_clk,  0, CCM_CGCR1,  7, get_rate_ipg, 
NULL, NULL);
 DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL,   NULL, NULL);
 DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL,  NULL, NULL);
 DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0,  7, NULL,  NULL, &lcdc_ahb_clk);
+DEFINE_CLOCK(csi_ahb_clk, 0, CCM_CGCR0, 18, get_rate_csi, NULL, NULL);
+DEFINE_CLOCK(csi_per_clk, 0, CCM_CGCR0, 0, get_rate_csi, NULL, &csi_ahb_clk);
 DEFINE_CLOCK(uart1_clk,  0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart2_clk,  0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
 DEFINE_CLOCK(uart3_clk,  0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
@@ -191,6 +198,7 @@ DEFINE_CLOCK(i2c_clk,0, CCM_CGCR0,  6, 
get_rate_i2c, NULL, NULL);
 DEFINE_CLOCK(fec_clk,   0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
 DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1,  8, get_rate_ipg, NULL, NULL);
 DEFINE_CLOCK(lcdc_clk,  0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
+DEFINE_CLOCK(csi_clk,0, CCM_CGCR1,  4, get_rate_csi, NULL,  &csi_per_clk);
 
 #define _REGISTER_CLOCK(d, n, c)   \
{   \
@@ -225,6 +233,7 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("fec.0", NULL, fec_clk)
_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
+   _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
 };
 
 int __init mx25_clocks_init(void)
@@ -239,8 +248,9 @@ int __init mx25_clocks_init(void)
__raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
__raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
 
-   /* Clock source for lcdc is upll */
-   __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64);
+   /* Clock source for lcdc and csi is upll */
+   __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0),
+   CRM_BASE + 0x64);
 
mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
 
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index 3a405fa..cbecbe1 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -515,3 +515,25 @@ struct platform_device mxc_wdt = {
.num_resources = ARRAY_SIZE(mxc_wdt_resources),
.resource = mxc_wdt_resources,
 };
+
+static struct resource mx25_csi_resources[] = {
+   {
+   .start  = MX25_CSI_BASE_ADDR,
+   .end= MX25_CSI_BASE_ADDR + 0xfff,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = MX25_INT_CSI,
+   .flags  = IORESOURCE_IRQ
+   },
+};
+
+struct platform_device mx25_csi_device = {
+   .name   = "mx2-camera",
+   .id = 0,
+   .num_resources  = ARRAY_SIZE(mx25_csi_resources),
+   .resource   = mx25_csi_resources,
+   .dev= {
+   .coherent_dma_mask = 0x,
+   },
+};
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
index cee12c0..b46f122 100644
--- a/arch/arm/mach-mx25/devices.h
+++ b/arch/arm/mach-mx25/devices.h
@@ -22,3 +22,4 @@ extern struct platform_device mxc_nand_device;
 extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
+extern struct platform_device mx25_csi_device;
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h 
b/arch/arm/plat-mxc/include/mach/mx25.h
index 4eb6e33..5e6a8b5 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -34,11 +34,13 @@
 #define MX25_NFC_BASE_ADDR 0xbb00
 #define MX25_DRYICE_BASE_ADDR  0x53ffc000
 #define MX25_LCDC_BASE_ADDR0x53fbc000
+#define MX25_CSI_BASE_ADDR 0x53ff8000
 
 #define MX25_INT_DRYICE25
 #define MX25_INT_FEC   57
 #define MX25_INT_NANDFC33
 #define MX25_INT_LCDC  39
+#define MX25_INT_CSI   17
 
 #if defined(IMX_NEEDS_DEPRECATED_SYMBOLS)
 #define UART1_BASE_ADDRMX25_UART1_BASE_ADDR
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message t

[PATCHv4 2/3] mx27: add support for the CSI device

2010-06-20 Thread Baruch Siach
Signed-off-by: Baruch Siach 
---
 arch/arm/mach-mx2/clock_imx27.c |2 +-
 arch/arm/mach-mx2/devices.c |   31 +++
 arch/arm/mach-mx2/devices.h |1 +
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index 0f0823c..5a1aa15 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
_REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
-   _REGISTER_CLOCK(NULL, "csi", csi_clk)
+   _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
_REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
_REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk1)
_REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk)
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
index a0aeb8a..08201f5 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-mx2/devices.c
@@ -40,6 +40,37 @@
 
 #include "devices.h"
 
+#ifdef CONFIG_MACH_MX27
+static struct resource mx27_camera_resources[] = {
+   {
+  .start = MX27_CSI_BASE_ADDR,
+  .end = MX27_CSI_BASE_ADDR + 0x1f,
+  .flags = IORESOURCE_MEM,
+   }, {
+  .start = MX27_EMMA_PRP_BASE_ADDR,
+  .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f,
+  .flags = IORESOURCE_MEM,
+   }, {
+  .start = MX27_INT_CSI,
+  .end = MX27_INT_CSI,
+  .flags = IORESOURCE_IRQ,
+   },{
+  .start = MX27_INT_EMMAPRP,
+  .end = MX27_INT_EMMAPRP,
+  .flags = IORESOURCE_IRQ,
+   },
+};
+struct platform_device mx27_camera_device = {
+   .name = "mx2-camera",
+   .id = 0,
+   .num_resources = ARRAY_SIZE(mx27_camera_resources),
+   .resource = mx27_camera_resources,
+   .dev = {
+   .coherent_dma_mask = 0x,
+   },
+};
+#endif
+
 /*
  * SPI master controller
  *
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
index 84ed513..8bdf018 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-mx2/devices.h
@@ -29,6 +29,7 @@ extern struct platform_device mxc_i2c_device1;
 extern struct platform_device mxc_sdhc_device0;
 extern struct platform_device mxc_sdhc_device1;
 extern struct platform_device mxc_otg_udc_device;
+extern struct platform_device mx27_camera_device;
 extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv4 0/3] Driver for the i.MX2x CMOS Sensor Interface

2010-06-20 Thread Baruch Siach
This series contains a soc_camera driver for the i.MX25/i.MX27 CSI device, and
platform code for the i.MX25 and i.MX27 chips. This driver is based on a 
driver for i.MX27 CSI from Sascha Hauer, that  Alan Carvalho de Assis has 
posted in linux-media last December[1]. I tested the mx2_camera driver on the 
i.MX25 PDK. Sascha Hauer has tested a earlier version of this driver on an 
i.MX27 based board. I included in this version some fixes from Sascha that 
enable i.MX27 support.

[1] https://patchwork.kernel.org/patch/67636/

Changes v3 -> v4
Address more comments from Guennadi Liakhovetski, including:

* Fix the double trigger handling of mx27 eMMA

* Add a FIXME comment in the code of eMMA overflow handling

Changes v2 -> v3
Address more comments from Guennadi Liakhovetski.

Applied part of Sashca's patch that I forgot in v2.

Changes v1 -> v2
Addressed the comments of Guennadi Liakhovetski except from the following:

1. The mclk_get_divisor implementation, since I don't know what this code 
   is good for

2. mx2_videobuf_release should not set pcdev->active on i.MX27, because 
   mx27_camera_frame_done needs this pointer

3. In mx27_camera_emma_buf_init I don't know the meaning of those hard 
   coded magic numbers

Applied i.MX27 fixes from Sascha.

Baruch Siach (3):
  mx2_camera: Add soc_camera support for i.MX25/i.MX27
  mx27: add support for the CSI device
  mx25: add support for the CSI device

 arch/arm/mach-mx2/clock_imx27.c  |2 +-
 arch/arm/mach-mx2/devices.c  |   31 +
 arch/arm/mach-mx2/devices.h  |1 +
 arch/arm/mach-mx25/clock.c   |   14 +-
 arch/arm/mach-mx25/devices.c |   22 +
 arch/arm/mach-mx25/devices.h |1 +
 arch/arm/plat-mxc/include/mach/memory.h  |4 +-
 arch/arm/plat-mxc/include/mach/mx25.h|2 +
 arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
 drivers/media/video/Kconfig  |   13 +
 drivers/media/video/Makefile |1 +
 drivers/media/video/mx2_camera.c | 1493 ++
 12 files changed, 1625 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
 create mode 100644 drivers/media/video/mx2_camera.c

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/3] mx2_camera: Add soc_camera support for i.MX25/i.MX27

2010-06-20 Thread Baruch Siach
Hi Guennadi,

On Sat, Jun 19, 2010 at 04:13:31PM +0200, Guennadi Liakhovetski wrote:
> On Wed, 26 May 2010, Baruch Siach wrote:
> 
> > This is the soc_camera support developed by Sascha Hauer for the i.MX27.  
> > Alan
> > Carvalho de Assis modified the original driver to get it working on more 
> > recent
> > kernels. I modified it further to add support for i.MX25. This driver has 
> > been
> > tested on i.MX25 and i.MX27 based platforms.

Tanks for your review. I'll send v4 shortly.

baruch

> I hoped, this would be the final version, but if I'm not mistaken, you've 
> introduced an error, which we better fix before committing. And as we anyway 
> will likely need a v4, I'll also ask you to improve a couple of stylistic 
> issues, which otherwise I'd just fix myself with your permission.
> 
> > Signed-off-by: Baruch Siach 
> > ---
> >  arch/arm/plat-mxc/include/mach/memory.h  |4 +-
> >  arch/arm/plat-mxc/include/mach/mx2_cam.h |   46 +
> >  drivers/media/video/Kconfig  |   13 +
> >  drivers/media/video/Makefile |1 +
> >  drivers/media/video/mx2_camera.c | 1488 
> > ++
> >  5 files changed, 1550 insertions(+), 2 deletions(-)
> >  create mode 100644 arch/arm/plat-mxc/include/mach/mx2_cam.h
> >  create mode 100644 drivers/media/video/mx2_camera.c
> > 
> > diff --git a/arch/arm/plat-mxc/include/mach/memory.h 
> > b/arch/arm/plat-mxc/include/mach/memory.h
> > index c4b40c3..5803836 100644
> > --- a/arch/arm/plat-mxc/include/mach/memory.h
> > +++ b/arch/arm/plat-mxc/include/mach/memory.h
> 
> [snip]
> 
> > +static void mx2_videobuf_queue(struct videobuf_queue *vq,
> > +  struct videobuf_buffer *vb)
> > +{
> > +   struct soc_camera_device *icd = vq->priv_data;
> > +   struct soc_camera_host *ici =
> > +   to_soc_camera_host(icd->dev.parent);
> > +   struct mx2_camera_dev *pcdev = ici->priv;
> > +   struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
> > +   unsigned long flags;
> > +   int ret;
> > +
> > +   dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
> > +   vb, vb->baddr, vb->bsize);
> > +
> > +   spin_lock_irqsave(&pcdev->lock, flags);
> > +
> > +   vb->state = VIDEOBUF_QUEUED;
> > +   list_add_tail(&vb->queue, &pcdev->capture);
> > +
> > +   if (mx27_camera_emma(pcdev))
> > +   goto out;
> > +   else if (cpu_is_mx27()) {
> 
> One of the minor ones - please, add braces in the "if" case.
> 
> [snip]
> 
> > +static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
> > +{
> > +   struct mx2_camera_dev *pcdev = data;
> > +   unsigned int status = readl(pcdev->base_emma + PRP_INTRSTATUS);
> > +   struct mx2_buffer *buf;
> > +
> > +   if ((status & (3 << 5)) == (3 << 5)
> > +   && !list_empty(&pcdev->active_bufs)) {
> > +   /*
> > +* Both buffers have triggered, process the one we're expecting
> > +* to first
> > +*/
> > +   buf = list_entry(pcdev->active_bufs.next,
> > +   struct mx2_buffer, vb.queue);
> > +   mx27_camera_frame_done_emma(pcdev, buf->bufnum, VIDEOBUF_DONE);
> > +   }
> > +   if (status & (1 << 6))
> > +   mx27_camera_frame_done_emma(pcdev, 0, VIDEOBUF_DONE);
> > +   if (status & (1 << 5))
> > +   mx27_camera_frame_done_emma(pcdev, 1, VIDEOBUF_DONE);
> 
> Now, this is the important one. In my review of v2 I proposed the above 
> fix for the both-bits-set case. But, I think, your implementation is not 
> correct. Don't you have to clear the expected buffer number, so that you 
> don't process it twice? Something like
> 
>   status &= ~(1 << 6 - buf->bufnum);
> 
> anywhere inside the first of the three ifs?
> 
> > +   if (status & (1 << 7)) {
> 
> Bit 7 is overflow. A correct handling could be resetting the buffer, 
> returning an error frame and continuing with the next one. However, I 
> understand, that you do not have a chance to implement this properly 
> now. So, please, at least add a "FIXME" comment, explaining, what should 
> be done here. Besides, error states are normally checked before normal 
> data processing. So, either mention this in the comment too, or move this 
> above the buffer completion processing.
> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/

-- 
 ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] ir-core: move decoding state to ir_raw_event_ctrl

2010-06-20 Thread Jarod Wilson
On Sun, Jun 20, 2010 at 8:47 PM, Andy Walls  wrote:
> On Thu, 2010-06-17 at 11:11 -0400, Jarod Wilson wrote:
>> On Thu, Jun 17, 2010 at 8:14 AM, Andy Walls  wrote:
>
>> >> A fully functional tree carrying both of David's patches and the
>> >> entire stack of other patches I've submitted today, based on top of
>> >> the linuxtv staging/rc branch, can be found here:
>> >>
>> >> http://git.wilsonet.com/linux-2.6-ir-wip.git/?a=shortlog;h=refs/heads/patches
>> >>
>> >> Also includes the lirc patches that I believe are ready to be
>> >> submitted for actual consideration (note that they're dependent on
>> >> David's two patches).
>> >
>> >
>> > I'll try and play with this this weekend along with some cx23885
>> > cleanup.
>>
>> Excellent. A few things to note...
>
> Jarrod,
>
> I was unable to get this task completed in the time I had available this
> weekend.  A power supply failure, unexpected hard drive replacement, and
> my inability to build/install a kernel from a git tree that would
> actually boot my Fedora 12 installation didn't help.  (My productivity
> has tanked since v4l-dvb went to GIT for CM, and the last time I built a
> real kernel without rpmbuild was for RedHat 9. I'm still working out
> processes for doing basic things, sorry.)

Heh, yeah, hardware failure is always fun when you're trying really
hard to get something done. :)

As for the building your own kernel thing... I've been doing my work
mainly on a pair of x86_64 systems, one a ThinkPad T61 running Fedora
13, and the other an HP xw4400 workstation running RHEL6. In both
cases, I copied a distro kernel's, config file out of /boot/, and then
ran make oldconfig over it and build straight from what's in my tree,
which works well enough on both setups.

> I'll have time on Thursday night to try again.

No rush yet, we've got a while before the merge window still.
Christoph (Bartelmus) helped me out with a bunch of ioctl
documentation this weekend, so I've got that to add to the tree, then
I think I'll be prepared to resubmit the lirc bits. I'll shoot for
doing that next weekend, and hopefully, that'll give you a chance to
try 'em out before then and provide any necessary feedback/fixes/etc.
(Not that we can't also just fix things up as needed post-merge). I'm
still up in the air as to what I should work on next... So many lirc
drivers left to port still... Maybe zilog, maybe streamzap... Maybe
the MCE IR keyboard...

-- 
Jarod Wilson
ja...@wilsonet.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] ir-core: move decoding state to ir_raw_event_ctrl

2010-06-20 Thread Andy Walls
On Thu, 2010-06-17 at 11:11 -0400, Jarod Wilson wrote:
> On Thu, Jun 17, 2010 at 8:14 AM, Andy Walls  wrote:

> >> A fully functional tree carrying both of David's patches and the
> >> entire stack of other patches I've submitted today, based on top of
> >> the linuxtv staging/rc branch, can be found here:
> >>
> >> http://git.wilsonet.com/linux-2.6-ir-wip.git/?a=shortlog;h=refs/heads/patches
> >>
> >> Also includes the lirc patches that I believe are ready to be
> >> submitted for actual consideration (note that they're dependent on
> >> David's two patches).
> >
> >
> > I'll try and play with this this weekend along with some cx23885
> > cleanup.
> 
> Excellent. A few things to note... 

Jarrod,

I was unable to get this task completed in the time I had available this
weekend.  A power supply failure, unexpected hard drive replacement, and
my inability to build/install a kernel from a git tree that would
actually boot my Fedora 12 installation didn't help.  (My productivity
has tanked since v4l-dvb went to GIT for CM, and the last time I built a
real kernel without rpmbuild was for RedHat 9. I'm still working out
processes for doing basic things, sorry.)

I'll have time on Thursday night to try again.




> Many of the lirc_dev ioctls are
> currently commented out, and haven't in any way been wired up to tx
> callbacks,

Yes, I saw, that's OK.  It should be easy enough to hack something in
for testing and prototyping.


>  I've only enabled the minimum necessary for mceusb. The
> ioctls are all using __u32 params, which, if you're on x86_64, will
> require a patched lirc userspace build to make the ioctl types match.
> I'm using this patch atm:
> 
> http://wilsonet.com/jarod/lirc_misc/lirc-0.8.6-make-ioctls-u32.patch
> 
> (In the future, lirc userspace should obviously just build against
> ).


I've got all x86_64 bit machines here, so thank you for the tips.

Regards,
Andy

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cx5000 default auto sleep mode

2010-06-20 Thread Timothy D. Lenz
Update, that card has now died. We bought 2 of those cards at the same 
time and the other has been working for a about 3 weeks with sleep mode 
disabled. I tried it with sleep mode enabled and ether vdr or xine 
crashed with in a few hours. But the version of xine I am still running 
on that computer is touchy about corrupt video streams and will crash 
when video starts pixeling or drops out totally for extended time. When 
I get a chance to update xine, I'll try turning auto sleep mode back on.


I have sent a message to Dvico, but I don't expect much since I've now 
had the card for more then a year. I should have just tried the other 
card way back then, but I thought sure it was a software/driver problem 
since making changes did at times effect how long it worked.


On 4/14/2010 9:39 PM, Devin Heitmueller wrote:

On Wed, Apr 14, 2010 at 11:44 PM, Andy Walls  wrote:

On Wed, 2010-04-14 at 13:40 -0400, Devin Heitmueller wrote:

On Wed, Apr 14, 2010 at 1:29 PM, Timothy D. Lenz  wrote:

Thanks to Andy Walls, found out why I kept loosing 1 tuner on a FusionHD7
Dual express. Didn't know linux supported an auto sleep mode on the tuner
chips and that it defaulted to on. Seems like it would be better to default
to off.


Regarding the general assertion that the power management should be
disabled by default, I disagree.  The power savings is considerable,
the time to bring the tuner out of sleep is negligible, and it's
generally good policy.

Andy, do you have any actual details regarding the nature of the problem?


Not really.  DViCo Fusion dual digital tv card.  One side of the card
would yield "black video screen" when starting a digital capture
sometime after (?) the VDR ATSC EPG plugin tried to suck off data.  I'm
not sure there was a causal relationship.

I hypothesized that one side of the dual-tuner was going stupid or one
of the two channels used in the cx23885 was getting confused.  I was
looking at how to narrow the problem down to cx23885 chip or xc5000
tuner, or s5h14xx demod when I noted the power managment module option
for the xc5000.  I suggested Tim try it.

It was dumb luck that my guess actually made his symptoms go away.

That's all I know.


We did have a similar issue with the PCTV 800i.  Basically, the GPIO
definition was improperly defined for the xc5000 reset callback.  As a
result, it was strobing the reset on both the xc5000 *and* the
s5h1411, which would then cause the s5h1411's hardware state to not
match the driver state.

After multiple round trips with the hardware engineer at PCTV, I
finally concluded that there actually wasn't a way to strobe the reset
without screwing up the demodulator, which prompted me to disable the
xc5000 reset callback (see cx88-cards:2944).

My guess is that the reset GPIO definition for that board is wrong (a
problem exposed by this change), or that it's resetting the s5h1411 as
well.

Devin


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] tm6000: add ir support

2010-06-20 Thread stefan . ringel
From: Stefan Ringel 

Signed-off-by: Stefan Ringel 
---
 drivers/staging/tm6000/Makefile   |3 +-
 drivers/staging/tm6000/tm6000-cards.c |   28 +++-
 drivers/staging/tm6000/tm6000-input.c |  365 +
 drivers/staging/tm6000/tm6000.h   |9 +
 4 files changed, 403 insertions(+), 2 deletions(-)
 create mode 100644 drivers/staging/tm6000/tm6000-input.c

diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile
index 4129c18..77e06bf 100644
--- a/drivers/staging/tm6000/Makefile
+++ b/drivers/staging/tm6000/Makefile
@@ -2,7 +2,8 @@ tm6000-objs := tm6000-cards.o \
   tm6000-core.o  \
   tm6000-i2c.o   \
   tm6000-video.o \
-  tm6000-stds.o
+  tm6000-stds.o \
+  tm6000-input.o
 
 obj-$(CONFIG_VIDEO_TM6000) += tm6000.o
 obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o
diff --git a/drivers/staging/tm6000/tm6000-cards.c 
b/drivers/staging/tm6000/tm6000-cards.c
index 50756e5..9860c55 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "tm6000.h"
 #include "tm6000-regs.h"
@@ -68,6 +69,8 @@ struct tm6000_board {
int demod_addr; /* demodulator address */
 
struct tm6000_gpio gpio;
+
+   char*ir_codes;
 };
 
 struct tm6000_board tm6000_boards[] = {
@@ -275,6 +278,7 @@ struct tm6000_board tm6000_boards[] = {
.dvb_led= TM6010_GPIO_5,
.ir = TM6010_GPIO_0,
},
+   .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
},
[TM6010_BOARD_TWINHAN_TU501] = {
.name = "Twinhan TU501(704D1)",
@@ -360,6 +364,8 @@ int tm6000_tuner_callback(void *ptr, int component, int 
command, int arg)
 
switch (command) {
case XC2028_RESET_CLK:
+   tm6000_ir_wait(dev, 0);
+
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, arg);
msleep(10);
@@ -409,13 +415,14 @@ int tm6000_tuner_callback(void *ptr, int component, int 
command, int arg)
msleep(130);
break;
}
+
+   tm6000_ir_wait(dev, 1);
break;
case 1:
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, 0x01);
msleep(10);
break;
-
case 2:
rc = tm6000_i2c_reset(dev, 100);
break;
@@ -635,6 +642,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
 
dev->gpio = tm6000_boards[dev->model].gpio;
 
+   dev->ir_codes = tm6000_boards[dev->model].ir_codes;
+
dev->demod_addr = tm6000_boards[dev->model].demod_addr;
 
dev->caps = tm6000_boards[dev->model].caps;
@@ -683,6 +692,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
tm6000_add_into_devlist(dev);
tm6000_init_extension(dev);
 
+   tm6000_ir_init(dev);
+
mutex_unlock(&dev->lock);
return 0;
 
@@ -828,6 +839,19 @@ static int tm6000_usb_probe(struct usb_interface 
*interface,
 &dev->isoc_out);
}
break;
+   case USB_ENDPOINT_XFER_INT:
+   if (!dir_out) {
+   get_max_endpoint(usbdev,
+   
&interface->altsetting[i],
+   "INT IN", e,
+   &dev->int_in);
+   } else {
+   get_max_endpoint(usbdev,
+   
&interface->altsetting[i],
+   "INT OUT", e,
+   &dev->int_out);
+   }
+   break;
}
}
}
@@ -886,6 +910,8 @@ static void tm6000_usb_disconnect(struct usb_interface 
*interface)
 
mutex_lock(&dev->lock);
 
+   tm6000_ir_fini(dev);
+
if (dev->gpio.power_led) {
switch (dev->model) {
case TM6010_BOARD_HAUPPAUGE_900H:
diff --git a/drivers/staging/tm6000/tm6000-input.c 
b/drivers/staging/tm6000/tm6000-input.c
new file mode 100644
index 000..d44182c
--- /dev/null
+++ b/drivers/staging/tm6000/tm6000-input.c
@@ -0,0 +1,365 @@
+/*
+   tm6000-input.c - driver for TM5600/TM6000/TM6010 USB video capture devices
+
+  

[cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS

2010-06-20 Thread Hans Verkuil
This message is generated daily by a cron job that builds v4l-dvb for
the kernels and architectures in the list below.

Results of the daily build of v4l-dvb:

date:Sun Jun 20 19:00:09 CEST 2010
path:http://www.linuxtv.org/hg/v4l-dvb
changeset:   14993:9652f85e688a
git master:   f6760aa024199cfbce564311dc4bc4d47b6fb349
git media-master: 41c5f984b67b331064e69acc9fca5e99bf73d400
gcc version:  i686-linux-gcc (GCC) 4.4.3
host hardware:x86_64
host os:  2.6.32.5

linux-2.6.32.6-armv5: OK
linux-2.6.33-armv5: OK
linux-2.6.34-armv5: WARNINGS
linux-2.6.35-rc1-armv5: ERRORS
linux-2.6.32.6-armv5-davinci: OK
linux-2.6.33-armv5-davinci: OK
linux-2.6.34-armv5-davinci: WARNINGS
linux-2.6.35-rc1-armv5-davinci: ERRORS
linux-2.6.32.6-armv5-ixp: WARNINGS
linux-2.6.33-armv5-ixp: WARNINGS
linux-2.6.34-armv5-ixp: WARNINGS
linux-2.6.35-rc1-armv5-ixp: ERRORS
linux-2.6.32.6-armv5-omap2: OK
linux-2.6.33-armv5-omap2: OK
linux-2.6.34-armv5-omap2: WARNINGS
linux-2.6.35-rc1-armv5-omap2: ERRORS
linux-2.6.22.19-i686: ERRORS
linux-2.6.23.17-i686: ERRORS
linux-2.6.24.7-i686: WARNINGS
linux-2.6.25.20-i686: WARNINGS
linux-2.6.26.8-i686: WARNINGS
linux-2.6.27.44-i686: WARNINGS
linux-2.6.28.10-i686: WARNINGS
linux-2.6.29.1-i686: WARNINGS
linux-2.6.30.10-i686: WARNINGS
linux-2.6.31.12-i686: OK
linux-2.6.32.6-i686: OK
linux-2.6.33-i686: OK
linux-2.6.34-i686: WARNINGS
linux-2.6.35-rc1-i686: ERRORS
linux-2.6.32.6-m32r: OK
linux-2.6.33-m32r: OK
linux-2.6.34-m32r: WARNINGS
linux-2.6.35-rc1-m32r: ERRORS
linux-2.6.32.6-mips: OK
linux-2.6.33-mips: OK
linux-2.6.34-mips: WARNINGS
linux-2.6.35-rc1-mips: ERRORS
linux-2.6.32.6-powerpc64: OK
linux-2.6.33-powerpc64: OK
linux-2.6.34-powerpc64: WARNINGS
linux-2.6.35-rc1-powerpc64: ERRORS
linux-2.6.22.19-x86_64: ERRORS
linux-2.6.23.17-x86_64: ERRORS
linux-2.6.24.7-x86_64: WARNINGS
linux-2.6.25.20-x86_64: WARNINGS
linux-2.6.26.8-x86_64: WARNINGS
linux-2.6.27.44-x86_64: WARNINGS
linux-2.6.28.10-x86_64: WARNINGS
linux-2.6.29.1-x86_64: WARNINGS
linux-2.6.30.10-x86_64: WARNINGS
linux-2.6.31.12-x86_64: OK
linux-2.6.32.6-x86_64: OK
linux-2.6.33-x86_64: OK
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35-rc1-x86_64: ERRORS
linux-git-armv5: WARNINGS
linux-git-armv5-davinci: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-armv5-omap2: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-x86_64: WARNINGS
spec: ERRORS
spec-git: OK
sparse: ERRORS
linux-2.6.16.62-i686: ERRORS
linux-2.6.17.14-i686: ERRORS
linux-2.6.18.8-i686: ERRORS
linux-2.6.19.7-i686: ERRORS
linux-2.6.20.21-i686: ERRORS
linux-2.6.21.7-i686: ERRORS
linux-2.6.16.62-x86_64: ERRORS
linux-2.6.17.14-x86_64: ERRORS
linux-2.6.18.8-x86_64: ERRORS
linux-2.6.19.7-x86_64: ERRORS
linux-2.6.20.21-x86_64: ERRORS
linux-2.6.21.7-x86_64: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The V4L-DVB specification from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT FIXES for 2.6.35] ivtv: Ensure decoder always restarts with a blank screen

2010-06-20 Thread Andy Walls
Mauro,

Please pull this small fix for ivtv.  Thanks go to Martin Dauskardt and
Ian Armstrong for the experimentation and testing, and Ian for the
patch.

The following changes since commit 41c5f984b67b331064e69acc9fca5e99bf73d400:
  Mauro Carvalho Chehab (1):
Merge tag 'v2.6.35-rc2' into HEAD

are available in the git repository at:

  ssh://linuxtv.org/git/awalls/v4l-dvb.git ivtv-fixes

Ian Armstrong (1):
  ivtv: Add delay to ensure the decoder always restarts with a blank screen

 drivers/media/video/ivtv/ivtv-streams.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Regards,
Andy

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Slovak Republic DVB-T scan updates

2010-06-20 Thread Peter Butkovic
Hi all,

in Slovak Republic there are some updates regarding DVB-T.
Diff is attached, please commit, thx.

Updates were made based on official announcement (in slovak):
http://www.dvbt.towercom.sk/odbornici.php

Kind regards

Peter Butkovic
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-BanskaBystrica
--- a/util/scan/dvb-t/sk-BanskaBystrica	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-BanskaBystrica	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Banska Bystrica (Banska Bystrica, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 65
+# 1.st multiplex - on channel 65
 T 82600 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 51
+T 71400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 33
+T 57000 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Bardejov
--- a/util/scan/dvb-t/sk-Bardejov	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Bardejov	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Bardejov (Bardejov, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 62
+# 1.st multiplex - on channel 62
 T 80200 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 40
+T 62600 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 54
+T 73800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Bratislava
--- a/util/scan/dvb-t/sk-Bratislava	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Bratislava	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Bratislava (Bratislava, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 66
+# 1.st multiplex - on channel 66
 T 83400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 56
+T 75400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 27
+T 52200 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Kosice
--- a/util/scan/dvb-t/sk-Kosice	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Kosice	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Kosice (Kosice, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 64
+# 1.st multiplex - on channel 64
 T 81800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 59
+T 77800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 25
+T 50600 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Michalovce
--- a/util/scan/dvb-t/sk-Michalovce	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Michalovce	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Michalovce (Michalovce, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 64
+# 1.st multiplex - on channel 64
 T 81800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 59
+T 77800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 25
+T 50600 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Namestovo
--- a/util/scan/dvb-t/sk-Namestovo	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Namestovo	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Namestovo (Namestovo, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 68
+# 1.st multiplex - on channel 68
 T 85000 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 59
+T 77800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 26
+T 51400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-Poprad
--- a/util/scan/dvb-t/sk-Poprad	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-Poprad	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Poprad (Poprad, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 66
+# 1.st multiplex - on channel 66
 T 83400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 55
+T 74600 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 3.st multiplex (public) - on channel 24
+T 49800 8MHz 2/3 NONE QAM64 8k 1/4 NONE
diff -r 75ca298d5aa4 util/scan/dvb-t/sk-RimavskaSobota
--- a/util/scan/dvb-t/sk-RimavskaSobota	Sat Jun 05 13:08:07 2010 +0200
+++ b/util/scan/dvb-t/sk-RimavskaSobota	Sun Jun 20 19:47:48 2010 +0200
@@ -1,5 +1,11 @@
 # DVB-T Rimavska Sobota (Rimavska Sobota, Slovak Republic)
 # T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
 
-# on channel 61
+# 1.st multiplex - on channel 61
 T 79400 8MHz 2/3 NONE QAM64 8k 1/4 NONE
+
+# 2.st multiplex (commercial) - on channel 27
+T 52200 8MHz 2/3 NONE QAM64 8k 1/4 

DVB-T USB-Stick 13d3:3213 - support needed

2010-06-20 Thread Kurt Balser
Hi,

device: ID 13d3:3213 IMC Networks DTV-DVB UDTT704D - DVBT/NTSC/PAL
Driver (PCM4)

use at Ubuntu 10.04

As I found this device is not supported.

Can anyone help me to get this device running.

Many thanks
Kurt

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/media/IR/imon.c: Use pr_err instead of err

2010-06-20 Thread Jarod Wilson
On Sun, Jun 20, 2010 at 12:53 PM, Joe Perches  wrote:
> On Sun, 2010-06-20 at 11:58 -0400, Jarod Wilson wrote:
>> On Jun 20, 2010, at 3:20 AM, Joe Perches  wrote:
>> Use the standard error logging mechanisms.
>> > Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__
>> > Remove __func__ from err calls, add '\n', rename to pr_err
>> Eh. If we're going to make a change here, I'd rather it be to using
>> dev_err instead, since most of the other spew in this driver uses
>> similar.
>
> The idea is to eventually remove info/err/warn from usb.h by
> changing the code outside of drivers/usb first.
>
> There will always be some mix of printk or pr_ along
> with dev_ because struct device * is NULL or as is
> mostly used here there's no struct imon_context * available.
>
> I suggest you have a look and see which ones of these
> changes could use dev_ instead.

Ah, tbh, didn't look all that closely. Okay, I'll see if any of them
can actually be made into dev_err instead of pr_err, but any that
can't, sure, there's no problem w/this change.

-- 
Jarod Wilson
ja...@wilsonet.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] V4L/DVB: mantis: use dvb_attach to avoid double dereferencing on module removal

2010-06-20 Thread Bjørn Mork
Convert the driver to use the dvb_attach macro to avoid the hard dependency
on the frontend drivers.  The hard dependecy will result in loading a
number of unused frontends, and unwanted automatic dereferencing.

This fixes a bug where unloading the mantis driver will derefence any
attached frontend twice, which will cause an oops if the same frontend is
used by another driver.

Signed-off-by: Bjørn Mork 
Cc: sta...@kernel.org
---
 drivers/media/dvb/mantis/hopper_vp3028.c |2 +-
 drivers/media/dvb/mantis/mantis_vp1033.c |2 +-
 drivers/media/dvb/mantis/mantis_vp1034.c |2 +-
 drivers/media/dvb/mantis/mantis_vp1041.c |6 +++---
 drivers/media/dvb/mantis/mantis_vp2033.c |4 ++--
 drivers/media/dvb/mantis/mantis_vp2040.c |4 ++--
 drivers/media/dvb/mantis/mantis_vp3030.c |4 ++--
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/media/dvb/mantis/hopper_vp3028.c 
b/drivers/media/dvb/mantis/hopper_vp3028.c
index 96674c7..567ed24 100644
--- a/drivers/media/dvb/mantis/hopper_vp3028.c
+++ b/drivers/media/dvb/mantis/hopper_vp3028.c
@@ -57,7 +57,7 @@ static int vp3028_frontend_init(struct mantis_pci *mantis, 
struct dvb_frontend *
if (err == 0) {
msleep(250);
dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
-   fe = zl10353_attach(&hopper_vp3028_config, adapter);
+   fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter);
 
if (!fe)
return -1;
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c 
b/drivers/media/dvb/mantis/mantis_vp1033.c
index 4a723bd..deec927 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -173,7 +173,7 @@ static int vp1033_frontend_init(struct mantis_pci *mantis, 
struct dvb_frontend *
msleep(250);
 
dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
-   fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+   fe = dvb_attach(stv0299_attach, &lgtdqcs001f_config, adapter);
 
if (fe) {
fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c 
b/drivers/media/dvb/mantis/mantis_vp1034.c
index 8e6ae55..bf62338 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -82,7 +82,7 @@ static int vp1034_frontend_init(struct mantis_pci *mantis, 
struct dvb_frontend *
msleep(250);
 
dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
-   fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
+   fe = dvb_attach(mb86a16_attach, &vp1034_mb86a16_config, 
adapter);
if (fe) {
dprintk(MANTIS_ERROR, 1,
"found MB86A16 DVB-S/DSS frontend @0x%02x",
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c 
b/drivers/media/dvb/mantis/mantis_vp1041.c
index d1aa2bc..38a436c 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.c
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -316,14 +316,14 @@ static int vp1041_frontend_init(struct mantis_pci 
*mantis, struct dvb_frontend *
if (err == 0) {
mantis_frontend_soft_reset(mantis);
msleep(250);
-   mantis->fe = stb0899_attach(&vp1041_stb0899_config, adapter);
+   mantis->fe = dvb_attach(stb0899_attach, &vp1041_stb0899_config, 
adapter);
if (mantis->fe) {
dprintk(MANTIS_ERROR, 1,
"found STB0899 DVB-S/DVB-S2 frontend @0x%02x",
vp1041_stb0899_config.demod_address);
 
-   if (stb6100_attach(mantis->fe, &vp1041_stb6100_config, 
adapter)) {
-   if (!lnbp21_attach(mantis->fe, adapter, 0, 0))
+   if (dvb_attach(stb6100_attach, mantis->fe, 
&vp1041_stb6100_config, adapter)) {
+   if (!dvb_attach(lnbp21_attach, mantis->fe, 
adapter, 0, 0))
dprintk(MANTIS_ERROR, 1, "No LNBP21 
found!");
}
} else {
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c 
b/drivers/media/dvb/mantis/mantis_vp2033.c
index 10ce817..06da0dd 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -132,7 +132,7 @@ static int vp2033_frontend_init(struct mantis_pci *mantis, 
struct dvb_frontend *
msleep(250);
 
dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
-   fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
+   fe = dvb_attach(tda10021_attach, &vp2033_tda1002x_cu1216_config,
 adapter,
 read_pwm(mantis));
 
@@ -141,7 +141,7 @@ static int vp2033_frontend_init(s

[PATCH 2/2] DVB/V4L: mantis: remove unused files

2010-06-20 Thread Bjørn Mork
The files mantis_core.c and mantis_core.h are not used anywhere, so
delete them

Signed-off-by: Bjørn Mork 
---
 drivers/media/dvb/mantis/mantis_core.c |  238 
 drivers/media/dvb/mantis/mantis_core.h |   57 
 2 files changed, 0 insertions(+), 295 deletions(-)
 delete mode 100644 drivers/media/dvb/mantis/mantis_core.c
 delete mode 100644 drivers/media/dvb/mantis/mantis_core.h

diff --git a/drivers/media/dvb/mantis/mantis_core.c 
b/drivers/media/dvb/mantis/mantis_core.c
deleted file mode 100644
index 8113b23..000
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-   Mantis PCI bridge driver
-
-   Copyright (C) Manu Abraham (abraham.m...@gmail.com)
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "mantis_common.h"
-#include "mantis_core.h"
-#include "mantis_vp1033.h"
-#include "mantis_vp1034.h"
-#include "mantis_vp1041.h"
-#include "mantis_vp2033.h"
-#include "mantis_vp2040.h"
-#include "mantis_vp3030.h"
-
-static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
-{
-   int err;
-   struct i2c_msg msg[] = {
-   {
-   .addr = 0x50,
-   .flags = 0,
-   .buf = data,
-   .len = 1
-   }, {
-   .addr = 0x50,
-   .flags = I2C_M_RD,
-   .buf = data,
-   .len = length
-   },
-   };
-
-   err = i2c_transfer(&mantis->adapter, msg, 2);
-   if (err < 0) {
-   dprintk(verbose, MANTIS_ERROR, 1,
-   "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >",
-   err, data[0], data[1]);
-
-   return err;
-   }
-
-   return 0;
-}
-
-static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
-{
-   int err;
-
-   struct i2c_msg msg = {
-   .addr = 0x50,
-   .flags = 0,
-   .buf = data,
-   .len = length
-   };
-
-   err = i2c_transfer(&mantis->adapter, &msg, 1);
-   if (err < 0) {
-   dprintk(verbose, MANTIS_ERROR, 1,
-   "ERROR: i2c write: < err=%i length=0x%02x d0=0x%02x, 
d1=0x%02x >",
-   err, length, data[0], data[1]);
-
-   return err;
-   }
-
-   return 0;
-}
-
-static int get_mac_address(struct mantis_pci *mantis)
-{
-   int err;
-
-   mantis->mac_address[0] = 0x08;
-   err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6);
-   if (err < 0) {
-   dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
-
-   return err;
-   }
-   dprintk(verbose, MANTIS_ERROR, 0,
-   "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
-   mantis->mac_address[0], mantis->mac_address[1],
-   mantis->mac_address[2], mantis->mac_address[3],
-   mantis->mac_address[4], mantis->mac_address[5]);
-
-   return 0;
-}
-
-#define MANTIS_MODEL_UNKNOWN   "UNKNOWN"
-#define MANTIS_DEV_UNKNOWN "UNKNOWN"
-
-struct mantis_hwconfig unknown_device = {
-   .model_name = MANTIS_MODEL_UNKNOWN,
-   .dev_type   = MANTIS_DEV_UNKNOWN,
-};
-
-static void mantis_load_config(struct mantis_pci *mantis)
-{
-   switch (mantis->subsystem_device) {
-   case MANTIS_VP_1033_DVB_S:  /* VP-1033 */
-   mantis->hwconfig = &vp1033_mantis_config;
-   break;
-   case MANTIS_VP_1034_DVB_S:  /* VP-1034 */
-   mantis->hwconfig = &vp1034_mantis_config;
-   break;
-   case MANTIS_VP_1041_DVB_S2: /* VP-1041 */
-   case TECHNISAT_SKYSTAR_HD2:
-   mantis->hwconfig = &vp1041_mantis_config;
-   break;
-   case MANTIS_VP_2033_DVB_C:  /* VP-2033 */
-   mantis->hwconfig = &vp2033_mantis_config;
-   break;
-   case MANTIS_VP_2040_DVB_C:  /* VP-2040 */
-   case TERRATEC_CINERGY_C_PCI:/* VP-2040 clone */
-   case TECHNISAT_CABLESTAR_HD2:
-   mantis->hwconfig = &vp2040_mantis_config;
-   break;
-   case MANTIS_VP_3030_DVB_T:  /* VP-3030 */
-

Re: Cinergy C PCI HD with current v4l-dvb - PATCH for review/pull included

2010-06-20 Thread Bjørn Mork
Bjørn Mork  writes:
> Marko Ristola  writes:
>
>> 4. There is some problem with rmmod mantis, do lsmod:
>> Module  Size  Used by
>> tda100215486  4294967291
>> modprobe mantis
>> tda100215486  4294967292 mantis
>> So the reference count from mantis to tda10021 gets corrupted at rmmod.
>> I have Fedora 13 kernel, 2.6.33.5-124.fc13.x86_64
>
> FWIW, I do not see this running a Debian kernel (2.6.32-5-amd64) with a
> backported mantis driver (from 2.6.35-rc1).
>
> Module  Size  Used by
> tda100214774  1 mantis
> # rmmod mantis
> tda100214774  0 
> # modprobe mantis
> tda100214774  1 mantis

Sorry, you are of course quite right, Marko: There is such a bug, and it
will in fact cause an oops if this double dereferencing causes a
frontend driver which is in use to be unloaded.  But it will only affect
the frontend drivers actually in use, which is why I didn't see it above
(my card uses tda10023).

The cause of this (and the unwanted loading of a gazillion unused
frontend drivers), is that the mantis driver doesn't use dvb_attach.

I will follow up with a patch to fix this



Bjørn

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/media/IR/imon.c: Use pr_err instead of err

2010-06-20 Thread Joe Perches
On Sun, 2010-06-20 at 11:58 -0400, Jarod Wilson wrote:
> On Jun 20, 2010, at 3:20 AM, Joe Perches  wrote:
> Use the standard error logging mechanisms.
> > Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__
> > Remove __func__ from err calls, add '\n', rename to pr_err
> Eh. If we're going to make a change here, I'd rather it be to using  
> dev_err instead, since most of the other spew in this driver uses  
> similar.

The idea is to eventually remove info/err/warn from usb.h by
changing the code outside of drivers/usb first.

There will always be some mix of printk or pr_ along
with dev_ because struct device * is NULL or as is
mostly used here there's no struct imon_context * available.

I suggest you have a look and see which ones of these
changes could use dev_ instead.

cheers, Joe


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] tm6000: add ir support

2010-06-20 Thread Jarod Wilson
On Sun, Jun 20, 2010 at 12:44 PM, Stefan Ringel  wrote:
> Am 20.06.2010 18:31, schrieb Jarod Wilson:
>> On Sun, Jun 20, 2010 at 11:38 AM,   wrote:
>>> From: Stefan Ringel 
>>>
>>> Signed-off-by: Stefan Ringel 
>>> ---
>>>  drivers/staging/tm6000/Makefile       |    3 +-
>>>  drivers/staging/tm6000/tm6000-cards.c |   27 +++-
>>>  drivers/staging/tm6000/tm6000-input.c |  357
> +
>>>  drivers/staging/tm6000/tm6000.h       |   11 +
>>>  4 files changed, 396 insertions(+), 2 deletions(-)
>>>  create mode 100644 drivers/staging/tm6000/tm6000-input.c
>> ...
>>> diff --git a/drivers/staging/tm6000/tm6000-input.c
> b/drivers/staging/tm6000/tm6000-input.c
>>> new file mode 100644
>>> index 000..e45b443
>>> --- /dev/null
>>> +++ b/drivers/staging/tm6000/tm6000-input.c
>>> @@ -0,0 +1,357 @@
>>> +/*
>>> +   tm6000-input.c - driver for TM5600/TM6000/TM6010 USB video capture
> devices
>>> +
>>> +   Copyright (C) 2010 Stefan Ringel 
>>> +
>>> +   This program is free software; you can redistribute it and/or modify
>>> +   it under the terms of the GNU General Public License as published by
>>> +   the Free Software Foundation version 2
>>> +
>>> +   This program is distributed in the hope that it will be useful,
>>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> +   GNU General Public License for more details.
>>> +
>>> +   You should have received a copy of the GNU General Public License
>>> +   along with this program; if not, write to the Free Software
>>> +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include 
>>> +#include 
>>> +
>>> +#include "compat.h"
>>> +#include "tm6000.h"
>>> +#include "tm6000-regs.h"
>>
>> Please use the new ir-core infrastructure here. (#include
>> , #include , and assorted code in
>> drivers/media/IR/).
>>
>>
> It use the new code (for example rc map in tm6000-card.c), but I can
> added the header files. It doesn't use software encoding, it use
> hardware encodeing.

It only partially uses it. You're setting up input_dev's directly and
still using ir_input_state. You should be using the ir_input_dev
functions. Hardware decoder vs. software decoder doesn't matter. See
drivers/media/IR/imon.c for another hardware decoding device that's
using ir_input_dev. :)


-- 
Jarod Wilson
ja...@wilsonet.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] tm6000: add ir support

2010-06-20 Thread Stefan Ringel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
Am 20.06.2010 18:31, schrieb Jarod Wilson:
> On Sun, Jun 20, 2010 at 11:38 AM,   wrote:
>> From: Stefan Ringel 
>>
>> Signed-off-by: Stefan Ringel 
>> ---
>>  drivers/staging/tm6000/Makefile   |3 +-
>>  drivers/staging/tm6000/tm6000-cards.c |   27 +++-
>>  drivers/staging/tm6000/tm6000-input.c |  357
+
>>  drivers/staging/tm6000/tm6000.h   |   11 +
>>  4 files changed, 396 insertions(+), 2 deletions(-)
>>  create mode 100644 drivers/staging/tm6000/tm6000-input.c
> ...
>> diff --git a/drivers/staging/tm6000/tm6000-input.c
b/drivers/staging/tm6000/tm6000-input.c
>> new file mode 100644
>> index 000..e45b443
>> --- /dev/null
>> +++ b/drivers/staging/tm6000/tm6000-input.c
>> @@ -0,0 +1,357 @@
>> +/*
>> +   tm6000-input.c - driver for TM5600/TM6000/TM6010 USB video capture
devices
>> +
>> +   Copyright (C) 2010 Stefan Ringel 
>> +
>> +   This program is free software; you can redistribute it and/or modify
>> +   it under the terms of the GNU General Public License as published by
>> +   the Free Software Foundation version 2
>> +
>> +   This program is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +   GNU General Public License for more details.
>> +
>> +   You should have received a copy of the GNU General Public License
>> +   along with this program; if not, write to the Free Software
>> +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +
>> +#include "compat.h"
>> +#include "tm6000.h"
>> +#include "tm6000-regs.h"
>
> Please use the new ir-core infrastructure here. (#include
> , #include , and assorted code in
> drivers/media/IR/).
>
>
It use the new code (for example rc map in tm6000-card.c), but I can
added the header files. It doesn't use software encoding, it use
hardware encodeing.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.12 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iQEcBAEBAgAGBQJMHkVtAAoJEAWtPFjxMvFGgA8IAKeW68Acv0jgJcV4gIWFiEk1
DFVdcvqbWQHbFzLPi427QjFFao8YRXT+XDnADVmYzneBAlcnsdfwHgi4ufCjB9BX
FqPhrhaePluGW4YmSGLHX135wNhfa8ZLSg7WMN0gNkif+4bJ1ZAXUtE1nVwzasVW
LHCY1IX5JtUH19PYdsozkJBgfyLAfgqmP7S35not6zsAjXsimp2vid4UNJ55MyOo
gcrkzcCxqaMkxLc3wKBtwrtb3hUQbJp3znkjPvIJTcFh5wzm+4yr9sk2heObNJVY
n7DVS+YMegBugq9wKNWNiL+eZQQ/IR8okm0qDneleP0seKirL2JHGeDw2z9CePk=
=09n5
-END PGP SIGNATURE-

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] tm6000: add ir support

2010-06-20 Thread Jarod Wilson
On Sun, Jun 20, 2010 at 11:38 AM,   wrote:
> From: Stefan Ringel 
>
> Signed-off-by: Stefan Ringel 
> ---
>  drivers/staging/tm6000/Makefile       |    3 +-
>  drivers/staging/tm6000/tm6000-cards.c |   27 +++-
>  drivers/staging/tm6000/tm6000-input.c |  357 
> +
>  drivers/staging/tm6000/tm6000.h       |   11 +
>  4 files changed, 396 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/staging/tm6000/tm6000-input.c
...
> diff --git a/drivers/staging/tm6000/tm6000-input.c 
> b/drivers/staging/tm6000/tm6000-input.c
> new file mode 100644
> index 000..e45b443
> --- /dev/null
> +++ b/drivers/staging/tm6000/tm6000-input.c
> @@ -0,0 +1,357 @@
> +/*
> +   tm6000-input.c - driver for TM5600/TM6000/TM6010 USB video capture devices
> +
> +   Copyright (C) 2010 Stefan Ringel 
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation version 2
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +#include "compat.h"
> +#include "tm6000.h"
> +#include "tm6000-regs.h"

Please use the new ir-core infrastructure here. (#include
, #include , and assorted code in
drivers/media/IR/).


-- 
Jarod Wilson
ja...@wilsonet.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Mantis: append tasklet maintenance for DVB stream delivery

2010-06-20 Thread Marko Ristola

20.06.2010 16:51, Bjørn Mork kirjoitti:

Note that mantis_core_exit() is never called.  Unless I've missed
something, the drivers/media/dvb/mantis/mantis_core.{h,c} files can
just be deleted.  They look like some development leftovers?

   

I see. mantis_core.ko kernel module exists though.
Maybe the mantis/Makefile references for mantis_core.c, mantis.c and 
hopper.c are just some leftovers too.


I moved tasklet_enable/disable calls into mantis_dvb.c where almost all 
other tasklet code is located.


So the following reasoning still holds:

1. dvb_dmxdev_filter_stop() calls mantis_dvb_stop_feed: mantis_dma_stop()
2. dvb_dmxdev_filter_stop() calls release_ts_feed() or some other filter 
freeing function.
3. tasklet: mantis_dma_xfer calls dvb_dmx_swfilter to copy DMA buffer's 
content into freed memory, accessing freed spinlocks.

This case might occur while tuning into another frequency.
Perhaps cdurrhau has found some version from this bug at 
http://www.linuxtv.org/pipermail/linux-dvb/2010-June/032688.html:

> This is what I get on the remote console via IPMI:
> 40849.442492] BUG: soft lockup - CPU#2 stuck for 61s! [section
> handler:4617]


New reasoning for the patch (same as the one above, but from higher level):
After dvb-core has called mantis-fe->stop_feed(dvbdmxfeed) the last time 
(count to zero),
no data should ever be copied with dvb_dmx_swfilter() by a tasklet: the 
target structure might be in an unusable state.
Caller of mantis_fe->stop_feed() assumes that feeding is stopped after 
stop_feed() has been called, ie. dvb_dmx_swfilter()

isn't running, and won't be called.

There is a risk that dvb_dmx_swfilter() references freed resources 
(memory or spinlocks or ???) causing instabilities.
Thus tasklet_disable(&mantis->tasklet) must be called inside of 
mantis-fe->stop_feed(dvbdmxfeed) when necessary.


Signed-off-by: Marko Ristola 

Marko

diff --git a/drivers/media/dvb/mantis/mantis_dvb.c 
b/drivers/media/dvb/mantis/mantis_dvb.c

index 99d82ee..a9864f7 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -117,6 +117,7 @@ static int mantis_dvb_start_feed(struct 
dvb_demux_feed *dvbdmxfeed)

 if (mantis->feeds == 1) {
 dprintk(MANTIS_DEBUG, 1, "mantis start feed & dma");
 mantis_dma_start(mantis);
+tasklet_enable(&mantis->tasklet);
 }

 return mantis->feeds;
@@ -136,6 +137,7 @@ static int mantis_dvb_stop_feed(struct 
dvb_demux_feed *dvbdmxfeed)

 mantis->feeds--;
 if (mantis->feeds == 0) {
 dprintk(MANTIS_DEBUG, 1, "mantis stop feed and dma");
+tasklet_disable(&mantis->tasklet);
 mantis_dma_stop(mantis);
 }

@@ -216,6 +218,7 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)

 dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, 
&mantis->demux.dmx);
 tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) 
mantis);

+tasklet_disable(&mantis->tasklet);
 if (mantis->hwconfig) {
 result = config->frontend_init(mantis, mantis->fe);
 if (result < 0) {

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/media/IR/imon.c: Use pr_err instead of err

2010-06-20 Thread Jarod Wilson

On Jun 20, 2010, at 3:20 AM, Joe Perches  wrote:


Use the standard error logging mechanisms.
Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__
Remove __func__ from err calls, add '\n', rename to pr_err

Signed-off-by: Joe Perches 
---


Eh. If we're going to make a change here, I'd rather it be to using  
dev_err instead, since most of the other spew in this driver uses  
similar.


--
Jarod Wilson
ja...@wilsonet.com

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2010-06-20 Thread Waling Dijkstra

Hi linux-media,

adding support for CI and IR on the TT CT-3650.
Signed-off-by: Waling Dijkstra 

rgrds,

Waling

diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c 
b/drivers/media/dvb/dvb-usb/ttusb2.cindex a6de489..5ce6a51 100644--- 
a/drivers/media/dvb/dvb-usb/ttusb2.c+++ b/drivers/media/dvb/dvb-usb/ttusb2.c@@ 
-32,6 +32,8 @@ #include "tda1002x.h" #include "tda827x.h" #include 
"lnbp21.h"+/* CA */+#include "dvb_ca_en50221.h"  /* debug */ static int 
dvb_usb_ttusb2_debug;@@ -41,7 +43,26 @@ MODULE_PARM_DESC(debug, "set debugging 
level (1=info (or-able))." 
DVB_USB_DEBUG_  DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +#define 
ci_dbg(format, arg...)                \+do {                                    
      \+   if (0)                                    \+printk 
(KERN_DEBUG DVB_USB_LOG_PREFIX \+": " format "\n" , ## 
arg);       \+} while (0)++enum {+TT3650_CMD_CI_TEST = 0x40,+ 
TT3650_CMD_CI_RD_CTRL,+ TT3650_CMD_CI_WR_CTRL,+ TT3650_CMD_CI_RD_ATTR,+ 
TT3650_CMD_CI_WR_ATTR,+ TT3650_CMD_CI_RESET,+   
TT3650_CMD_CI_SET_VIDEO_PORT+};+ struct ttusb2_state {+ struct dvb_ca_en50221 
ca;+  struct mutex ca_mutex;  u8 id; }; @@ -128,6 +149,333 @@ static struct 
i2c_algorithm ttusb2_i2c_algo = { .functionality = 
ttusb2_i2c_func, }; +/* IR */+/* Remote Control Stuff for CT-3650 (copied from 
TT-S1500): */+static struct dvb_usb_rc_key tt_connect_CT_3650_rc_key[] = {+ 
{0x1501, KEY_POWER},+   {0x1502, KEY_SHUFFLE}, /* ? double-arrow key */+
{0x1503, KEY_1},+   {0x1504, KEY_2},+   {0x1505, KEY_3},+   
{0x1506, KEY_4},+   {0x1507, KEY_5},+   {0x1508, KEY_6},+   
{0x1509, KEY_7},+   {0x150a, KEY_8},+   {0x150b, KEY_9},+   
{0x150c, KEY_0},+   {0x150d, KEY_UP},+  {0x150e, KEY_LEFT},+
{0x150f, KEY_OK},+  {0x1510, KEY_RIGHT},+   {0x1511, KEY_DOWN},+
{0x1512, KEY_INFO},+{0x1513, KEY_EXIT},+{0x1514, KEY_RED},+ 
{0x1515, KEY_GREEN},+   {0x1516, KEY_YELLOW},+  {0x1517, KEY_BLUE},+
{0x1518, KEY_MUTE},+{0x1519, KEY_TEXT},+{0x151a, KEY_MODE},  /* ? 
TV/Radio */+  {0x1521, KEY_OPTION},+  {0x1522, KEY_EPG},+ {0x1523, 
KEY_CHANNELUP},+   {0x1524, KEY_CHANNELDOWN},+ {0x1525, KEY_VOLUMEUP},+ 
   {0x1526, KEY_VOLUMEDOWN},+  {0x1527, KEY_SETUP},+   {0x153a, 
KEY_RECORD},/* these keys are only in the black remote */+ {0x153b, 
KEY_PLAY},+{0x153c, KEY_STOP},+{0x153d, KEY_REWIND},+  {0x153e, 
KEY_PAUSE},+   {0x153f, KEY_FORWARD}+};++static int tt3650_rc_query(struct 
dvb_usb_device *d, u32 *keyevent, int *keystate)+{+ u8 keybuf[5];+  int ret;+   
u8 b[36];/* this was (CMD_BUFFER_SIZE) u8 b[0x28] - dvb_usb_generic_rw adds 
another 4 */+   u8 rx[60];/* same (64 -4) */+   ret = ttusb2_msg(d, 
CMD_GET_IR_CODE, b, 0, rx, 9);+ if (ret != 0)+  return ret;++   if 
(rx[8] & 0x01) {+/* got a "press" event */+/*if (debug> 
2) {+printk("%s: cmd=0x%02x sys=0x%02x\n", __func__, 
rx[2], rx[3]);+ }+*/+   keybuf[0] = 0x01;/* 
DVB_USB_RC_NEC_KEY_PRESSED; why is this #define'd privately? */+
keybuf[1] = rx[3];+ keybuf[2] = ~keybuf[1]; /* fake checksum */+
keybuf[3] = rx[2];+ keybuf[4] = ~keybuf[3]; /* fake 
checksum */+dvb_usb_nec_rc_key_to_event(d, keybuf, keyevent, 
keystate);+}+  return 0;+}++/* ci */+static int tt3650_ci_msg (struct 
dvb_usb_device *d, u8 cmd, u8 *data,+   
 unsigned int write_len, unsigned int read_len)+{+    int ret;+    u8 
rx[60];/* (64 -4) */+    ret = ttusb2_msg(d, cmd, data, write_len, rx, 
read_len);+    if (ret == 0)+   memcpy (data, rx, read_len);+    
return ret;+}++static int tt3650_ci_msg_locked(struct dvb_ca_en50221 *ca,+  
   u8 cmd, u8 *data, 
unsigned int write_len, unsigned int read_len)+{+ struct dvb_usb_device *d 
= (struct dvb_usb_device *)ca->data;+  struct ttusb2_state *state = (struct 
ttusb2_state *)d->priv;+   int ret;++  mutex_lock(&state->ca_mutex);+  ret 
= tt3650_ci_msg(d, cmd, data, write_len, read_len);+
mutex_unlock(&state->ca_mutex);++   return ret;+}++static int 
tt3650_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int 
address)+{+ u8 buf[3];+ int ret;++  if (0 != slot)+ return 
-EINVAL;++   buf[0] = (address>> 8) & 0x0F;+ buf[1] = address;++ ret = 
tt3650_ci_msg_locked(ca, TT3650_CMD_CI_RD_ATTR, buf, 2, 3);++ ci_dbg ("%s 
%04x -> %d 0x%02x",+__func__, address, ret, buf[2]);++  if 
(ret < 0)+   return ret;++   return buf[2];+}++static int 
tt3650_ci_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address, 
u8 value)+{+   u8 buf[3];++ci_dbg("%s %d 0x%04x 0x%02x",+  
__func__, slot, address, value);++  if (0 != slot)+ return 
-EI

[PATCH] tm6000: add ir support

2010-06-20 Thread stefan . ringel
From: Stefan Ringel 

Signed-off-by: Stefan Ringel 
---
 drivers/staging/tm6000/Makefile   |3 +-
 drivers/staging/tm6000/tm6000-cards.c |   27 +++-
 drivers/staging/tm6000/tm6000-input.c |  357 +
 drivers/staging/tm6000/tm6000.h   |   11 +
 4 files changed, 396 insertions(+), 2 deletions(-)
 create mode 100644 drivers/staging/tm6000/tm6000-input.c

diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile
index 4129c18..77e06bf 100644
--- a/drivers/staging/tm6000/Makefile
+++ b/drivers/staging/tm6000/Makefile
@@ -2,7 +2,8 @@ tm6000-objs := tm6000-cards.o \
   tm6000-core.o  \
   tm6000-i2c.o   \
   tm6000-video.o \
-  tm6000-stds.o
+  tm6000-stds.o \
+  tm6000-input.o
 
 obj-$(CONFIG_VIDEO_TM6000) += tm6000.o
 obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o
diff --git a/drivers/staging/tm6000/tm6000-cards.c 
b/drivers/staging/tm6000/tm6000-cards.c
index 50756e5..55d05ac 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -68,6 +68,8 @@ struct tm6000_board {
int demod_addr; /* demodulator address */
 
struct tm6000_gpio gpio;
+
+   char*ir_codes;
 };
 
 struct tm6000_board tm6000_boards[] = {
@@ -275,6 +277,7 @@ struct tm6000_board tm6000_boards[] = {
.dvb_led= TM6010_GPIO_5,
.ir = TM6010_GPIO_0,
},
+   .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
},
[TM6010_BOARD_TWINHAN_TU501] = {
.name = "Twinhan TU501(704D1)",
@@ -360,6 +363,8 @@ int tm6000_tuner_callback(void *ptr, int component, int 
command, int arg)
 
switch (command) {
case XC2028_RESET_CLK:
+   tm6000_ir_wait(dev, 0);
+
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, arg);
msleep(10);
@@ -409,13 +414,14 @@ int tm6000_tuner_callback(void *ptr, int component, int 
command, int arg)
msleep(130);
break;
}
+
+   tm6000_ir_wait(dev, 1);
break;
case 1:
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, 0x01);
msleep(10);
break;
-
case 2:
rc = tm6000_i2c_reset(dev, 100);
break;
@@ -635,6 +641,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
 
dev->gpio = tm6000_boards[dev->model].gpio;
 
+   dev->ir_codes = tm6000_boards[dev->model].ir_codes;
+
dev->demod_addr = tm6000_boards[dev->model].demod_addr;
 
dev->caps = tm6000_boards[dev->model].caps;
@@ -683,6 +691,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
tm6000_add_into_devlist(dev);
tm6000_init_extension(dev);
 
+   tm6000_ir_init(dev);
+
mutex_unlock(&dev->lock);
return 0;
 
@@ -828,6 +838,19 @@ static int tm6000_usb_probe(struct usb_interface 
*interface,
 &dev->isoc_out);
}
break;
+   case USB_ENDPOINT_XFER_INT:
+   if (!dir_out) {
+   get_max_endpoint(usbdev,
+   
&interface->altsetting[i],
+   "INT IN", e,
+   &dev->int_in);
+   } else {
+   get_max_endpoint(usbdev,
+   
&interface->altsetting[i],
+   "INT OUT", e,
+   &dev->int_out);
+   }
+   break;
}
}
}
@@ -886,6 +909,8 @@ static void tm6000_usb_disconnect(struct usb_interface 
*interface)
 
mutex_lock(&dev->lock);
 
+   tm6000_ir_fini(dev);
+
if (dev->gpio.power_led) {
switch (dev->model) {
case TM6010_BOARD_HAUPPAUGE_900H:
diff --git a/drivers/staging/tm6000/tm6000-input.c 
b/drivers/staging/tm6000/tm6000-input.c
new file mode 100644
index 000..e45b443
--- /dev/null
+++ b/drivers/staging/tm6000/tm6000-input.c
@@ -0,0 +1,357 @@
+/*
+   tm6000-input.c - driver for TM5600/TM6000/TM6010 USB video capture devices
+
+   Copyright (C) 2010 Stefan Ringel 
+
+   This program is free software; you can redistribute it and/or modify
+

Firmware extract from usbsnoop.log

2010-06-20 Thread Martin Berndaner
Hello,

does anyone know how to extract the firmware from a usbsnoop.log?

Regards
Martin.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Mantis: append tasklet maintenance for DVB stream delivery

2010-06-20 Thread Bjørn Mork
Marko Ristola  writes:

> The following schedule might also be a problem:
> 1. mantis_core_exit: mantis_dma_stop()
> 2. mantis_core_exit: mantis_dma_exit().

Note that mantis_core_exit() is never called.  Unless I've missed
something, the drivers/media/dvb/mantis/mantis_core.{h,c} files can
just be deleted.  They look like some development leftovers?


Bjørn

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] drivers/media/dvb/frontends: remove duplicate structure field initialization

2010-06-20 Thread Julia Lawall
From: Julia Lawall 

The read_status field is initialized twice to the same value.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// 
@r@
identifier I, s, fld;
position p0,p;
expression E;
@@

struct I s =...@p0 { ... @p = E, ...};

@s@
identifier I, s, r.fld;
position r.p0,p;
expression E;
@@

struct I s =...@p0 { ... @p = E, ...};

@script:python@
p0 << r.p0;
fld << r.fld;
ps << s.p;
pr << r.p;
@@

if int(ps[0].line)

Signed-off-by: Julia Lawall 

---
 drivers/media/dvb/frontends/mb86a16.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb/frontends/mb86a16.c 
b/drivers/media/dvb/frontends/mb86a16.c
index 599d1aa..33b6323 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -1833,7 +1833,6 @@ static struct dvb_frontend_ops mb86a16_ops = {
 
.get_frontend_algo  = mb86a16_frontend_algo,
.search = mb86a16_search,
-   .read_status= mb86a16_read_status,
.init   = mb86a16_init,
.sleep  = mb86a16_sleep,
.read_status= mb86a16_read_status,
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Mantis: append tasklet maintenance for DVB stream delivery

2010-06-20 Thread Marko Ristola


Hi

I have a patch that should fix possible memory corruption problems in 
Mantis drivers

with tasklets after DMA transfer has been stopped.
In the patch tasklet is enabled only for DVB stream delivery, at end of 
DVB stream delivery tasklet is disabled again.
The lack of tasklet maintenance might cause problems with following 
schedulings:


1. dvb_dmxdev_filter_stop() calls mantis_dvb_stop_feed: mantis_dma_stop()
2. dvb_dmxdev_filter_stop() calls release_ts_feed() or some other filter 
freeing function.
3. tasklet: mantis_dma_xfer calls dvb_dmx_swfilter to copy DMA buffer's 
content into freed memory, accessing freed spinlocks.

This case might occur while tuning into another frequency.
Perhaps cdurrhau has found some version from this bug at 
http://www.linuxtv.org/pipermail/linux-dvb/2010-June/032688.html:

> This is what I get on the remote console via IPMI:
> 40849.442492] BUG: soft lockup - CPU#2 stuck for 61s! [section
> handler:4617]


The following schedule might also be a problem:
1. mantis_core_exit: mantis_dma_stop()
2. mantis_core_exit: mantis_dma_exit().
3. run tasklet (with another CPU?), accessing memory freed by 
mantis_dma_exit().

This case might occur with rmmod.

The following patch tries to deactivate the tasklet in mantis_dma_stop 
and activate it in mantis_dma_start, thus avoiding these cases.


Marko Ristola


diff --git a/drivers/media/dvb/mantis/mantis_dma.c 
b/drivers/media/dvb/mantis/mantis_dma.c

index 46202a4..cf502a6 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -217,12 +217,14 @@ void mantis_dma_start(struct mantis_pci *mantis)
 mmwrite(MANTIS_FIFO_EN | MANTIS_DCAP_EN
| MANTIS_RISC_EN, MANTIS_DMA_CTL);

+tasklet_enable(&mantis->tasklet);
 }

 void mantis_dma_stop(struct mantis_pci *mantis)
 {
 u32 stat = 0, mask = 0;

+tasklet_disable(&mantis->tasklet);
 stat = mmread(MANTIS_INT_STAT);
 mask = mmread(MANTIS_INT_MASK);
 dprintk(MANTIS_DEBUG, 1, "Mantis Stop DMA engine");
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c 
b/drivers/media/dvb/mantis/mantis_dvb.c

index 99d82ee..0c29f01 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -216,6 +216,7 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)

 dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, 
&mantis->demux.dmx);
 tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) 
mantis);

+tasklet_disable_nosync(&mantis->tasklet);
 if (mantis->hwconfig) {
 result = config->frontend_init(mantis, mantis->fe);
 if (result < 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Compro VideoMate U3 [eb1a:2870] still not working in 2.6.32

2010-06-20 Thread Alica
According to various sources, the U3 uses EM2870+MT352+QT1010 as its
USB video capture/demodulator/tuner combination.

http://www.ixbt.com/monitor/images/compro-u3/inside-front.jpg

However in em28xx-cards.c, the U3 is listed as below:

>[EM2870_BOARD_COMPRO_VIDEOMATE] = {
> .name = "Compro, VideoMate U3",
> .valid= EM28XX_BOARD_NOT_VALIDATED,
> .tuner_type   = TUNER_ABSENT, /* MT2060 */ },

Therefore I might be able to validate that the driver does *not* work
with U3. How can I help to fix this?


2010/6/14 Alica :
> My Compro VideoMate U3 DVB-T USB stick [eb1a:2870] does not work under
> Debian squeeze (kernel 2.6.32). Below is the kernel message from
> "modprobe em28xx":
>
>> Jun 13 01:51:42 dvb kernel: [85382.931321] Linux video capture interface: 
>> v2.00
>> Jun 13 01:51:42 dvb kernel: [85382.950628] em28xx: New device VideoMate U3 @ 
>> 480 Mbps (eb1a:2870, interface 0, class 0)
>> Jun 13 01:51:42 dvb kernel: [85382.951393] em28xx #0: chip ID is em2870
>> Jun 13 01:51:42 dvb kernel: [85383.029814] em28xx #0: i2c eeprom 00: 1a eb 
>> 67 95 1a eb 70 28 40 12 62 40 6a 1c 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.029868] em28xx #0: i2c eeprom 10: 00 00 
>> 04 57 0e 1d 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.029917] em28xx #0: i2c eeprom 20: 04 00 
>> 00 00 f0 10 01 00 00 00 00 00 5b 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.029965] em28xx #0: i2c eeprom 30: 00 00 
>> 20 40 20 80 02 20 01 01 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030013] em28xx #0: i2c eeprom 40: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030061] em28xx #0: i2c eeprom 50: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030109] em28xx #0: i2c eeprom 60: 00 00 
>> 00 00 00 00 00 00 00 00 1c 03 56 00 69 00
>> Jun 13 01:51:42 dvb kernel: [85383.030157] em28xx #0: i2c eeprom 70: 64 00 
>> 65 00 6f 00 4d 00 61 00 74 00 65 00 20 00
>> Jun 13 01:51:42 dvb kernel: [85383.030205] em28xx #0: i2c eeprom 80: 55 00 
>> 33 00 00 00 63 00 65 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030253] em28xx #0: i2c eeprom 90: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030301] em28xx #0: i2c eeprom a0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030349] em28xx #0: i2c eeprom b0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030397] em28xx #0: i2c eeprom c0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030445] em28xx #0: i2c eeprom d0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030493] em28xx #0: i2c eeprom e0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030541] em28xx #0: i2c eeprom f0: 00 00 
>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> Jun 13 01:51:42 dvb kernel: [85383.030591] em28xx #0: EEPROM ID= 0x9567eb1a, 
>> EEPROM hash = 0xc9c50bc9
>> Jun 13 01:51:42 dvb kernel: [85383.030611] em28xx #0: EEPROM info:
>> Jun 13 01:51:42 dvb kernel: [85383.030627] em28xx #0:^INo audio on board.
>> Jun 13 01:51:42 dvb kernel: [85383.030643] em28xx #0:^I500mA max power
>> Jun 13 01:51:42 dvb kernel: [85383.030661] em28xx #0:^ITable at 0x04, 
>> strings=0x1c6a, 0x, 0x
>> Jun 13 01:51:42 dvb kernel: [85383.031562] em28xx #0: Identified as Unknown 
>> EM2750/28xx video grabber (card=1)
>> Jun 13 01:51:42 dvb kernel: [85383.053436] em28xx #0: found i2c device @ 
>> 0xa0 [eeprom]
>> Jun 13 01:51:42 dvb kernel: [85383.058435] em28xx #0: found i2c device @ 
>> 0xc4 [tuner (analog)]
>> Jun 13 01:51:42 dvb kernel: [85383.067576] em28xx #0: v4l2 driver version 
>> 0.1.2
>> Jun 13 01:51:42 dvb kernel: [85383.077231] em28xx #0: V4L2 video device 
>> registered as /dev/video0
>> Jun 13 01:51:42 dvb kernel: [85383.077302] usbcore: registered new interface 
>> driver em28xx
>> Jun 13 01:51:42 dvb kernel: [85383.078147] em28xx driver loaded
>
> Adding the card=46 module option (which is U3 listed as 185b:2870 in
> CARDLIST.em28xx) also does not populate the dvb device. Any
> suggestions?
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Mantis DMA transfer cleanup, fixes data corruption and a race, improves performance.

2010-06-20 Thread Marko Ristola


Hi

Here is another version of the DMA transfer fix.
Please try it. Comments?

The current DMA code with drivers/media/dvb/mantis/mantis_dma.c has user 
visible problems:
- about 1500 interrupts per second. One CPU can't copy h.264 data over 
the network for me (vdr, streamdev).
- 64K garbage at start of the data stream, part of which goes into User 
land application.
The garbage data is partly from the same stream (given twice), and 
partly from previous tuned frequency (buffer

uninitialized at DMA start).
- Race condition: Memory copying from DMA buffer is done at the same 
time as there is DMA transfer going on to the same bytes.

Can this race cause harware problems?

Current DMA code is not clear:
Current DMA RISC coding creates one DMA transfer per 2048 bytes.
Risc command generating code has mantis->line_count=32.
mantis->last_block and mantis->finished_block iterates over [0 to 16].

These counters are confusing. It takes lots of time to look and debug to 
understand

what is happening there even for me :(

Basic example how the 64K garbage generation happens:
At mantis_dma_start, mantis->last_block = mantis->finished_block = 0
1st DMA transfer (2048 bytes) generates interrupt, sets 
mantis->finished_block=15.
Tasklet will call mantis_dma_xfer(), which iterates from 
mantis->last_block = 0 to mantis->finished_block = 14. Set last_block=15.
2nd DMA transfer of 2048 bytes goes quietly (no interrupt generated), 
race with the tasklet above here.
3rd DMA transfer sets mantis->finished_block = 0, mantis_dma_xfer() 
copies mantis->finished_block = 15. Set last_block=0.
After this copying continues from block 0, so the content is valid, 
although block 0 was already partly copied.


Because the current looping implementation is too hard to understand,
I decided to rewrite it and not give you any small patch that fixes the 
issue but nobody else understands it.
This doesn't have the alignment stuff at all that I mentioned in earlier 
emails last week.


Basic idea:
Keep DMA buffer of size 64k, but generate interrupts four times, thus 
one interrupt per 16k.
Rename mantis->finished_block to be mantis->busy_block, because that 
keeps mantis_dma_xfer() simple:
while(mantis->last_block != mantis->busy_block) { do copy, last_block = 
(last_block + 1) mod 4.
last_block is thus incremented until last_block == busy_block, which 
can't be copied yet.


DMA RISC code generation: outer loop iterates over blocks from 0 to 4.
Inner loop iterates over DMA transfer units from 0 to 
MANTIS_DMA_TR_UNITS, each DMA transfer is 2048 bytes.
The interrupt is generated at block[0], DMA unit 0: the block 0 is now 
busy :)


mantis->line_bytes, mantis->line_count and mantis->risc_pos
were used only for DMA risc code generation.
Removed them from the structure.

Benefits of this code:
- Removes the 64k garbage issue.
- Remove race condition with concurrent DMA transfer and memory copy.
- Lessen interrupts to about 350 per second (seen by powertop) by
  moving 16k bytes per interrupt, instead of 4k per interrupt.
  The number of interrupts gets much smaller, and it becomes possible 
with single core AMD cpu to

  deliver h.264 data over the network from vdr via streamdev.
- Mantis DMA code is more understandable for reviewers and others.

My patch is GPLv2.
The patch is made against GIT linuxtv/master, applies cleanly to 
Mercurial v4l-dvb too.


Best regards,
Marko Ristola

diff --git a/drivers/media/dvb/mantis/hopper_cards.c 
b/drivers/media/dvb/mantis/hopper_cards.c

index 09e9fc7..3b7e376 100644
--- a/drivers/media/dvb/mantis/hopper_cards.c
+++ b/drivers/media/dvb/mantis/hopper_cards.c
@@ -126,7 +126,7 @@ static irqreturn_t hopper_irq_handler(int irq, void 
*dev_id)

 }
 if (stat & MANTIS_INT_RISCI) {
 dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]);
-mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+mantis->busy_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
 tasklet_schedule(&mantis->tasklet);
 }
 if (stat & MANTIS_INT_I2CDONE) {
diff --git a/drivers/media/dvb/mantis/mantis_cards.c 
b/drivers/media/dvb/mantis/mantis_cards.c

index cf4b39f..8f048d5 100644
--- a/drivers/media/dvb/mantis/mantis_cards.c
+++ b/drivers/media/dvb/mantis/mantis_cards.c
@@ -134,7 +134,7 @@ static irqreturn_t mantis_irq_handler(int irq, void 
*dev_id)

 }
 if (stat & MANTIS_INT_RISCI) {
 dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]);
-mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+mantis->busy_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
 tasklet_schedule(&mantis->tasklet);
 }
 if (stat & MANTIS_INT_I2CDONE) {
diff --git a/drivers/media/dvb/mantis/mantis_common.h 
b/drivers/media/dvb/mantis/mantis_common.h

index d0b645a..23b23b7 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -122,11 +122,8 @@ struct mantis_pci {
 unsigned intnum;

 /*RISC Core*/
-u32   

[PATCH] drivers/media/IR/imon.c: Use pr_err instead of err

2010-06-20 Thread Joe Perches
Use the standard error logging mechanisms.
Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s" fmt, __func__
Remove __func__ from err calls, add '\n', rename to pr_err

Signed-off-by: Joe Perches 
---
 drivers/media/IR/imon.c |   73 ++-
 1 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c
index 4bbd45f..36fb423 100644
--- a/drivers/media/IR/imon.c
+++ b/drivers/media/IR/imon.c
@@ -26,6 +26,8 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+
 #include 
 #include 
 #include 
@@ -364,15 +366,14 @@ static int display_open(struct inode *inode, struct file 
*file)
subminor = iminor(inode);
interface = usb_find_interface(&imon_driver, subminor);
if (!interface) {
-   err("%s: could not find interface for minor %d",
-   __func__, subminor);
+   pr_err("could not find interface for minor %d\n", subminor);
retval = -ENODEV;
goto exit;
}
ictx = usb_get_intfdata(interface);
 
if (!ictx) {
-   err("%s: no context found for minor %d", __func__, subminor);
+   pr_err("no context found for minor %d\n", subminor);
retval = -ENODEV;
goto exit;
}
@@ -380,10 +381,10 @@ static int display_open(struct inode *inode, struct file 
*file)
mutex_lock(&ictx->lock);
 
if (!ictx->display_supported) {
-   err("%s: display not supported by device", __func__);
+   pr_err("display not supported by device\n");
retval = -ENODEV;
} else if (ictx->display_isopen) {
-   err("%s: display port is already open", __func__);
+   pr_err("display port is already open\n");
retval = -EBUSY;
} else {
ictx->display_isopen = true;
@@ -410,17 +411,17 @@ static int display_close(struct inode *inode, struct file 
*file)
ictx = (struct imon_context *)file->private_data;
 
if (!ictx) {
-   err("%s: no context for device", __func__);
+   pr_err("no context for device\n");
return -ENODEV;
}
 
mutex_lock(&ictx->lock);
 
if (!ictx->display_supported) {
-   err("%s: display not supported by device", __func__);
+   pr_err("display not supported by device\n");
retval = -ENODEV;
} else if (!ictx->display_isopen) {
-   err("%s: display is not open", __func__);
+   pr_err("display is not open\n");
retval = -EIO;
} else {
ictx->display_isopen = false;
@@ -499,19 +500,19 @@ static int send_packet(struct imon_context *ictx)
if (retval) {
ictx->tx.busy = false;
smp_rmb(); /* ensure later readers know we're not busy */
-   err("%s: error submitting urb(%d)", __func__, retval);
+   pr_err("error submitting urb(%d)\n", retval);
} else {
/* Wait for transmission to complete (or abort) */
mutex_unlock(&ictx->lock);
retval = wait_for_completion_interruptible(
&ictx->tx.finished);
if (retval)
-   err("%s: task interrupted", __func__);
+   pr_err("task interrupted\n");
mutex_lock(&ictx->lock);
 
retval = ictx->tx.status;
if (retval)
-   err("%s: packet tx failed (%d)", __func__, retval);
+   pr_err("packet tx failed (%d)\n", retval);
}
 
kfree(control_req);
@@ -543,12 +544,12 @@ static int send_associate_24g(struct imon_context *ictx)
  0x00, 0x00, 0x00, 0x20 };
 
if (!ictx) {
-   err("%s: no context for device", __func__);
+   pr_err("no context for device\n");
return -ENODEV;
}
 
if (!ictx->dev_present_intf0) {
-   err("%s: no iMON device present", __func__);
+   pr_err("no iMON device present\n");
return -ENODEV;
}
 
@@ -576,7 +577,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
int i;
 
if (!ictx) {
-   err("%s: no context for device", __func__);
+   pr_err("no context for device\n");
return -ENODEV;
}
 
@@ -637,8 +638,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8);
retval = send_packet(ictx);
if (retval) {
-   err("%s: send_packet failed for packet %d",
-   __func__, i);
+   pr_err("send_packet fa