media: i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Javier Martin
This driver wasn't converted to the new clock changes
(clk_prepare_enable/clk_disable_unprepare). Also naming
of emma-prp related clocks for the i.MX27 was not correct.

Signed-of-by: Javier Martin javier.mar...@vista-silicon.com
---
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 295cbd7..e8a6016 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -250,8 +250,10 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[i2c2_ipg_gate], NULL, imx-i2c.1);
clk_register_clkdev(clk[owire_ipg_gate], NULL, mxc_w1.0);
clk_register_clkdev(clk[kpp_ipg_gate], NULL, imx-keypad);
-   clk_register_clkdev(clk[emma_ahb_gate], ahb, imx-emma);
-   clk_register_clkdev(clk[emma_ipg_gate], ipg, imx-emma);
+   clk_register_clkdev(clk[emma_ahb_gate], ahb, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ipg_gate], ipg, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ahb_gate], ahb, m2m-emmaprp.0);
+   clk_register_clkdev(clk[emma_ipg_gate], ipg, m2m-emmaprp.0);
clk_register_clkdev(clk[iim_ipg_gate], iim, NULL);
clk_register_clkdev(clk[gpio_ipg_gate], gpio, NULL);
clk_register_clkdev(clk[brom_ahb_gate], brom, NULL);
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 41f9a25..95154e8 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -270,7 +270,7 @@ struct mx2_camera_dev {
struct device   *dev;
struct soc_camera_host  soc_host;
struct soc_camera_device *icd;
-   struct clk  *clk_csi, *clk_emma;
+   struct clk  *clk_csi, *clk_emma_ahb, *clk_emma_ipg;
 
unsigned intirq_csi, irq_emma;
void __iomem*base_csi, *base_emma;
@@ -417,7 +417,7 @@ static int mx2_camera_add_device(struct soc_camera_device 
*icd)
if (pcdev-icd)
return -EBUSY;
 
-   ret = clk_enable(pcdev-clk_csi);
+   ret = clk_prepare_enable(pcdev-clk_csi);
if (ret  0)
return ret;
 
@@ -1616,23 +1616,12 @@ static int __devinit mx27_camera_emma_init(struct 
mx2_camera_dev *pcdev)
goto exit_iounmap;
}
 
-   pcdev-clk_emma = clk_get(NULL, emma);
-   if (IS_ERR(pcdev-clk_emma)) {
-   err = PTR_ERR(pcdev-clk_emma);
-   goto exit_free_irq;
-   }
-
-   clk_enable(pcdev-clk_emma);
-
err = mx27_camera_emma_prp_reset(pcdev);
if (err)
-   goto exit_clk_emma_put;
+   goto exit_free_irq;
 
return err;
 
-exit_clk_emma_put:
-   clk_disable(pcdev-clk_emma);
-   clk_put(pcdev-clk_emma);
 exit_free_irq:
free_irq(pcdev-irq_emma, pcdev);
 exit_iounmap:
@@ -1655,6 +1644,7 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
 
res_csi = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_csi = platform_get_irq(pdev, 0);
+
if (res_csi == NULL || irq_csi  0) {
dev_err(pdev-dev, Missing platform resources data\n);
err = -ENODEV;
@@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
goto exit;
}
 
-   pcdev-clk_csi = clk_get(pdev-dev, NULL);
+   pcdev-clk_csi = devm_clk_get(pdev-dev, NULL);
if (IS_ERR(pcdev-clk_csi)) {
dev_err(pdev-dev, Could not get csi clock\n);
err = PTR_ERR(pcdev-clk_csi);
goto exit_kfree;
}
+   pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, ipg);
+   if (IS_ERR(pcdev-clk_emma_ipg)) {
+   err = PTR_ERR(pcdev-clk_emma_ipg);
+   goto exit_kfree;
+   }
+   pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, ahb);
+   if (IS_ERR(pcdev-clk_emma_ahb)) {
+   err = PTR_ERR(pcdev-clk_emma_ahb);
+   goto exit_kfree;
+   }
+
+   clk_prepare_enable(pcdev-clk_csi);
+   clk_prepare_enable(pcdev-clk_emma_ipg);
+   clk_prepare_enable(pcdev-clk_emma_ahb);
 
pcdev-res_csi = res_csi;
pcdev-pdata = pdev-dev.platform_data;
@@ -1768,8 +1772,8 @@ exit_free_emma:
 eallocctx:
if (cpu_is_mx27()) {
free_irq(pcdev-irq_emma, pcdev);
-   clk_disable(pcdev-clk_emma);
-   clk_put(pcdev-clk_emma);
+   clk_disable_unprepare(pcdev-clk_emma_ipg);
+   clk_disable_unprepare(pcdev-clk_emma_ahb);
iounmap(pcdev-base_emma);
release_mem_region(pcdev-res_emma-start, 
resource_size(pcdev-res_emma));
}
@@ -1781,7 +1785,9 @@ exit_iounmap:
 exit_release:
release_mem_region(res_csi-start, resource_size(res_csi));
 exit_dma_free:
-   clk_put(pcdev-clk_csi);
+   clk_disable_unprepare(pcdev-clk_emma_ipg);
+   clk_disable_unprepare(pcdev-clk_emma_ahb);
+   clk_disable_unprepare(pcdev-clk_csi);
 

Re: media: i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Sascha Hauer
Hi Javier,

On Fri, Jul 06, 2012 at 08:31:49AM +0200, Javier Martin wrote:
 This driver wasn't converted to the new clock changes
 (clk_prepare_enable/clk_disable_unprepare). Also naming
 of emma-prp related clocks for the i.MX27 was not correct.

Thanks for fixing this. Sorry for breaking this in the first place.

 @@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)
   goto exit;
   }
  
 - pcdev-clk_csi = clk_get(pdev-dev, NULL);
 + pcdev-clk_csi = devm_clk_get(pdev-dev, NULL);
   if (IS_ERR(pcdev-clk_csi)) {
   dev_err(pdev-dev, Could not get csi clock\n);
   err = PTR_ERR(pcdev-clk_csi);
   goto exit_kfree;
   }
 + pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, ipg);
 + if (IS_ERR(pcdev-clk_emma_ipg)) {
 + err = PTR_ERR(pcdev-clk_emma_ipg);
 + goto exit_kfree;
 + }
 + pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, ahb);
 + if (IS_ERR(pcdev-clk_emma_ahb)) {
 + err = PTR_ERR(pcdev-clk_emma_ahb);
 + goto exit_kfree;
 + }

So we have three clocks involved here, a csi ahb clock and two emma
clocks. Can we rename the clocks to:

clk_register_clkdev(clk[csi_ahb_gate], ahb, mx2-camera.0);
clk_register_clkdev(clk[emma_ahb_gate], emma-ahb, mx2-camera.0);
clk_register_clkdev(clk[emma_ipg_gate], emma-ipg, mx2-camera.0);

The rationale is that the csi_ahb_gate really is a ahb clock related to
the csi whereas the emma clocks are normally for the emma device, but
the csi driver happens to use parts of the emma.

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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: media: i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread javier Martin
On 6 July 2012 08:43, Sascha Hauer s.ha...@pengutronix.de wrote:
 Hi Javier,

 On Fri, Jul 06, 2012 at 08:31:49AM +0200, Javier Martin wrote:
 This driver wasn't converted to the new clock changes
 (clk_prepare_enable/clk_disable_unprepare). Also naming
 of emma-prp related clocks for the i.MX27 was not correct.

 Thanks for fixing this. Sorry for breaking this in the first place.

 @@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)
   goto exit;
   }

 - pcdev-clk_csi = clk_get(pdev-dev, NULL);
 + pcdev-clk_csi = devm_clk_get(pdev-dev, NULL);
   if (IS_ERR(pcdev-clk_csi)) {
   dev_err(pdev-dev, Could not get csi clock\n);
   err = PTR_ERR(pcdev-clk_csi);
   goto exit_kfree;
   }
 + pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, ipg);
 + if (IS_ERR(pcdev-clk_emma_ipg)) {
 + err = PTR_ERR(pcdev-clk_emma_ipg);
 + goto exit_kfree;
 + }
 + pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, ahb);
 + if (IS_ERR(pcdev-clk_emma_ahb)) {
 + err = PTR_ERR(pcdev-clk_emma_ahb);
 + goto exit_kfree;
 + }

 So we have three clocks involved here, a csi ahb clock and two emma
 clocks. Can we rename the clocks to:

 clk_register_clkdev(clk[csi_ahb_gate], ahb, mx2-camera.0);
 clk_register_clkdev(clk[emma_ahb_gate], emma-ahb, mx2-camera.0);
 clk_register_clkdev(clk[emma_ipg_gate], emma-ipg, mx2-camera.0);

 The rationale is that the csi_ahb_gate really is a ahb clock related to
 the csi whereas the emma clocks are normally for the emma device, but
 the csi driver happens to use parts of the emma.

Yes, I find it quite appealing. Let me send a new patch.


-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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: pctv452e

2012-07-06 Thread Marx

On 05.07.2012 16:23, Antti Palosaari wrote:

Check if those modules are enabled, in file .config
CONFIG_DVB_USB_V2=m
CONFIG_DVB_USB_PCTV452E=m

use make menuconfig to enable if disabled. Then make  make
install_modules  make install as usually.


You were right, I didn't have this options anabled. I've enabled both 
via 'make menuconfig' and recompiled kernel. Driver loaded succesfully, 
I haven time to test only a few SD channels, and they were working, but 
some encrypted and HD didn't. I have to check yet why.


Anyway when using card logs are full of i2c errors

Jul  6 07:04:19 wuwek kernel: [6.087199] input: HDA ATI SB Line Out 
Front as /devices/pci:00/:00:14.2/sound/card

1/input8
Jul  6 07:04:19 wuwek kernel: [6.108046] stb6100_attach: Attaching 
STB6100

Jul  6 07:04:19 wuwek kernel: [6.108054] pctv452e_power_ctrl: 0
Jul  6 07:04:19 wuwek kernel: [6.108063] usb 1-4: dvb_usbv2: 'PCTV 
HDTV USB' successfully initialized and connected
Jul  6 07:04:19 wuwek kernel: [7.659462] Adding 2097148k swap on 
/dev/sda2.  Priority:-1 extents:1 across:2097148k
Jul  6 07:04:19 wuwek kernel: [7.707592] EXT4-fs (sda1): re-mounted. 
Opts: (null)


(...)

Jul  6 07:04:21 wuwek kernel: [   45.112483] Bluetooth: BNEP (Ethernet 
Emulation) ver 1.3
Jul  6 07:04:21 wuwek kernel: [   45.112496] Bluetooth: BNEP filters: 
protocol multicast

Jul  6 07:04:40 wuwek kernel: [   64.367411] pctv452e_power_ctrl: 1
Jul  6 07:04:48 wuwek kernel: [   72.693972] I2C error -121; AA 0B  CC 
00 01 - 55 0B  CC 00 00.
Jul  6 07:04:59 wuwek kernel: [   83.605643] I2C error -121; AA 49  CC 
00 01 - 55 49  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.565805] I2C error -121; AA EE  CC 
00 01 - 55 EE  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.578295] I2C error -121; AA 05  CC 
00 01 - 55 05  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.637539] I2C error -121; AA 20  CC 
00 01 - 55 20  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.525868] I2C error -121; AA 08  CC 
00 01 - 55 08  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.538359] I2C error -121; AA 1F  CC 
00 01 - 55 1F  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.597603] I2C error -121; AA 3A  CC 
00 01 - 55 3A  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.765372] I2C error -121; AA F5  CC 
00 01 - 55 F5  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.777986] I2C error -121; AA 0C  CC 
00 01 - 55 0C  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.837480] I2C error -121; AA 27  CC 
00 01 - 55 27  CC 00 00.
Jul  6 07:05:35 wuwek kernel: [  120.069153] I2C error -121; AA CF  CC 
00 01 - 55 CF  CC 00 00.
Jul  6 07:05:37 wuwek kernel: [  121.325610] I2C error -121; AA A7  CC 
00 01 - 55 A7  CC 00 00.
Jul  6 07:05:38 wuwek kernel: [  122.581565] I2C error -121; AA 7F  CC 
00 01 - 55 7F  CC 00 00.
Jul  6 07:05:39 wuwek kernel: [  123.841526] I2C error -121; AA 57  CC 
00 01 - 55 57  CC 00 00.
Jul  6 07:05:40 wuwek kernel: [  125.096979] I2C error -121; AA 2F  CC 
00 01 - 55 2F  CC 00 00.
Jul  6 07:05:42 wuwek kernel: [  126.353689] I2C error -121; AA 07  CC 
00 01 - 55 07  CC 00 00.



I will test tonight when I have more time
Marx

--
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] [v2] i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Javier Martin
This driver wasn't converted to the new clock changes
(clk_prepare_enable/clk_disable_unprepare). Also naming
of emma-prp related clocks for the i.MX27 was not correct.

Signed-off-by: Javier Martin javier.mar...@vista-silicon.com
---
 arch/arm/mach-imx/clk-imx27.c|8 ---
 drivers/media/video/mx2_camera.c |   47 +-
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 295cbd7..373c8fd 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -223,7 +223,7 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[per3_gate], per, imx-fb.0);
clk_register_clkdev(clk[lcdc_ipg_gate], ipg, imx-fb.0);
clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx-fb.0);
-   clk_register_clkdev(clk[csi_ahb_gate], NULL, mx2-camera.0);
+   clk_register_clkdev(clk[csi_ahb_gate], ahb, mx2-camera.0);
clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc);
clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc);
clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc);
@@ -250,8 +250,10 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[i2c2_ipg_gate], NULL, imx-i2c.1);
clk_register_clkdev(clk[owire_ipg_gate], NULL, mxc_w1.0);
clk_register_clkdev(clk[kpp_ipg_gate], NULL, imx-keypad);
-   clk_register_clkdev(clk[emma_ahb_gate], ahb, imx-emma);
-   clk_register_clkdev(clk[emma_ipg_gate], ipg, imx-emma);
+   clk_register_clkdev(clk[emma_ahb_gate], emma-ahb, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ipg_gate], emma-ipg, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ahb_gate], ahb, m2m-emmaprp.0);
+   clk_register_clkdev(clk[emma_ipg_gate], ipg, m2m-emmaprp.0);
clk_register_clkdev(clk[iim_ipg_gate], iim, NULL);
clk_register_clkdev(clk[gpio_ipg_gate], gpio, NULL);
clk_register_clkdev(clk[brom_ahb_gate], brom, NULL);
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 41f9a25..e4d77e1 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -270,7 +270,7 @@ struct mx2_camera_dev {
struct device   *dev;
struct soc_camera_host  soc_host;
struct soc_camera_device *icd;
-   struct clk  *clk_csi, *clk_emma;
+   struct clk  *clk_csi, *clk_emma_ahb, *clk_emma_ipg;
 
unsigned intirq_csi, irq_emma;
void __iomem*base_csi, *base_emma;
@@ -417,7 +417,7 @@ static int mx2_camera_add_device(struct soc_camera_device 
*icd)
if (pcdev-icd)
return -EBUSY;
 
-   ret = clk_enable(pcdev-clk_csi);
+   ret = clk_prepare_enable(pcdev-clk_csi);
if (ret  0)
return ret;
 
@@ -1616,23 +1616,12 @@ static int __devinit mx27_camera_emma_init(struct 
mx2_camera_dev *pcdev)
goto exit_iounmap;
}
 
-   pcdev-clk_emma = clk_get(NULL, emma);
-   if (IS_ERR(pcdev-clk_emma)) {
-   err = PTR_ERR(pcdev-clk_emma);
-   goto exit_free_irq;
-   }
-
-   clk_enable(pcdev-clk_emma);
-
err = mx27_camera_emma_prp_reset(pcdev);
if (err)
-   goto exit_clk_emma_put;
+   goto exit_free_irq;
 
return err;
 
-exit_clk_emma_put:
-   clk_disable(pcdev-clk_emma);
-   clk_put(pcdev-clk_emma);
 exit_free_irq:
free_irq(pcdev-irq_emma, pcdev);
 exit_iounmap:
@@ -1655,6 +1644,7 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
 
res_csi = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_csi = platform_get_irq(pdev, 0);
+
if (res_csi == NULL || irq_csi  0) {
dev_err(pdev-dev, Missing platform resources data\n);
err = -ENODEV;
@@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
goto exit;
}
 
-   pcdev-clk_csi = clk_get(pdev-dev, NULL);
+   pcdev-clk_csi = devm_clk_get(pdev-dev, ahb);
if (IS_ERR(pcdev-clk_csi)) {
dev_err(pdev-dev, Could not get csi clock\n);
err = PTR_ERR(pcdev-clk_csi);
goto exit_kfree;
}
+   pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, emma-ipg);
+   if (IS_ERR(pcdev-clk_emma_ipg)) {
+   err = PTR_ERR(pcdev-clk_emma_ipg);
+   goto exit_kfree;
+   }
+   pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, emma-ahb);
+   if (IS_ERR(pcdev-clk_emma_ahb)) {
+   err = PTR_ERR(pcdev-clk_emma_ahb);
+   goto exit_kfree;
+   }
+
+   clk_prepare_enable(pcdev-clk_csi);
+   clk_prepare_enable(pcdev-clk_emma_ipg);
+   clk_prepare_enable(pcdev-clk_emma_ahb);
 
pcdev-res_csi = res_csi;
pcdev-pdata = pdev-dev.platform_data;
@@ 

Re: [PATCH] [v2] i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Sascha Hauer
On Fri, Jul 06, 2012 at 09:13:11AM +0200, Javier Martin wrote:
 This driver wasn't converted to the new clock changes
 (clk_prepare_enable/clk_disable_unprepare). Also naming
 of emma-prp related clocks for the i.MX27 was not correct.
 
 Signed-off-by: Javier Martin javier.mar...@vista-silicon.com
 ---
  arch/arm/mach-imx/clk-imx27.c|8 ---
  drivers/media/video/mx2_camera.c |   47 
 +-
  2 files changed, 31 insertions(+), 24 deletions(-)
 
 @@ -1616,23 +1616,12 @@ static int __devinit mx27_camera_emma_init(struct 
 mx2_camera_dev *pcdev)
   goto exit_iounmap;
   }
  
 - pcdev-clk_emma = clk_get(NULL, emma);
 - if (IS_ERR(pcdev-clk_emma)) {
 - err = PTR_ERR(pcdev-clk_emma);
 - goto exit_free_irq;
 - }
 -
 - clk_enable(pcdev-clk_emma);
 -
   err = mx27_camera_emma_prp_reset(pcdev);
   if (err)
 - goto exit_clk_emma_put;
 + goto exit_free_irq;
  
   return err;
  
 -exit_clk_emma_put:
 - clk_disable(pcdev-clk_emma);
 - clk_put(pcdev-clk_emma);
  exit_free_irq:
   free_irq(pcdev-irq_emma, pcdev);
  exit_iounmap:
 @@ -1655,6 +1644,7 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)
  
   res_csi = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   irq_csi = platform_get_irq(pdev, 0);
 +
   if (res_csi == NULL || irq_csi  0) {
   dev_err(pdev-dev, Missing platform resources data\n);
   err = -ENODEV;
 @@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)
   goto exit;
   }
  
 - pcdev-clk_csi = clk_get(pdev-dev, NULL);
 + pcdev-clk_csi = devm_clk_get(pdev-dev, ahb);
   if (IS_ERR(pcdev-clk_csi)) {
   dev_err(pdev-dev, Could not get csi clock\n);
   err = PTR_ERR(pcdev-clk_csi);
   goto exit_kfree;
   }
 + pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, emma-ipg);
 + if (IS_ERR(pcdev-clk_emma_ipg)) {
 + err = PTR_ERR(pcdev-clk_emma_ipg);
 + goto exit_kfree;
 + }
 + pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, emma-ahb);
 + if (IS_ERR(pcdev-clk_emma_ahb)) {
 + err = PTR_ERR(pcdev-clk_emma_ahb);
 + goto exit_kfree;
 + }
 +
 + clk_prepare_enable(pcdev-clk_csi);
 + clk_prepare_enable(pcdev-clk_emma_ipg);
 + clk_prepare_enable(pcdev-clk_emma_ahb);
  
   pcdev-res_csi = res_csi;
   pcdev-pdata = pdev-dev.platform_data;
 @@ -1768,8 +1772,8 @@ exit_free_emma:
  eallocctx:
   if (cpu_is_mx27()) {
   free_irq(pcdev-irq_emma, pcdev);
 - clk_disable(pcdev-clk_emma);
 - clk_put(pcdev-clk_emma);
 + clk_disable_unprepare(pcdev-clk_emma_ipg);
 + clk_disable_unprepare(pcdev-clk_emma_ahb);

The clk_disable_unprepare is inside a cpu_is_mx27() which seems correct.
Shouldn't the corresponding clk_get be in cpu_is_mx27() aswell?

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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] [v2] i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread javier Martin
On 6 July 2012 09:34, Sascha Hauer s.ha...@pengutronix.de wrote:
 On Fri, Jul 06, 2012 at 09:13:11AM +0200, Javier Martin wrote:
 This driver wasn't converted to the new clock changes
 (clk_prepare_enable/clk_disable_unprepare). Also naming
 of emma-prp related clocks for the i.MX27 was not correct.

 Signed-off-by: Javier Martin javier.mar...@vista-silicon.com
 ---
  arch/arm/mach-imx/clk-imx27.c|8 ---
  drivers/media/video/mx2_camera.c |   47 
 +-
  2 files changed, 31 insertions(+), 24 deletions(-)

 @@ -1616,23 +1616,12 @@ static int __devinit mx27_camera_emma_init(struct 
 mx2_camera_dev *pcdev)
   goto exit_iounmap;
   }

 - pcdev-clk_emma = clk_get(NULL, emma);
 - if (IS_ERR(pcdev-clk_emma)) {
 - err = PTR_ERR(pcdev-clk_emma);
 - goto exit_free_irq;
 - }
 -
 - clk_enable(pcdev-clk_emma);
 -
   err = mx27_camera_emma_prp_reset(pcdev);
   if (err)
 - goto exit_clk_emma_put;
 + goto exit_free_irq;

   return err;

 -exit_clk_emma_put:
 - clk_disable(pcdev-clk_emma);
 - clk_put(pcdev-clk_emma);
  exit_free_irq:
   free_irq(pcdev-irq_emma, pcdev);
  exit_iounmap:
 @@ -1655,6 +1644,7 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)

   res_csi = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   irq_csi = platform_get_irq(pdev, 0);
 +
   if (res_csi == NULL || irq_csi  0) {
   dev_err(pdev-dev, Missing platform resources data\n);
   err = -ENODEV;
 @@ -1668,12 +1658,26 @@ static int __devinit mx2_camera_probe(struct 
 platform_device *pdev)
   goto exit;
   }

 - pcdev-clk_csi = clk_get(pdev-dev, NULL);
 + pcdev-clk_csi = devm_clk_get(pdev-dev, ahb);
   if (IS_ERR(pcdev-clk_csi)) {
   dev_err(pdev-dev, Could not get csi clock\n);
   err = PTR_ERR(pcdev-clk_csi);
   goto exit_kfree;
   }
 + pcdev-clk_emma_ipg = devm_clk_get(pdev-dev, emma-ipg);
 + if (IS_ERR(pcdev-clk_emma_ipg)) {
 + err = PTR_ERR(pcdev-clk_emma_ipg);
 + goto exit_kfree;
 + }
 + pcdev-clk_emma_ahb = devm_clk_get(pdev-dev, emma-ahb);
 + if (IS_ERR(pcdev-clk_emma_ahb)) {
 + err = PTR_ERR(pcdev-clk_emma_ahb);
 + goto exit_kfree;
 + }
 +
 + clk_prepare_enable(pcdev-clk_csi);
 + clk_prepare_enable(pcdev-clk_emma_ipg);
 + clk_prepare_enable(pcdev-clk_emma_ahb);

   pcdev-res_csi = res_csi;
   pcdev-pdata = pdev-dev.platform_data;
 @@ -1768,8 +1772,8 @@ exit_free_emma:
  eallocctx:
   if (cpu_is_mx27()) {
   free_irq(pcdev-irq_emma, pcdev);
 - clk_disable(pcdev-clk_emma);
 - clk_put(pcdev-clk_emma);
 + clk_disable_unprepare(pcdev-clk_emma_ipg);
 + clk_disable_unprepare(pcdev-clk_emma_ahb);

 The clk_disable_unprepare is inside a cpu_is_mx27() which seems correct.
 Shouldn't the corresponding clk_get be in cpu_is_mx27() aswell?

Yes indeed. Should I fix it in a new version of this patch or should I
send another one instead?

-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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] [v2] i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Sascha Hauer
On Fri, Jul 06, 2012 at 09:46:46AM +0200, javier Martin wrote:
 On 6 July 2012 09:34, Sascha Hauer s.ha...@pengutronix.de wrote:
  On Fri, Jul 06, 2012 at 09:13:11AM +0200, Javier Martin wrote:
if (cpu_is_mx27()) {
free_irq(pcdev-irq_emma, pcdev);
  - clk_disable(pcdev-clk_emma);
  - clk_put(pcdev-clk_emma);
  + clk_disable_unprepare(pcdev-clk_emma_ipg);
  + clk_disable_unprepare(pcdev-clk_emma_ahb);
 
  The clk_disable_unprepare is inside a cpu_is_mx27() which seems correct.
  Shouldn't the corresponding clk_get be in cpu_is_mx27() aswell?
 
 Yes indeed. Should I fix it in a new version of this patch or should I
 send another one instead?

Another version of this patch should be fine.

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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] stv090x: variable 'no_signal' set but not used

2012-07-06 Thread Manu Abraham
On Thu, Jun 28, 2012 at 7:38 PM, Peter Senna Tschudin
peter.se...@gmail.com wrote:
 Remove variable and ignore return value of stv090x_chk_signal().

 Tested by compilation only.

 Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

Reviewed-by: Manu Abraham m...@linuxtv.org

 ---
  drivers/media/dvb/frontends/stv090x.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/dvb/frontends/stv090x.c 
 b/drivers/media/dvb/frontends/stv090x.c
 index d79e69f..ea86a56 100644
 --- a/drivers/media/dvb/frontends/stv090x.c
 +++ b/drivers/media/dvb/frontends/stv090x.c
 @@ -3172,7 +3172,7 @@ static enum stv090x_signal_state stv090x_algo(struct 
 stv090x_state *state)
 enum stv090x_signal_state signal_state = STV090x_NOCARRIER;
 u32 reg;
 s32 agc1_power, power_iq = 0, i;
 -   int lock = 0, low_sr = 0, no_signal = 0;
 +   int lock = 0, low_sr = 0;

 reg = STV090x_READ_DEMOD(state, TSCFGH);
 STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 1); /* Stop path 1 stream 
 merger */
 @@ -3413,7 +3413,7 @@ static enum stv090x_signal_state stv090x_algo(struct 
 stv090x_state *state)
 goto err;
 } else {
 signal_state = STV090x_NODATA;
 -   no_signal = stv090x_chk_signal(state);
 +   stv090x_chk_signal(state);
 }
 }
 return signal_state;
 --
 1.7.10.2

--
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: [Device-drivers-devel] [RFCv1 PATCH 0/7] Add adv7604/ad9389b drivers

2012-07-06 Thread Lars-Peter Clausen
On 07/05/2012 04:26 PM, Hans Verkuil wrote:
 Hi all,
 
 This RFC patch series builds on an earlier RFC patch series (posted only to
 linux-media) that adds support for DVI/HDMI/DP connectors to the V4L2 API.
 
 This earlier patch series is here:
 
   http://www.spinics.net/lists/linux-media/msg48529.html
 
 The first 3 patches are effectively unchanged compared to that patch series,
 patch 4 adds support for the newly defined controls to the V4L2 control 
 framework
 and patch 5 adds helper functions to v4l2-common.c to help in detecting VESA
 CVT and GTF formats.
 
 Finally, two Analog Devices drivers are added to actually use this new API.
 The adv7604 is an HDMI/DVI receiver and the ad9389b is an HDMI transmitter.
 
 Another tree of mine also contains preliminary drivers for the adv7842
 and adv7511:

Hm, ok that's interesting I do have a DRM driver for the adv7511:
https://github.com/lclausen-adi/linux-2.6/blob/adv7511_zynq/drivers/gpu/drm/i2c/adv7511_core.c

I wonder if it is possible to share some code on this.

 
   http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/hdmi
 
 However, I want to start with adv7604 and ad9389b since those have had the 
 most
 testing.

I've also have some code which adds adv7611 support to your adv7604 driver.

 
 As the commit message of says these drivers do not implement the full
 functionality of these devices, but that can be added later, either
 by Cisco or by others.
 
 A lot of work has been put into the V4L2 subsystem to reach this point,
 particularly the control framework, the VIDIOC_G/S/ENUM/QUERY_DV_TIMINGS
 ioctls, and the V4L2 event mechanism. So I'm very pleased to be able to 
 finally
 post this code.
 
 Comments are welcome!
 
 Regards,
 
   Hans Verkuil
 
 ___
 Device-drivers-devel mailing list
 device-drivers-de...@blackfin.uclinux.org
 https://blackfin.uclinux.org/mailman/listinfo/device-drivers-devel

--
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: [Device-drivers-devel] [RFCv1 PATCH 0/7] Add adv7604/ad9389b drivers

2012-07-06 Thread Hans Verkuil
On Fri July 6 2012 10:10:15 Lars-Peter Clausen wrote:
 On 07/05/2012 04:26 PM, Hans Verkuil wrote:
  Hi all,
  
  This RFC patch series builds on an earlier RFC patch series (posted only to
  linux-media) that adds support for DVI/HDMI/DP connectors to the V4L2 API.
  
  This earlier patch series is here:
  
  http://www.spinics.net/lists/linux-media/msg48529.html
  
  The first 3 patches are effectively unchanged compared to that patch series,
  patch 4 adds support for the newly defined controls to the V4L2 control 
  framework
  and patch 5 adds helper functions to v4l2-common.c to help in detecting VESA
  CVT and GTF formats.
  
  Finally, two Analog Devices drivers are added to actually use this new API.
  The adv7604 is an HDMI/DVI receiver and the ad9389b is an HDMI transmitter.
  
  Another tree of mine also contains preliminary drivers for the adv7842
  and adv7511:
 
 Hm, ok that's interesting I do have a DRM driver for the adv7511:
 https://github.com/lclausen-adi/linux-2.6/blob/adv7511_zynq/drivers/gpu/drm/i2c/adv7511_core.c
 
 I wonder if it is possible to share some code on this.

That will be an interesting exercise. The V4L and DRM subsystems are trying to
improve their cooperation, but we are not yet at the stage that you can easily
share video encoders. This might be a good starting point, though.

  
  http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/hdmi
  
  However, I want to start with adv7604 and ad9389b since those have had the 
  most
  testing.
 
 I've also have some code which adds adv7611 support to your adv7604 driver.

Let's try and get this driver in first, before we start adding patches other
than fixes. The main purpose is to get the new API elements merged in the
kernel, after that the drivers can easily be expanded and improved (which is
so much easier once they are in the kernel).

Regards,

Hans

 
  
  As the commit message of says these drivers do not implement the full
  functionality of these devices, but that can be added later, either
  by Cisco or by others.
  
  A lot of work has been put into the V4L2 subsystem to reach this point,
  particularly the control framework, the VIDIOC_G/S/ENUM/QUERY_DV_TIMINGS
  ioctls, and the V4L2 event mechanism. So I'm very pleased to be able to 
  finally
  post this code.
  
  Comments are welcome!
  
  Regards,
  
  Hans Verkuil
  
  ___
  Device-drivers-devel mailing list
  device-drivers-de...@blackfin.uclinux.org
  https://blackfin.uclinux.org/mailman/listinfo/device-drivers-devel
 
--
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: [GIT PULL FOR 3.6] V4L2 API cleanups

2012-07-06 Thread Laurent Pinchart
Hi Mauro,

On Thursday 05 July 2012 17:46:36 Mauro Carvalho Chehab wrote:
 Em 11-06-2012 06:39, Sakari Ailus escreveu:
  On Mon, Jun 11, 2012 at 09:50:54AM +0200, Laurent Pinchart wrote:
  On Sunday 10 June 2012 23:22:59 Sakari Ailus wrote:
  Hi Mauro,
  
  Here are two V4L2 API cleanup patches; the first removes __user from
  videodev2.h from a few places, making it possible to use the header file
  as such in user space, while the second one changes the
  v4l2_buffer.input field back to reserved.
  
  The following changes since commit 
5472d3f17845c4398c6a510b46855820920c2181:
 [media] mt9m032: Implement V4L2_CID_PIXEL_RATE control (2012-05-24
  
  09:27:24 -0300)
  
  are available in the git repository at:
 ssh://linuxtv.org/git/sailus/media_tree.git media-for-3.6
  
  Sakari Ailus (2):
 v4l: Remove __user from interface structure definitions
  
  NAK, sorry.
  
  __user has a purpose, we need to add it where it's missing, not remove it
  where it's rightfully present.
  
  It's not quite as simple as adding __user everywhere it might belong to
  ---
  these structs are being used in kernel space, too.
 
 Only kernelspace see __user. The make headers_install target removes
 __user from the userspace copy.

The issue at hand is that the same structure is used as an ioctl argument 
(where __user annotation makes sense), but also inside the kernel after 
video_usercopy, where the user pointer fields then store a kernel pointer. We 
thus can't annotate the fields with __user unconditionally.

-- 
Regards,

Laurent Pinchart

--
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: pctv452e

2012-07-06 Thread Antti Palosaari

On 07/06/2012 09:13 AM, Marx wrote:

On 05.07.2012 16:23, Antti Palosaari wrote:

Check if those modules are enabled, in file .config
CONFIG_DVB_USB_V2=m
CONFIG_DVB_USB_PCTV452E=m

use make menuconfig to enable if disabled. Then make  make
install_modules  make install as usually.


You were right, I didn't have this options anabled. I've enabled both
via 'make menuconfig' and recompiled kernel. Driver loaded succesfully,
I haven time to test only a few SD channels, and they were working, but
some encrypted and HD didn't. I have to check yet why.


Did I missed something? PCTV device does not support CI/CAM and thus no 
support for encrypted channels. Is there still CI slot?



Anyway when using card logs are full of i2c errors


Argh! But this must be issue of earlier driver too.

I debug it and it seems to be totally clueless implementation of 
stb6100_read_reg() as it sets device address like device address + 
register address. This makes stb6100 I2C address of tuner set for that 
request 0x66 whilst it should be 0x60. Is that code never tested...


pctv452e DVB USB driver behaves just correctly as it says this is not 
valid and returns error.


Also pctv452e I2C adapter supports only I2C operations that are done 
with repeated STOP condition - but I cannot see there is logic to sent 
STOP after last message. I suspect it is not correct as logically but 
will work - very common mistake with many I2C adapters we have.



Jul  6 07:04:19 wuwek kernel: [6.087199] input: HDA ATI SB Line Out
Front as /devices/pci:00/:00:14.2/sound/card
1/input8
Jul  6 07:04:19 wuwek kernel: [6.108046] stb6100_attach: Attaching
STB6100
Jul  6 07:04:19 wuwek kernel: [6.108054] pctv452e_power_ctrl: 0
Jul  6 07:04:19 wuwek kernel: [6.108063] usb 1-4: dvb_usbv2: 'PCTV
HDTV USB' successfully initialized and connected
Jul  6 07:04:19 wuwek kernel: [7.659462] Adding 2097148k swap on
/dev/sda2.  Priority:-1 extents:1 across:2097148k
Jul  6 07:04:19 wuwek kernel: [7.707592] EXT4-fs (sda1): re-mounted.
Opts: (null)

(...)

Jul  6 07:04:21 wuwek kernel: [   45.112483] Bluetooth: BNEP (Ethernet
Emulation) ver 1.3
Jul  6 07:04:21 wuwek kernel: [   45.112496] Bluetooth: BNEP filters:
protocol multicast
Jul  6 07:04:40 wuwek kernel: [   64.367411] pctv452e_power_ctrl: 1
Jul  6 07:04:48 wuwek kernel: [   72.693972] I2C error -121; AA 0B  CC
00 01 - 55 0B  CC 00 00.
Jul  6 07:04:59 wuwek kernel: [   83.605643] I2C error -121; AA 49  CC
00 01 - 55 49  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.565805] I2C error -121; AA EE  CC
00 01 - 55 EE  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.578295] I2C error -121; AA 05  CC
00 01 - 55 05  CC 00 00.
Jul  6 07:05:10 wuwek kernel: [   94.637539] I2C error -121; AA 20  CC
00 01 - 55 20  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.525868] I2C error -121; AA 08  CC
00 01 - 55 08  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.538359] I2C error -121; AA 1F  CC
00 01 - 55 1F  CC 00 00.
Jul  6 07:05:18 wuwek kernel: [  102.597603] I2C error -121; AA 3A  CC
00 01 - 55 3A  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.765372] I2C error -121; AA F5  CC
00 01 - 55 F5  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.777986] I2C error -121; AA 0C  CC
00 01 - 55 0C  CC 00 00.
Jul  6 07:05:29 wuwek kernel: [  113.837480] I2C error -121; AA 27  CC
00 01 - 55 27  CC 00 00.
Jul  6 07:05:35 wuwek kernel: [  120.069153] I2C error -121; AA CF  CC
00 01 - 55 CF  CC 00 00.
Jul  6 07:05:37 wuwek kernel: [  121.325610] I2C error -121; AA A7  CC
00 01 - 55 A7  CC 00 00.
Jul  6 07:05:38 wuwek kernel: [  122.581565] I2C error -121; AA 7F  CC
00 01 - 55 7F  CC 00 00.
Jul  6 07:05:39 wuwek kernel: [  123.841526] I2C error -121; AA 57  CC
00 01 - 55 57  CC 00 00.
Jul  6 07:05:40 wuwek kernel: [  125.096979] I2C error -121; AA 2F  CC
00 01 - 55 2F  CC 00 00.
Jul  6 07:05:42 wuwek kernel: [  126.353689] I2C error -121; AA 07  CC
00 01 - 55 07  CC 00 00.


Regardless of those errors it still works?


I will test tonight when I have more time
Marx


regards
Antti

--
http://palosaari.fi/


--
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: omap3isp: cropping bug in previewer?

2012-07-06 Thread Florian Neuhaus
Hi Laurent,

Laurent Pinchart wrote on 2012-07-05:

 There's really an issue, which was introduced in v3.5-rc1. Could you please 
 try
 the following patch instead of yours ?
 
 diff --git a/drivers/media/video/omap3isp/isppreview.c
 b/drivers/media/video/omap3isp/isppreview.c index 9c6dd44..614752a
 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++
 b/drivers/media/video/omap3isp/isppreview.c @@ -1116,7 +1116,7 @@ static
 void preview_config_input_size(struct isp_prev_device *prev, u32 active)
   unsigned int elv = prev-crop.top + prev-crop.height - 1;
   u32 features;
 - if (format-code == V4L2_MBUS_FMT_Y10_1X10) {
 + if (format-code != V4L2_MBUS_FMT_Y10_1X10) {
   sph -= 2;
   eph += 2;
   slv -= 2;

This patch resolves the issue for me. I get a good picture at both the 
previewer and the resizer output. Thanks for your help!

--
Best regards,
Florian Neuhaus


--
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


media_build and Terratec Cinergy T Black.

2012-07-06 Thread Hin-Tak Leung
Firstly, the downloaded linux-media.tar.bz2 has some simple typos, missing 3 
brackets:

(please feel free to add my signed-off though this is trivial).

-
--- linux/drivers/media/video/v4l2-compat-ioctl32.c~2012-07-06 
04:45:17.0 +0100
+++ linux/drivers/media/video/v4l2-compat-ioctl32.c 2012-07-06 
07:35:54.166512279 +0100
@@ -387,7 +387,7 @@
get_user(kp-index, up-index) ||
get_user(kp-type, up-type) ||
get_user(kp-flags, up-flags) ||
-   get_user(kp-memory, up-memory)
+   get_user(kp-memory, up-memory))
return -EFAULT;
 
if (V4L2_TYPE_IS_OUTPUT(kp-type))
@@ -471,7 +471,7 @@
put_user(kp-index, up-index) ||
put_user(kp-type, up-type) ||
put_user(kp-flags, up-flags) ||
-   put_user(kp-memory, up-memory)
+   put_user(kp-memory, up-memory))
return -EFAULT;
 
if (put_user(kp-bytesused, up-bytesused) ||
@@ -481,7 +481,7 @@
copy_to_user(up-timecode, kp-timecode, sizeof(struct 
v4l2_timecode)) ||
put_user(kp-sequence, up-sequence) ||
put_user(kp-reserved2, up-reserved2) ||
-   put_user(kp-reserved, up-reserved)
+   put_user(kp-reserved, up-reserved))
return -EFAULT;
 
if (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) {


A few comments  issues:

- don't realy like the build script trying to clone media_tree, etc had 
hard-coded remotes - if(0) out'ed the whole git-on-the-fly block inside to make 
it use an existing symlink'ed checkout - consider offering something similar?

- $ lsdvb seems to be doing garbage:(fedora 17's)

usb (-1975381336:62 64848224:32767) on PCI Domain:-1965359032 Bus:62 
Device:64848416 Function:32767
DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek RTL2832 (DVB-T)) 
 FE_OFDM Fmin=174MHz Fmax=862MHz

lsdvb on mercury is only marginally better with the PCI zero's, but the other 
numbers swapped:

usb (62:-1975379912 32767:-348245472) on PCI Domain:0 Bus:0 Device:0 Function:0
DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek RTL2832 (DVB-T)) 
 FE_OFDM Fmin=174MHz Fmax=862MHz

- 'scandvb' segfault at the end on its own.


- scandvb /usr/share/dvb/dvb-t/uk-SandyHeath (supposedly where I am) got a 
few WARNING:  tuning failed!!! and no list.

- 'w_scan -G -c GB'
  have a few curious
WARNING: received garbage data: crc = 0xcc93876c; expected crc = 0xb81bb6c4

return a list of 26, with entries like (which seems to be vaguely correct):

BBC 
ONE;(null):522000:B8C23D0G32M64T8Y0:T:27500:101=2:102,106=eng:0:0:4173:9018:4173:0:100

So I just put it in ~/.mplayer:channels.conf

Took me a while to figure out that mplayer wants:

mplayer 'dvb://BBC ONE;(null)'

rather than anything else - curious about the ';(null)' part.


Playing dvb://BBC ONE;(null).
dvb_tune Freq: 522000
ERROR IN SETTING DMX_FILTER 9018 for fd 4: ERRNO: 22ERROR, COULDN'T SET CHANNEL 
 8: Failed to open dvb://BBC ONE;(null).
--

At this point I am lost :-).






--
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] [v3] i.MX27: Fix emma-prp clocks in mx2_camera.c

2012-07-06 Thread Javier Martin
This driver wasn't converted to the new clock changes
(clk_prepare_enable/clk_disable_unprepare). Also naming
of emma-prp related clocks for the i.MX27 was not correct.
---
Enable clocks only for i.MX27.

---
 arch/arm/mach-imx/clk-imx27.c|8 +++--
 drivers/media/video/mx2_camera.c |   67 ++
 2 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 295cbd7..373c8fd 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -223,7 +223,7 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[per3_gate], per, imx-fb.0);
clk_register_clkdev(clk[lcdc_ipg_gate], ipg, imx-fb.0);
clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx-fb.0);
-   clk_register_clkdev(clk[csi_ahb_gate], NULL, mx2-camera.0);
+   clk_register_clkdev(clk[csi_ahb_gate], ahb, mx2-camera.0);
clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc);
clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc);
clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc);
@@ -250,8 +250,10 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[i2c2_ipg_gate], NULL, imx-i2c.1);
clk_register_clkdev(clk[owire_ipg_gate], NULL, mxc_w1.0);
clk_register_clkdev(clk[kpp_ipg_gate], NULL, imx-keypad);
-   clk_register_clkdev(clk[emma_ahb_gate], ahb, imx-emma);
-   clk_register_clkdev(clk[emma_ipg_gate], ipg, imx-emma);
+   clk_register_clkdev(clk[emma_ahb_gate], emma-ahb, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ipg_gate], emma-ipg, mx2-camera.0);
+   clk_register_clkdev(clk[emma_ahb_gate], ahb, m2m-emmaprp.0);
+   clk_register_clkdev(clk[emma_ipg_gate], ipg, m2m-emmaprp.0);
clk_register_clkdev(clk[iim_ipg_gate], iim, NULL);
clk_register_clkdev(clk[gpio_ipg_gate], gpio, NULL);
clk_register_clkdev(clk[brom_ahb_gate], brom, NULL);
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 41f9a25..11a9353 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -270,7 +270,7 @@ struct mx2_camera_dev {
struct device   *dev;
struct soc_camera_host  soc_host;
struct soc_camera_device *icd;
-   struct clk  *clk_csi, *clk_emma;
+   struct clk  *clk_csi, *clk_emma_ahb, *clk_emma_ipg;
 
unsigned intirq_csi, irq_emma;
void __iomem*base_csi, *base_emma;
@@ -389,7 +389,8 @@ static void mx2_camera_deactivate(struct mx2_camera_dev 
*pcdev)
 {
unsigned long flags;
 
-   clk_disable(pcdev-clk_csi);
+   if (cpu_is_mx27())
+   clk_disable_unprepare(pcdev-clk_csi);
writel(0, pcdev-base_csi + CSICR1);
if (cpu_is_mx27()) {
writel(0, pcdev-base_emma + PRP_CNTL);
@@ -417,9 +418,11 @@ static int mx2_camera_add_device(struct soc_camera_device 
*icd)
if (pcdev-icd)
return -EBUSY;
 
-   ret = clk_enable(pcdev-clk_csi);
-   if (ret  0)
-   return ret;
+   if (cpu_is_mx27()) {
+   ret = clk_prepare_enable(pcdev-clk_csi);
+   if (ret  0)
+   return ret;
+   }
 
csicr1 = CSICR1_MCLKEN;
 
@@ -1616,23 +1619,12 @@ static int __devinit mx27_camera_emma_init(struct 
mx2_camera_dev *pcdev)
goto exit_iounmap;
}
 
-   pcdev-clk_emma = clk_get(NULL, emma);
-   if (IS_ERR(pcdev-clk_emma)) {
-   err = PTR_ERR(pcdev-clk_emma);
-   goto exit_free_irq;
-   }
-
-   clk_enable(pcdev-clk_emma);
-
err = mx27_camera_emma_prp_reset(pcdev);
if (err)
-   goto exit_clk_emma_put;
+   goto exit_free_irq;
 
return err;
 
-exit_clk_emma_put:
-   clk_disable(pcdev-clk_emma);
-   clk_put(pcdev-clk_emma);
 exit_free_irq:
free_irq(pcdev-irq_emma, pcdev);
 exit_iounmap:
@@ -1655,6 +1647,7 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
 
res_csi = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_csi = platform_get_irq(pdev, 0);
+
if (res_csi == NULL || irq_csi  0) {
dev_err(pdev-dev, Missing platform resources data\n);
err = -ENODEV;
@@ -1668,11 +1661,26 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
goto exit;
}
 
-   pcdev-clk_csi = clk_get(pdev-dev, NULL);
-   if (IS_ERR(pcdev-clk_csi)) {
-   dev_err(pdev-dev, Could not get csi clock\n);
-   err = PTR_ERR(pcdev-clk_csi);
-   goto exit_kfree;
+   if (cpu_is_mx27()) {
+   pcdev-clk_csi = devm_clk_get(pdev-dev, ahb);
+   if (IS_ERR(pcdev-clk_csi)) {
+   dev_err(pdev-dev, Could not get csi clock\n);
+   

Re: [PATCH v3][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread javier Martin
Hi,
can this patch be applied please?

It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for this?

Regards.
-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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: media_build and Terratec Cinergy T Black.

2012-07-06 Thread Hin-Tak Leung
One more comment: blowing away /lib/modules/`uname -r`/kernel/drivers/ seems 
drastic?

The compat-wireless people uses some clever tricks to get modprobe to 
preferentially load /lib/modules/`uname -r`/updates first. This way you can 
just remove that, run 'depmod -a' and go back to stock distro kernel behavior.

Also it might be useful/quicker not to build the whole 500+ kernel modules...

--- On Fri, 6/7/12, Hin-Tak Leung ht...@users.sourceforge.net wrote:

 From: Hin-Tak Leung ht...@users.sourceforge.net
 Subject: media_build and Terratec Cinergy T Black.
 To: Antti Palosaari cr...@iki.fi, mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Date: Friday, 6 July, 2012, 11:54
 Firstly, the downloaded
 linux-media.tar.bz2 has some simple typos, missing 3
 brackets:
 
 (please feel free to add my signed-off though this is
 trivial).
 
 -
 ---
 linux/drivers/media/video/v4l2-compat-ioctl32.c~   
 2012-07-06 04:45:17.0 +0100
 +++
 linux/drivers/media/video/v4l2-compat-ioctl32.c   
 2012-07-06 07:35:54.166512279 +0100
 @@ -387,7 +387,7 @@
         
 get_user(kp-index, up-index) ||
          get_user(kp-type,
 up-type) ||
         
 get_user(kp-flags, up-flags) ||
 -       
 get_user(kp-memory, up-memory)
 +       
 get_user(kp-memory, up-memory))
             
 return -EFAULT;
  
      if (V4L2_TYPE_IS_OUTPUT(kp-type))
 @@ -471,7 +471,7 @@
         
 put_user(kp-index, up-index) ||
          put_user(kp-type,
 up-type) ||
         
 put_user(kp-flags, up-flags) ||
 -       
 put_user(kp-memory, up-memory)
 +       
 put_user(kp-memory, up-memory))
             
 return -EFAULT;
  
      if (put_user(kp-bytesused,
 up-bytesused) ||
 @@ -481,7 +481,7 @@
         
 copy_to_user(up-timecode, kp-timecode,
 sizeof(struct v4l2_timecode)) ||
         
 put_user(kp-sequence, up-sequence) ||
         
 put_user(kp-reserved2, up-reserved2) ||
 -       
 put_user(kp-reserved, up-reserved)
 +       
 put_user(kp-reserved, up-reserved))
             
 return -EFAULT;
  
      if
 (V4L2_TYPE_IS_MULTIPLANAR(kp-type)) {
 
 
 A few comments  issues:
 
 - don't realy like the build script trying to clone
 media_tree, etc had hard-coded remotes - if(0) out'ed the
 whole git-on-the-fly block inside to make it use an existing
 symlink'ed checkout - consider offering something similar?
 
 - $ lsdvb seems to be doing garbage:(fedora 17's)
 
 usb (-1975381336:62 64848224:32767) on PCI
 Domain:-1965359032 Bus:62 Device:64848416 Function:32767
     DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek
 RTL2832 (DVB-T)) 
      FE_OFDM
 Fmin=174MHz Fmax=862MHz
 
 lsdvb on mercury is only marginally better with the PCI
 zero's, but the other numbers swapped:
 
 usb (62:-1975379912 32767:-348245472) on PCI Domain:0 Bus:0
 Device:0 Function:0
     DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek
 RTL2832 (DVB-T)) 
      FE_OFDM
 Fmin=174MHz Fmax=862MHz
 
 - 'scandvb' segfault at the end on its own.
 
 
 - scandvb /usr/share/dvb/dvb-t/uk-SandyHeath (supposedly
 where I am) got a few WARNING:  tuning
 failed!!! and no list.
 
 - 'w_scan -G -c GB'
   have a few curious
 WARNING: received garbage data: crc = 0xcc93876c; expected
 crc = 0xb81bb6c4
 
 return a list of 26, with entries like (which seems to be
 vaguely correct):
 
 BBC
 ONE;(null):522000:B8C23D0G32M64T8Y0:T:27500:101=2:102,106=eng:0:0:4173:9018:4173:0:100
 
 So I just put it in ~/.mplayer:channels.conf
 
 Took me a while to figure out that mplayer wants:
 
 mplayer 'dvb://BBC ONE;(null)'
 
 rather than anything else - curious about the ';(null)'
 part.
 
 
 Playing dvb://BBC ONE;(null).
 dvb_tune Freq: 522000
 ERROR IN SETTING DMX_FILTER 9018 for fd 4: ERRNO: 22ERROR,
 COULDN'T SET CHANNEL  8: Failed to open dvb://BBC
 ONE;(null).
 --
 
 At this point I am lost :-).
 
 
 
 
 
 
 
--
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][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread javier Martin
On 6 July 2012 13:00, javier Martin javier.mar...@vista-silicon.com wrote:
 Hi,
 can this patch be applied please?

 It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for this?

 Regards.

But it should be applied after this one to preserve bisectability:

http://patchwork.linuxtv.org/patch/10483/

So I'd better send a new series to clarify the order.

-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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 v3][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread Guennadi Liakhovetski
On Fri, 6 Jul 2012, javier Martin wrote:

 Hi,
 can this patch be applied please?
 
 It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for this?

Sorry? This patch has been applied and proven to break more, than it 
fixed, so, it has been reverted. Am I missing something?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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: omap3isp: cropping bug in previewer?

2012-07-06 Thread Laurent Pinchart
Hi Florian,

On Friday 06 July 2012 11:55:40 Florian Neuhaus wrote:
 Hi Laurent,
 
 Laurent Pinchart wrote on 2012-07-05:
  There's really an issue, which was introduced in v3.5-rc1. Could you
  please try the following patch instead of yours ?
  
  diff --git a/drivers/media/video/omap3isp/isppreview.c
  b/drivers/media/video/omap3isp/isppreview.c index 9c6dd44..614752a
  100644 --- a/drivers/media/video/omap3isp/isppreview.c +++
  b/drivers/media/video/omap3isp/isppreview.c @@ -1116,7 +1116,7 @@ static
  void preview_config_input_size(struct isp_prev_device *prev, u32 active)
  
  unsigned int elv = prev-crop.top + prev-crop.height - 1;
  u32 features;
  
  -   if (format-code == V4L2_MBUS_FMT_Y10_1X10) {
  +   if (format-code != V4L2_MBUS_FMT_Y10_1X10) {
  
  sph -= 2;
  eph += 2;
  slv -= 2;
 
 This patch resolves the issue for me. I get a good picture at both the
 previewer and the resizer output. Thanks for your help!

You're welcome. Can I include your

Tested-by: Florian Neuhaus florian.neuh...@reberinformatik.ch

in the patch ?

-- 
Regards,

Laurent Pinchart

--
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][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread javier Martin
Hi Guennadi,

On 6 July 2012 13:09, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
 On Fri, 6 Jul 2012, javier Martin wrote:

 Hi,
 can this patch be applied please?

 It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for this?

 Sorry? This patch has been applied and proven to break more, than it
 fixed, so, it has been reverted. Am I missing something?

Patch v1 was the version that broke pass-through mode (which nobody
seems to be using/testing). It was applied, then it was reverted as
you requested in [1].

Then I sent v2 that didn't break pass-through but was invalid too
because of a merge conflict [2].

Finally, this is v3 which has the pass-through problem and the merge
problem fixed. It is currently marked as Under review and should be
applied as a fix to 3.5.

It can be applied safely since the patch I stated previously is
already in 3.5-rc5 [4] (it was applied through the imx tree).

[1] http://patchwork.linuxtv.org/patch/11504/
[2] http://patchwork.linuxtv.org/patch/11558/
[3] http://patchwork.linuxtv.org/patch/11559/
[4] http://patchwork.linuxtv.org/patch/10483/
--
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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: media_build and Terratec Cinergy T Black.

2012-07-06 Thread Antti Palosaari

On 07/06/2012 01:54 PM, Hin-Tak Leung wrote:

- $ lsdvb seems to be doing garbage:(fedora 17's)

usb (-1975381336:62 64848224:32767) on PCI Domain:-1965359032 Bus:62 
Device:64848416 Function:32767
DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek RTL2832 (DVB-T))
 FE_OFDM Fmin=174MHz Fmax=862MHz

lsdvb on mercury is only marginally better with the PCI zero's, but the other 
numbers swapped:

usb (62:-1975379912 32767:-348245472) on PCI Domain:0 Bus:0 Device:0 Function:0
DEVICE:0 ADAPTER:0 FRONTEND:0 (Realtek RTL2832 (DVB-T))
 FE_OFDM Fmin=174MHz Fmax=862MHz


I was aware of that tool but didn't know it lists USB devices too.
Someone should fix it working properly for USB devices.


- 'scandvb' segfault at the end on its own.


I didn't see that.


- scandvb /usr/share/dvb/dvb-t/uk-SandyHeath (supposedly where I am) got a few WARNING: 
 tuning failed!!! and no list.

- 'w_scan -G -c GB'
   have a few curious
WARNING: received garbage data: crc = 0xcc93876c; expected crc = 0xb81bb6c4

return a list of 26, with entries like (which seems to be vaguely correct):

BBC 
ONE;(null):522000:B8C23D0G32M64T8Y0:T:27500:101=2:102,106=eng:0:0:4173:9018:4173:0:100


Both scandvb and w_scan works here, same device used. I suspect your 
signal is just simply too weak for reception. Small antenna coming with 
those DVB sticks is not suitable unless you are living very near 
transmitter. Try to connect it roof antenna. One thing that helps a lot 
is to attach small bundled antenna to outside window.


There is both dvbscan and scandvb in Fedora dvb-apps. It is not clear 
for me why two similar looking tools. Anyhow it is just scandvb which I 
found working one.




So I just put it in ~/.mplayer:channels.conf

Took me a while to figure out that mplayer wants:

mplayer 'dvb://BBC ONE;(null)'

rather than anything else - curious about the ';(null)' part.


Playing dvb://BBC ONE;(null).
dvb_tune Freq: 522000
ERROR IN SETTING DMX_FILTER 9018 for fd 4: ERRNO: 22ERROR, COULDN'T SET CHANNEL 
 8: Failed to open dvb://BBC ONE;(null).
--


Typical channels.conf entry looks like that:
MTV3:71400:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:305:561:49

And tuning to that channel using mplayer:
mplayer dvb://MTV3

However, I prefer VLC. Just open channels.conf to VLC and should show 
playlist. Totem does not work anymore. at least stream used here in 
Finland. It went broken when they changed from playbin to playbin2 which 
is really shame as it is default video player for Gnome desktop.




At this point I am lost :-).


Not big surprise unfortunately :/

Unfortunately desktop integration is currently poor and most users are 
coming from the HTPC.


regards
Antti


--
http://palosaari.fi/


--
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][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread Guennadi Liakhovetski
On Fri, 6 Jul 2012, javier Martin wrote:

 Hi Guennadi,
 
 On 6 July 2012 13:09, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
  On Fri, 6 Jul 2012, javier Martin wrote:
 
  Hi,
  can this patch be applied please?
 
  It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for 
  this?
 
  Sorry? This patch has been applied and proven to break more, than it
  fixed, so, it has been reverted. Am I missing something?
 
 Patch v1 was the version that broke pass-through mode (which nobody
 seems to be using/testing). It was applied, then it was reverted as
 you requested in [1].
 
 Then I sent v2 that didn't break pass-through but was invalid too
 because of a merge conflict [2].
 
 Finally, this is v3 which has the pass-through problem and the merge
 problem fixed. It is currently marked as Under review and should be
 applied as a fix to 3.5.

Ah, ok, then, don't you think, that expecting your patch to be applied 
within 4 minutes of its submission is a bit... overoptimistic? Because 
it's 4 minutes after your original patch, that you've sent your 
reminder...

Thanks
Guennadi

 It can be applied safely since the patch I stated previously is
 already in 3.5-rc5 [4] (it was applied through the imx tree).
 
 [1] http://patchwork.linuxtv.org/patch/11504/
 [2] http://patchwork.linuxtv.org/patch/11558/
 [3] http://patchwork.linuxtv.org/patch/11559/
 [4] http://patchwork.linuxtv.org/patch/10483/
 --
 Javier Martin
 Vista Silicon S.L.
 CDTUC - FASE C - Oficina S-345
 Avda de los Castros s/n
 39005- Santander. Cantabria. Spain
 +34 942 25 32 60
 www.vista-silicon.com
 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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


AW: omap3isp: cropping bug in previewer?

2012-07-06 Thread Florian Neuhaus
Hi Laurent,

Laurent Pinchart wrote on 2012-07-06:

 This patch resolves the issue for me. I get a good picture at both the
 previewer and the resizer output. Thanks for your help!
 
 You're welcome. Can I include your
 
 Tested-by: Florian Neuhaus florian.neuh...@reberinformatik.ch
 
 in the patch ?

Yes, of course!

I tested it with the following commands:

For the previewer out:
# media-ctl -v -r -l 'mt9p031 2-0048:0-OMAP3 ISP CCDC:0[1], OMAP3 ISP 
CCDC:2-OMAP3 ISP preview:0[1], OMAP3 ISP preview:1-OMAP3 ISP preview 
output:0[1]'
# media-ctl -v -f 'mt9p031 2-0048:0 [SGRBG12 800x600], OMAP3 ISP CCDC:2 
[SGRBG10 800x600], OMAP3 ISP preview:1 [UYVY 800x600]'

# yavta -c1000 -p --stdout --skip 3 -f UYVY -s 782x592 /dev/video4 | mplayer - 
-demuxer rawvideo -rawvideo w=784:h=592:format=uyvy -vo fbdev -fs

(Note the 784 width in the mplayer command)

For the resizer out:
# media-ctl -v -r -l 'mt9p031 2-0048:0-OMAP3 ISP CCDC:0[1], OMAP3 ISP 
CCDC:2-OMAP3 ISP preview:0[1], OMAP3 ISP preview:1-OMAP3 ISP 
resizer:0[1], OMAP3 ISP resizer:1-OMAP3 ISP resizer output: 0[1]' 
# media-ctl -v -f 'mt9p031 2-0048:0 [SGRBG12 800x600], OMAP3 ISP CCDC:2 
[SGRBG10 800x600], OMAP3 ISP preview:1 [UYVY 800x600], OMAP3 ISP resizer:1 
[UYVY 800x600]' 
# yavta -f UYVY -s 800x600 -n 8 --skip 3 --capture=1000 --stdout /dev/video6 | 
mplayer - -demuxer rawvideo -rawvideo w=800:h=600:format=uyvy -vo fbdev

--
Best regards,
Florian Neuhaus


--
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][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread javier Martin
Hi Guennadi,

On 6 July 2012 13:39, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
 On Fri, 6 Jul 2012, javier Martin wrote:

 Hi Guennadi,

 On 6 July 2012 13:09, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
  On Fri, 6 Jul 2012, javier Martin wrote:
 
  Hi,
  can this patch be applied please?
 
  It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for 
  this?
 
  Sorry? This patch has been applied and proven to break more, than it
  fixed, so, it has been reverted. Am I missing something?

 Patch v1 was the version that broke pass-through mode (which nobody
 seems to be using/testing). It was applied, then it was reverted as
 you requested in [1].

 Then I sent v2 that didn't break pass-through but was invalid too
 because of a merge conflict [2].

 Finally, this is v3 which has the pass-through problem and the merge
 problem fixed. It is currently marked as Under review and should be
 applied as a fix to 3.5.

 Ah, ok, then, don't you think, that expecting your patch to be applied
 within 4 minutes of its submission is a bit... overoptimistic? Because
 it's 4 minutes after your original patch, that you've sent your
 reminder...

This patch was sent on '2012-06-01 09:31:45', which is more than a
month ago. Look at patchwork:
http://patchwork.linuxtv.org/patch/11559/

I think that a month is a reasonable period to send a reminder and I
didn't mean to offend anyone with it.

Regards.
-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.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: pctv452e

2012-07-06 Thread Marx

On 06.07.2012 11:34, Antti Palosaari wrote:

Did I missed something? PCTV device does not support CI/CAM and thus no
support for encrypted channels. Is there still CI slot?


no, I simply use external reader with plugin in VDR. Unfortunetelly on 
Hotbird there is no unencrypted HD channel I can use to test.



Anyway when using card logs are full of i2c errors


Argh! But this must be issue of earlier driver too.


yes, those errors were in logs earlier on previous driver. Hovewer 
previous driver allowed to play only once or two time and then was 
stopping work. And i've never played successfully HD channel on this card.



I debug it and it seems to be totally clueless implementation of
stb6100_read_reg() as it sets device address like device address +
register address. This makes stb6100 I2C address of tuner set for that
request 0x66 whilst it should be 0x60. Is that code never tested...

pctv452e DVB USB driver behaves just correctly as it says this is not
valid and returns error.

Also pctv452e I2C adapter supports only I2C operations that are done
with repeated STOP condition - but I cannot see there is logic to sent
STOP after last message. I suspect it is not correct as logically but
will work - very common mistake with many I2C adapters we have.


I have second card in this computer
http://www.proftuners.com/prof8000.html
which uses STB6100 (and also STV0903 and CX23885).
I wasn't aware that both of this card uses the same chip (as I see from 
http://www.linuxtv.org/wiki/index.php/TechnoTrend_TT-connect_S2-3650_CI 
it uses STB6100 too).

Can it be a problem? Anyway i will take off this second card a test again.


Regardless of those errors it still works?


Thank you for help. I had only a few minutes at the morning to test it 
and it partly worked. More test are planned tonight and I will write 
here outcomes.


Marx

--
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] [media] Kconfig: Split the core support options from the driver ones

2012-07-06 Thread Mauro Carvalho Chehab
Better arrange the remote controller driver items to happen after the
core support, on their proper menus, and making clerarer what is media
core options and what is media driver options.

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/Kconfig|3 ++-
 drivers/media/rc/Kconfig |   11 +--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 6d10ccb..d941581 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -59,7 +59,7 @@ config MEDIA_RADIO_SUPPORT
support radio reception. Disabling this option will
disable support for them.
 
-menuconfig MEDIA_RC_SUPPORT
+config MEDIA_RC_SUPPORT
bool Remote Controller support
depends on INPUT
---help---
@@ -138,6 +138,7 @@ config DVB_NET
  You may want to disable the network support on embedded devices. If
  unsure say Y.
 
+comment Media drivers
 source drivers/media/common/Kconfig
 source drivers/media/rc/Kconfig
 
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index d2655f1..2478b06 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -4,6 +4,14 @@ config RC_CORE
depends on INPUT
default y
 
+source drivers/media/rc/keymaps/Kconfig
+
+menuconfig RC_DECODERS
+bool Remote controller decoders
+   depends on RC_CORE
+   default y
+
+if RC_DECODERS
 config LIRC
tristate LIRC interface driver
depends on RC_CORE
@@ -15,8 +23,6 @@ config LIRC
   LIRC daemon handles protocol decoding for IR reception and
   encoding for IR transmitting (aka blasting).
 
-source drivers/media/rc/keymaps/Kconfig
-
 config IR_NEC_DECODER
tristate Enable IR raw decoder for the NEC protocol
depends on RC_CORE
@@ -99,6 +105,7 @@ config IR_MCE_KBD_DECODER
   Enable this option if you have a Microsoft Remote Keyboard for
   Windows Media Center Edition, which you would like to use with
   a raw IR receiver in your system.
+endif #RC_DECODERS
 
 menuconfig RC_DEVICES
bool Remote Controller devices
-- 
1.7.10.4

--
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


[v4l-utils] [PATCH] Cross compilation corrections and script

2012-07-06 Thread Federico Fuga

Hello, I saw that in the current stable branch of 0.8 (at least in tag 0.8.8) 
no configure script is provided.
Cross compiling with it could be difficult.
This patch deals with this problem. It corrects some Makefile and adds a script 
(./cross-compile.sh) that
cross compiles the utils with some different parameters, like:
- cross tool selection
- Static linking (very useful for testing!)
- Stripping
- jpeg library path selection.

Tested on ARM with arm-linux-gnueabi toolchain, static linking and no staging 
jpeg libraries (only statically linked 
libraries outside the root build tree)

Regards

Federico Fuga

--
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] Cross compilation corrections and script

2012-07-06 Thread Federico Fuga
This patch includes some corrections to makefiles and adds a script to be used 
when crosscompiling.
In particular, I introduced the option to specify the cross toolchain prefix, 
static linking and stripping
the binaries and specify eventually another jpeg library directory to be used 
instead of the current one.

./cross-compile.sh --help to have some help about.
---
 cross-compile.sh   |   56 
 utils/Makefile |2 ++
 utils/v4l2-compliance/Makefile |6 -
 utils/v4l2-ctl/Makefile|   10 ---
 4 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100755 cross-compile.sh

diff --git a/cross-compile.sh b/cross-compile.sh
new file mode 100755
index 000..22f47e5
--- /dev/null
+++ b/cross-compile.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+function help() {
+   cat  __END__
+Usage: $0 --host cross-compiler-prefix [--strip] [target]
+
+   --host cross-compiler-prefix  The toolchain prefix, for example: 
arm-linux-gnueabi
+   If required, you can define the 
complete path
+   --strip Strip binaries (optional)
+   --with-jpeg-dir Complete path to jpeg library 
installation (optional)
+   --staticMake compilation static (good 
for test on embedded systems) 
+   (optional)
+   target  The makefile target (clean, 
all, etc...)
+
+__END__
+}
+
+while [ $END ==  ] ; do
+   case $1 in
+   --host) 
+   shift;
+   HOST=$1
+   shift;
+   ;;
+   --strip)
+   shift
+   STRIP=-s
+   ;;
+   --static)
+   OPT_LINKTYPE=LINKTYPE=static;
+   shift;
+   ;;
+   --with-jpeg-dir)
+   shift
+   OPT_JPEG_INCLUDE=-I$1/include
+   OPT_JPEG_LIB=-L$1/lib
+   shift
+   ;;
+   --help)
+   help $0
+   shift
+   exit 1
+   ;;
+   *)
+   END=y
+   ;;
+   esac
+done
+
+if [ $HOST ==  ] ; then
+   echo --host is mandatory. $0 help to have assistance.
+   exit 1
+fi
+
+make CC=$HOST-gcc LD=$HOST-g++ CXX=$HOST-g++ CFLAGS=$OPT_JPEG_INCLUDE 
CPPFLAGS=$OPT_JPEG_INCLUDE $OPT_LINKTYPE LDFLAGS=$STRIP $OPT_JPEG_LIB 
NOQT4=y $@
+
diff --git a/utils/Makefile b/utils/Makefile
index 014b82d..565e46d 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -5,6 +5,7 @@ all install:
$(MAKE) -C $$i $@ || exit 1; \
done
 
+ifneq ($(NOQT4),y)
# Test whether qmake is installed, and whether it is for qt4.
@if which qmake-qt4 /dev/null 21; then \
QMAKE=qmake-qt4; \
@@ -19,6 +20,7 @@ all install:
$(MAKE) -C qv4l2 -f Makefile.install $@; \
fi \
fi
+endif
 
 sync-with-kernel:
$(MAKE) -C keytable $@
diff --git a/utils/v4l2-compliance/Makefile b/utils/v4l2-compliance/Makefile
index b65fc82..3a0cdc8 100644
--- a/utils/v4l2-compliance/Makefile
+++ b/utils/v4l2-compliance/Makefile
@@ -1,12 +1,16 @@
 TARGETS = v4l2-compliance
 
+ifeq ($(LINKTYPE),static)
+   EXTRA_LIBS=-ljpeg
+endif
+
 all: $(TARGETS)
 
 -include *.d
 
 v4l2-compliance: v4l2-compliance.o v4l2-test-debug.o v4l2-test-input-output.o \
v4l2-test-controls.o v4l2-test-io-config.o v4l2-test-formats.o
-   $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
+   $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt $(EXTRA_LIBS)
 
 install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin
diff --git a/utils/v4l2-ctl/Makefile b/utils/v4l2-ctl/Makefile
index 5ea58c7..9f681f6 100644
--- a/utils/v4l2-ctl/Makefile
+++ b/utils/v4l2-ctl/Makefile
@@ -2,18 +2,22 @@ override CPPFLAGS += 
-DV4L_UTILS_VERSION=\$(V4L_UTILS_VERSION)\
 
 TARGETS = cx18-ctl ivtv-ctl v4l2-ctl
 
+ifeq ($(LINKTYPE),static)
+   EXTRA_LIBS=-ljpeg
+endif
+
 all: $(TARGETS)
 
 -include *.d
 
 cx18-ctl: cx18-ctl.o
-   $(CC) $(LDFLAGS) -o $@ $^
+   $(CC) $(LDFLAGS) -o $@ $^ $(EXTRA_LIBS) 
 
 ivtv-ctl: ivtv-ctl.o
-   $(CC) $(LDFLAGS) -o $@ $^ -lm
+   $(CC) $(LDFLAGS) -o $@ $^ -lm $(EXTRA_LIBS) 
 
 v4l2-ctl: v4l2-ctl.o
-   $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
+   $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt $(EXTRA_LIBS) 
 
 install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin
-- 
1.7.9.5

--
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  

Re: [PATCH v3][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread Guennadi Liakhovetski
On Fri, 6 Jul 2012, javier Martin wrote:

 Hi Guennadi,
 
 On 6 July 2012 13:39, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
  On Fri, 6 Jul 2012, javier Martin wrote:
 
  Hi Guennadi,
 
  On 6 July 2012 13:09, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote:
   On Fri, 6 Jul 2012, javier Martin wrote:
  
   Hi,
   can this patch be applied please?
  
   It solves a BUG for 3.5. Guennadi, Fabio, could you give me an ack for 
   this?
  
   Sorry? This patch has been applied and proven to break more, than it
   fixed, so, it has been reverted. Am I missing something?
 
  Patch v1 was the version that broke pass-through mode (which nobody
  seems to be using/testing). It was applied, then it was reverted as
  you requested in [1].
 
  Then I sent v2 that didn't break pass-through but was invalid too
  because of a merge conflict [2].
 
  Finally, this is v3 which has the pass-through problem and the merge
  problem fixed. It is currently marked as Under review and should be
  applied as a fix to 3.5.
 
  Ah, ok, then, don't you think, that expecting your patch to be applied
  within 4 minutes of its submission is a bit... overoptimistic? Because
  it's 4 minutes after your original patch, that you've sent your
  reminder...
 
 This patch was sent on '2012-06-01 09:31:45', which is more than a
 month ago. Look at patchwork:
 http://patchwork.linuxtv.org/patch/11559/
 
 I think that a month is a reasonable period to send a reminder and I
 didn't mean to offend anyone with it.

Hrm, right, sorry. Must have been blind. I've looked at v3 of your patch, 
I've got one more question to it, expect a reply in a few minutes.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread Guennadi Liakhovetski
Hi Javier

Thanks for the patch, and sorry for delay. I was away first 10 days of 
June and still haven't come round to cleaning up my todo list since 
then...

On Fri, 1 Jun 2012, Javier Martin wrote:

 Remove MX2_CAMERA_SWAP16 and MX2_CAMERA_PACK_DIR_MSB flags
 so that the driver can negotiate with the attached sensor
 whether the mbus format needs convertion from UYUV to YUYV
 or not.
 
 Signed-off-by: Javier Martin javier.mar...@vista-silicon.com
 ---
 Fix pass-through mode as requested by Guennadi.
 Also a merge conflict has been addressed.
 
 This patch should be applied to for_v3.5 since Guennadi
 has requested Mauro to remove the old version:
 
 [PATCH] Revert [media] media: mx2_camera: Fix mbus format handling
 
 This patch is part of the following series:
 
 media: tvp5150: Fix mbus format.
 i.MX27: visstrim_m10: Remove use of MX2_CAMERA_SWAP16.
 media: mx2_camera: Fix mbus format handling.
 ---
  arch/arm/plat-mxc/include/mach/mx2_cam.h |2 -
  drivers/media/video/mx2_camera.c |   50 
 +++---
  2 files changed, 45 insertions(+), 7 deletions(-)
 
 diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h 
 b/arch/arm/plat-mxc/include/mach/mx2_cam.h
 index 3c080a3..7ded6f1 100644
 --- a/arch/arm/plat-mxc/include/mach/mx2_cam.h
 +++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h
 @@ -23,7 +23,6 @@
  #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)
 @@ -31,7 +30,6 @@
  #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
 diff --git a/drivers/media/video/mx2_camera.c 
 b/drivers/media/video/mx2_camera.c
 index 18afaee..b30ebe5 100644
 --- a/drivers/media/video/mx2_camera.c
 +++ b/drivers/media/video/mx2_camera.c
 @@ -344,6 +344,19 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
   PRP_INTR_CH2OVF,
   }
   },
 + {
 + .in_fmt = V4L2_MBUS_FMT_UYVY8_2X8,
 + .out_fmt= V4L2_PIX_FMT_YUV420,
 + .cfg= {
 + .channel= 2,
 + .in_fmt = PRP_CNTL_DATA_IN_YUV422,
 + .out_fmt= PRP_CNTL_CH2_OUT_YUV420,
 + .src_pixel  = 0x22000888, /* YUV422 (YUYV) */
 + .irq_flags  = PRP_INTR_RDERR | PRP_INTR_CH2WERR |
 + PRP_INTR_CH2FC | PRP_INTR_LBOVF |
 + PRP_INTR_CH2OVF,
 + }
 + },

IIUC, this adds one more conversion from V4L2_MBUS_FMT_UYVY8_2X8 to 
V4L2_PIX_FMT_YUV420.

  };
  
  static struct mx2_fmt_cfg *mx27_emma_prp_get_format(
 @@ -980,6 +993,8 @@ static int mx2_camera_set_bus_param(struct 
 soc_camera_device *icd)
   struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
   struct mx2_camera_dev *pcdev = ici-priv;
   struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,};
 + const struct soc_camera_format_xlate *xlate;
 + u32 pixfmt = icd-current_fmt-host_fmt-fourcc;
   unsigned long common_flags;
   int ret;
   int bytesperline;
 @@ -1024,14 +1039,28 @@ static int mx2_camera_set_bus_param(struct 
 soc_camera_device *icd)
   return ret;
   }
  
 + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
 + if (!xlate) {
 + dev_warn(icd-parent, Format %x not found\n, pixfmt);
 + return -EINVAL;
 + }
 +
 + if (xlate-code == V4L2_MBUS_FMT_YUYV8_2X8) {
 + csicr1 |= CSICR1_PACK_DIR;
 + csicr1 = ~CSICR1_SWAP16_EN;
 + dev_dbg(icd-parent, already yuyv format, don't convert\n);
 + } else if (xlate-code == V4L2_MBUS_FMT_UYVY8_2X8) {
 + csicr1 = ~CSICR1_PACK_DIR;
 + csicr1 |= CSICR1_SWAP16_EN;
 + dev_dbg(icd-parent, convert uyvy mbus format into yuyv\n);
 + }
 +
   if (common_flags  V4L2_MBUS_PCLK_SAMPLE_RISING)
   csicr1 |= CSICR1_REDGE;
   if (common_flags  V4L2_MBUS_VSYNC_ACTIVE_HIGH)
   csicr1 |= CSICR1_SOF_POL;
   if (common_flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
   csicr1 |= CSICR1_HSYNC_POL;
 - if (pcdev-platform_flags  MX2_CAMERA_SWAP16)
 - csicr1 |= CSICR1_SWAP16_EN;
   if (pcdev-platform_flags  MX2_CAMERA_EXT_VSYNC)
   csicr1 |= CSICR1_EXT_VSYNC;
   if (pcdev-platform_flags  MX2_CAMERA_CCIR)
 @@ -1042,8 +1071,6 @@ static int mx2_camera_set_bus_param(struct 
 soc_camera_device *icd)
   csicr1 |= CSICR1_GCLK_MODE;
   if (pcdev-platform_flags  MX2_CAMERA_INV_DATA)

[PATCH 0/3] Add support for 'Coda' video codec IP.

2012-07-06 Thread Javier Martin
This patch provides support for the codadx6 that is inside
the i.MX27. Currently only H.264 and MPEG4 Part-2 encoding
operations are supported.

This is a refined version of the RFC sent two weeks ago [1].
The following tasks have been addressed since then:
 - Get rid of 'runtime' structure.
 - Device tree support (not tested).
 - Merge all the code in a single source file.
 - Use one node for both encoding and decoding.
 - Multi-instance support (not tested for more than one instance).
 - Prepare the code so that integration of further coda versions is easier.

This patch takes into account recommendations from Sascha and Philipp
from Pengutronix.

[PATCH 1/3] i.MX: coda: Add platform support for coda in i.MX27.
[PATCH 2/3] media: coda: Add driver for Coda video codec.
[PATCH 3/3] Visstrim M10: Add support for Coda.


[1] http://patchwork.linuxtv.org/patch/12977/
--
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] Visstrim M10: Add support for Coda.

2012-07-06 Thread Javier Martin
Support the codadx6 that is included in
the i.MX27 SoC.
---
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c |   24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c 
b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index f76edb9..bee2714 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -232,10 +232,10 @@ static void __init visstrim_camera_init(void)
 static void __init visstrim_reserve(void)
 {
/* reserve 4 MiB for mx2-camera */
-   mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
+   mx2_camera_base = memblock_alloc(2 * MX2_CAMERA_BUF_SIZE,
MX2_CAMERA_BUF_SIZE);
-   memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
-   memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
+   memblock_free(mx2_camera_base, 2 * MX2_CAMERA_BUF_SIZE);
+   memblock_remove(mx2_camera_base, 2 * MX2_CAMERA_BUF_SIZE);
 }
 
 /* GPIOs used as events for applications */
@@ -404,6 +404,23 @@ static const struct imx_ssi_platform_data 
visstrim_m10_ssi_pdata __initconst = {
.flags  = IMX_SSI_DMA | IMX_SSI_SYN,
 };
 
+/* coda */
+
+static void __init visstrim_coda_init(void)
+{
+   struct platform_device *pdev;
+   int dma;
+
+   pdev = imx27_add_coda();
+   dma = dma_declare_coherent_memory(pdev-dev,
+ mx2_camera_base + MX2_CAMERA_BUF_SIZE,
+ mx2_camera_base + MX2_CAMERA_BUF_SIZE,
+ MX2_CAMERA_BUF_SIZE,
+ DMA_MEMORY_MAP | 
DMA_MEMORY_EXCLUSIVE);
+   if (!(dma  DMA_MEMORY_MAP))
+   return;
+}
+
 static void __init visstrim_m10_revision(void)
 {
int exp_version = 0;
@@ -467,6 +484,7 @@ static void __init visstrim_m10_board_init(void)
  iclink_tvp5150, sizeof(iclink_tvp5150));
gpio_led_register_device(0, visstrim_m10_led_data);
visstrim_camera_init();
+   visstrim_coda_init();
 }
 
 static void __init visstrim_m10_timer_init(void)
-- 
1.7.9.5

--
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 1/3] i.MX: coda: Add platform support for coda in i.MX27.

2012-07-06 Thread Javier Martin
i.MX27 SoC include a codadx6 codec that is able to encode
and decode H.264, H.263 and MPEG4.
---
 arch/arm/mach-imx/clk-imx27.c   |4 +--
 arch/arm/mach-imx/devices-imx27.h   |4 +++
 arch/arm/plat-mxc/devices/Kconfig   |6 +++-
 arch/arm/plat-mxc/devices/Makefile  |1 +
 arch/arm/plat-mxc/devices/platform-imx27-coda.c |   37 +++
 arch/arm/plat-mxc/include/mach/devices-common.h |8 +
 6 files changed, 57 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/plat-mxc/devices/platform-imx27-coda.c

diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 373c8fd..6e9cb02 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -239,8 +239,8 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[ssi1_ipg_gate], NULL, imx-ssi.0);
clk_register_clkdev(clk[ssi2_ipg_gate], NULL, imx-ssi.1);
clk_register_clkdev(clk[nfc_baud_gate], NULL, mxc_nand.0);
-   clk_register_clkdev(clk[vpu_baud_gate], per, imx-vpu);
-   clk_register_clkdev(clk[vpu_ahb_gate], ahb, imx-vpu);
+   clk_register_clkdev(clk[vpu_baud_gate], per, coda-imx27.0);
+   clk_register_clkdev(clk[vpu_ahb_gate], ahb, coda-imx27.0);
clk_register_clkdev(clk[dma_ahb_gate], ahb, imx-dma);
clk_register_clkdev(clk[dma_ipg_gate], ipg, imx-dma);
clk_register_clkdev(clk[fec_ipg_gate], ipg, imx27-fec.0);
diff --git a/arch/arm/mach-imx/devices-imx27.h 
b/arch/arm/mach-imx/devices-imx27.h
index 28537a5..a2aaa7c 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -17,6 +17,10 @@ extern const struct imx_fsl_usb2_udc_data 
imx27_fsl_usb2_udc_data;
 #define imx27_add_fsl_usb2_udc(pdata)  \
imx_add_fsl_usb2_udc(imx27_fsl_usb2_udc_data, pdata)
 
+extern const struct imx_imx27_coda_data imx27_coda_data;
+#define imx27_add_coda()   \
+   imx_add_imx27_coda(imx27_coda_data)
+
 extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data;
 #define imx27_add_imx2_wdt(pdata)  \
imx_add_imx2_wdt(imx27_imx2_wdt_data)
diff --git a/arch/arm/plat-mxc/devices/Kconfig 
b/arch/arm/plat-mxc/devices/Kconfig
index cb3e3ee..6b46cee 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -15,7 +15,11 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS
 
 config IMX_HAVE_PLATFORM_IMX21_HCD
bool
-   
+
+config IMX_HAVE_PLATFORM_IMX27_CODA
+   bool
+   default y if SOC_IMX27
+
 config IMX_HAVE_PLATFORM_IMX2_WDT
bool
 
diff --git a/arch/arm/plat-mxc/devices/Makefile 
b/arch/arm/plat-mxc/devices/Makefile
index c11ac84..76f3195 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += 
platform-fsl-usb2-udc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
 obj-y += platform-gpio-mxc.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
 obj-y += platform-imx-dma.o
diff --git a/arch/arm/plat-mxc/devices/platform-imx27-coda.c 
b/arch/arm/plat-mxc/devices/platform-imx27-coda.c
new file mode 100644
index 000..8b12aac
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx27-coda.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Vista Silicon
+ * Javier Martin javier.mar...@vista-silicon.com
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+
+#include mach/hardware.h
+#include mach/devices-common.h
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_imx27_coda_data imx27_coda_data __initconst = {
+   .iobase = MX27_VPU_BASE_ADDR,
+   .iosize = SZ_512,
+   .irq = MX27_INT_VPU,
+};
+#endif
+
+struct platform_device *__init imx_add_imx27_coda(
+   const struct imx_imx27_coda_data *data)
+{
+   struct resource res[] = {
+   {
+   .start = data-iobase,
+   .end = data-iobase + data-iosize - 1,
+   .flags = IORESOURCE_MEM,
+   }, {
+   .start = data-irq,
+   .end = data-irq,
+   .flags = IORESOURCE_IRQ,
+   },
+   };
+   return imx_add_platform_device_dmamask(coda-imx27, 0, res, 2, NULL,
+   0, DMA_BIT_MASK(32));
+}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h 
b/arch/arm/plat-mxc/include/mach/devices-common.h
index 1b2258d..ee38186 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -83,6 +83,14 @@ 

[PATCH v2 0/6] omap3isp: preview: Add support for non-GRBG Bayer patterns

2012-07-06 Thread Laurent Pinchart
Hi everybody,

Here's the second version of the non-GRBG Bayer patterns support for the OMAP3
ISP preview engine. Compared to v1, the CFA table can be reconfigured at
runtime, which resulted in several cleanup patches.

The first patch is a v3.5 regression fix, I'll send a separate pull request.

Jean-Philippe, could you please test this patch set on your hardware ? It's
based on top of the latest linuxtv/staging/for_v3.6 branch.

Laurent Pinchart (6):
  omap3isp: preview: Fix contrast and brightness handling
  omap3isp: preview: Remove lens shading compensation support
  omap3isp: preview: Pass a prev_params pointer to configuration
functions
  omap3isp: preview: Reorder configuration functions
  omap3isp: preview: Merge gamma correction and gamma bypass
  omap3isp: preview: Add support for non-GRBG Bayer patterns

 drivers/media/video/omap3isp/isppreview.c |  706 ++---
 drivers/media/video/omap3isp/isppreview.h |1 +
 2 files changed, 346 insertions(+), 361 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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 v2 1/6] omap3isp: preview: Fix contrast and brightness handling

2012-07-06 Thread Laurent Pinchart
Commit bac387efbb88cf0e8df6f46a38387897cea464ee (omap3isp: preview:
Simplify configuration parameters access) added three fields to the
preview_update structure, but failed to properly update the related
initializers. Fix this.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index 8a4935e..aec9860 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -888,12 +888,12 @@ static const struct preview_update update_attrs[] = {
preview_config_contrast,
NULL,
offsetof(struct prev_params, contrast),
-   0, true,
+   0, 0, true,
}, /* OMAP3ISP_PREV_BRIGHTNESS */ {
preview_config_brightness,
NULL,
offsetof(struct prev_params, brightness),
-   0, true,
+   0, 0, true,
},
 };
 
-- 
1.7.8.6

--
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 v2 2/6] omap3isp: preview: Remove lens shading compensation support

2012-07-06 Thread Laurent Pinchart
The feature isn't fully implemented and doesn't work, remove it.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |   18 +-
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index aec9860..4cdcc48 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -215,22 +215,6 @@ preview_enable_drkframe(struct isp_prev_device *prev, u8 
enable)
 }
 
 /*
- * preview_config_drkf_shadcomp - Configures shift value in shading comp.
- * @scomp_shtval: 3bit value of shift used in shading compensation.
- */
-static void
-preview_config_drkf_shadcomp(struct isp_prev_device *prev,
-const void *scomp_shtval)
-{
-   struct isp_device *isp = to_isp_device(prev);
-   const u32 *shtval = scomp_shtval;
-
-   isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_SCOMP_SFT_MASK,
-   *shtval  ISPPRV_PCR_SCOMP_SFT_SHIFT);
-}
-
-/*
  * preview_enable_hmed - Enables/Disables of the Horizontal Median Filter.
  * @enable: 1 - Enables Horizontal Median Filter.
  */
@@ -870,7 +854,7 @@ static const struct preview_update update_attrs[] = {
NULL,
preview_enable_drkframe,
}, /* OMAP3ISP_PREV_LENS_SHADING */ {
-   preview_config_drkf_shadcomp,
+   NULL,
preview_enable_drkframe,
}, /* OMAP3ISP_PREV_NF */ {
preview_config_noisefilter,
-- 
1.7.8.6

--
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 v2 5/6] omap3isp: preview: Merge gamma correction and gamma bypass

2012-07-06 Thread Laurent Pinchart
Enabling gamma bypass disables gamma correction and vice versa. Merge
the two parameters.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |   42 ++--
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index c325e79..71ce0f4 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -481,25 +481,6 @@ static void preview_enable_dcor(struct isp_prev_device 
*prev, bool enable)
 }
 
 /*
- * preview_enable_gammabypass - Enable/disable Gamma Bypass
- *
- * When gamma bypass is enabled, the output of the gamma correction is the 8 
MSB
- * of the 10-bit input .
- */
-static void
-preview_enable_gammabypass(struct isp_prev_device *prev, bool enable)
-{
-   struct isp_device *isp = to_isp_device(prev);
-
-   if (enable)
-   isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_GAMMA_BYPASS);
-   else
-   isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_GAMMA_BYPASS);
-}
-
-/*
  * preview_enable_drkframe_capture - Enable/disable Dark Frame Capture
  */
 static void
@@ -597,6 +578,25 @@ preview_config_gammacorrn(struct isp_prev_device *prev,
 }
 
 /*
+ * preview_enable_gammacorrn - Enable/disable Gamma Correction
+ *
+ * When gamma correction is disabled, the module is bypassed and its output is
+ * the 8 MSB of the 10-bit input .
+ */
+static void
+preview_enable_gammacorrn(struct isp_prev_device *prev, bool enable)
+{
+   struct isp_device *isp = to_isp_device(prev);
+
+   if (enable)
+   isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
+   ISPPRV_PCR_GAMMA_BYPASS);
+   else
+   isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
+   ISPPRV_PCR_GAMMA_BYPASS);
+}
+
+/*
  * preview_config_contrast - Configure the Contrast
  *
  * Value should be programmed before enabling the module.
@@ -817,7 +817,7 @@ static const struct preview_update update_attrs[] = {
offsetof(struct omap3isp_prev_update_config, dcor),
}, /* OMAP3ISP_PREV_GAMMABYPASS */ {
NULL,
-   preview_enable_gammabypass,
+   NULL,
}, /* OMAP3ISP_PREV_DRK_FRM_CAPTURE */ {
NULL,
preview_enable_drkframe_capture,
@@ -835,7 +835,7 @@ static const struct preview_update update_attrs[] = {
offsetof(struct omap3isp_prev_update_config, nf),
}, /* OMAP3ISP_PREV_GAMMA */ {
preview_config_gammacorrn,
-   NULL,
+   preview_enable_gammacorrn,
offsetof(struct prev_params, gamma),
FIELD_SIZEOF(struct prev_params, gamma),
offsetof(struct omap3isp_prev_update_config, gamma),
-- 
1.7.8.6

--
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 v2 6/6] omap3isp: preview: Add support for non-GRBG Bayer patterns

2012-07-06 Thread Laurent Pinchart
Rearrange the CFA interpolation coefficients table based on the Bayer
pattern. Support for non-Bayer CFA patterns is dropped as they were not
correctly supported, and have never been tested.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |  134 ++---
 drivers/media/video/omap3isp/isppreview.h |1 +
 2 files changed, 85 insertions(+), 50 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index 71ce0f4..475908b 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -236,20 +236,30 @@ static void preview_enable_hmed(struct isp_prev_device 
*prev, bool enable)
ISPPRV_PCR_HMEDEN);
 }
 
+#define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
+
 /*
- * preview_config_cfa - Configure CFA Interpolation
- */
-static void
-preview_config_cfa(struct isp_prev_device *prev,
-  const struct prev_params *params)
-{
-   struct isp_device *isp = to_isp_device(prev);
+ * preview_config_cfa - Configure CFA Interpolation for Bayer formats
+ *
+ * The CFA table is organised in four blocks, one per Bayer component. The
+ * hardware expects blocks to follow the Bayer order of the input data, while
+ * the driver stores the table in GRBG order in memory. The blocks need to be
+ * reordered to support non-GRBG Bayer patterns.
+ */
+static void preview_config_cfa(struct isp_prev_device *prev,
+  const struct prev_params *params)
+{
+   static const unsigned int cfa_coef_order[4][4] = {
+   { 0, 1, 2, 3 }, /* GRBG */
+   { 1, 0, 3, 2 }, /* RGGB */
+   { 2, 3, 0, 1 }, /* BGGR */
+   { 3, 2, 1, 0 }, /* GBRG */
+   };
+   const unsigned int *order = cfa_coef_order[prev-params.cfa_order];
const struct omap3isp_prev_cfa *cfa = params-cfa;
+   struct isp_device *isp = to_isp_device(prev);
unsigned int i;
-
-   isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_CFAFMT_MASK,
-   cfa-format  ISPPRV_PCR_CFAFMT_SHIFT);
+   unsigned int j;
 
isp_reg_writel(isp,
(cfa-gradthrs_vert  ISPPRV_CFA_GRADTH_VER_SHIFT) |
@@ -259,9 +269,13 @@ preview_config_cfa(struct isp_prev_device *prev,
isp_reg_writel(isp, ISPPRV_CFA_TABLE_ADDR,
   OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
 
-   for (i = 0; i  OMAP3ISP_PREV_CFA_TBL_SIZE; i++) {
-   isp_reg_writel(isp, cfa-table[i],
-  OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
+   for (i = 0; i  4; ++i) {
+   const __u32 *block = cfa-table
+  + order[i] * OMAP3ISP_PREV_CFA_BLK_SIZE;
+
+   for (j = 0; j  OMAP3ISP_PREV_CFA_BLK_SIZE; ++j)
+   isp_reg_writel(isp, block[j], OMAP3_ISP_IOMEM_PREV,
+  ISPPRV_SET_TBL_DATA);
}
 }
 
@@ -993,42 +1007,62 @@ preview_config_ycpos(struct isp_prev_device *prev,
 static void preview_config_averager(struct isp_prev_device *prev, u8 average)
 {
struct isp_device *isp = to_isp_device(prev);
-   struct prev_params *params;
-   int reg = 0;
 
-   params = (prev-params.active  OMAP3ISP_PREV_CFA)
-  ? prev-params.params[0] : prev-params.params[1];
-
-   if (params-cfa.format == OMAP3ISP_CFAFMT_BAYER)
-   reg = ISPPRV_AVE_EVENDIST_2  ISPPRV_AVE_EVENDIST_SHIFT |
- ISPPRV_AVE_ODDDIST_2  ISPPRV_AVE_ODDDIST_SHIFT |
- average;
-   else if (params-cfa.format == OMAP3ISP_CFAFMT_RGBFOVEON)
-   reg = ISPPRV_AVE_EVENDIST_3  ISPPRV_AVE_EVENDIST_SHIFT |
- ISPPRV_AVE_ODDDIST_3  ISPPRV_AVE_ODDDIST_SHIFT |
- average;
-   isp_reg_writel(isp, reg, OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE);
+   isp_reg_writel(isp, ISPPRV_AVE_EVENDIST_2  ISPPRV_AVE_EVENDIST_SHIFT |
+  ISPPRV_AVE_ODDDIST_2  ISPPRV_AVE_ODDDIST_SHIFT |
+  average, OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE);
 }
 
+
+#define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
+
 /*
  * preview_config_input_format - Configure the input format
  * @prev: The preview engine
  * @format: Format on the preview engine sink pad
  *
- * Enable CFA interpolation for Bayer formats and disable it for greyscale
- * formats.
+ * Enable and configure CFA interpolation for Bayer formats and disable it for
+ * greyscale formats.
+ *
+ * The CFA table is organised in four blocks, one per Bayer component. The
+ * hardware expects blocks to follow the Bayer order of the input data, while
+ * the driver stores the table in GRBG order in memory. The blocks need to be
+ * reordered to support non-GRBG Bayer patterns.
  */
 static 

[PATCH v2 4/6] omap3isp: preview: Reorder configuration functions

2012-07-06 Thread Laurent Pinchart
Reorder the configuration and enable functions to match the parameters
order.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |  452 ++--
 1 files changed, 226 insertions(+), 226 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index 1ac48b7..c325e79 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -157,64 +157,53 @@ static u32 luma_enhance_table[] = {
 };
 
 /*
- * preview_enable_invalaw - Enable/disable Inverse A-Law decompression
- */
-static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable)
-{
-   struct isp_device *isp = to_isp_device(prev);
-
-   if (enable)
-   isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
-   else
-   isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
-}
-
-/*
- * preview_enable_drkframe_capture - Enable/disable Dark Frame Capture
+ * preview_config_luma_enhancement - Configure the Luminance Enhancement table
  */
 static void
-preview_enable_drkframe_capture(struct isp_prev_device *prev, bool enable)
+preview_config_luma_enhancement(struct isp_prev_device *prev,
+   const struct prev_params *params)
 {
struct isp_device *isp = to_isp_device(prev);
+   const struct omap3isp_prev_luma *yt = params-luma;
+   unsigned int i;
 
-   if (enable)
-   isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_DRKFCAP);
-   else
-   isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_DRKFCAP);
+   isp_reg_writel(isp, ISPPRV_YENH_TABLE_ADDR,
+  OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
+   for (i = 0; i  OMAP3ISP_PREV_YENH_TBL_SIZE; i++) {
+   isp_reg_writel(isp, yt-table[i],
+  OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
+   }
 }
 
 /*
- * preview_enable_drkframe - Enable/disable Dark Frame Subtraction
+ * preview_enable_luma_enhancement - Enable/disable Luminance Enhancement
  */
-static void preview_enable_drkframe(struct isp_prev_device *prev, bool enable)
+static void
+preview_enable_luma_enhancement(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
if (enable)
isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_DRKFEN);
+   ISPPRV_PCR_YNENHEN);
else
isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_DRKFEN);
+   ISPPRV_PCR_YNENHEN);
 }
 
 /*
- * preview_enable_hmed - Enable/disable the Horizontal Median Filter
+ * preview_enable_invalaw - Enable/disable Inverse A-Law decompression
  */
-static void preview_enable_hmed(struct isp_prev_device *prev, bool enable)
+static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
if (enable)
isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_HMEDEN);
+   ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
else
isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
-   ISPPRV_PCR_HMEDEN);
+   ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW);
 }
 
 /*
@@ -233,46 +222,18 @@ static void preview_config_hmed(struct isp_prev_device 
*prev,
 }
 
 /*
- * preview_config_noisefilter - Configure the Noise Filter
- */
-static void
-preview_config_noisefilter(struct isp_prev_device *prev,
-  const struct prev_params *params)
-{
-   struct isp_device *isp = to_isp_device(prev);
-   const struct omap3isp_prev_nf *nf = params-nf;
-   unsigned int i;
-
-   isp_reg_writel(isp, nf-spread, OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
-   isp_reg_writel(isp, ISPPRV_NF_TABLE_ADDR,
-  OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
-   for (i = 0; i  OMAP3ISP_PREV_NF_TBL_SIZE; i++) {
-   isp_reg_writel(isp, nf-table[i],
-  OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
-   }
-}
-
-/*
- * preview_config_dcor - Configure Couplet Defect Correction
+ * preview_enable_hmed - Enable/disable the Horizontal Median Filter
  */
-static void
-preview_config_dcor(struct isp_prev_device *prev,
-   const struct prev_params *params)
+static void preview_enable_hmed(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
-   const struct omap3isp_prev_dcor *dcor = params-dcor;
 
-  

[PATCH v2 3/6] omap3isp: preview: Pass a prev_params pointer to configuration functions

2012-07-06 Thread Laurent Pinchart
Instead of using void pointers and offset arithmetics to compute a
pointer to configuration parameters in a generic way, pass the complete
parameters structure to configuration functions and let them access the
parameters they need.

Also modify the enable functions to use a bool enable parameter instead
of a u8.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/omap3isp/isppreview.c |  200 -
 1 files changed, 83 insertions(+), 117 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index 4cdcc48..1ac48b7 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -157,11 +157,9 @@ static u32 luma_enhance_table[] = {
 };
 
 /*
- * preview_enable_invalaw - Enable/Disable Inverse A-Law module in Preview.
- * @enable: 1 - Reverse the A-Law done in CCDC.
+ * preview_enable_invalaw - Enable/disable Inverse A-Law decompression
  */
-static void
-preview_enable_invalaw(struct isp_prev_device *prev, u8 enable)
+static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
@@ -174,15 +172,10 @@ preview_enable_invalaw(struct isp_prev_device *prev, u8 
enable)
 }
 
 /*
- * preview_enable_drkframe_capture - Enable/Disable of the darkframe capture.
- * @prev -
- * @enable: 1 - Enable, 0 - Disable
- *
- * NOTE: PRV_WSDR_ADDR and PRV_WADD_OFFSET must be set also
- * The process is applied for each captured frame.
+ * preview_enable_drkframe_capture - Enable/disable Dark Frame Capture
  */
 static void
-preview_enable_drkframe_capture(struct isp_prev_device *prev, u8 enable)
+preview_enable_drkframe_capture(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
@@ -195,14 +188,9 @@ preview_enable_drkframe_capture(struct isp_prev_device 
*prev, u8 enable)
 }
 
 /*
- * preview_enable_drkframe - Enable/Disable of the darkframe subtract.
- * @enable: 1 - Acquires memory bandwidth since the pixels in each frame is
- *  subtracted with the pixels in the current frame.
- *
- * The process is applied for each captured frame.
+ * preview_enable_drkframe - Enable/disable Dark Frame Subtraction
  */
-static void
-preview_enable_drkframe(struct isp_prev_device *prev, u8 enable)
+static void preview_enable_drkframe(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
@@ -215,11 +203,9 @@ preview_enable_drkframe(struct isp_prev_device *prev, u8 
enable)
 }
 
 /*
- * preview_enable_hmed - Enables/Disables of the Horizontal Median Filter.
- * @enable: 1 - Enables Horizontal Median Filter.
+ * preview_enable_hmed - Enable/disable the Horizontal Median Filter
  */
-static void
-preview_enable_hmed(struct isp_prev_device *prev, u8 enable)
+static void preview_enable_hmed(struct isp_prev_device *prev, bool enable)
 {
struct isp_device *isp = to_isp_device(prev);
 
@@ -232,15 +218,13 @@ preview_enable_hmed(struct isp_prev_device *prev, u8 
enable)
 }
 
 /*
- * preview_config_hmed - Configures the Horizontal Median Filter.
- * @prev_hmed: Structure containing the odd and even distance between the
- * pixels in the image along with the filter threshold.
+ * preview_config_hmed - Configure the Horizontal Median Filter
  */
-static void
-preview_config_hmed(struct isp_prev_device *prev, const void *prev_hmed)
+static void preview_config_hmed(struct isp_prev_device *prev,
+   const struct prev_params *params)
 {
struct isp_device *isp = to_isp_device(prev);
-   const struct omap3isp_prev_hmed *hmed = prev_hmed;
+   const struct omap3isp_prev_hmed *hmed = params-hmed;
 
isp_reg_writel(isp, (hmed-odddist == 1 ? 0 : ISPPRV_HMED_ODDDIST) |
   (hmed-evendist == 1 ? 0 : ISPPRV_HMED_EVENDIST) |
@@ -249,15 +233,14 @@ preview_config_hmed(struct isp_prev_device *prev, const 
void *prev_hmed)
 }
 
 /*
- * preview_config_noisefilter - Configures the Noise Filter.
- * @prev_nf: Structure containing the noisefilter table, strength to be used
- *   for the noise filter and the defect correction enable flag.
+ * preview_config_noisefilter - Configure the Noise Filter
  */
 static void
-preview_config_noisefilter(struct isp_prev_device *prev, const void *prev_nf)
+preview_config_noisefilter(struct isp_prev_device *prev,
+  const struct prev_params *params)
 {
struct isp_device *isp = to_isp_device(prev);
-   const struct omap3isp_prev_nf *nf = prev_nf;
+   const struct omap3isp_prev_nf *nf = params-nf;
unsigned int i;
 
isp_reg_writel(isp, nf-spread, OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
@@ -270,14 +253,14 @@ preview_config_noisefilter(struct isp_prev_device *prev, 
const void *prev_nf)
 }
 
 /*
- * preview_config_dcor - Configures the defect correction
- * 

[PATCH v2 0/2] update MFC v4l2 driver to support MFC6.x

2012-07-06 Thread Arun Kumar K
This is the v2 series of patches for adding support for MFC v6.x.
In this the new v4l controls added in patch [1] are removed. These can be
added as a separate patch later for providing extra encoder controls for
MFC v6. This also incorporates the review comments received for the original
patch and fixed for backward compatibility with MFC v5.

[1] 
http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/45190/

Jeongtae Park (2):
  [media] v4l: add fourcc definitions for new formats
  [media] s5p-mfc: update MFC v4l2 driver to support MFC6.x

 drivers/media/video/Kconfig  |   16 +-
 drivers/media/video/s5p-mfc/Makefile |7 +-
 drivers/media/video/s5p-mfc/regs-mfc-v6.h|  676 ++
 drivers/media/video/s5p-mfc/regs-mfc.h   |   29 +
 drivers/media/video/s5p-mfc/s5p_mfc.c|  163 ++-
 drivers/media/video/s5p-mfc/s5p_mfc_cmd.c|6 +-
 drivers/media/video/s5p-mfc/s5p_mfc_cmd.h|3 +
 drivers/media/video/s5p-mfc/s5p_mfc_cmd_v6.c |   96 ++
 drivers/media/video/s5p-mfc/s5p_mfc_common.h |  123 ++-
 drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c   |  160 ++-
 drivers/media/video/s5p-mfc/s5p_mfc_ctrl.h   |1 +
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c|  210 +++-
 drivers/media/video/s5p-mfc/s5p_mfc_dec.h|1 +
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c|  191 ++--
 drivers/media/video/s5p-mfc/s5p_mfc_enc.h|1 +
 drivers/media/video/s5p-mfc/s5p_mfc_intr.c   |1 -
 drivers/media/video/s5p-mfc/s5p_mfc_opr.c|  278 +++--
 drivers/media/video/s5p-mfc/s5p_mfc_opr.h|   25 +-
 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.c | 1697 ++
 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.h |  140 +++
 drivers/media/video/s5p-mfc/s5p_mfc_pm.c |6 +-
 drivers/media/video/s5p-mfc/s5p_mfc_shm.c|   28 +-
 drivers/media/video/s5p-mfc/s5p_mfc_shm.h|   13 +-
 drivers/media/video/v4l2-ctrls.c |1 -
 include/linux/videodev2.h|4 +
 25 files changed, 3480 insertions(+), 396 deletions(-)
 create mode 100644 drivers/media/video/s5p-mfc/regs-mfc-v6.h
 create mode 100644 drivers/media/video/s5p-mfc/s5p_mfc_cmd_v6.c
 create mode 100644 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.c
 create mode 100644 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.h

--
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 v2 1/2] [media] v4l: add fourcc definitions for new formats

2012-07-06 Thread Arun Kumar K
From: Jeongtae Park jtp.p...@samsung.com

Add new fourcc definitions for interleaved YCbCr and
compressed formats MVC and VP8.

Signed-off-by: Jeongtae Park jtp.p...@samsung.com
Signed-off-by: Naveen Krishna Chatradhi ch.nav...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
Cc: Marek Szyprowski m.szyprow...@samsung.com
Cc: Kamil Debski k.deb...@samsung.com
---
 include/linux/videodev2.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index f79d0cc..e23e6a7 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -359,7 +359,9 @@ struct v4l2_pix_format {
 
 /* two non contiguous planes - one Y, one Cr + Cb interleaved  */
 #define V4L2_PIX_FMT_NV12M   v4l2_fourcc('N', 'M', '1', '2') /* 12  Y/CbCr 
4:2:0  */
+#define V4L2_PIX_FMT_NV21M   v4l2_fourcc('N', 'M', '2', '1') /* 21  Y/CrCb 
4:2:0  */
 #define V4L2_PIX_FMT_NV12MT  v4l2_fourcc('T', 'M', '1', '2') /* 12  Y/CbCr 
4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12  
Y/CbCr 4:2:0 16x16 macroblocks */
 
 /* three non contiguous planes - Y, Cb, Cr */
 #define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12  YUV420 
planar */
@@ -395,6 +397,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 
Multiplexed */
 #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with 
start codes */
 #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 
without start codes */
+#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
 #define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263  
*/
 #define V4L2_PIX_FMT_MPEG1v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES 
*/
 #define V4L2_PIX_FMT_MPEG2v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES 
*/
@@ -402,6 +405,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid  
 */
 #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M 
Annex G compliant stream */
 #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M 
Annex L compliant stream */
+#define V4L2_PIX_FMT_VP8  v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
-- 
1.7.0.4

--
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 PULL FOR v3.5] OMAP3 ISP regression fixes

2012-07-06 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 6887a4131da3adaab011613776d865f4bcfb5678:

  Linux 3.5-rc5 (2012-06-30 16:08:57 -0700)

are available in the git repository at:
  git://linuxtv.org/pinchartl/media.git omap3isp-omap3isp-stable

Both are v3.5 regression fixes.

Laurent Pinchart (2):
  omap3isp: preview: Fix output size computation depending on input format
  omap3isp: preview: Fix contrast and brightness handling

 drivers/media/video/omap3isp/isppreview.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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] [media] uvc/Kconfig: Fix INPUT/EVDEV dependencies

2012-07-06 Thread Mauro Carvalho Chehab
USB_VIDEO_CLASS_INPUT_EVDEV should be dependent on the UVC
selection, as otherwise, when UVC is unselected, this dependent
config still appears.

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/video/uvc/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/video/uvc/Kconfig b/drivers/media/video/uvc/Kconfig
index 6c197da..541c9f1 100644
--- a/drivers/media/video/uvc/Kconfig
+++ b/drivers/media/video/uvc/Kconfig
@@ -10,6 +10,7 @@ config USB_VIDEO_CLASS
 config USB_VIDEO_CLASS_INPUT_EVDEV
bool UVC input events device support
default y
+   depends on USB_VIDEO_CLASS
depends on USB_VIDEO_CLASS=INPUT || INPUT=y
---help---
  This option makes USB Video Class devices register an input device
-- 
1.7.10.4

--
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] [media] rc/Kconfig: Move a LIRC sub-option to the right place

2012-07-06 Thread Mauro Carvalho Chehab
The IR to LIRC option were at the wrong sub-menu. Move it to the right
place.

Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/rc/Kconfig |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 2478b06..908ef70 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -23,6 +23,17 @@ config LIRC
   LIRC daemon handles protocol decoding for IR reception and
   encoding for IR transmitting (aka blasting).
 
+config IR_LIRC_CODEC
+   tristate Enable IR to LIRC bridge
+   depends on RC_CORE
+   depends on LIRC
+   default y
+
+   ---help---
+  Enable this option to pass raw IR to and from userspace via
+  the LIRC interface.
+
+
 config IR_NEC_DECODER
tristate Enable IR raw decoder for the NEC protocol
depends on RC_CORE
@@ -113,16 +124,6 @@ menuconfig RC_DEVICES
 
 if RC_DEVICES
 
-config IR_LIRC_CODEC
-   tristate Enable IR to LIRC bridge
-   depends on RC_CORE
-   depends on LIRC
-   default y
-
-   ---help---
-  Enable this option to pass raw IR to and from userspace via
-  the LIRC interface.
-
 config RC_ATI_REMOTE
tristate ATI / X10 based USB RF remote controls
depends on USB_ARCH_HAS_HCD
-- 
1.7.10.4

--
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] em28xx: Remove useless runtime-private_data usage

2012-07-06 Thread Ezequiel Garcia
Mauro,

On Thu, Jul 5, 2012 at 2:22 PM, Ezequiel Garcia  Are you sure that
this can be removed? I think this is used internally
 by the alsa API, but maybe something has changed and this is not
 required anymore.

 Yes, I'm sure.


This should be: I'm almost sure :-)
Anyway, probably the patch should have a more verbose commit
message, right?

Do you want to do drop it entirely?

Regards,
Ezequiel.
--
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 00/10] Miscellaneous ov772x cleanups and fixes

2012-07-06 Thread Laurent Pinchart
Hi Guennadi,

The subject line says it all :-) These patches have been written while
preparing the ov772x driver for being used with a non soc-camera host.
They apply on top of my previous soc-camera patch series.

Laurent Pinchart (10):
  ov772x: Reorganize the code in sections
  ov772x: Fix memory leak in probe error path
  ov772x: Select the default format at probe time
  ov772x: Don't fail in s_fmt if the requested format isn't supported
  ov772x: try_fmt must not default to the current format
  ov772x: Make to_ov772x convert from v4l2_subdev to ov772x_priv
  ov772x: Add ov772x_read() and ov772x_write() functions
  ov772x: Add support for SBGGR10 format
  ov772x: Compute window size registers at runtime
  ov772x: Stop sensor readout right after reset

 drivers/media/video/ov772x.c |  801 +-
 1 files changed, 398 insertions(+), 403 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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 01/10] ov772x: Reorganize the code in sections

2012-07-06 Thread Laurent Pinchart
Functions are only moved around without any other code change.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |  503 +-
 1 files changed, 256 insertions(+), 247 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 641f6f4..7c645dd 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -439,8 +439,55 @@ static const struct regval_list ov772x_vga_regs[] = {
 };
 
 /*
- * supported color format list
+ * general function
  */
+
+static struct ov772x_priv *to_ov772x(const struct i2c_client *client)
+{
+   return container_of(i2c_get_clientdata(client), struct ov772x_priv,
+   subdev);
+}
+
+static int ov772x_write_array(struct i2c_client*client,
+ const struct regval_list *vals)
+{
+   while (vals-reg_num != 0xff) {
+   int ret = i2c_smbus_write_byte_data(client,
+   vals-reg_num,
+   vals-value);
+   if (ret  0)
+   return ret;
+   vals++;
+   }
+   return 0;
+}
+
+static int ov772x_mask_set(struct i2c_client *client,
+ u8  command,
+ u8  mask,
+ u8  set)
+{
+   s32 val = i2c_smbus_read_byte_data(client, command);
+   if (val  0)
+   return val;
+
+   val = ~mask;
+   val |= set  mask;
+
+   return i2c_smbus_write_byte_data(client, command, val);
+}
+
+static int ov772x_reset(struct i2c_client *client)
+{
+   int ret = i2c_smbus_write_byte_data(client, COM7, SCCB_RESET);
+   msleep(1);
+   return ret;
+}
+
+/* 
-
+ * Formats and hardware configuration
+ */
+
 static const struct ov772x_color_format ov772x_cfmts[] = {
{
.code   = V4L2_MBUS_FMT_YUYV8_2X8,
@@ -493,10 +540,6 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
},
 };
 
-
-/*
- * window size list
- */
 #define VGA_WIDTH   640
 #define VGA_HEIGHT  480
 #define QVGA_WIDTH  320
@@ -520,177 +563,6 @@ static const struct ov772x_win_size ov772x_win_qvga = {
.regs = ov772x_qvga_regs,
 };
 
-/*
- * general function
- */
-
-static struct ov772x_priv *to_ov772x(const struct i2c_client *client)
-{
-   return container_of(i2c_get_clientdata(client), struct ov772x_priv,
-   subdev);
-}
-
-static int ov772x_write_array(struct i2c_client*client,
- const struct regval_list *vals)
-{
-   while (vals-reg_num != 0xff) {
-   int ret = i2c_smbus_write_byte_data(client,
-   vals-reg_num,
-   vals-value);
-   if (ret  0)
-   return ret;
-   vals++;
-   }
-   return 0;
-}
-
-static int ov772x_mask_set(struct i2c_client *client,
- u8  command,
- u8  mask,
- u8  set)
-{
-   s32 val = i2c_smbus_read_byte_data(client, command);
-   if (val  0)
-   return val;
-
-   val = ~mask;
-   val |= set  mask;
-
-   return i2c_smbus_write_byte_data(client, command, val);
-}
-
-static int ov772x_reset(struct i2c_client *client)
-{
-   int ret = i2c_smbus_write_byte_data(client, COM7, SCCB_RESET);
-   msleep(1);
-   return ret;
-}
-
-/*
- * soc_camera_ops function
- */
-
-static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
-
-   if (!enable) {
-   ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
-   return 0;
-   }
-
-   if (!priv-win || !priv-cfmt) {
-   dev_err(client-dev, norm or win select error\n);
-   return -EPERM;
-   }
-
-   ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, 0);
-
-   dev_dbg(client-dev, format %d, win %s\n,
-   priv-cfmt-code, priv-win-name);
-
-   return 0;
-}
-
-static int ov772x_s_ctrl(struct v4l2_ctrl *ctrl)
-{
-   struct ov772x_priv *priv = container_of(ctrl-handler,
-   struct ov772x_priv, hdl);
-   struct v4l2_subdev *sd = priv-subdev;
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-   int ret = 0;
-   u8 val;
-
-   switch (ctrl-id) {
-   case V4L2_CID_VFLIP:
-   val = ctrl-val ? VFLIP_IMG : 0x00;
-   priv-flag_vflip = ctrl-val;
-   

[PATCH 08/10] ov772x: Add support for SBGGR10 format

2012-07-06 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   43 +++--
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 67c385b..07ff709 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -274,6 +274,7 @@
 #define SLCT_VGA0x00   /*   0 : VGA */
 #define SLCT_QVGA   0x40   /*   1 : QVGA */
 #define ITU656_ON_OFF   0x20   /* ITU656 protocol ON/OFF selection */
+#define SENSOR_RAW 0x10/* Sensor RAW */
/* RGB output format control */
 #define FMT_MASK0x0c   /*  Mask of color format */
 #define FMT_GBR422  0x00   /*  00 : GBR 4:2:2 */
@@ -337,6 +338,12 @@
 #define CBAR_ON 0x20   /*   ON */
 #define CBAR_OFF0x00   /*   OFF */
 
+/* DSP_CTRL4 */
+#define DSP_OFMT_YUV   0x00
+#define DSP_OFMT_RGB   0x00
+#define DSP_OFMT_RAW8  0x02
+#define DSP_OFMT_RAW10 0x03
+
 /* HSTART */
 #define HST_VGA 0x23
 #define HST_QVGA0x3F
@@ -388,6 +395,7 @@ struct ov772x_color_format {
enum v4l2_mbus_pixelcode code;
enum v4l2_colorspace colorspace;
u8 dsp3;
+   u8 dsp4;
u8 com3;
u8 com7;
 };
@@ -498,6 +506,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_YUYV8_2X8,
.colorspace = V4L2_COLORSPACE_JPEG,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_YUV,
.com7   = OFMT_YUV,
},
@@ -505,6 +514,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_YVYU8_2X8,
.colorspace = V4L2_COLORSPACE_JPEG,
.dsp3   = UV_ON,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_YUV,
.com7   = OFMT_YUV,
},
@@ -512,6 +522,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_UYVY8_2X8,
.colorspace = V4L2_COLORSPACE_JPEG,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = 0x0,
.com7   = OFMT_YUV,
},
@@ -519,6 +530,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_RGB,
.com7   = FMT_RGB555 | OFMT_RGB,
},
@@ -526,6 +538,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = 0x0,
.com7   = FMT_RGB555 | OFMT_RGB,
},
@@ -533,6 +546,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_RGB565_2X8_LE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_RGB,
.com7   = FMT_RGB565 | OFMT_RGB,
},
@@ -540,9 +554,22 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
.code   = V4L2_MBUS_FMT_RGB565_2X8_BE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_YUV,
.com3   = 0x0,
.com7   = FMT_RGB565 | OFMT_RGB,
},
+   {
+   /* Setting DSP4 to DSP_OFMT_RAW8 still gives 10-bit output,
+* regardless of the COM7 value. We can thus only support 10-bit
+* Bayer until someone figures it out.
+*/
+   .code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+   .colorspace = V4L2_COLORSPACE_SRGB,
+   .dsp3   = 0x0,
+   .dsp4   = DSP_OFMT_RAW10,
+   .com3   = 0x0,
+   .com7   = SENSOR_RAW | OFMT_BRAW,
+   },
 };
 
 #define VGA_WIDTH   640
@@ -684,6 +711,13 @@ static int ov772x_set_params(struct ov772x_priv *priv,
goto ov772x_set_fmt_error;
}
 
+   /* DSP_CTRL4: AEC reference point and DSP output format. */
+   if (cfmt-dsp4) {
+   ret = ov772x_write(client, DSP_CTRL4, cfmt-dsp4);
+   if (ret  0)
+   goto 

[PATCH 06/10] ov772x: Make to_ov772x convert from v4l2_subdev to ov772x_priv

2012-07-06 Thread Laurent Pinchart
Conversion from i2c_client to ov772x_priv is only needed in a single
location, while conversion from v4l2_subdev to ov772x_priv is needed in
several locations. Perform the former manually, and use to_ov772x for
the later.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   21 ++---
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index e3de4de..9055ba4 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -442,10 +442,9 @@ static const struct regval_list ov772x_vga_regs[] = {
  * general function
  */
 
-static struct ov772x_priv *to_ov772x(const struct i2c_client *client)
+static struct ov772x_priv *to_ov772x(struct v4l2_subdev *sd)
 {
-   return container_of(i2c_get_clientdata(client), struct ov772x_priv,
-   subdev);
+   return container_of(sd, struct ov772x_priv, subdev);
 }
 
 static int ov772x_write_array(struct i2c_client*client,
@@ -789,7 +788,7 @@ static const struct v4l2_ctrl_ops ov772x_ctrl_ops = {
 static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
   struct v4l2_dbg_chip_ident *id)
 {
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+   struct ov772x_priv *priv = to_ov772x(sd);
 
id-ident= priv-model;
id-revision = 0;
@@ -845,7 +844,7 @@ static int ov772x_s_power(struct v4l2_subdev *sd, int on)
 static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+   struct ov772x_priv *priv = to_ov772x(sd);
 
if (!enable) {
ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
@@ -863,7 +862,7 @@ static int ov772x_s_stream(struct v4l2_subdev *sd, int 
enable)
 static int ov772x_g_fmt(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *mf)
 {
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+   struct ov772x_priv *priv = to_ov772x(sd);
 
mf-width   = priv-win-width;
mf-height  = priv-win-height;
@@ -876,7 +875,7 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
 
 static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
 {
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+   struct ov772x_priv *priv = to_ov772x(sd);
const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
int ret;
@@ -999,9 +998,9 @@ static struct v4l2_subdev_ops ov772x_subdev_ops = {
  * Initialization and cleanup
  */
 
-static int ov772x_video_probe(struct i2c_client *client)
+static int ov772x_video_probe(struct ov772x_priv *priv)
 {
-   struct ov772x_priv *priv = to_ov772x(client);
+   struct i2c_client  *client = v4l2_get_subdevdata(priv-subdev);
u8  pid, ver;
const char *devname;
int ret;
@@ -1086,7 +1085,7 @@ static int ov772x_probe(struct i2c_client *client,
goto done;
}
 
-   ret = ov772x_video_probe(client);
+   ret = ov772x_video_probe(priv);
if (ret  0)
goto done;
 
@@ -1103,7 +1102,7 @@ done:
 
 static int ov772x_remove(struct i2c_client *client)
 {
-   struct ov772x_priv *priv = to_ov772x(client);
+   struct ov772x_priv *priv = to_ov772x(i2c_get_clientdata(client));
 
v4l2_device_unregister_subdev(priv-subdev);
v4l2_ctrl_handler_free(priv-hdl);
-- 
1.7.8.6

--
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 09/10] ov772x: Compute window size registers at runtime

2012-07-06 Thread Laurent Pinchart
Instead of hardcoding register arrays, compute the values at runtime.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |  149 -
 1 files changed, 58 insertions(+), 91 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 07ff709..98b1bdf 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -317,8 +317,15 @@
 #define SGLF_ON_OFF 0x02   /* Single frame ON/OFF selection */
 #define SGLF_TRIG   0x01   /* Single frame transfer trigger */
 
+/* HREF */
+#define HREF_VSTART_SHIFT  6   /* VSTART LSB */
+#define HREF_HSTART_SHIFT  4   /* HSTART 2 LSBs */
+#define HREF_VSIZE_SHIFT   2   /* VSIZE LSB */
+#define HREF_HSIZE_SHIFT   0   /* HSIZE 2 LSBs */
+
 /* EXHCH */
-#define VSIZE_LSB   0x04   /* Vertical data output size LSB */
+#define EXHCH_VSIZE_SHIFT  2   /* VOUTSIZE LSB */
+#define EXHCH_HSIZE_SHIFT  0   /* HOUTSIZE 2 LSBs */
 
 /* DSP_CTRL1 */
 #define FIFO_ON 0x80   /* FIFO enable/disable selection */
@@ -344,30 +351,6 @@
 #define DSP_OFMT_RAW8  0x02
 #define DSP_OFMT_RAW10 0x03
 
-/* HSTART */
-#define HST_VGA 0x23
-#define HST_QVGA0x3F
-
-/* HSIZE */
-#define HSZ_VGA 0xA0
-#define HSZ_QVGA0x50
-
-/* VSTART */
-#define VST_VGA 0x07
-#define VST_QVGA0x03
-
-/* VSIZE */
-#define VSZ_VGA 0xF0
-#define VSZ_QVGA0x78
-
-/* HOUTSIZE */
-#define HOSZ_VGA0xA0
-#define HOSZ_QVGA   0x50
-
-/* VOUTSIZE */
-#define VOSZ_VGA0xF0
-#define VOSZ_QVGA   0x78
-
 /* DSPAUTO (DSP Auto Function ON/OFF Control) */
 #define AWB_ACTRL   0x80 /* AWB auto threshold control */
 #define DENOISE_ACTRL   0x40 /* De-noise auto threshold control */
@@ -386,10 +369,6 @@
 /*
  * struct
  */
-struct regval_list {
-   unsigned char reg_num;
-   unsigned char value;
-};
 
 struct ov772x_color_format {
enum v4l2_mbus_pixelcode code;
@@ -402,10 +381,8 @@ struct ov772x_color_format {
 
 struct ov772x_win_size {
char *name;
-   __u32 width;
-   __u32 height;
unsigned char com7_bit;
-   const struct regval_list *regs;
+   struct v4l2_rect  rect;
 };
 
 struct ov772x_priv {
@@ -421,31 +398,6 @@ struct ov772x_priv {
unsigned shortband_filter;
 };
 
-#define ENDMARKER { 0xff, 0xff }
-
-/*
- * register setting for window size
- */
-static const struct regval_list ov772x_qvga_regs[] = {
-   { HSTART,   HST_QVGA },
-   { HSIZE,HSZ_QVGA },
-   { VSTART,   VST_QVGA },
-   { VSIZE,VSZ_QVGA  },
-   { HOUTSIZE, HOSZ_QVGA },
-   { VOUTSIZE, VOSZ_QVGA },
-   ENDMARKER,
-};
-
-static const struct regval_list ov772x_vga_regs[] = {
-   { HSTART,   HST_VGA },
-   { HSIZE,HSZ_VGA },
-   { VSTART,   VST_VGA },
-   { VSIZE,VSZ_VGA },
-   { HOUTSIZE, HOSZ_VGA },
-   { VOUTSIZE, VOSZ_VGA },
-   ENDMARKER,
-};
-
 /*
  * general function
  */
@@ -465,18 +417,6 @@ static inline int ov772x_write(struct i2c_client *client, 
u8 addr, u8 value)
return i2c_smbus_write_byte_data(client, addr, value);
 }
 
-static int ov772x_write_array(struct i2c_client*client,
- const struct regval_list *vals)
-{
-   while (vals-reg_num != 0xff) {
-   int ret = ov772x_write(client, vals-reg_num, vals-value);
-   if (ret  0)
-   return ret;
-   vals++;
-   }
-   return 0;
-}
-
 static int ov772x_mask_set(struct i2c_client *client, u8  command, u8  mask,
   u8  set)
 {
@@ -574,24 +514,26 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
 
 #define VGA_WIDTH   640
 #define VGA_HEIGHT  480
-#define QVGA_WIDTH  320
-#define QVGA_HEIGHT 240
-#define MAX_WIDTH   VGA_WIDTH
-#define MAX_HEIGHT  VGA_HEIGHT
 
 static const struct ov772x_win_size ov772x_win_sizes[] = {
{
.name = VGA,
-   .width= VGA_WIDTH,
-   .height   = VGA_HEIGHT,
.com7_bit = SLCT_VGA,
-   .regs = ov772x_vga_regs,
+   .rect = {
+   .left = 140,
+   .top = 14,
+   .width = 640,
+   .height = 480,
+   },
}, {
.name = QVGA,
-   .width= QVGA_WIDTH,
-   .height   = QVGA_HEIGHT,
.com7_bit = SLCT_QVGA,
-   .regs = ov772x_qvga_regs,
+   .rect = {
+   .left = 252,
+   .top = 6,
+   .width = 320,
+   .height = 240,
+   },
},
 };
 
@@ -602,8 +544,8 @@ static const struct 

[PATCH 10/10] ov772x: Stop sensor readout right after reset

2012-07-06 Thread Laurent Pinchart
The sensor starts streaming video as soon as it gets powered or is
reset. Disable the output in the reset function.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 98b1bdf..6e08bae 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -432,9 +432,15 @@ static int ov772x_mask_set(struct i2c_client *client, u8  
command, u8  mask,
 
 static int ov772x_reset(struct i2c_client *client)
 {
-   int ret = ov772x_write(client, COM7, SCCB_RESET);
+   int ret;
+
+   ret = ov772x_write(client, COM7, SCCB_RESET);
+   if (ret  0)
+   return ret;
+
msleep(1);
-   return ret;
+
+   return ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
 }
 
 /* 
-
-- 
1.7.8.6

--
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 03/10] ov772x: Select the default format at probe time

2012-07-06 Thread Laurent Pinchart
The format and window size are only initialized during the first g_fmt
call. This leaves the device in an inconsistent state after
initialization, which will cause problems when implementing pad
operations. Move the format and window size initialization to probe
time.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   63 -
 1 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 066bac6..576780a 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -547,37 +547,36 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
 #define MAX_WIDTH   VGA_WIDTH
 #define MAX_HEIGHT  VGA_HEIGHT
 
-static const struct ov772x_win_size ov772x_win_vga = {
-   .name = VGA,
-   .width= VGA_WIDTH,
-   .height   = VGA_HEIGHT,
-   .com7_bit = SLCT_VGA,
-   .regs = ov772x_vga_regs,
-};
-
-static const struct ov772x_win_size ov772x_win_qvga = {
-   .name = QVGA,
-   .width= QVGA_WIDTH,
-   .height   = QVGA_HEIGHT,
-   .com7_bit = SLCT_QVGA,
-   .regs = ov772x_qvga_regs,
+static const struct ov772x_win_size ov772x_win_sizes[] = {
+   {
+   .name = VGA,
+   .width= VGA_WIDTH,
+   .height   = VGA_HEIGHT,
+   .com7_bit = SLCT_VGA,
+   .regs = ov772x_vga_regs,
+   }, {
+   .name = QVGA,
+   .width= QVGA_WIDTH,
+   .height   = QVGA_HEIGHT,
+   .com7_bit = SLCT_QVGA,
+   .regs = ov772x_qvga_regs,
+   },
 };
 
 static const struct ov772x_win_size *ov772x_select_win(u32 width, u32 height)
 {
-   __u32 diff;
-   const struct ov772x_win_size *win;
-
-   /* default is QVGA */
-   diff = abs(width - ov772x_win_qvga.width) +
-   abs(height - ov772x_win_qvga.height);
-   win = ov772x_win_qvga;
-
-   /* VGA */
-   if (diff 
-   abs(width  - ov772x_win_vga.width) +
-   abs(height - ov772x_win_vga.height))
-   win = ov772x_win_vga;
+   const struct ov772x_win_size *win = ov772x_win_sizes[0];
+   unsigned int i;
+   u32 best_diff = (u32)-1;
+
+   for (i = 0; i  ARRAY_SIZE(ov772x_win_sizes); ++i) {
+   u32 diff = abs(width - ov772x_win_sizes[i].width)
++ abs(height - ov772x_win_sizes[i].height);
+   if (diff  best_diff) {
+   best_diff = diff;
+   win = ov772x_win_sizes[i];
+   }
+   }
 
return win;
 }
@@ -874,11 +873,6 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
 {
struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
 
-   if (!priv-win || !priv-cfmt) {
-   priv-cfmt = ov772x_cfmts[0];
-   priv-win = ov772x_select_win(VGA_WIDTH, VGA_HEIGHT);
-   }
-
mf-width   = priv-win-width;
mf-height  = priv-win-height;
mf-code= priv-cfmt-code;
@@ -1112,6 +1106,11 @@ static int ov772x_probe(struct i2c_client *client,
}
 
ret = ov772x_video_probe(client);
+   if (ret  0)
+   goto done;
+
+   priv-cfmt = ov772x_cfmts[0];
+   priv-win = ov772x_win_sizes[0];
 
 done:
if (ret) {
-- 
1.7.8.6

--
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 04/10] ov772x: Don't fail in s_fmt if the requested format isn't supported

2012-07-06 Thread Laurent Pinchart
Select a default format instead.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   83 ++
 1 files changed, 43 insertions(+), 40 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 576780a..fcb338a 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -581,31 +581,33 @@ static const struct ov772x_win_size 
*ov772x_select_win(u32 width, u32 height)
return win;
 }
 
-static int ov772x_set_params(struct i2c_client *client, u32 *width, u32 
*height,
-enum v4l2_mbus_pixelcode code)
+static void ov772x_select_params(const struct v4l2_mbus_framefmt *mf,
+const struct ov772x_color_format **cfmt,
+const struct ov772x_win_size **win)
 {
-   struct ov772x_priv *priv = to_ov772x(client);
-   int ret = -EINVAL;
-   u8  val;
-   int i;
+   unsigned int i;
+
+   /* Select the format format. */
+   *cfmt = ov772x_cfmts[0];
 
-   /*
-* select format
-*/
-   priv-cfmt = NULL;
for (i = 0; i  ARRAY_SIZE(ov772x_cfmts); i++) {
-   if (code == ov772x_cfmts[i].code) {
-   priv-cfmt = ov772x_cfmts + i;
+   if (mf-code == ov772x_cfmts[i].code) {
+   *cfmt = ov772x_cfmts[i];
break;
}
}
-   if (!priv-cfmt)
-   goto ov772x_set_fmt_error;
 
-   /*
-* select win
-*/
-   priv-win = ov772x_select_win(*width, *height);
+   /* Select the window size. */
+   *win = ov772x_select_win(mf-width, mf-height);
+}
+
+static int ov772x_set_params(struct ov772x_priv *priv,
+const struct ov772x_color_format *cfmt,
+const struct ov772x_win_size *win)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(priv-subdev);
+   int ret;
+   u8  val;
 
/*
 * reset hardware
@@ -662,14 +664,14 @@ static int ov772x_set_params(struct i2c_client *client, 
u32 *width, u32 *height,
/*
 * set size format
 */
-   ret = ov772x_write_array(client, priv-win-regs);
+   ret = ov772x_write_array(client, win-regs);
if (ret  0)
goto ov772x_set_fmt_error;
 
/*
 * set DSP_CTRL3
 */
-   val = priv-cfmt-dsp3;
+   val = cfmt-dsp3;
if (val) {
ret = ov772x_mask_set(client,
  DSP_CTRL3, UV_MASK, val);
@@ -680,7 +682,7 @@ static int ov772x_set_params(struct i2c_client *client, u32 
*width, u32 *height,
/*
 * set COM3
 */
-   val = priv-cfmt-com3;
+   val = cfmt-com3;
if (priv-info-flags  OV772X_FLAG_VFLIP)
val |= VFLIP_IMG;
if (priv-info-flags  OV772X_FLAG_HFLIP)
@@ -698,7 +700,7 @@ static int ov772x_set_params(struct i2c_client *client, u32 
*width, u32 *height,
/*
 * set COM7
 */
-   val = priv-win-com7_bit | priv-cfmt-com7;
+   val = win-com7_bit | cfmt-com7;
ret = ov772x_mask_set(client,
  COM7, SLCT_MASK | FMT_MASK | OFMT_MASK,
  val);
@@ -717,16 +719,11 @@ static int ov772x_set_params(struct i2c_client *client, 
u32 *width, u32 *height,
goto ov772x_set_fmt_error;
}
 
-   *width = priv-win-width;
-   *height = priv-win-height;
-
return ret;
 
 ov772x_set_fmt_error:
 
ov772x_reset(client);
-   priv-win = NULL;
-   priv-cfmt = NULL;
 
return ret;
 }
@@ -855,11 +852,6 @@ static int ov772x_s_stream(struct v4l2_subdev *sd, int 
enable)
return 0;
}
 
-   if (!priv-win || !priv-cfmt) {
-   dev_err(client-dev, norm or win select error\n);
-   return -EPERM;
-   }
-
ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, 0);
 
dev_dbg(client-dev, format %d, win %s\n,
@@ -882,18 +874,29 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int ov772x_s_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *mf)
+static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
-   int ret = ov772x_set_params(client, mf-width, mf-height,
-   mf-code);
+   const struct ov772x_color_format *cfmt;
+   const struct ov772x_win_size *win;
+   int ret;
 
-   if (!ret)
-   mf-colorspace = priv-cfmt-colorspace;
+   ov772x_select_params(mf, cfmt, win);
 
-   return ret;
+   ret = ov772x_set_params(priv, cfmt, win);
+   if (ret  

[PATCH 05/10] ov772x: try_fmt must not default to the current format

2012-07-06 Thread Laurent Pinchart
If the requested format isn't supported, return a fixed default format
instead of the current format.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   36 +++-
 1 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index fcb338a..e3de4de 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -902,38 +902,16 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd, struct 
v4l2_mbus_framefmt *mf)
 static int ov772x_try_fmt(struct v4l2_subdev *sd,
  struct v4l2_mbus_framefmt *mf)
 {
-   struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
+   const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
-   int i;
-
-   /*
-* select suitable win
-*/
-   win = ov772x_select_win(mf-width, mf-height);
 
-   mf-width   = win-width;
-   mf-height  = win-height;
-   mf-field   = V4L2_FIELD_NONE;
-
-   for (i = 0; i  ARRAY_SIZE(ov772x_cfmts); i++)
-   if (mf-code == ov772x_cfmts[i].code)
-   break;
+   ov772x_select_params(mf, cfmt, win);
 
-   if (i == ARRAY_SIZE(ov772x_cfmts)) {
-   /* Unsupported format requested. Propose either */
-   if (priv-cfmt) {
-   /* the current one or */
-   mf-colorspace = priv-cfmt-colorspace;
-   mf-code = priv-cfmt-code;
-   } else {
-   /* the default one */
-   mf-colorspace = ov772x_cfmts[0].colorspace;
-   mf-code = ov772x_cfmts[0].code;
-   }
-   } else {
-   /* Also return the colorspace */
-   mf-colorspace  = ov772x_cfmts[i].colorspace;
-   }
+   mf-code = cfmt-code;
+   mf-width = win-width;
+   mf-height = win-height;
+   mf-field = V4L2_FIELD_NONE;
+   mf-colorspace = cfmt-colorspace;
 
return 0;
 }
-- 
1.7.8.6

--
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 07/10] ov772x: Add ov772x_read() and ov772x_write() functions

2012-07-06 Thread Laurent Pinchart
And use them instead of calling SMBus access functions directly.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |   38 ++
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 9055ba4..67c385b 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -447,13 +447,21 @@ static struct ov772x_priv *to_ov772x(struct v4l2_subdev 
*sd)
return container_of(sd, struct ov772x_priv, subdev);
 }
 
+static inline int ov772x_read(struct i2c_client *client, u8 addr)
+{
+   return i2c_smbus_read_byte_data(client, addr);
+}
+
+static inline int ov772x_write(struct i2c_client *client, u8 addr, u8 value)
+{
+   return i2c_smbus_write_byte_data(client, addr, value);
+}
+
 static int ov772x_write_array(struct i2c_client*client,
  const struct regval_list *vals)
 {
while (vals-reg_num != 0xff) {
-   int ret = i2c_smbus_write_byte_data(client,
-   vals-reg_num,
-   vals-value);
+   int ret = ov772x_write(client, vals-reg_num, vals-value);
if (ret  0)
return ret;
vals++;
@@ -461,24 +469,22 @@ static int ov772x_write_array(struct i2c_client
*client,
return 0;
 }
 
-static int ov772x_mask_set(struct i2c_client *client,
- u8  command,
- u8  mask,
- u8  set)
+static int ov772x_mask_set(struct i2c_client *client, u8  command, u8  mask,
+  u8  set)
 {
-   s32 val = i2c_smbus_read_byte_data(client, command);
+   s32 val = ov772x_read(client, command);
if (val  0)
return val;
 
val = ~mask;
val |= set  mask;
 
-   return i2c_smbus_write_byte_data(client, command, val);
+   return ov772x_write(client, command, val);
 }
 
 static int ov772x_reset(struct i2c_client *client)
 {
-   int ret = i2c_smbus_write_byte_data(client, COM7, SCCB_RESET);
+   int ret = ov772x_write(client, COM7, SCCB_RESET);
msleep(1);
return ret;
 }
@@ -807,7 +813,7 @@ static int ov772x_g_register(struct v4l2_subdev *sd,
if (reg-reg  0xff)
return -EINVAL;
 
-   ret = i2c_smbus_read_byte_data(client, reg-reg);
+   ret = ov772x_write(client, reg-reg);
if (ret  0)
return ret;
 
@@ -825,7 +831,7 @@ static int ov772x_s_register(struct v4l2_subdev *sd,
reg-val  0xff)
return -EINVAL;
 
-   return i2c_smbus_write_byte_data(client, reg-reg, reg-val);
+   return ov772x_write(client, reg-reg, reg-val);
 }
 #endif
 
@@ -1012,8 +1018,8 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
/*
 * check and show product ID and manufacturer ID
 */
-   pid = i2c_smbus_read_byte_data(client, PID);
-   ver = i2c_smbus_read_byte_data(client, VER);
+   pid = ov772x_read(client, PID);
+   ver = ov772x_read(client, VER);
 
switch (VERSION(pid, ver)) {
case OV7720:
@@ -1036,8 +1042,8 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
 devname,
 pid,
 ver,
-i2c_smbus_read_byte_data(client, MIDH),
-i2c_smbus_read_byte_data(client, MIDL));
+ov772x_read(client, MIDH),
+ov772x_read(client, MIDL));
ret = v4l2_ctrl_handler_setup(priv-hdl);
 
 done:
-- 
1.7.8.6

--
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 02/10] ov772x: Fix memory leak in probe error path

2012-07-06 Thread Laurent Pinchart
The control handler isn't freed if its initialization fails. Fix it.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/ov772x.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 7c645dd..066bac6 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -1107,18 +1107,17 @@ static int ov772x_probe(struct i2c_client *client,
V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
priv-subdev.ctrl_handler = priv-hdl;
if (priv-hdl.error) {
-   int err = priv-hdl.error;
-
-   kfree(priv);
-   return err;
+   ret = priv-hdl.error;
+   goto done;
}
 
ret = ov772x_video_probe(client);
+
+done:
if (ret) {
v4l2_ctrl_handler_free(priv-hdl);
kfree(priv);
}
-
return ret;
 }
 
-- 
1.7.8.6

--
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 v4] media: Add stk1160 new driver

2012-07-06 Thread Ezequiel Garcia
On Thu, Jul 5, 2012 at 9:01 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 Em 05-07-2012 19:36, Sylwester Nawrocki escreveu:
 On 07/06/2012 12:11 AM, Mauro Carvalho Chehab wrote:
 +static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer 
 *p)
 +{
 +   struct stk1160 *dev = video_drvdata(file);
 +
 +   if (!stk1160_is_owner(dev, file))
 +   return -EBUSY;
 +
 +   return vb2_dqbuf(dev-vb_vidq, p, file-f_flags  O_NONBLOCK);

 Why to use O_NONBLOCK here? it should be doing whatever userspace wants.

 This is OK, since the third argument to vb2_dqbuf() is a boolean indicating
 whether this call should be blocking or not. And a  O_NONBLOCK masks this
 information out from file-f_flags.

 Ah! OK then.

 It might be better to initialize it during vb2 initialization, at open,
 instead of requiring this argument every time vb_dqbuf() is called.


Okey, I'll do that.

 Btw, just noticed a minor issue: an space is required before the  operator.


That space was there, it got mangled on Sylwester answer. :-)

Regards,
Ezequiel.
--
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 v4] media: Add stk1160 new driver

2012-07-06 Thread Ezequiel Garcia
Hi Mauro,



On Thu, Jul 5, 2012 at 7:11 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
 index 99937c9..8d94d56 100644
 --- a/drivers/media/video/Kconfig
 +++ b/drivers/media/video/Kconfig
 @@ -661,6 +661,8 @@ source drivers/media/video/hdpvr/Kconfig

   source drivers/media/video/em28xx/Kconfig

 +source drivers/media/video/stk1160/Kconfig
 +
   source drivers/media/video/tlg2300/Kconfig

   source drivers/media/video/cx231xx/Kconfig
 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index d209de0..7698b25 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -125,6 +125,7 @@ obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o
   obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
   obj-$(CONFIG_STA2X11_VIP) += sta2x11_vip.o
   obj-$(CONFIG_VIDEO_TIMBERDALE)  += timblogiw.o
 +obj-$(CONFIG_VIDEO_STK1160) += stk1160/

   obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
   obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 diff --git a/drivers/media/video/stk1160/Kconfig 
 b/drivers/media/video/stk1160/Kconfig
 new file mode 100644
 index 000..7ae1685
 --- /dev/null
 +++ b/drivers/media/video/stk1160/Kconfig
 @@ -0,0 +1,12 @@
 +config VIDEO_STK1160
 + tristate STK1160 USB video capture support
 + depends on VIDEO_DEV  I2C  EASYCAP!=m  EASYCAP!=y

 Instead of it, why don't you just remove the EASYCAP driver?


Sure!



 + select VIDEOBUF2_VMALLOC
 + select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
 + select SND_AC97_CODEC
 +
 + ---help---
 +   This is a video4linux driver for STK1160 based video capture devices
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called stk1160
 diff --git a/drivers/media/video/stk1160/Makefile 
 b/drivers/media/video/stk1160/Makefile
 new file mode 100644
 index 000..5d8f1ba
 --- /dev/null
 +++ b/drivers/media/video/stk1160/Makefile
 @@ -0,0 +1,6 @@
 +stk1160-y := stk1160-core.o stk1160-v4l.o stk1160-video.o stk1160-i2c.o 
 stk1160-ac97.o
 +
 +obj-$(CONFIG_VIDEO_STK1160) += stk1160.o
 +
 +ccflags-y += -Wall
 +ccflags-y += -Idrivers/media/video
 diff --git a/drivers/media/video/stk1160/stk1160-ac97.c 
 b/drivers/media/video/stk1160/stk1160-ac97.c
 new file mode 100644
 index 000..529b05b
 --- /dev/null
 +++ b/drivers/media/video/stk1160/stk1160-ac97.c
 @@ -0,0 +1,152 @@
 +/*
 + * STK1160 driver
 + *
 + * Copyright (C) 2012 Ezequiel Garcia
 + * elezegarcia--a.t--gmail.com
 + *
 + * Based on Easycap driver by R.M. Thomas
 + *   Copyright (C) 2010 R.M. Thomas
 + *   rmthomas--a.t--sciolus.org
 + *
 + * 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.
 + *
 + */
 +
 +#include linux/module.h
 +#include sound/core.h
 +#include sound/initval.h
 +#include sound/ac97_codec.h
 +
 +#include stk1160.h
 +#include stk1160-reg.h
 +
 +static struct snd_ac97 *stk1160_ac97;
 +
 +static void stk1160_write_ac97(struct snd_ac97 *ac97, u16 reg, u16 value)
 +{
 + struct stk1160 *dev = ac97-private_data;
 +
 + /* Set codec register address */
 + stk1160_write_reg(dev, STK1160_AC97_ADDR, reg);
 +
 + /* Set codec command */
 + stk1160_write_reg(dev, STK1160_AC97_CMD, value  0xff);
 + stk1160_write_reg(dev, STK1160_AC97_CMD + 1, (value  0xff00)  8);
 +
 + /*
 +  * Set command write bit to initiate write operation.
 +  * The bit will be cleared when transfer is done.
 +  */
 + stk1160_write_reg(dev, STK1160_AC97CTL_0, 0x8c);
 +}
 +
 +static u16 stk1160_read_ac97(struct snd_ac97 *ac97, u16 reg)
 +{
 + struct stk1160 *dev = ac97-private_data;
 + u8 vall = 0;
 + u8 valh = 0;
 +
 + /* Set codec register address */
 + stk1160_write_reg(dev, STK1160_AC97_ADDR, reg);
 +
 + /*
 +  * Set command read bit to initiate read operation.
 +  * The bit will be cleared when transfer is done.
 +  */
 + stk1160_write_reg(dev, STK1160_AC97CTL_0, 0x8b);
 +
 + /* Retrieve register value */
 + stk1160_read_reg(dev, STK1160_AC97_CMD, vall);
 + stk1160_read_reg(dev, STK1160_AC97_CMD + 1, valh);
 +
 + return (valh  8) | vall;
 +}
 +
 +static void stk1160_reset_ac97(struct snd_ac97 *ac97)
 +{
 + struct stk1160 *dev = ac97-private_data;
 + /* Two-step reset AC97 interface and hardware codec */
 + stk1160_write_reg(dev, STK1160_AC97CTL_0, 0x94);
 + stk1160_write_reg(dev, STK1160_AC97CTL_0, 0x88);
 +
 + /* Set 16-bit audio data and choose LR channel*/
 

Re: [PATCH v3][for_v3.5] media: mx2_camera: Fix mbus format handling

2012-07-06 Thread Guennadi Liakhovetski
hmm... sorry again. It is my fault, that I left this patch without 
attention for full 5 weeks, but I still don't have a sufficiently good 
feeling about it. Look here:

On Fri, 6 Jul 2012, Guennadi Liakhovetski wrote:

 Hi Javier
 
 Thanks for the patch, and sorry for delay. I was away first 10 days of 
 June and still haven't come round to cleaning up my todo list since 
 then...
 
 On Fri, 1 Jun 2012, Javier Martin wrote:

[snip]

  @@ -1024,14 +1039,28 @@ static int mx2_camera_set_bus_param(struct 
  soc_camera_device *icd)
  return ret;
  }
   
  +   xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
  +   if (!xlate) {
  +   dev_warn(icd-parent, Format %x not found\n, pixfmt);
  +   return -EINVAL;
  +   }
  +
  +   if (xlate-code == V4L2_MBUS_FMT_YUYV8_2X8) {
  +   csicr1 |= CSICR1_PACK_DIR;
  +   csicr1 = ~CSICR1_SWAP16_EN;
  +   dev_dbg(icd-parent, already yuyv format, don't convert\n);
  +   } else if (xlate-code == V4L2_MBUS_FMT_UYVY8_2X8) {
  +   csicr1 = ~CSICR1_PACK_DIR;
  +   csicr1 |= CSICR1_SWAP16_EN;
  +   dev_dbg(icd-parent, convert uyvy mbus format into yuyv\n);
  +   }

This doesn't look right. From V4L2_MBUS_FMT_YUYV8_2X8 you can produce two 
output formats:

V4L2_PIX_FMT_YUV420 and
V4L2_PIX_FMT_YUYV

For both of them you set CSICR1_PACK_DIR, which wasn't the default before? 
Next for V4L2_MBUS_FMT_UYVY8_2X8. From this one you can produce 3 formats:

V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_YUYV and
V4L2_PIX_FMT_UYVY

For all 3 of them you now set CSICR1_SWAP16_EN. Are you sure all the above 
is correct?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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] em28xx: Remove useless runtime-private_data usage

2012-07-06 Thread Mauro Carvalho Chehab
Em 06-07-2012 11:33, Ezequiel Garcia escreveu:
 Mauro,
 
 On Thu, Jul 5, 2012 at 2:22 PM, Ezequiel Garcia  Are you sure that
 this can be removed? I think this is used internally
 by the alsa API, but maybe something has changed and this is not
 required anymore.

 Yes, I'm sure.

 
 This should be: I'm almost sure :-)
 Anyway, probably the patch should have a more verbose commit
 message, right?

Yeah, that would be good.

 Do you want to do drop it entirely?

No, but, as I'm taking a 2-week vacations starting next week, I'll postpone
those compiled-only cleanup patches to apply after my return, probably
holding them to be applied on 3.6.

Regards,
Mauro

--
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: stk1160 linux driver

2012-07-06 Thread Ezequiel Garcia
Gianluca,

On Mon, Jun 25, 2012 at 4:09 AM, Gianluca Bergamo
gianluca.berg...@gmail.com wrote:

 In my environment this command line gives only one format supported (UYVY)
 and then yavta freezes.
 I suspect it freezes on an ioctl to the driver. I must check it.


This freezing is actually a dead lock, and I think it's not related to
ARM but to a (now fixed) bug.

The bug was related to differences in locking scheme between v3.2 and
v3.4 kernel,
i.e. to make stk1160 work on v3.2 some fixes are needed, beside your
module_usb_driver
patch.

If you (or anyone) wants to use stk1160 on current kernels (3.2 and such) you
can checkout this github tree I've prepared to help user adoption of stk1160.

This is current (beta tested) branch:
https://github.com/ezequielgarcia/stk1160-standalone

And this is with keep_buffers parameter:
https://github.com/ezequielgarcia/stk1160-standalone/tree/0.9.4_v3.2

I don't know if you're still interested in using stk1160, but I wanted you to be
aware of this issue. As far as I know, there shouldn't be any issues
with ARM; if you can confirm this we'd appreciate it.

Regards,
Ezequiel.
--
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] em28xx: Remove useless runtime-private_data usage

2012-07-06 Thread Ezequiel Garcia
On Fri, Jul 6, 2012 at 12:12 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 Em 06-07-2012 11:33, Ezequiel Garcia escreveu:
 Mauro,

 On Thu, Jul 5, 2012 at 2:22 PM, Ezequiel Garcia  Are you sure that
 this can be removed? I think this is used internally
 by the alsa API, but maybe something has changed and this is not
 required anymore.

 Yes, I'm sure.


 This should be: I'm almost sure :-)
 Anyway, probably the patch should have a more verbose commit
 message, right?

 Yeah, that would be good.

 Do you want to do drop it entirely?

 No, but, as I'm taking a 2-week vacations starting next week, I'll postpone
 those compiled-only cleanup patches to apply after my return, probably
 holding them to be applied on 3.6.


Okey.

Have a nice holiday!
Ezequiel.
--
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] media: dvb-usb: print mac address via native %pM

2012-07-06 Thread Andy Shevchenko
Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
---
 drivers/media/dvb/dvb-usb/az6007.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/az6007.c 
b/drivers/media/dvb/dvb-usb/az6007.c
index 4008b9c..8ffcad0 100644
--- a/drivers/media/dvb/dvb-usb/az6007.c
+++ b/drivers/media/dvb/dvb-usb/az6007.c
@@ -593,9 +593,7 @@ static int az6007_read_mac_addr(struct dvb_usb_device *d, 
u8 mac[6])
memcpy(mac, st-data, sizeof(mac));
 
if (ret  0)
-   deb_info(%s: mac is %02x:%02x:%02x:%02x:%02x:%02x\n,
-__func__, mac[0], mac[1], mac[2],
-mac[3], mac[4], mac[5]);
+   deb_info(%s: mac is %pM\n, __func__, mac);
 
return ret;
 }
-- 
1.7.10.4

--
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/3] Visstrim M10: Add support for Coda.

2012-07-06 Thread Russell King - ARM Linux
On Fri, Jul 06, 2012 at 02:57:51PM +0200, Javier Martin wrote:
 Support the codadx6 that is included in
 the i.MX27 SoC.
 ---
  arch/arm/mach-imx/mach-imx27_visstrim_m10.c |   24 +---
  1 file changed, 21 insertions(+), 3 deletions(-)
 
 diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c 
 b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
 index f76edb9..bee2714 100644
 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
 +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
 @@ -232,10 +232,10 @@ static void __init visstrim_camera_init(void)
  static void __init visstrim_reserve(void)
  {
   /* reserve 4 MiB for mx2-camera */
 - mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
 + mx2_camera_base = memblock_alloc(2 * MX2_CAMERA_BUF_SIZE,
   MX2_CAMERA_BUF_SIZE);
 - memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
 - memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
 + memblock_free(mx2_camera_base, 2 * MX2_CAMERA_BUF_SIZE);
 + memblock_remove(mx2_camera_base, 2 * MX2_CAMERA_BUF_SIZE);

NAK.  If you're going to do this please move it to the right API:

 arch/arm/mach-imx/mach-imx27_visstrim_m10.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c 
b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index f7b074f..c27058e 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -32,12 +32,12 @@
 #include linux/delay.h
 #include linux/dma-mapping.h
 #include linux/leds.h
-#include linux/memblock.h
 #include media/soc_camera.h
 #include sound/tlv320aic32x4.h
 #include asm/mach-types.h
 #include asm/mach/arch.h
 #include asm/mach/time.h
+#include asm/memblock.h
 #include mach/common.h
 #include mach/iomux-mx27.h
 
@@ -193,10 +193,8 @@ static void __init visstrim_camera_init(void)
 static void __init visstrim_reserve(void)
 {
/* reserve 4 MiB for mx2-camera */
-   mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
+   mx2_camera_base = memblock_steal(MX2_CAMERA_BUF_SIZE,
MX2_CAMERA_BUF_SIZE);
-   memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
-   memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
 }
 
 /* GPIOs used as events for applications */

--
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 2/3] media: coda: Add driver for Coda video codec.

2012-07-06 Thread Russell King - ARM Linux
On Fri, Jul 06, 2012 at 02:57:50PM +0200, Javier Martin wrote:
 +config VIDEO_CODA
 + tristate ChipsMedia Coda multi-standard codec IP
 + depends on VIDEO_DEV  VIDEO_V4L2  SOC_IMX27
 + select VIDEOBUF2_DMA_CONTIG
 + select V4L2_MEM2MEM_DEV
 + default n

Please, no more 'default n'... it's the default default anyway.

 + ---help---
 +Coda is a range of video codec IPs that supports
 +H.264, MPEG-4, and other video formats.
 +
  config VIDEO_SAMSUNG_S5P_G2D
   tristate Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver
   depends on VIDEO_DEV  VIDEO_V4L2  PLAT_S5P
 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index d209de0..a04c307 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -187,6 +187,7 @@ obj-$(CONFIG_VIDEO_OMAP1) += omap1_camera.o
  obj-$(CONFIG_VIDEO_ATMEL_ISI)+= atmel-isi.o
  
  obj-$(CONFIG_VIDEO_MX2_EMMAPRP)  += mx2_emmaprp.o
 +obj-$(CONFIG_VIDEO_CODA) += coda.o
  
  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) += s5p-fimc/
  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg/
 diff --git a/drivers/media/video/coda.c b/drivers/media/video/coda.c
 new file mode 100644
 index 000..7b43345
 --- /dev/null
 +++ b/drivers/media/video/coda.c
 @@ -0,0 +1,1916 @@
 +/*
 + * Coda multi-standard codec IP
 + *
 + * Copyright (C) 2012 Vista Silicon S.L.
 + *Javier Martin, javier.mar...@vista-silicon.com
 + *Xavier Duret
 + *
 + * 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.
 + */
 +
 +#include linux/clk.h
 +#include linux/delay.h
 +#include linux/firmware.h
 +#include linux/interrupt.h
 +#include linux/io.h
 +#include linux/irq.h
 +#include linux/module.h
 +#include linux/of_device.h
 +#include linux/platform_device.h
 +#include linux/slab.h
 +#include linux/videodev2.h
 +
 +#include mach/hardware.h

What in here needs mach/hardware.h ?  We really should be questioning any
new driver that needs mach/ headers...
--
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: pctv452e

2012-07-06 Thread Antti Palosaari

On 07/06/2012 02:04 PM, Marx wrote:

On 06.07.2012 11:34, Antti Palosaari wrote:

Did I missed something? PCTV device does not support CI/CAM and thus no
support for encrypted channels. Is there still CI slot?


no, I simply use external reader with plugin in VDR. Unfortunetelly on
Hotbird there is no unencrypted HD channel I can use to test.


From the driver / device perspective HD or SD channel does not have 
much difference - difference is just used video codec and likely wider 
stream. For demodulator driver perspective there could some difference 
as HD channels are more often transmitted using DVB-S2 standard - but 
not always.


Also as you are using SoftCAM there is no difference from driver POV if 
stream is encrypted or unencrypted. Device just moves bits from the 
antenna to the computer - it does not know if those bits are encrypted 
or not.



Anyway when using card logs are full of i2c errors


Argh! But this must be issue of earlier driver too.


yes, those errors were in logs earlier on previous driver. Hovewer
previous driver allowed to play only once or two time and then was
stopping work. And i've never played successfully HD channel on this card.


Could you say what was the original problem of your device?


I debug it and it seems to be totally clueless implementation of
stb6100_read_reg() as it sets device address like device address +
register address. This makes stb6100 I2C address of tuner set for that
request 0x66 whilst it should be 0x60. Is that code never tested...

pctv452e DVB USB driver behaves just correctly as it says this is not
valid and returns error.

Also pctv452e I2C adapter supports only I2C operations that are done
with repeated STOP condition - but I cannot see there is logic to sent
STOP after last message. I suspect it is not correct as logically but
will work - very common mistake with many I2C adapters we have.


Oops, s/repeated STOP condition/repeated START condition/


I have second card in this computer
http://www.proftuners.com/prof8000.html
which uses STB6100 (and also STV0903 and CX23885).
I wasn't aware that both of this card uses the same chip (as I see from
http://www.linuxtv.org/wiki/index.php/TechnoTrend_TT-connect_S2-3650_CI
it uses STB6100 too).
Can it be a problem? Anyway i will take off this second card a test again.


I never say it could not be problem, but it is highly unlikely. Anyhow 
it is possible there is some static variables inside driver that could 
have effect. But it is very very unlikely and those kind of shared 
variables should not exits without very good reason.



Regardless of those errors it still works?


Thank you for help. I had only a few minutes at the morning to test it
and it partly worked. More test are planned tonight and I will write
here outcomes.


Still waiting


regards
Antti

--
http://palosaari.fi/


--
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


cron job: media_tree daily build: ERRORS

2012-07-06 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:Fri Jul  6 19:00:23 CEST 2012
git hash:cd5534be6bc681d6a5ca62b3b6066ff8515e1aac
gcc version:  i686-linux-gcc (GCC) 4.7.1
host hardware:x86_64
host os:  3.4.07-marune

linux-git-arm-eabi-davinci: ERRORS
linux-git-arm-eabi-exynos: ERRORS
linux-git-arm-eabi-omap: ERRORS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
linux-2.6.31.12-x86_64: ERRORS
linux-2.6.32.6-x86_64: ERRORS
linux-2.6.33-x86_64: WARNINGS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
linux-3.4-x86_64: WARNINGS
linux-2.6.31.12-i686: ERRORS
linux-2.6.32.6-i686: ERRORS
linux-2.6.33-i686: WARNINGS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-i686: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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


Re: [GIT PULL FOR v3.5] S5P driver fixes

2012-07-06 Thread Mauro Carvalho Chehab
Em 29-06-2012 15:05, Sylwester Nawrocki escreveu:
 Hi Mauro,
 
 On 06/28/2012 06:29 PM, Sylwester Nawrocki wrote:

 The following changes since commit 433002d69888238b16f8ea9434447feaa1fc9bf0:

Merge remote-tracking branch 'party-public/v4l-fimc-fixes' into v4l-fixes
 (2012-06-27 16:28:08 +0200)

 are available in the git repository at:


git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes

 for you to fetch changes up to f8a623efac978987be818a0a9d2d407791a066e4:

Revert [media] V4L: JPEG class documentation corrections (2012-06-27
 16:31:20 +0200)

 
 Kamil Debski (1):
s5p-mfc: Fixed setup of custom controls in decoder and encoder

 Sylwester Nawrocki (2):
s5p-fimc: Add missing FIMC-LITE file operations locking

 This patch depends on my previous pull request:
 http://patchwork.linuxtv.org/patch/11503

Revert [media] V4L: JPEG class documentation corrections

   Documentation/DocBook/media/v4l/controls.xml   |2 +-
   Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
   drivers/media/video/s5p-fimc/fimc-lite.c   |   61
 -
   drivers/media/video/s5p-mfc/s5p_mfc_dec.c  |1 +
   drivers/media/video/s5p-mfc/s5p_mfc_enc.c  |1 +
   5 files changed, 47 insertions(+), 25 deletions(-)
 
 Sorry, I messed up this pull request by rebasing it onto wrong branch.
 Here it is corrected, against staging/for_v3.5 and on top of merged
 v4l-fimc-fixes branch, as per http://patchwork.linuxtv.org/patch/11503
 
 
 The following changes since commit 96fc9f0f51d6b0d807aeb1f6e38485a3de429fd4:
 
s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails 
 (2012-06-05 13:28:25 +0200)
 
 are available in the git repository at:
 
git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes
 
 for you to fetch changes up to c7de5370086a948c67cb7eeb5f25178c8979b0fe:
 
Revert [media] V4L: JPEG class documentation corrections (2012-06-29 
 16:00:33 +0200)
 
 
 Kamil Debski (1):
s5p-mfc: Fixed setup of custom controls in decoder and encoder

This patch applied OK.

 Sylwester Nawrocki (2):
s5p-fimc: Add missing FIMC-LITE file operations locking

This one didn't apply for v3.5:

Applying patch 
patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch
patching file drivers/media/video/s5p-fimc/fimc-lite.c
Hunk #1 FAILED at 453.
Hunk #2 succeeded at 492 (offset -2 lines).
1 out of 2 hunks FAILED -- rejects in file 
drivers/media/video/s5p-fimc/fimc-lite.c
Patch patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch 
does not apply (enforce with -f)
Patch didn't apply. Aborting


Revert [media] V4L: JPEG class documentation corrections

My scripts say that this patch were already applied.

$ test_patch
testing if 
patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch applies
patch -p1 -i 
patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch 
--dry-run -t -N
patching file Documentation/DocBook/media/v4l/controls.xml
patching file Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 Documentation/DocBook/media/v4l/controls.xml   |2 +-
 Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
 2 files changed, 1 insertion(+), 8 deletions(-)
Subject: Revert [media] V4L: JPEG class documentation corrections
From: Sylwester Nawrocki s.nawro...@samsung.com
Date: Wed, 27 Jun 2012 15:12:31 +0200
Patch applies OK
total: 0 errors, 0 warnings, 21 lines checked

patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch has no 
obvious style problems and is ready for submission.
Patch is likely applied

So, from this series, I'll only apply the s5p-fimc: Add missing FIMC-LITE file 
operations locking
patch.

Regards,
Mauro
--
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 1/5] libdvbv5: Fix dvb-file USER CMD

2012-07-06 Thread André Roth
Signed-off-by: André Roth neol...@gmail.com
---
 lib/libdvbv5/dvb-file.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 5ab0d97..ea9caa0 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -387,7 +387,7 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
break;
}
if (i  ARRAY_SIZE(dvb_v5_name)) {
-   const char * const *attr_name = dvb_v5_attr_names[i];
+   const char * const *attr_name = dvb_attr_names(i);
n_prop = entry-n_props;
entry-props[n_prop].cmd = i;
if (!attr_name || !*attr_name)
@@ -412,7 +412,7 @@ static int fill_entry(struct dvb_entry *entry, char *key, 
char *value)
break;
}
if (i  ARRAY_SIZE(dvb_user_name)) {
-   const char * const *attr_name = dvb_user_attr_names[i];
+   const char * const *attr_name = dvb_attr_names(i);
n_prop = entry-n_props;
entry-props[n_prop].cmd = i + DTV_USER_COMMAND_START;
if (!attr_name || !*attr_name)
-- 
1.7.2.5

--
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 2/5] libdvbv5: Fix set delsys other than current

2012-07-06 Thread André Roth
Signed-off-by: André Roth neol...@gmail.com
---
 lib/libdvbv5/dvb-fe.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 4fb927a..9b18226 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -392,8 +392,8 @@ int dvb_set_compat_delivery_system(struct dvb_v5_fe_parms 
*parms,
for (i = 0; i  parms-num_systems; i++) {
if (parms-systems[i] == desired_system) {
dvb_set_sys(parms, desired_system);
+   return 0;
}
-   return 0;
}
 
/*
-- 
1.7.2.5

--
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 4/5] libdvbv5: Fix DiSEqC and LNB handling

2012-07-06 Thread André Roth
Signed-off-by: André Roth neol...@gmail.com
---
 lib/include/dvb-fe.h  |2 +-
 lib/libdvbv5/dvb-fe.c |   61 +
 lib/libdvbv5/dvb-sat.c|   13 +
 lib/libdvbv5/dvb-v5-std.c |8 +++---
 4 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index a91a627..8b795cb 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -166,7 +166,7 @@ const char * const *dvb_attr_names(int cmd);
  */
 
 int dvb_fe_sec_voltage(struct dvb_v5_fe_parms *parms, int on, int v18);
-int dvb_fe_sec_tone(struct dvb_v5_fe_parms *parms, int on);
+int dvb_fe_sec_tone(struct dvb_v5_fe_parms *parms, fe_sec_tone_mode_t tone);
 int dvb_fe_lnb_high_voltage(struct dvb_v5_fe_parms *parms, int on);
 int dvb_fe_diseqc_burst(struct dvb_v5_fe_parms *parms, int mini_b);
 int dvb_fe_diseqc_cmd(struct dvb_v5_fe_parms *parms, const unsigned len,
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 9ff5b7b..1ef7b0d 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -534,7 +534,7 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
/* DVBv3 call */
if (ioctl(parms-fd, FE_GET_FRONTEND, v3_parms) == -1) {
dvb_perror(FE_GET_FRONTEND);
-   return errno;
+   return -1;
}
 
dvb_fe_store_parm(parms, DTV_FREQUENCY, v3_parms.frequency);
@@ -603,7 +603,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
dvb_perror(FE_SET_PROPERTY);
if (parms-verbose)
dvb_fe_prt_parms(parms);
-   return errno;
+   return -1;
}
goto ret;
}
@@ -645,7 +645,7 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
dvb_perror(FE_SET_FRONTEND);
if (parms-verbose)
dvb_fe_prt_parms(parms);
-   return errno;
+   return -1;
}
 ret:
/* For satellite, need to recover from LNBf IF frequency */
@@ -798,41 +798,43 @@ int dvb_fe_sec_voltage(struct dvb_v5_fe_parms *parms, int 
on, int v18)
fe_sec_voltage_t v;
int rc;
 
-   if (!on)
+   if (!on) {
v = SEC_VOLTAGE_OFF;
-   else
+   if (parms-verbose)
+   dvb_log(DiSEqC VOLTAGE: OFF);
+   } else {
v = v18 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13;
-
+   if (parms-verbose)
+   dvb_log(DiSEqC VOLTAGE: %s, v18 ? 18 : 13);
+   }
rc = ioctl(parms-fd, FE_SET_VOLTAGE, v);
if (rc == -1)
-   perror (FE_SET_VOLTAGE);
-   return errno;
+   dvb_perror(FE_SET_VOLTAGE);
+   return rc;
 }
 
-int dvb_fe_sec_tone(struct dvb_v5_fe_parms *parms, int on)
+int dvb_fe_sec_tone(struct dvb_v5_fe_parms *parms, fe_sec_tone_mode_t tone)
 {
-   fe_sec_tone_mode_t tone;
int rc;
-
-   tone = on ? SEC_TONE_ON : SEC_TONE_OFF;
-
+   if (parms-verbose)
+   dvb_log( DiSEqC TONE: %s, fe_tone_name[tone] );
rc = ioctl(parms-fd, FE_SET_TONE, tone);
if (rc == -1)
-   perror (FE_SET_TONE);
-   return errno;
+   dvb_perror(FE_SET_TONE);
+   return rc;
 }
 
 int dvb_fe_lnb_high_voltage(struct dvb_v5_fe_parms *parms, int on)
 {
int rc;
 
-   if (on)
-   on = 1;
-
+   if (on) on = 1;
+   if (parms-verbose)
+   dvb_log( DiSEqC HIGH LNB VOLTAGE: %s, on ? ON : OFF );
rc = ioctl(parms-fd, FE_ENABLE_HIGH_LNB_VOLTAGE, on);
if (rc == -1)
-   perror (FE_ENABLE_HIGH_LNB_VOLTAGE);
-   return errno;
+   dvb_perror(FE_ENABLE_HIGH_LNB_VOLTAGE);
+   return rc;
 }
 
 int dvb_fe_diseqc_burst(struct dvb_v5_fe_parms *parms, int mini_b)
@@ -842,10 +844,12 @@ int dvb_fe_diseqc_burst(struct dvb_v5_fe_parms *parms, 
int mini_b)
 
mini = mini_b ? SEC_MINI_B : SEC_MINI_A;
 
+   if (parms-verbose)
+   dvb_log( DiSEqC BURST: %s, mini_b ? SEC_MINI_B : 
SEC_MINI_A );
rc = ioctl(parms-fd, FE_DISEQC_SEND_BURST, mini);
if (rc == -1)
-   perror (FE_DISEQC_SEND_BURST);
-   return errno;
+   dvb_perror(FE_DISEQC_SEND_BURST);
+   return rc;
 }
 
 int dvb_fe_diseqc_cmd(struct dvb_v5_fe_parms *parms, const unsigned len,
@@ -864,16 +868,16 @@ int dvb_fe_diseqc_cmd(struct dvb_v5_fe_parms *parms, 
const unsigned len,
int i;
char log[len * 3 + 20], *p = log;
 
-   p += sprintf(p, DiSEqC cmd: );
+   p += sprintf(p, DiSEqC command: );
for (i = 0; i  len; i++)
-   p += sprintf (p, 0x%02x , buf[i]);
+   p += sprintf (p, %02x , buf[i]);
dvb_log(log);
}
 
rc = ioctl(parms-fd, FE_DISEQC_SEND_MASTER_CMD, msg);
   

[PATCH 5/5] libdvbv5: Support multi section DVB tables, string parsing

2012-07-06 Thread André Roth
Signed-off-by: André Roth neol...@gmail.com
---
 lib/include/descriptors.h  |   15 ++-
 lib/include/descriptors/desc_cable_delivery.h  |2 +-
 lib/include/descriptors/desc_frequency_list.h  |2 +-
 lib/include/descriptors/desc_language.h|2 +-
 lib/include/descriptors/desc_network_name.h|2 +-
 lib/include/descriptors/desc_sat.h |2 +-
 lib/include/descriptors/desc_service.h |2 +-
 lib/include/descriptors/desc_service_list.h|2 +-
 .../descriptors/desc_terrestrial_delivery.h|2 +-
 lib/include/descriptors/nit.h  |2 +-
 lib/include/descriptors/pat.h  |2 +-
 lib/include/descriptors/pmt.h  |   12 +-
 lib/include/descriptors/sdt.h  |2 +-
 lib/include/dvb-scan.h |2 +-
 lib/libdvbv5/descriptors.c |   88 +
 lib/libdvbv5/descriptors/desc_network_name.c   |   24 +++-
 lib/libdvbv5/descriptors/desc_service.c|   46 +-
 lib/libdvbv5/descriptors/nit.c |   65 ++
 lib/libdvbv5/descriptors/pat.c |   37 +++---
 lib/libdvbv5/descriptors/pmt.c |   87 ++--
 lib/libdvbv5/descriptors/sdt.c |   57 +---
 lib/libdvbv5/dvb-scan.c|  143 +++
 lib/libdvbv5/parse_string.c|   16 ++-
 lib/libdvbv5/parse_string.h|4 +-
 utils/dvb/dvbv5-scan.c |2 +-
 25 files changed, 391 insertions(+), 229 deletions(-)

diff --git a/lib/include/descriptors.h b/lib/include/descriptors.h
index 8ecb13d..0493e80 100644
--- a/lib/include/descriptors.h
+++ b/lib/include/descriptors.h
@@ -35,13 +35,15 @@
 
 struct dvb_v5_fe_parms;
 
-typedef void *(*dvb_table_init_func)(struct dvb_v5_fe_parms *parms, const 
uint8_t *ptr, ssize_t size);
+typedef void (*dvb_table_init_func)(struct dvb_v5_fe_parms *parms, const 
uint8_t *ptr, ssize_t size, uint8_t **buf, ssize_t *buflen);
 
 struct dvb_table_init {
dvb_table_init_func init;
 };
 
 extern const struct dvb_table_init dvb_table_initializers[];
+extern char *default_charset;
+extern char *output_charset;
 
 #define bswap16(b) do {\
b = be16toh(b); \
@@ -53,11 +55,15 @@ extern const struct dvb_table_init dvb_table_initializers[];
 
 struct dvb_desc {
uint8_t type;
-   struct dvb_desc *next;
uint8_t length;
+   struct dvb_desc *next;
+
uint8_t data[];
 } __attribute__((packed));
 
+ssize_t dvb_desc_default_init(struct dvb_v5_fe_parms *parms, const uint8_t 
*buf, struct dvb_desc *desc);
+void dvb_desc_default_print  (struct dvb_v5_fe_parms *parms, const struct 
dvb_desc *desc);
+
 #define dvb_desc_foreach( _desc, _tbl ) \
for( struct dvb_desc *_desc = _tbl-descriptor; _desc; _desc = 
_desc-next ) \
 
@@ -69,7 +75,10 @@ ssize_t dvb_desc_init(const uint8_t *buf, struct dvb_desc 
*desc);
 
 uint32_t bcd(uint32_t bcd);
 
+void hexdump(struct dvb_v5_fe_parms *parms, const char *prefix, const unsigned 
char *buf, int len);
+
 ssize_t dvb_parse_descriptors(struct dvb_v5_fe_parms *parms, const uint8_t 
*buf, uint8_t *dest, uint16_t section_length, struct dvb_desc **head_desc);
+void dvb_print_descriptors(struct dvb_v5_fe_parms *parms, struct dvb_desc 
*desc);
 
 struct dvb_v5_fe_parms;
 
@@ -381,7 +390,7 @@ struct dvb_v5_descriptors {
unsigned cur_ts;
 };
 
-void parse_descriptor(enum dvb_tables type,
+void parse_descriptor(struct dvb_v5_fe_parms *parms, enum dvb_tables type,
struct dvb_v5_descriptors *dvb_desc,
const unsigned char *buf, int len);
 
diff --git a/lib/include/descriptors/desc_cable_delivery.h 
b/lib/include/descriptors/desc_cable_delivery.h
index 4d10a29..bdbe706 100644
--- a/lib/include/descriptors/desc_cable_delivery.h
+++ b/lib/include/descriptors/desc_cable_delivery.h
@@ -27,8 +27,8 @@
 
 struct dvb_desc_cable_delivery {
uint8_t type;
-   struct dvb_desc *next;
uint8_t length;
+   struct dvb_desc *next;
 
uint32_t frequency;
union {
diff --git a/lib/include/descriptors/desc_frequency_list.h 
b/lib/include/descriptors/desc_frequency_list.h
index 21f0256..80a7fb9 100644
--- a/lib/include/descriptors/desc_frequency_list.h
+++ b/lib/include/descriptors/desc_frequency_list.h
@@ -27,8 +27,8 @@
 
 struct dvb_desc_frequency_list {
uint8_t type;
-   struct dvb_desc *next;
uint8_t length;
+   struct dvb_desc *next;
 
union {
uint8_t bitfield;
diff --git a/lib/include/descriptors/desc_language.h 
b/lib/include/descriptors/desc_language.h
index 321a948..eca9cdb 100644
--- a/lib/include/descriptors/desc_language.h
+++ b/lib/include/descriptors/desc_language.h
@@ -27,8 +27,8 @@
 
 struct dvb_desc_language {
uint8_t 

Re: [PATCH 1/1] Add support for newer PCTV 800i cards with s5h1411 demodulators

2012-07-06 Thread Mauro Carvalho Chehab
Em 29-06-2012 01:38, Mack Stanley escreveu:
 I'm sorry to have missed the word-wrap.  Here's a new copy. ---Mack
 
 Testing needed on older (Pinnacle) PCTV 800i cards with S5H1409 demodulators
 to check that current support for them isn't broken by this patch.
 
 Signed-off-by: Mack Stanley mcs1...@gmail.com
 ---
   drivers/media/video/cx88/cx88-dvb.c |   40
 --


It is still completely mangled. It is impossible to apply it this way.

Regards,
Mauro

   1 files changed, 28 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/media/video/cx88/cx88-dvb.c
 b/drivers/media/video/cx88/cx88-dvb.c
 index 003937c..6d49672 100644
 --- a/drivers/media/video/cx88/cx88-dvb.c
 +++ b/drivers/media/video/cx88/cx88-dvb.c
 @@ -501,7 +501,7 @@ static const struct cx24123_config
 kworld_dvbs_100_config = {
  .lnb_polarity  = 1,
   };
 
 -static const struct s5h1409_config pinnacle_pctv_hd_800i_config = {
 +static const struct s5h1409_config pinnacle_pctv_hd_800i_s5h1409_config = {
  .demod_address = 0x32  1,
  .output_mode   = S5H1409_PARALLEL_OUTPUT,
  .gpio  = S5H1409_GPIO_ON,
 @@ -509,7 +509,7 @@ static const struct s5h1409_config
 pinnacle_pctv_hd_800i_config = {
  .inversion = S5H1409_INVERSION_OFF,
  .status_mode   = S5H1409_DEMODLOCKING,
  .mpeg_timing   = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
 -};
 +};
 
   static const struct s5h1409_config dvico_hdtv5_pci_nano_config = {
  .demod_address = 0x32  1,
 @@ -556,6 +556,16 @@ static const struct s5h1411_config
 dvico_fusionhdtv7_config = {
  .status_mode   = S5H1411_DEMODLOCKING
   };
 
 +static const struct s5h1411_config pinnacle_pctv_hd_800i_s5h1411_config = {
 +   .output_mode   = S5H1411_PARALLEL_OUTPUT,
 +   .gpio  = S5H1411_GPIO_ON,
 +   .mpeg_timing   = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
 +   .qam_if= S5H1411_IF_44000,
 +   .vsb_if= S5H1411_IF_44000,
 +   .inversion = S5H1411_INVERSION_OFF,
 +   .status_mode   = S5H1411_DEMODLOCKING
 +};
 +
   static const struct xc5000_config dvico_fusionhdtv7_tuner_config = {
  .i2c_address= 0xc2  1,
  .if_khz = 5380,
 @@ -1297,16 +1307,22 @@ static int dvb_register(struct cx8802_dev *dev)
  }
  break;
  case CX88_BOARD_PINNACLE_PCTV_HD_800i:
 -   fe0-dvb.frontend = dvb_attach(s5h1409_attach,
 -
 pinnacle_pctv_hd_800i_config,
 -  core-i2c_adap);
 -   if (fe0-dvb.frontend != NULL) {
 -   if (!dvb_attach(xc5000_attach, fe0-dvb.frontend,
 -   core-i2c_adap,
 -
 pinnacle_pctv_hd_800i_tuner_config))
 -   goto frontend_detach;
 -   }
 -   break;
 +   /* Try s5h1409 chip first */
 +   fe0-dvb.frontend = dvb_attach(s5h1409_attach,
 +
 pinnacle_pctv_hd_800i_s5h1409_config,
 +   core-i2c_adap);
 +   /* Otherwise, try s5h1411 */
 +   if (fe0-dvb.frontend == NULL)
 +   fe0-dvb.frontend = dvb_attach(s5h1411_attach,
 +
 pinnacle_pctv_hd_800i_s5h1411_config,
 +   core-i2c_adap);
 +   if (fe0-dvb.frontend != NULL) {
 +   if (!dvb_attach(xc5000_attach, fe0-dvb.frontend,
 +   core-i2c_adap,
 +
 pinnacle_pctv_hd_800i_tuner_config))
 +   goto frontend_detach;
 +   }
 +   break;
  case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
  fe0-dvb.frontend = dvb_attach(s5h1409_attach,
 
 dvico_hdtv5_pci_nano_config,
 --
 1.7.7.6
 
 
 --
 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
 


--
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: [GIT PULL FOR v3.5] S5P driver fixes

2012-07-06 Thread Sylwester Nawrocki
On 07/06/2012 09:10 PM, Mauro Carvalho Chehab wrote:
 Em 29-06-2012 15:05, Sylwester Nawrocki escreveu:
 Hi Mauro,

 On 06/28/2012 06:29 PM, Sylwester Nawrocki wrote:

 The following changes since commit 433002d69888238b16f8ea9434447feaa1fc9bf0:

 Merge remote-tracking branch 'party-public/v4l-fimc-fixes' into 
 v4l-fixes
 (2012-06-27 16:28:08 +0200)

 are available in the git repository at:


 git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes

 for you to fetch changes up to f8a623efac978987be818a0a9d2d407791a066e4:

 Revert [media] V4L: JPEG class documentation corrections (2012-06-27
 16:31:20 +0200)

 
 Kamil Debski (1):
 s5p-mfc: Fixed setup of custom controls in decoder and encoder

 Sylwester Nawrocki (2):
 s5p-fimc: Add missing FIMC-LITE file operations locking

 This patch depends on my previous pull request:
 http://patchwork.linuxtv.org/patch/11503

 Revert [media] V4L: JPEG class documentation corrections

Documentation/DocBook/media/v4l/controls.xml   |2 +-
Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
drivers/media/video/s5p-fimc/fimc-lite.c   |   61
 -
drivers/media/video/s5p-mfc/s5p_mfc_dec.c  |1 +
drivers/media/video/s5p-mfc/s5p_mfc_enc.c  |1 +
5 files changed, 47 insertions(+), 25 deletions(-)

 Sorry, I messed up this pull request by rebasing it onto wrong branch.
 Here it is corrected, against staging/for_v3.5 and on top of merged
 v4l-fimc-fixes branch, as per http://patchwork.linuxtv.org/patch/11503


 The following changes since commit 96fc9f0f51d6b0d807aeb1f6e38485a3de429fd4:

 s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails 
 (2012-06-05 13:28:25 +0200)

 are available in the git repository at:

 git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes

 for you to fetch changes up to c7de5370086a948c67cb7eeb5f25178c8979b0fe:

 Revert [media] V4L: JPEG class documentation corrections (2012-06-29 
 16:00:33 +0200)

 
 Kamil Debski (1):
 s5p-mfc: Fixed setup of custom controls in decoder and encoder
 
 This patch applied OK.
 
 Sylwester Nawrocki (2):
 s5p-fimc: Add missing FIMC-LITE file operations locking
 
 This one didn't apply for v3.5:

Hmm, perhaps because these previous fixes aren't applied yet
http://patchwork.linuxtv.org/patch/11503 ?

 Applying patch 
 patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch
 patching file drivers/media/video/s5p-fimc/fimc-lite.c
 Hunk #1 FAILED at 453.
 Hunk #2 succeeded at 492 (offset -2 lines).
 1 out of 2 hunks FAILED -- rejects in file 
 drivers/media/video/s5p-fimc/fimc-lite.c
 Patch patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch 
 does not apply (enforce with -f)
 Patch didn't apply. Aborting
 
 
 Revert [media] V4L: JPEG class documentation corrections
 
 My scripts say that this patch were already applied.
 
 $ test_patch
 testing if 
 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch 
 applies
 patch -p1 -i 
 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch 
 --dry-run -t -N
 patching file Documentation/DocBook/media/v4l/controls.xml
 patching file Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
   Documentation/DocBook/media/v4l/controls.xml   |2 +-
   Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
   2 files changed, 1 insertion(+), 8 deletions(-)
 Subject: Revert [media] V4L: JPEG class documentation corrections
 From: Sylwester Nawrockis.nawro...@samsung.com
 Date: Wed, 27 Jun 2012 15:12:31 +0200
 Patch applies OK
 total: 0 errors, 0 warnings, 21 lines checked
 
 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch has 
 no obvious style problems and is ready for submission.
 Patch is likely applied

I'm not sure why it doesn't apply now, but the issue is still there, 
two similar patches exist in v3.5:

http://git.linuxtv.org/linux-2.6.git/history/c4aed353b1b079eb4843e6a708fc68b4b28f72aa:/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml

One of them just needs to be reverted. I described this issue previously:
http://www.spinics.net/lists/linux-media/msg47879.html

And then decided to send a reverting patch myself.

I tried all three patches on latest Linus' tree and they applied cleanly
(but I had applied fixups from v4l-fimc-fixes first).

 So, from this series, I'll only apply the s5p-fimc: Add missing FIMC-LITE 
 file operations locking
 patch.

Regards,
Sylwester
--
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 1/1] Add support for newer PCTV 800i cards with s5h1411 demodulators

2012-07-06 Thread Devin Heitmueller
On Fri, Jul 6, 2012 at 3:39 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 Em 29-06-2012 01:38, Mack Stanley escreveu:
 I'm sorry to have missed the word-wrap.  Here's a new copy. ---Mack

 Testing needed on older (Pinnacle) PCTV 800i cards with S5H1409 demodulators
 to check that current support for them isn't broken by this patch.

 Signed-off-by: Mack Stanley mcs1...@gmail.com
 ---
   drivers/media/video/cx88/cx88-dvb.c |   40
 --


 It is still completely mangled. It is impossible to apply it this way.

 Regards,
 Mauro

Mack,

Assuming this is a git tree, just use git format-patch followed by
git send-email.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.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: media_build and Terratec Cinergy T Black.

2012-07-06 Thread Hin-Tak Leung
--- On Fri, 6/7/12, Antti Palosaari cr...@iki.fi wrote:

 On 07/06/2012 01:54 PM, Hin-Tak Leung
 wrote:
  - $ lsdvb seems to be doing garbage:(fedora 17's)
  
  usb (-1975381336:62 64848224:32767) on PCI
 Domain:-1965359032 Bus:62 Device:64848416 Function:32767
      DEVICE:0 ADAPTER:0 FRONTEND:0
 (Realtek RTL2832 (DVB-T))
     
  FE_OFDM Fmin=174MHz
 Fmax=862MHz
  
  lsdvb on mercury is only marginally better with the PCI
 zero's, but the other numbers swapped:
  
  usb (62:-1975379912 32767:-348245472) on PCI Domain:0
 Bus:0 Device:0 Function:0
      DEVICE:0 ADAPTER:0 FRONTEND:0
 (Realtek RTL2832 (DVB-T))
     
  FE_OFDM Fmin=174MHz
 Fmax=862MHz
 
 I was aware of that tool but didn't know it lists USB
 devices too.
 Someone should fix it working properly for USB devices.

The mercury repository is on linuxtv, so presumably one of you can do it :-). 
It is wierd that (1) those numbers are swapped between fc17's vs upstream, (2) 
the numbers also change between runs
 
  - 'scandvb' segfault at the end on its own.
 
 I didn't see that.

This is fc17's - it does so in a string function (v*printf) - probably easy to 
fix if/when I get the debuginfo package, if it isn't fixed upstream already.

  - scandvb /usr/share/dvb/dvb-t/uk-SandyHeath
 (supposedly where I am) got a few WARNING: 
 tuning failed!!! and no list.

This is where it gets confusing - /usr/share/dvb/dvb-t/* and  
/usr/share/doc/dvb-apps-1.1.2/channels-conf/dvb-t/* have similiar names, but 
different content, and no explanation which is which. The latter seems to be in 
the correct format you wrote below, but does not work.

One thing would be nice to do would be write up a description of those formats, 
and say which is which.

  - 'w_scan -G -c GB'
     have a few curious
  WARNING: received garbage data: crc = 0xcc93876c;
 expected crc = 0xb81bb6c4
  
  return a list of 26, with entries like (which seems to
 be vaguely correct):
  
  BBC
 ONE;(null):522000:B8C23D0G32M64T8Y0:T:27500:101=2:102,106=eng:0:0:4173:9018:4173:0:100

w_scan is the only one which seems to be able to scan, but its output format 
isn't correct.

Any ideas about the garbage data message?

 Both scandvb and w_scan works here, same device used. I
 suspect your signal is just simply too weak for reception.
 Small antenna coming with those DVB sticks is not suitable
 unless you are living very near transmitter. Try to connect
 it roof antenna. One thing that helps a lot is to attach
 small bundled antenna to outside window.

I was using my satellite dish as antenna, BTW. Nothing with the small antenna.

 There is both dvbscan and scandvb in Fedora dvb-apps. It is
 not clear for me why two similar looking tools. Anyhow it is
 just scandvb which I found working one.

I just found a dvbv5-scan on my harddisk (fc17) also, and dvbscan is in 
locate.db but gone. Apparently one might be 'scan' but too confusing and got 
its name changed during packaging.


  So I just put it in ~/.mplayer:channels.conf
  
  Took me a while to figure out that mplayer wants:
  
  mplayer 'dvb://BBC ONE;(null)'
  
  rather than anything else - curious about the ';(null)'
 part.
  
  
  Playing dvb://BBC ONE;(null).
  dvb_tune Freq: 522000
  ERROR IN SETTING DMX_FILTER 9018 for fd 4: ERRNO:
 22ERROR, COULDN'T SET CHANNEL  8: Failed to open
 dvb://BBC ONE;(null).
  --
 
 Typical channels.conf entry looks like that:
 MTV3:71400:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:305:561:49
 
 And tuning to that channel using mplayer:
 mplayer dvb://MTV3

Well that at least clear up something - I tried this form (from  
/usr/share/doc/dvb-apps-1.1.2/channels-conf/dvb-t/* ) but did not get anything 
either - the error message seemed worse so I didn't go further. I guess I 
should try getting w_scan to do this form.

 However, I prefer VLC. Just open channels.conf to VLC and
 should show playlist. Totem does not work anymore. at least
 stream used here in Finland. It went broken when they
 changed from playbin to playbin2 which is really shame as it
 is default video player for Gnome desktop.
 
 
  At this point I am lost :-).
 
 Not big surprise unfortunately :/
 
 Unfortunately desktop integration is currently poor and most
 users are coming from the HTPC.

There seems to be at least two channels.conf formats (one for 
mplayer/vlc/gstreamer, one for vdr?), and unfortunately both seems to have the 
same name conventionally, but different content. I can't find documentation 
about either, or even examples :-).

I am also surprised by the checksum failed message with w_scan, and that it 
does not change output format with adding options, etc.

--
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] media: gpio-ir-recv: add allowed_protos and map_name for platform data

2012-07-06 Thread Mauro Carvalho Chehab
Em 03-07-2012 08:19, Benoît Thébaudeau escreveu:
 Hi Changbin,
 
 On Tue, Jul 3, 2012 at 12:27:19PM +0200, Changbin Du wrote:
 It's better to give platform code a chance to specify the allowed
 protocols and which keymap to use.
 
 Already half done here:
 http://git.linuxtv.org/media_tree.git?a=commitdiff;h=2bd237b

OK. Applied just the other half of the change.

Regards,
Mauro

-

[media] media: gpio-ir-recv: add allowed_protos for platform data

From: Du, Changbin changbin...@gmail.com

It's better to give platform code a chance to specify the allowed
protocols to use.

[mche...@redhat.com: fix merge conflict with a patch that made
 half of this change]
Signed-off-by: Du, Changbin changbin...@gmail.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 59fe60c..04cb272 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -84,7 +84,6 @@ static int __devinit gpio_ir_recv_probe(struct 
platform_device *pdev)
 
rcdev-priv = gpio_dev;
rcdev-driver_type = RC_DRIVER_IR_RAW;
-   rcdev-allowed_protos = RC_TYPE_ALL;
rcdev-input_name = GPIO_IR_DEVICE_NAME;
rcdev-input_phys = GPIO_IR_DEVICE_NAME /input0;
rcdev-input_id.bustype = BUS_HOST;
@@ -93,6 +92,10 @@ static int __devinit gpio_ir_recv_probe(struct 
platform_device *pdev)
rcdev-input_id.version = 0x0100;
rcdev-dev.parent = pdev-dev;
rcdev-driver_name = GPIO_IR_DRIVER_NAME;
+   if (pdata-allowed_protos)
+   rcdev-allowed_protos = pdata-allowed_protos;
+   else
+   rcdev-allowed_protos = RC_TYPE_ALL;
rcdev-map_name = pdata-map_name ?: RC_MAP_EMPTY;
 
gpio_dev-rcdev = rcdev;
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
index 91546f3..0142736 100644
--- a/include/media/gpio-ir-recv.h
+++ b/include/media/gpio-ir-recv.h
@@ -14,9 +14,10 @@
 #define __GPIO_IR_RECV_H__
 
 struct gpio_ir_recv_platform_data {
-   int gpio_nr;
-   bool active_low;
-   const char *map_name;
+   int gpio_nr;
+   boolactive_low;
+   u64 allowed_protos;
+   const char  *map_name;
 };
 
 #endif /* __GPIO_IR_RECV_H__ */
--
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 v2 1/1] media: gpio-ir-recv: add allowed_protos for platform data

2012-07-06 Thread Mauro Carvalho Chehab
Em 04-07-2012 00:11, Du, Changbin escreveu:
 Make it possible to specify allowed RC protocols through the device's
 platform data.
 
 Signed-off-by: Du, Changbin changbin...@gmail.com

Gah, you trapped me: you've resent it, without using the original message ID.

Too late. I'll keep the version where I've fixed the merge
conflict, as it does the same thing.

Regards,
Mauro.

 ---
 For v2:
   Keymap has already done by another patch.
 ---
   drivers/media/rc/gpio-ir-recv.c |2 +-
   include/media/gpio-ir-recv.h|7 ---
   2 files changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/rc/gpio-ir-recv.c
 b/drivers/media/rc/gpio-ir-recv.c
 index 59fe60c..38da91e 100644
 --- a/drivers/media/rc/gpio-ir-recv.c
 +++ b/drivers/media/rc/gpio-ir-recv.c
 @@ -84,7 +84,7 @@ static int __devinit gpio_ir_recv_probe(struct
 platform_device *pdev)
   
   rcdev-priv = gpio_dev;
   rcdev-driver_type = RC_DRIVER_IR_RAW;
 - rcdev-allowed_protos = RC_TYPE_ALL;
 + rcdev-allowed_protos = pdata-allowed_protos ?: RC_TYPE_ALL;
   rcdev-input_name = GPIO_IR_DEVICE_NAME;
   rcdev-input_phys = GPIO_IR_DEVICE_NAME /input0;
   rcdev-input_id.bustype = BUS_HOST;
 diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
 index 91546f3..0142736 100644
 --- a/include/media/gpio-ir-recv.h
 +++ b/include/media/gpio-ir-recv.h
 @@ -14,9 +14,10 @@
   #define __GPIO_IR_RECV_H__
   
   struct gpio_ir_recv_platform_data {
 - int gpio_nr;
 - bool active_low;
 - const char *map_name;
 + int gpio_nr;
 + boolactive_low;
 + u64 allowed_protos;
 + const char  *map_name;
   };
   
   #endif /* __GPIO_IR_RECV_H__ */
 


--
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: [Resend PATCH] media: rc: ati_remote.c: code style and compile warning fixing

2012-07-06 Thread Mauro Carvalho Chehab
Em 04-07-2012 05:08, Du, Changbin escreveu:
 changes:
   1. break some lines that are longer than 80 characters.
   2. remove local function prototype declarations which do not
  need.
   3. replace TAB character with a space character in function
  comments.
   4. change the types of array init1[] and init2[] to
  unsigned char to avoid compile warning.
 
 Signed-off-by: Du, Changbin changbin...@gmail.com
 ---
   drivers/media/rc/ati_remote.c |  139
 +
   1 file changed, 84 insertions(+), 55 deletions(-)
 
 diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
 index 7be377f..0df66ac 100644
 --- a/drivers/media/rc/ati_remote.c
 +++ b/drivers/media/rc/ati_remote.c
 @@ -23,6 +23,8 @@
*Vincent Vanackere vanack...@lif.univ-mrs.fr
*Added support for the Lola remote contributed by:
*Seth Cohn sethc...@yahoo.com
 + *  Jul 2012: Du, Changbin changbin...@gmail.com
 + *Code style and compile warning fixing

You shouldn't be changing the driver's authorship just due to codingstyle
and warning fixes. Btw, Please split Coding Style form Compilation warnings,
as they're two different matters.

Thanks!
Mauro

*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
*
 @@ -147,7 +149,8 @@ static bool mouse = true;
   module_param(mouse, bool, 0444);
   MODULE_PARM_DESC(mouse, Enable mouse device, default = yes);
   
 -#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format
 , ## arg); } while (0)
 +#define dbginfo(dev, format, arg...) \
 + do { if (debug) dev_info(dev , format , ## arg); } while (0)
   #undef err
   #define err(format, arg...) printk(KERN_ERR format , ## arg)
   
 @@ -191,17 +194,41 @@ static const char *get_medion_keymap(struct
 usb_interface *interface)
   return RC_MAP_MEDION_X10;
   }
   
 -static const struct ati_receiver_type type_ati   = { 
 .default_keymap
 = RC_MAP_ATI_X10 };
 -static const struct ati_receiver_type type_medion= {
 .get_default_keymap = get_medion_keymap };
 -static const struct ati_receiver_type type_firefly   = { .default_keymap
 = RC_MAP_SNAPSTREAM_FIREFLY };
 +static const struct ati_receiver_type type_ati   = {
 + .default_keymap = RC_MAP_ATI_X10
 +};
 +static const struct ati_receiver_type type_medion= {
 + .get_default_keymap = get_medion_keymap
 +};
 +static const struct ati_receiver_type type_firefly   = {
 + .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY
 +};
   
   static struct usb_device_id ati_remote_table[] = {
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_ati },
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_ati },
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_ati },
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_ati },
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_medion },
 - { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
 .driver_info = (unsigned long)type_firefly },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_ati
 + },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_ati
 + },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_ati
 + },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_ati
 + },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_medion
 + },
 + {
 + USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
 + .driver_info = (unsigned long)type_firefly
 + },
   {}  /* Terminating entry */
   };
   
 @@ -215,8 +242,8 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table);
   #define SEND_FLAG_COMPLETE  2
   
   /* Device initialization strings */
 -static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
 -static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
 +static unsigned char init1[] = { 0x01, 0x00, 0x20, 0x14 };
 +static unsigned char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20
 };
   
   struct ati_remote {
   struct input_dev *idev;
 @@ -296,25 +323,8 @@ static const struct {
   {KIND_END, 0x00, EV_MAX + 1, 0, 0}
   };
   
 -/* Local function prototypes */
 -static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16
 cmd, unsigned char *data);
 -static void 

Re: [GIT PULL FOR v3.6] DVB USB v2

2012-07-06 Thread Mauro Carvalho Chehab
Em 03-07-2012 18:47, Antti Palosaari escreveu:
 On 07/02/2012 04:08 PM, Antti Palosaari wrote:
 Here it is finally - quite totally rewritten DVB-USB-framework. I
 haven't got almost any feedback so far...
 
 I rebased it in order to fix compilation issues coming from Kconfig.
 
 
 regards
 Antti


 The following changes since commit
 6887a4131da3adaab011613776d865f4bcfb5678:

Linux 3.5-rc5 (2012-06-30 16:08:57 -0700)

 are available in the git repository at:

git://linuxtv.org/anttip/media_tree.git dvb_usb_pull

 for you to fetch changes up to 747abaa1e0ee4415e67026c119cb73e6277f4898:

dvb_usb_v2: remove usb_clear_halt() from stream (2012-07-02 15:54:29
 +0300)

 
 Antti Palosaari (103):
dvb_usb_v2: copy current dvb_usb as a starting point

Naming the DVB USB v2 as dvb_usb, instead of dvb-usb is very very ugly.
It took me some time to discover what happened.

You should have named it as dvb-usb-v2 instead, or to store it into
a separate directory.

This is even worse as it seems that this series doesn't change all
drivers to use dvb usb v2. So, it will be harder to discover what
drivers are at V1 and what are at V2.

I won't merge it as-is at staging/for_v3.6. I may eventually create
a separate topic branch and add them there, while the namespace mess
is not corrected, if I still have some time today. Otherwise, I'll only
handle that after returning from vacations.

Regards,
Mauro
--
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: [GIT PULL FOR v3.5] S5P driver fixes

2012-07-06 Thread Mauro Carvalho Chehab
Em 06-07-2012 16:56, Sylwester Nawrocki escreveu:
 On 07/06/2012 09:10 PM, Mauro Carvalho Chehab wrote:
 Em 29-06-2012 15:05, Sylwester Nawrocki escreveu:
 Hi Mauro,

 On 06/28/2012 06:29 PM, Sylwester Nawrocki wrote:

 The following changes since commit 
 433002d69888238b16f8ea9434447feaa1fc9bf0:

  Merge remote-tracking branch 'party-public/v4l-fimc-fixes' into 
 v4l-fixes
 (2012-06-27 16:28:08 +0200)

 are available in the git repository at:


  git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes

 for you to fetch changes up to f8a623efac978987be818a0a9d2d407791a066e4:

  Revert [media] V4L: JPEG class documentation corrections (2012-06-27
 16:31:20 +0200)

 
 Kamil Debski (1):
  s5p-mfc: Fixed setup of custom controls in decoder and encoder

 Sylwester Nawrocki (2):
  s5p-fimc: Add missing FIMC-LITE file operations locking

 This patch depends on my previous pull request:
 http://patchwork.linuxtv.org/patch/11503

  Revert [media] V4L: JPEG class documentation corrections

 Documentation/DocBook/media/v4l/controls.xml   |2 +-
 Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
 drivers/media/video/s5p-fimc/fimc-lite.c   |   61
 -
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c  |1 +
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c  |1 +
 5 files changed, 47 insertions(+), 25 deletions(-)

 Sorry, I messed up this pull request by rebasing it onto wrong branch.
 Here it is corrected, against staging/for_v3.5 and on top of merged
 v4l-fimc-fixes branch, as per http://patchwork.linuxtv.org/patch/11503


 The following changes since commit 96fc9f0f51d6b0d807aeb1f6e38485a3de429fd4:

  s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails 
 (2012-06-05 13:28:25 +0200)

 are available in the git repository at:

  git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes

 for you to fetch changes up to c7de5370086a948c67cb7eeb5f25178c8979b0fe:

  Revert [media] V4L: JPEG class documentation corrections (2012-06-29 
 16:00:33 +0200)

 
 Kamil Debski (1):
  s5p-mfc: Fixed setup of custom controls in decoder and encoder

 This patch applied OK.

 Sylwester Nawrocki (2):
  s5p-fimc: Add missing FIMC-LITE file operations locking

 This one didn't apply for v3.5:
 
 Hmm, perhaps because these previous fixes aren't applied yet
 http://patchwork.linuxtv.org/patch/11503 ?
 
 Applying patch 
 patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch
 patching file drivers/media/video/s5p-fimc/fimc-lite.c
 Hunk #1 FAILED at 453.
 Hunk #2 succeeded at 492 (offset -2 lines).
 1 out of 2 hunks FAILED -- rejects in file 
 drivers/media/video/s5p-fimc/fimc-lite.c
 Patch 
 patches/0016-s5p-fimc-Add-missing-FIMC-LITE-file-operations-locki.patch does 
 not apply (enforce with -f)
 Patch didn't apply. Aborting


  Revert [media] V4L: JPEG class documentation corrections

 My scripts say that this patch were already applied.

 $ test_patch
 testing if 
 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch 
 applies
 patch -p1 -i 
 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch 
 --dry-run -t -N
 patching file Documentation/DocBook/media/v4l/controls.xml
 patching file Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
Documentation/DocBook/media/v4l/controls.xml   |2 +-
Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml |7 ---
2 files changed, 1 insertion(+), 8 deletions(-)
 Subject: Revert [media] V4L: JPEG class documentation corrections
 From: Sylwester Nawrockis.nawro...@samsung.com
 Date: Wed, 27 Jun 2012 15:12:31 +0200
 Patch applies OK
 total: 0 errors, 0 warnings, 21 lines checked

 patches/0017-Revert-media-V4L-JPEG-class-documentation-correction.patch has 
 no obvious style problems and is ready for submission.
 Patch is likely applied
 
 I'm not sure why it doesn't apply now, but the issue is still there,
 two similar patches exist in v3.5:
 
 http://git.linuxtv.org/linux-2.6.git/history/c4aed353b1b079eb4843e6a708fc68b4b28f72aa:/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 
 One of them just needs to be reverted. I described this issue previously:
 http://www.spinics.net/lists/linux-media/msg47879.html
 
 And then decided to send a reverting patch myself.
 
 I tried all three patches on latest Linus' tree and they applied cleanly
 (but I had applied fixups from v4l-fimc-fixes first).

I pushed the branch with the fixes into my experimental tree:

http://git.linuxtv.org/mchehab/experimental.git/shortlog/refs/heads/v4l_for_linus

Could you please check what's missing there and rebase the pending patches for 
it?


 
 So, from this 

Re: pctv452e

2012-07-06 Thread Marx

Driver doesn't work good.
I've took out the second card, so there is only pctv452e connected.
It worked the same way as usually.
At first driver was playing some SD channels (encrypted and FTA - no 
matter), it even played one HD channel for the first time ever, but 
after it it refused to play any more channels. I've restarted computer, 
but it didn't help.


Logs from boot:
Jul  6 18:22:11 wuwek kernel: [5.948597] input: HD-Audio Generic 
HDMI/DP,pcm=3 as /devices/pci:00/:00:01.1/sound/card0/input3
Jul  6 18:22:11 wuwek kernel: [6.121534] input: HDA ATI SB Line as 
/devices/pci:00/:00:14.2/sound/card1/input4
Jul  6 18:22:11 wuwek kernel: [6.121770] input: HDA ATI SB Rear Mic 
as /devices/pci:00/:00:14.2/sound/card1/input5
Jul  6 18:22:11 wuwek kernel: [6.123094] input: HDA ATI SB Line Out 
CLFE as /devices/pci:00/:00:14.2/sound/card1/input6
Jul  6 18:22:11 wuwek kernel: [6.125812] input: HDA ATI SB Line Out 
Surround as /devices/pci:00/:00:14.2/sound/card1/input7
Jul  6 18:22:11 wuwek kernel: [6.126523] input: HDA ATI SB Line Out 
Front as /devices/pci:00/:00:14.2/sound/card1/input8
Jul  6 18:22:11 wuwek kernel: [6.276933] usb 1-4: dvb_usbv2: found a 
'PCTV HDTV USB' in warm state

Jul  6 18:22:11 wuwek kernel: [6.276945] pctv452e_power_ctrl: 1
Jul  6 18:22:11 wuwek kernel: [6.277544] usbcore: registered new 
interface driver dvb_usb_pctv452e
Jul  6 18:22:11 wuwek kernel: [6.278000] usb 1-4: dvb_usbv2: will 
pass the complete MPEG2 transport stream to the software demuxer
Jul  6 18:22:11 wuwek kernel: [6.278041] DVB: registering new 
adapter (PCTV HDTV USB)
Jul  6 18:22:11 wuwek kernel: [6.342525] stb0899_attach: Attaching 
STB0899
Jul  6 18:22:11 wuwek kernel: [6.375893] DVB: registering adapter 0 
frontend 0 (STB0899 Multistandard)...
ul  6 18:22:11 wuwek kernel: [6.399122] stb6100_attach: Attaching 
STB6100

Jul  6 18:22:11 wuwek kernel: [6.399137] pctv452e_power_ctrl: 0
Jul  6 18:22:11 wuwek kernel: [6.399152] usb 1-4: dvb_usbv2: 'PCTV 
HDTV USB' successfully initialized and connected
Jul  6 18:22:11 wuwek kernel: [7.959465] Adding 2097148k swap on 
/dev/sda2.  Priority:-1 extents:1 across:2097148k
Jul  6 18:22:11 wuwek kernel: [8.009082] EXT4-fs (sda1): re-mounted. 
Opts: (null)
Jul  6 18:22:11 wuwek kernel: [8.393422] EXT4-fs (sda1): re-mounted. 
Opts: errors=remount-ro

Jul  6 18:22:11 wuwek kernel: [8.507454] loop: module loaded
Jul  6 18:22:11 wuwek kernel: [8.535684] nf_conntrack version 0.5.0 
(16384 buckets, 65536 max)
Jul  6 18:22:11 wuwek kernel: [8.609385] w83627ehf: Found NCT6775F 
chip at 0x290
Jul  6 18:22:11 wuwek kernel: [8.609767] hwmon_vid: Unknown VRM 
version of your x86 CPU
Jul  6 18:22:11 wuwek kernel: [   10.634908] EXT4-fs (sda3): mounted 
filesystem with ordered data mode. Opts: errors=remount-ro
Jul  6 18:22:11 wuwek kernel: [   10.715194] EXT4-fs (sda4): mounted 
filesystem with ordered data mode. Opts: errors=remount-ro
Jul  6 18:22:11 wuwek kernel: [   13.602684] Netfilter messages via 
NETLINK v0.30.

Jul  6 18:22:11 wuwek kernel: [   13.782616] ip_set: protocol 6
Jul  6 18:22:11 wuwek kernel: [   15.613353] xt_nfacct: Unknown symbol 
nfnl_acct_put (err 0)
Jul  6 18:22:11 wuwek kernel: [   15.613451] xt_nfacct: Unknown symbol 
nfnl_acct_update (err 0)
Jul  6 18:22:11 wuwek kernel: [   15.613522] xt_nfacct: Unknown symbol 
nfnl_acct_find_get (err 0)
Jul  6 18:22:11 wuwek kernel: [   16.475299] xt_time: kernel timezone is 
+0200
Jul  6 18:22:11 wuwek kernel: [   20.154987] ip_tables: (C) 2000-2006 
Netfilter Core Team
Jul  6 18:22:11 wuwek kernel: [   21.228305] ip6_tables: (C) 2000-2006 
Netfilter Core Team

Jul  6 18:22:11 wuwek kernel: [   22.182152] Bridge firewalling registered
Jul  6 18:22:11 wuwek kernel: [   22.685996] r8169 :04:00.0: eth6: 
link down
Jul  6 18:22:11 wuwek kernel: [   22.686014] r8169 :04:00.0: eth6: 
link down
Jul  6 18:22:11 wuwek kernel: [   22.686366] IPv6: ADDRCONF(NETDEV_UP): 
eth6: link is not ready
Jul  6 18:22:11 wuwek kernel: [   34.686600] r8169 :04:00.0: eth6: 
link up
Jul  6 18:22:11 wuwek kernel: [   34.687111] IPv6: 
ADDRCONF(NETDEV_CHANGE): eth6: link becomes ready
Jul  6 18:22:11 wuwek kernel: [   41.261271] RPC: Registered named UNIX 
socket transport module.
Jul  6 18:22:11 wuwek kernel: [   41.261279] RPC: Registered udp 
transport module.
Jul  6 18:22:11 wuwek kernel: [   41.261282] RPC: Registered tcp 
transport module.
Jul  6 18:22:11 wuwek kernel: [   41.261284] RPC: Registered tcp NFSv4.1 
backchannel transport module.

Jul  6 18:22:11 wuwek kernel: [   41.308018] FS-Cache: Loaded
Jul  6 18:22:11 wuwek kernel: [   41.361383] NFS: Registering the 
id_resolver key type

Jul  6 18:22:11 wuwek kernel: [   41.361424] Key type id_resolver registered
Jul  6 18:22:11 wuwek kernel: [   41.361441] FS-Cache: Netfs 'nfs' 
registered for caching
Jul  6 18:22:11 wuwek kernel: [   

Re: pctv452e

2012-07-06 Thread Antti Palosaari

On 07/07/2012 01:23 AM, Marx wrote:

Driver doesn't work good.
I've took out the second card, so there is only pctv452e connected.
It worked the same way as usually.
At first driver was playing some SD channels (encrypted and FTA - no
matter), it even played one HD channel for the first time ever, but
after it it refused to play any more channels. I've restarted computer,
but it didn't help.


Sounds bad. It should be always enough just remove device, boot and plug 
device back.



Jul  6 18:22:42 wuwek kernel: [   73.801143] I2C error -121; AA AE  CC
00 01 - 55 AE  CC 00 00.





HD channels desire better signal, but i'm sure signal is ok because it's
twin setup and on second port I have traditional tuner which works ok
with all channels.

Original problem - it's rather long story. To say it short: I have 4 DVB
tuners and none of them works reliable. I'm able to make each of them
recognized, scan channels etc. To concentrate on pctv452e: it works from
the beginning the same way as I've written above. It outputs endlessly
i2c errors, usually allows to switch 4-5 times channels and then it
stops working. What is strange - scan works, szap2 works on some
channels, on others doesn't work.


Those I2C errors coming from the bug I explained earlier. It could be 
also reason of all problems.



Let's get for example FTA channel Mango 24.
Mango 24;TVN:11393:v:S13.0E:27500:517=2:700=pol@4:581:0:4316:318:1000:0

wuwek:~# szap -n 51 -r
reading channels from file '/root/.szap/channels.conf'
zapping to 51 'Mango 24;TVN':
sat 0, frequency = 11393 MHz V, symbolrate 2750, vpid = 0x0205, apid
= 0x02bc sid = 0x0245
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
status 1f | signal 01c6 | snr 0095 | ber  | unc fffe |
FE_HAS_LOCK
status 1f | signal 01c6 | snr 0094 | ber  | unc fffe |
FE_HAS_LOCK
status 1f | signal 01c6 | snr 0095 | ber  | unc fffe |
FE_HAS_LOCK
status 1f | signal 01c6 | snr 0094 | ber  | unc fffe |
FE_HAS_LOCK


Seems to work fine.


but it doesn't now play in VDR.


You can use it only from application at the time. It is used by szap so 
vdr could not use it.



Unplug and plug again USB cable:
Jul  7 00:05:53 wuwek kernel: [20664.576589] pctv452e_power_ctrl: 0
Jul  7 00:06:08 wuwek kernel: [20679.752198] usb 1-4: USB disconnect,
device number 2
Jul  7 00:06:08 wuwek kernel: [20679.752728] usb 1-4: dvb_usbv2:
usb_bulk_msg() failed=-19
Jul  7 00:06:08 wuwek kernel: [20679.752779] I2C error -19; AA E6  10 04
00 - AA E6  10 04 00.
Jul  7 00:06:08 wuwek kernel: [20679.752876] usb 1-4: dvb_usbv2:
usb_bulk_msg() failed=-19
Jul  7 00:06:08 wuwek kernel: [20679.752909] I2C error -19; AA E7  D0 03
00 - AA E7  D0 03 00.


Nothing special, device is removed and ongoing control commands fails 
because no device.



Device isn't recognized. Again the same:

Jul  7 00:09:29 wuwek kernel: [20880.538582] INFO: task khubd:83 blocked
for more than 120 seconds.
Jul  7 00:09:29 wuwek kernel: [20880.538624] echo 0 
/proc/sys/kernel/hung_task_timeout_secs disables this message.
Jul  7 00:09:29 wuwek kernel: [20880.538669] khubd   D f72fe064
 083  2 0x
Jul  7 00:09:29 wuwek kernel: [20880.538683]  f5bf4180 0046 
f72fe064 c1115e10 f6e13208 c14989c0 c14989c0
Jul  7 00:09:29 wuwek kernel: [20880.538704]  f6d774c0 f71b1600 f6d774c0
f71b1608 f6d774c0 0282 f6cbe1e0 f71b1600
Jul  7 00:09:29 wuwek kernel: [20880.538723]  f6cbe1e0 f6d77540 0246
c12d22a6 0246 0246 c104408a 0002
Jul  7 00:09:29 wuwek kernel: [20880.538742] Call Trace:
Jul  7 00:09:29 wuwek kernel: [20880.538763]  [c1115e10] ?
remove_dir+0x20/0x25
Jul  7 00:09:29 wuwek kernel: [20880.538780]  [c12d22a6] ?
_raw_spin_lock_irqsave+0x11/0x30
Jul  7 00:09:29 wuwek kernel: [20880.538797]  [c104408a] ?
prepare_to_wait+0x57/0x5f
Jul  7 00:09:29 wuwek kernel: [20880.538880]  [f8542751] ?
dvb_dmxdev_release+0x5a/0xf0 [dvb_core]
Jul  7 00:09:29 wuwek kernel: [20880.538895]  [c1043f3e] ?
bit_waitqueue+0x47/0x47
Jul  7 00:09:29 wuwek kernel: [20880.538926]  [f84b46c1] ?
dvb_usb_adapter_dvb_exit+0x31/0x48 [dvb_usbv2]
Jul  7 00:09:29 wuwek kernel: [20880.538956]  [f84b5055] ?
dvb_usbv2_disconnect+0xc9/0x128 [dvb_usbv2]
Jul  7 00:09:29 wuwek kernel: [20880.539025]  [c1206845] ?
rpm_suspend+0x3ed/0x3ed
Jul  7 00:09:29 wuwek kernel: [20880.539038]  [c120721b] ?
pm_schedule_suspend+0x8e/0x8e
Jul  7 00:09:29 wuwek kernel: [20880.539113]  [f82564da] ?
usb_unbind_interface+0x46/0x106 [usbcore]
Jul  7 00:09:29 wuwek kernel: [20880.539147]  [c120070f] ?
__device_release_driver+0x60/0x97
Jul  7 00:09:29 wuwek kernel: [20880.539160]  [c120075b] ?
device_release_driver+0x15/0x1e
Jul  7 00:09:29 wuwek kernel: [20880.539173]  [c120020b] ?
bus_remove_device+0xa1/0xb0
Jul  7 00:09:29 wuwek kernel: [20880.539185]  [c11feb9a] ?
device_del+0xe6/0x130
Jul  7 00:09:29 wuwek kernel: [20880.539236]  [f8254d02] ?
usb_disable_device+0x56/0x13a [usbcore]
Jul  7 00:09:29 wuwek kernel: 

Re: [GIT PULL FOR v3.5] S5P driver fixes

2012-07-06 Thread Sylwester Nawrocki
On 07/07/2012 12:37 AM, Mauro Carvalho Chehab wrote:
 I pushed the branch with the fixes into my experimental tree:
   
 http://git.linuxtv.org/mchehab/experimental.git/shortlog/refs/heads/v4l_for_linus
 
 Could you please check what's missing there and rebase the pending patches 
 for it?

It looks good, there are only 2 patches missing (from
git://git.infradead.org/users/kmpark/linux-samsung v4l-fixes):

df5772f Revert [media] V4L: JPEG class documentation corrections
196073a s5p-fimc: Add missing FIMC-LITE file operations locking

They applied cleanly without a need to rebase.

I pushed everything for reference to:
 g...@github.com:snawrocki/linux.git mchehab-experimental

https://github.com/snawrocki/linux/commits/mchehab-experimental

Sorry for the hassle. Next time I'll try not to send subsequent pull request
when any previous one is pending.

--

Regards,
Sylwester


--
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: [Resend PATCH] media: rc: ati_remote.c: code style and compile warning fixing

2012-07-06 Thread Du Changbin
  diff --git a/drivers/media/rc/ati_remote.c
b/drivers/media/rc/ati_remote.c
  index 7be377f..0df66ac 100644
  --- a/drivers/media/rc/ati_remote.c
  +++ b/drivers/media/rc/ati_remote.c
  @@ -23,6 +23,8 @@
 *Vincent Vanackere vanack...@lif.univ-mrs.fr
 *Added support for the Lola remote contributed by:
 *Seth Cohn sethc...@yahoo.com
  + *  Jul 2012: Du, Changbin changbin...@gmail.com
  + *Code style and compile warning fixing
 
 You shouldn't be changing the driver's authorship just due to codingstyle
 and warning fixes. Btw, Please split Coding Style form Compilation
warnings,
 as they're two different matters.

Sorry, I didn't know this rule. I just want to make  a track for me. OK, I
will resend this patch and remove me from it.
BTW, I am looking for something to learn these basic rules when sending
patches. Could you tell me where I can find it?
Many thanks!
[Du, Changbin]

 
 Thanks!
 Mauro


--
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


success! (Re: media_build and Terratec Cinergy T Black.)

2012-07-06 Thread Hin-Tak Leung
--- On Fri, 6/7/12, Hin-Tak Leung ht...@users.sourceforge.net wrote:

snipped
  Typical channels.conf entry looks like that:
 
 MTV3:71400:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:305:561:49
  
  And tuning to that channel using mplayer:
  mplayer dvb://MTV3
 
 Well that at least clear up something - I tried this form
 (from 
 /usr/share/doc/dvb-apps-1.1.2/channels-conf/dvb-t/* ) but
 did not get anything either - the error message seemed worse
 so I didn't go further. I guess I should try getting w_scan
 to do this form.

snipped
 There seems to be at least two channels.conf formats (one
 for mplayer/vlc/gstreamer, one for vdr?), and unfortunately
 both seems to have the same name conventionally, but
 different content. I can't find documentation about either,
 or even examples :-).

Apparently it was just me not reading the manual/options properly. There are 3 
formats - gstreamer, vdr and mplayer's! I thought it was just vdr vs everything 
else. It was also confusing that mplayer did not complain about it.

scandvb still does not work at all, nor those sample config files under 
/usr/share/doc/dvb-apps-1.1.2/channels-conf/dvb-t/* , or use those (tried about 
6 different transmitter config various distance away). It is also true that I 
have poor reception: all the BBC* channels seems to work okay - about 18 
channels - but none of the non-BBC stations. Also they are not there on a 2nd 
scan, so I guess they are weaker.

So obviously there are a lot of rough edges. I also think it is a bit stupid 
for w_scan not to offer writing *all* the formats, since all the information 
should be there after a scan. It takes about 8 minutes to do a full scan. It 
would be more logical to generate all the channels.conf formats on one scan, 
and let the user throw away the ones he does not need, if it takes that long to 
do a full scan.



--
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


unload/unplugging (Re: success! (Re: media_build and Terratec Cinergy T Black.))

2012-07-06 Thread Hin-Tak Leung
BTW, I tried just pulling the USB stick out while mplayer is running. Strangely 
enough mplayer did not notice it gone and kept going for some 5 to 10 seconds. 
Probably buffering?

The only sign about it is two lines in dmesg (other than the usual usb messages 
about device being unplug).

[227690.953311] rtl2832: i2c rd failed=-19 reg=01 len=1
[227710.818089] usb 1-2: dvb_usbv2: streaming_ctrl() failed=-19

I also have quite a few :

[224773.229293] DVB: adapter 0 frontend 0 frequency 2 out of range 
(17400..86200)

This seems to come from running w_scan.

The kernel seems happy while having the device physically pulled out. But the 
kernel module does not like to be unloaded (modprobe -r) while mplayer is 
running, so we need to fix that.
--
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: [Resend PATCH] media: rc: ati_remote.c: code style and compile warning fixing

2012-07-06 Thread Mauro Carvalho Chehab
Em 06-07-2012 22:49, Du Changbin escreveu:
 diff --git a/drivers/media/rc/ati_remote.c
 b/drivers/media/rc/ati_remote.c
 index 7be377f..0df66ac 100644
 --- a/drivers/media/rc/ati_remote.c
 +++ b/drivers/media/rc/ati_remote.c
 @@ -23,6 +23,8 @@
 *Vincent Vanackere vanack...@lif.univ-mrs.fr
 *Added support for the Lola remote contributed by:
 *Seth Cohn sethc...@yahoo.com
 + *  Jul 2012: Du, Changbin changbin...@gmail.com
 + *Code style and compile warning fixing

 You shouldn't be changing the driver's authorship just due to codingstyle
 and warning fixes. Btw, Please split Coding Style form Compilation
 warnings,
 as they're two different matters.
 
 Sorry, I didn't know this rule. I just want to make  a track for me. OK, I
 will resend this patch and remove me from it.
 BTW, I am looking for something to learn these basic rules when sending
 patches. Could you tell me where I can find it?

There are some rules at linuxtv wiki pages, others at the Kernel Documentation
dir and other not so explicit rules like the above that you'll get as you
continue contributing ;)

In opposite to other open source projects, the contribution history is the
git logs, and not inside the comments at the source code.


 Many thanks!
 [Du, Changbin]

Thanks,
Mauro
--
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 v2] Avoid sysfs oops when an rc_dev's raw device is absent

2012-07-06 Thread Douglas Bagnall
For some reason, when the lirc daemon learns that a usb remote control
has been unplugged, it wants to read the sysfs attributes of the
disappearing device. This is useful for uncovering transient
inconsistencies, but less so for keeping the system running when such
inconsistencies exist.

Under some circumstances (like every time I unplug my dvb stick from
my laptop), lirc catches an rc_dev whose raw event handler has been
removed (presumably by ir_raw_event_unregister), and proceeds to
interrogate the raw protocols supported by the NULL pointer.

This patch avoids the NULL dereference, and ignores the issue of how
this state of affairs came about in the first place.

Version 2 incorporates changes recommended by Mauro Carvalho Chehab
(-ENODEV instead of -EINVAL, and a signed-off-by).

Signed-off-by: Douglas Bagnall doug...@paradise.net.nz
---
 drivers/media/rc/rc-main.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 6e16b09..9880926 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -775,10 +775,12 @@ static ssize_t show_protocols(struct device *device,
if (dev-driver_type == RC_DRIVER_SCANCODE) {
enabled = dev-rc_map.rc_type;
allowed = dev-allowed_protos;
-   } else {
+   } else if (dev-raw) {
enabled = dev-raw-enabled_protocols;
allowed = ir_raw_get_allowed_protocols();
}
+   else
+   return -ENODEV;
 
IR_dprintk(1, allowed - 0x%llx, enabled - 0x%llx\n,
   (long long)allowed,
--
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