Re: [QUERY] V4L async api

2013-03-21 Thread Prabhakar Lad
Guennadi,

On Sun, Feb 3, 2013 at 2:32 AM, Guennadi Liakhovetski
g.liakhovet...@gmx.de wrote:
 On Wed, 30 Jan 2013, Prabhakar Lad wrote:

 Hi Guennadi,

 I am working on adding v4l-asyn for capture and display device..

 Here is my hw details:--
  1: The capture device has two subdevs tvp514x @0x5c and tvp514x @0x5d.
  2: The display device has a one subdev adv7343 @0x2a.

 Note:- I have added  async support for all the subdevices and the
 capture and display driver too

 Test Case:-
   1:   I have v4l2_async_notifier_register() for both capture and
 display driver, as of now I have built
 the subdevices as module. when board is up, I insert the
 tvp514x  subdevices and the capture
 driver gets intialized (/dev/video0  /dev/video1) nodes get
 created, now I do insmod on the other
 subdevice adv7343, the bound callback is called in capture
 driver, but whereas this should have been
 called in the display driver.

 This certainly _should_ not happen. Your subdevice driver should call
 v4l2_async_subdev_bound(), which will walk the notifier list and check,
 which of them this subdevice matches. I'm afraid you'll have to debug your
 set up to see why the wrong notifier matches.

   2:   When I build the subdevices as part of uImage I hit a crash.
 Attached is the crash log.

 The crash happens in v4l2_async_notifier_register() when a newly
 registered notifier walks the list of _already_ successfully probed
 subdevices. Then I'm not exactly sure where the actual crash happens, one
 of the possibilities is if the match_i2c() function is called for an
 invalid or unbound i2c device. You'll have to debug this too.

Trying to debug, I see that list_for_each_entry() in v4l2_async_belongs()
is picking up some invalid entry which is causing it to crash!

Cheers,
--Prabhakar

 Thanks
 Guennadi

   3:   When I just build and use either the capture/display driver and
 their respective subdevices only every thing works fine.

 Regards,
 --Prabhakar


 ---
 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: [QUERY] V4L async api

2013-03-21 Thread Prabhakar Lad
Guennadi,

On Fri, Mar 22, 2013 at 11:02 AM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Guennadi,

 On Sun, Feb 3, 2013 at 2:32 AM, Guennadi Liakhovetski
 g.liakhovet...@gmx.de wrote:
 On Wed, 30 Jan 2013, Prabhakar Lad wrote:

 Hi Guennadi,

 I am working on adding v4l-asyn for capture and display device..

 Here is my hw details:--
  1: The capture device has two subdevs tvp514x @0x5c and tvp514x @0x5d.
  2: The display device has a one subdev adv7343 @0x2a.

 Note:- I have added  async support for all the subdevices and the
 capture and display driver too

 Test Case:-
   1:   I have v4l2_async_notifier_register() for both capture and
 display driver, as of now I have built
 the subdevices as module. when board is up, I insert the
 tvp514x  subdevices and the capture
 driver gets intialized (/dev/video0  /dev/video1) nodes get
 created, now I do insmod on the other
 subdevice adv7343, the bound callback is called in capture
 driver, but whereas this should have been
 called in the display driver.

 This certainly _should_ not happen. Your subdevice driver should call
 v4l2_async_subdev_bound(), which will walk the notifier list and check,
 which of them this subdevice matches. I'm afraid you'll have to debug your
 set up to see why the wrong notifier matches.

   2:   When I build the subdevices as part of uImage I hit a crash.
 Attached is the crash log.

 The crash happens in v4l2_async_notifier_register() when a newly
 registered notifier walks the list of _already_ successfully probed
 subdevices. Then I'm not exactly sure where the actual crash happens, one
 of the possibilities is if the match_i2c() function is called for an
 invalid or unbound i2c device. You'll have to debug this too.

 Trying to debug, I see that list_for_each_entry() in v4l2_async_belongs()
 is picking up some invalid entry which is causing it to crash!

Here is the case when this happens may be you can try it out on your side,
I have single subdev (say A) element in  the asd array which is for
the capture driver.
and I have two subdevs (say B and C) which support  asynchronous
probing, which is required
for the display driver. I have built only the capture driver and not
the display driver as part of uImage,
and I also build subdevs A, B, C as part of uImage. Note the the
subdevs as are i2c based and
is registered via i2c_register_board_info() , ie probe of A, B, C get
called. Here is when the crash happens.

The other case is when the crash doesn’t happen is if I have more than
one element in asd array strange!
or if I don’t build B and C as part of uImage.

Regards,
--Prabhakar

 Cheers,
 --Prabhakar

 Thanks
 Guennadi

   3:   When I just build and use either the capture/display driver and
 their respective subdevices only every thing works fine.

 Regards,
 --Prabhakar


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


[PATCH 0/2] davinci: vpss: clock cleanup

2013-03-22 Thread Prabhakar lad
From: Lad, Prabhakar prabhakar.cse...@gmail.com

This patch series cleanup's the VPSS clock enabling.
The first patch removes vpss clock enabling from the capture
drivers and moves it to the VPSS driver itself.
The second patch moves the venc_enable_vpss_clock() to the driver
which was being done in platform code.

Lad, Prabhakar (2):
  media: davinci: vpss: enable vpss clocks
  media: davinci: vpbe: venc: move the enabling of vpss clocks to
driver

 arch/arm/mach-davinci/dm355.c|3 -
 arch/arm/mach-davinci/dm365.c|9 +++-
 arch/arm/mach-davinci/dm644x.c   |5 --
 drivers/media/platform/davinci/dm355_ccdc.c  |   39 +
 drivers/media/platform/davinci/dm644x_ccdc.c |   44 ---
 drivers/media/platform/davinci/isif.c|   28 ++--
 drivers/media/platform/davinci/vpbe_venc.c   |   26 +++
 drivers/media/platform/davinci/vpss.c|   60 ++
 8 files changed, 98 insertions(+), 116 deletions(-)

-- 
1.7.4.1

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


[PATCH 1/2] media: davinci: vpss: enable vpss clocks

2013-03-22 Thread Prabhakar lad
From: Lad, Prabhakar prabhakar.cse...@gmail.com

By default the VPSS clocks are only enabled in capture driver
for davinci family which creates duplicates. This
patch adds support to enable the VPSS clocks in VPSS driver.
This avoids duplication of code and also adding clock aliases.
This patch cleanups the VPSS clock enabling in the capture driver,
and also removes the clock alias in machine file. Along side adds
a vpss slave clock for DM365 as mentioned by Sekhar
(https://patchwork.kernel.org/patch/1221261/).

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 arch/arm/mach-davinci/dm355.c|3 -
 arch/arm/mach-davinci/dm365.c|9 +++-
 arch/arm/mach-davinci/dm644x.c   |5 --
 drivers/media/platform/davinci/dm355_ccdc.c  |   39 +
 drivers/media/platform/davinci/dm644x_ccdc.c |   44 ---
 drivers/media/platform/davinci/isif.c|   28 ++--
 drivers/media/platform/davinci/vpss.c|   60 ++
 7 files changed, 72 insertions(+), 116 deletions(-)

diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index b49c3b7..a917983 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -873,9 +873,6 @@ static int __init dm355_init_devices(void)
if (!cpu_is_davinci_dm355())
return 0;
 
-   /* Add ccdc clock aliases */
-   clk_add_alias(master, dm355_ccdc_dev.name, vpss_master, NULL);
-   clk_add_alias(slave, dm355_ccdc_dev.name, vpss_master, NULL);
davinci_cfg_reg(DM355_INT_EDMA_CC);
platform_device_register(dm355_edma_device);
platform_device_register(dm355_vpss_device);
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 6c39805..f4c19f7 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -257,6 +257,12 @@ static struct clk vpss_master_clk = {
.flags  = CLK_PSC,
 };
 
+static struct clk vpss_slave_clk = {
+   .name   = vpss_slave,
+   .parent = pll1_sysclk5,
+   .lpsc   = DAVINCI_LPSC_VPSSSLV,
+};
+
 static struct clk arm_clk = {
.name   = arm_clk,
.parent = pll2_sysclk2,
@@ -450,6 +456,7 @@ static struct clk_lookup dm365_clks[] = {
CLK(NULL, pll2_sysclk9, pll2_sysclk9),
CLK(NULL, vpss_dac, vpss_dac_clk),
CLK(NULL, vpss_master, vpss_master_clk),
+   CLK(NULL, vpss_slave, vpss_slave_clk),
CLK(NULL, arm, arm_clk),
CLK(NULL, uart0, uart0_clk),
CLK(NULL, uart1, uart1_clk),
@@ -1239,8 +1246,6 @@ static int __init dm365_init_devices(void)
clk_add_alias(NULL, dev_name(dm365_mdio_device.dev),
  NULL, dm365_emac_device.dev);
 
-   /* Add isif clock alias */
-   clk_add_alias(master, dm365_isif_dev.name, vpss_master, NULL);
platform_device_register(dm365_vpss_device);
platform_device_register(dm365_isif_dev);
platform_device_register(vpfe_capture_dev);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index ee0e994..026e7e3 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -901,11 +901,6 @@ int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
platform_device_register(dm644x_ccdc_dev);
platform_device_register(dm644x_vpfe_dev);
-   /* Add ccdc clock aliases */
-   clk_add_alias(master, dm644x_ccdc_dev.name,
- vpss_master, NULL);
-   clk_add_alias(slave, dm644x_ccdc_dev.name,
- vpss_slave, NULL);
}
 
if (vpbe_cfg) {
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
b/drivers/media/platform/davinci/dm355_ccdc.c
index 2364dba..05f8fb7 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -37,7 +37,6 @@
 #include linux/platform_device.h
 #include linux/uaccess.h
 #include linux/videodev2.h
-#include linux/clk.h
 #include linux/err.h
 #include linux/module.h
 
@@ -59,10 +58,6 @@ static struct ccdc_oper_config {
struct ccdc_params_raw bayer;
/* YCbCr configuration */
struct ccdc_params_ycbcr ycbcr;
-   /* Master clock */
-   struct clk *mclk;
-   /* slave clock */
-   struct clk *sclk;
/* ccdc base address */
void __iomem *base_addr;
 } ccdc_cfg = {
@@ -997,32 +992,10 @@ static int dm355_ccdc_probe(struct platform_device *pdev)
goto fail_nomem;
}
 
-   /* Get and enable Master clock */
-   ccdc_cfg.mclk = clk_get(pdev-dev, master);
-   if (IS_ERR(ccdc_cfg.mclk)) {
-   status = PTR_ERR(ccdc_cfg.mclk);
-   goto fail_nomap;
-   }
-   if (clk_prepare_enable(ccdc_cfg.mclk)) {
-   status = 

[PATCH 2/2] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver

2013-03-22 Thread Prabhakar lad
From: Lad, Prabhakar prabhakar.cse...@gmail.com

The vpss clocks were enabled by calling a exported function from a driver
in a machine code. calling driver code from platform code is incorrect way.

This patch fixes this issue and calls the function from driver code itself.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 Note: This patch is based on the comment from Sekhar
  (https://patchwork-mail1.kernel.org/patch/2278441/).
  Shekar I haven't completely removed the callback, I just added
  the function calls after the callback. As you mentioned just to
  pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
  is already being used by VPSS driver. I'll take this cleanup task later
  point of time.

 drivers/media/platform/davinci/vpbe_venc.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_venc.c 
b/drivers/media/platform/davinci/vpbe_venc.c
index f15f211..26bdf9b 100644
--- a/drivers/media/platform/davinci/vpbe_venc.c
+++ b/drivers/media/platform/davinci/vpbe_venc.c
@@ -202,6 +202,26 @@ static void venc_enabledigitaloutput(struct v4l2_subdev 
*sd, int benable)
}
 }
 
+static void
+venc_enable_vpss_clock(int venc_type,
+  enum vpbe_enc_timings_type type,
+  unsigned int pclock)
+{
+   if (venc_type == VPBE_VERSION_1)
+   return;
+
+   if (venc_type == VPBE_VERSION_2  (type == VPBE_ENC_STD ||
+   (type == VPBE_ENC_DV_TIMINGS  pclock = 2700))) {
+   vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 1);
+   vpss_enable_clock(VPSS_VPBE_CLOCK, 1);
+   return;
+   }
+
+   if (venc_type == VPBE_VERSION_3  type == VPBE_ENC_STD)
+   vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 0);
+
+}
+
 #define VDAC_CONFIG_SD_V3  0x0E21A6B6
 #define VDAC_CONFIG_SD_V2  0x081141CF
 /*
@@ -220,6 +240,7 @@ static int venc_set_ntsc(struct v4l2_subdev *sd)
if (pdata-setup_clock(VPBE_ENC_STD, V4L2_STD_525_60)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_STD, V4L2_STD_525_60);
venc_enabledigitaloutput(sd, 0);
 
if (venc-venc_type == VPBE_VERSION_3) {
@@ -265,6 +286,7 @@ static int venc_set_pal(struct v4l2_subdev *sd)
if (venc-pdata-setup_clock(VPBE_ENC_STD, V4L2_STD_625_50)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_STD, V4L2_STD_625_50);
venc_enabledigitaloutput(sd, 0);
 
if (venc-venc_type == VPBE_VERSION_3) {
@@ -319,6 +341,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
if (pdata-setup_clock(VPBE_ENC_DV_TIMINGS, 2700)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_DV_TIMINGS, 2700);
venc_enabledigitaloutput(sd, 0);
 
if (venc-venc_type == VPBE_VERSION_2)
@@ -366,6 +389,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
if (pdata-setup_clock(VPBE_ENC_DV_TIMINGS, 2700)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_DV_TIMINGS, 2700);
venc_enabledigitaloutput(sd, 0);
 
if (venc-venc_type == VPBE_VERSION_2)
@@ -406,6 +430,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd)
if (pdata-setup_clock(VPBE_ENC_DV_TIMINGS, 7425)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_DV_TIMINGS, 7425);
venc_enabledigitaloutput(sd, 0);
 
venc_write(sd, VENC_OSDCLK0, 0);
@@ -434,6 +459,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd)
if (pdata-setup_clock(VPBE_ENC_DV_TIMINGS, 7425)  0)
return -EINVAL;
 
+   venc_enable_vpss_clock(venc-venc_type, VPBE_ENC_DV_TIMINGS, 7425);
venc_enabledigitaloutput(sd, 0);
 
venc_write(sd, VENC_OSDCLK0, 0);
-- 
1.7.4.1

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


Re: Status of the patches under review at LMML (32 patches)

2013-03-24 Thread Prabhakar Lad
Hi Mauro,

On Sun, Mar 24, 2013 at 11:41 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 This is the summary of the patches that are currently under review at
 Linux Media Mailing List linux-media@vger.kernel.org.
 Each patch is represented by its submission date, the subject (up to 70
 chars) and the patchwork link (if submitted via email).

 P.S.: This email is c/c to the developers where some action is expected.
   If you were copied, please review the patches, acking/nacking or
   submitting an update.

 It took me a lot of time to handle patches this time. The good news is that
 there's just one patch without an owner.


[Snip]


 == Prabhakar Lad prabhakar@ti.com ==

 Oct,24 2012: [media] vpif_display: fix return value check in vpif_reqbufs()   
   http://patchwork.linuxtv.org/patch/15167  Wei Yongjun 
 yongjun_...@trendmicro.com.cn

This patch can be marked as 'Superseded'.

Regards,
--Prabhakar
--
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/2] media: davinci: vpss: enable vpss clocks

2013-03-25 Thread Prabhakar Lad
Hi Sekhar,

Thanks for the review!

On Mon, Mar 25, 2013 at 11:02 AM, Sekhar Nori nsek...@ti.com wrote:
 On 3/22/2013 1:23 PM, Prabhakar lad wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 By default the VPSS clocks are only enabled in capture driver
 for davinci family which creates duplicates. This
 patch adds support to enable the VPSS clocks in VPSS driver.
 This avoids duplication of code and also adding clock aliases.
 This patch cleanups the VPSS clock enabling in the capture driver,
 and also removes the clock alias in machine file. Along side adds
 a vpss slave clock for DM365 as mentioned by Sekhar
 (https://patchwork.kernel.org/patch/1221261/).

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  arch/arm/mach-davinci/dm355.c|3 -
  arch/arm/mach-davinci/dm365.c|9 +++-
  arch/arm/mach-davinci/dm644x.c   |5 --
  drivers/media/platform/davinci/dm355_ccdc.c  |   39 +
  drivers/media/platform/davinci/dm644x_ccdc.c |   44 ---
  drivers/media/platform/davinci/isif.c|   28 ++--
  drivers/media/platform/davinci/vpss.c|   60 
 ++
  7 files changed, 72 insertions(+), 116 deletions(-)

  static struct clk arm_clk = {
   .name   = arm_clk,
   .parent = pll2_sysclk2,
 @@ -450,6 +456,7 @@ static struct clk_lookup dm365_clks[] = {
   CLK(NULL, pll2_sysclk9, pll2_sysclk9),
   CLK(NULL, vpss_dac, vpss_dac_clk),
   CLK(NULL, vpss_master, vpss_master_clk),
 + CLK(NULL, vpss_slave, vpss_slave_clk),

 These should use device name for look-up instead of relying just on
 con_id. So the entry should look like:

 CLK(vpss, slave, vpss_slave_clk),

OK

   CLK(NULL, arm, arm_clk),
   CLK(NULL, uart0, uart0_clk),
   CLK(NULL, uart1, uart1_clk),
 @@ -1239,8 +1246,6 @@ static int __init dm365_init_devices(void)
   clk_add_alias(NULL, dev_name(dm365_mdio_device.dev),
 NULL, dm365_emac_device.dev);

 - /* Add isif clock alias */
 - clk_add_alias(master, dm365_isif_dev.name, vpss_master, NULL);
   platform_device_register(dm365_vpss_device);
   platform_device_register(dm365_isif_dev);
   platform_device_register(vpfe_capture_dev);
 diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
 index ee0e994..026e7e3 100644
 --- a/arch/arm/mach-davinci/dm644x.c
 +++ b/arch/arm/mach-davinci/dm644x.c
 @@ -901,11 +901,6 @@ int __init dm644x_init_video(struct vpfe_config 
 *vpfe_cfg,
   dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
   platform_device_register(dm644x_ccdc_dev);
   platform_device_register(dm644x_vpfe_dev);
 - /* Add ccdc clock aliases */
 - clk_add_alias(master, dm644x_ccdc_dev.name,
 -   vpss_master, NULL);
 - clk_add_alias(slave, dm644x_ccdc_dev.name,
 -   vpss_slave, NULL);
   }

   if (vpbe_cfg) {
 diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
 b/drivers/media/platform/davinci/dm355_ccdc.c
 index 2364dba..05f8fb7 100644
 --- a/drivers/media/platform/davinci/dm355_ccdc.c
 +++ b/drivers/media/platform/davinci/dm355_ccdc.c
 @@ -37,7 +37,6 @@
  #include linux/platform_device.h
  #include linux/uaccess.h
  #include linux/videodev2.h
 -#include linux/clk.h
  #include linux/err.h
  #include linux/module.h

 @@ -59,10 +58,6 @@ static struct ccdc_oper_config {
   struct ccdc_params_raw bayer;
   /* YCbCr configuration */
   struct ccdc_params_ycbcr ycbcr;
 - /* Master clock */
 - struct clk *mclk;
 - /* slave clock */
 - struct clk *sclk;
   /* ccdc base address */
   void __iomem *base_addr;
  } ccdc_cfg = {
 @@ -997,32 +992,10 @@ static int dm355_ccdc_probe(struct platform_device 
 *pdev)
   goto fail_nomem;
   }

 - /* Get and enable Master clock */
 - ccdc_cfg.mclk = clk_get(pdev-dev, master);
 - if (IS_ERR(ccdc_cfg.mclk)) {
 - status = PTR_ERR(ccdc_cfg.mclk);
 - goto fail_nomap;
 - }
 - if (clk_prepare_enable(ccdc_cfg.mclk)) {
 - status = -ENODEV;
 - goto fail_mclk;
 - }
 -
 - /* Get and enable Slave clock */
 - ccdc_cfg.sclk = clk_get(pdev-dev, slave);
 - if (IS_ERR(ccdc_cfg.sclk)) {
 - status = PTR_ERR(ccdc_cfg.sclk);
 - goto fail_mclk;
 - }
 - if (clk_prepare_enable(ccdc_cfg.sclk)) {
 - status = -ENODEV;
 - goto fail_sclk;
 - }
 -
   /* Platform data holds setup_pinmux function ptr */
   if (NULL == pdev-dev.platform_data) {
   status = -ENODEV;
 - goto fail_sclk;
 + goto fail_nomap;
   }
   setup_pinmux = pdev-dev.platform_data;
   /*
 @@ -1033,12 +1006,6 @@ static int dm355_ccdc_probe(struct platform_device 
 *pdev)
   ccdc_cfg.dev = pdev-dev;
   printk

Re: [PATCH 2/2] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver

2013-03-25 Thread Prabhakar Lad
Hi Sekhar,

On Mon, Mar 25, 2013 at 11:09 AM, Sekhar Nori nsek...@ti.com wrote:
 On 3/22/2013 1:23 PM, Prabhakar lad wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 The vpss clocks were enabled by calling a exported function from a driver
 in a machine code. calling driver code from platform code is incorrect way.

 This patch fixes this issue and calls the function from driver code itself.

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  Note: This patch is based on the comment from Sekhar
   (https://patchwork-mail1.kernel.org/patch/2278441/).
   Shekar I haven't completely removed the callback, I just added
   the function calls after the callback. As you mentioned just to
   pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
   is already being used by VPSS driver. I'll take this cleanup task later
   point of time.

 Fine by me.

Can I have your ACK on this patch ?

Regards,
--Prabhakar

 Thanks,
 Sekhar
--
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/2] media: davinci: vpss: enable vpss clocks

2013-03-25 Thread Prabhakar Lad
Sekhar,

On Mon, Mar 25, 2013 at 3:54 PM, Sekhar Nori nsek...@ti.com wrote:
 On 3/25/2013 3:44 PM, Prabhakar Lad wrote:
 Hi Sekhar,

 Thanks for the review!

 On Mon, Mar 25, 2013 at 11:02 AM, Sekhar Nori nsek...@ti.com wrote:
 On 3/22/2013 1:23 PM, Prabhakar lad wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 By default the VPSS clocks are only enabled in capture driver
 for davinci family which creates duplicates. This
 patch adds support to enable the VPSS clocks in VPSS driver.
 This avoids duplication of code and also adding clock aliases.
 This patch cleanups the VPSS clock enabling in the capture driver,
 and also removes the clock alias in machine file. Along side adds
 a vpss slave clock for DM365 as mentioned by Sekhar
 (https://patchwork.kernel.org/patch/1221261/).

 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---
  arch/arm/mach-davinci/dm355.c|3 -
  arch/arm/mach-davinci/dm365.c|9 +++-
  arch/arm/mach-davinci/dm644x.c   |5 --
  drivers/media/platform/davinci/dm355_ccdc.c  |   39 +
  drivers/media/platform/davinci/dm644x_ccdc.c |   44 ---
  drivers/media/platform/davinci/isif.c|   28 ++--
  drivers/media/platform/davinci/vpss.c|   60 
 ++
  7 files changed, 72 insertions(+), 116 deletions(-)

  static struct clk arm_clk = {
   .name   = arm_clk,
   .parent = pll2_sysclk2,
 @@ -450,6 +456,7 @@ static struct clk_lookup dm365_clks[] = {
   CLK(NULL, pll2_sysclk9, pll2_sysclk9),
   CLK(NULL, vpss_dac, vpss_dac_clk),
   CLK(NULL, vpss_master, vpss_master_clk),
 + CLK(NULL, vpss_slave, vpss_slave_clk),

 These should use device name for look-up instead of relying just on
 con_id. So the entry should look like:

 CLK(vpss, slave, vpss_slave_clk),

 OK

   CLK(NULL, arm, arm_clk),
   CLK(NULL, uart0, uart0_clk),
   CLK(NULL, uart1, uart1_clk),
 @@ -1239,8 +1246,6 @@ static int __init dm365_init_devices(void)
   clk_add_alias(NULL, dev_name(dm365_mdio_device.dev),
 NULL, dm365_emac_device.dev);

 - /* Add isif clock alias */
 - clk_add_alias(master, dm365_isif_dev.name, vpss_master, NULL);
   platform_device_register(dm365_vpss_device);
   platform_device_register(dm365_isif_dev);
   platform_device_register(vpfe_capture_dev);
 diff --git a/arch/arm/mach-davinci/dm644x.c 
 b/arch/arm/mach-davinci/dm644x.c
 index ee0e994..026e7e3 100644
 --- a/arch/arm/mach-davinci/dm644x.c
 +++ b/arch/arm/mach-davinci/dm644x.c
 @@ -901,11 +901,6 @@ int __init dm644x_init_video(struct vpfe_config 
 *vpfe_cfg,
   dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
   platform_device_register(dm644x_ccdc_dev);
   platform_device_register(dm644x_vpfe_dev);
 - /* Add ccdc clock aliases */
 - clk_add_alias(master, dm644x_ccdc_dev.name,
 -   vpss_master, NULL);
 - clk_add_alias(slave, dm644x_ccdc_dev.name,
 -   vpss_slave, NULL);
   }

   if (vpbe_cfg) {
 diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
 b/drivers/media/platform/davinci/dm355_ccdc.c
 index 2364dba..05f8fb7 100644
 --- a/drivers/media/platform/davinci/dm355_ccdc.c
 +++ b/drivers/media/platform/davinci/dm355_ccdc.c
 @@ -37,7 +37,6 @@
  #include linux/platform_device.h
  #include linux/uaccess.h
  #include linux/videodev2.h
 -#include linux/clk.h
  #include linux/err.h
  #include linux/module.h

 @@ -59,10 +58,6 @@ static struct ccdc_oper_config {
   struct ccdc_params_raw bayer;
   /* YCbCr configuration */
   struct ccdc_params_ycbcr ycbcr;
 - /* Master clock */
 - struct clk *mclk;
 - /* slave clock */
 - struct clk *sclk;
   /* ccdc base address */
   void __iomem *base_addr;
  } ccdc_cfg = {
 @@ -997,32 +992,10 @@ static int dm355_ccdc_probe(struct platform_device 
 *pdev)
   goto fail_nomem;
   }

 - /* Get and enable Master clock */
 - ccdc_cfg.mclk = clk_get(pdev-dev, master);
 - if (IS_ERR(ccdc_cfg.mclk)) {
 - status = PTR_ERR(ccdc_cfg.mclk);
 - goto fail_nomap;
 - }
 - if (clk_prepare_enable(ccdc_cfg.mclk)) {
 - status = -ENODEV;
 - goto fail_mclk;
 - }
 -
 - /* Get and enable Slave clock */
 - ccdc_cfg.sclk = clk_get(pdev-dev, slave);
 - if (IS_ERR(ccdc_cfg.sclk)) {
 - status = PTR_ERR(ccdc_cfg.sclk);
 - goto fail_mclk;
 - }
 - if (clk_prepare_enable(ccdc_cfg.sclk)) {
 - status = -ENODEV;
 - goto fail_sclk;
 - }
 -
   /* Platform data holds setup_pinmux function ptr */
   if (NULL == pdev-dev.platform_data) {
   status = -ENODEV;
 - goto fail_sclk;
 + goto fail_nomap;
   }
   setup_pinmux = pdev-dev.platform_data

Re: [PATCH] staging: davinci: Fix typo in staging/media/davinci

2013-03-26 Thread Prabhakar Lad
Hi Masanari,

Thanks for the patch!

On Tue, Mar 26, 2013 at 8:53 PM, Masanari Iida standby2...@gmail.com wrote:
 Correct spelling typo in staging/media/davinci

 Signed-off-by: Masanari Iida standby2...@gmail.com
 ---
  drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt | 2 +-
  drivers/staging/media/davinci_vpfe/dm365_isif.c| 6 +++---
  drivers/staging/media/davinci_vpfe/vpfe_video.c| 8 
  drivers/staging/media/davinci_vpfe/vpfe_video.h| 2 +-
  4 files changed, 9 insertions(+), 9 deletions(-)

 diff --git a/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt 
 b/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt
 index 1dbd564..a1e9177 100644
 --- a/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt
 +++ b/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt
 @@ -38,7 +38,7 @@ interface to userspace.
 DAVINCI RESIZER A
 DAVINCI RESIZER B

 -Each possible link in the VPFE is modeled by a link in the Media controller
 +Each possible link in the VPFE is modelled by a link in the Media controller

s/modeled/modelled are one and the same. you can keep it as is.
Rest of the patch looks OK. With this change you can add my ACK.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Regards,
--Prabhakar

  interface. For an example program see [1].


 diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c 
 b/drivers/staging/media/davinci_vpfe/dm365_isif.c
 index ebeea72..6d4a93c 100644
 --- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
 +++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
 @@ -685,7 +685,7 @@ static void isif_config_bclamp(struct vpfe_isif_device 
 *isif,
 val = (bc-bc_mode_color  ISIF_BC_MODE_COLOR_MASK) 
 ISIF_BC_MODE_COLOR_SHIFT;

 -   /* Enable BC and horizontal clamp caculation paramaters */
 +   /* Enable BC and horizontal clamp calculation paramaters */
 val = val | 1 | ((bc-horz.mode  ISIF_HORZ_BC_MODE_MASK) 
   ISIF_HORZ_BC_MODE_SHIFT);

 @@ -722,7 +722,7 @@ static void isif_config_bclamp(struct vpfe_isif_device 
 *isif,
 isif_write(isif-isif_cfg.base_addr, val, CLHWIN2);
 }

 -   /* vertical clamp caculation paramaters */
 +   /* vertical clamp calculation paramaters */
 /* OB H Valid */
 val = bc-vert.ob_h_sz_calc  ISIF_VERT_BC_OB_H_SZ_MASK;

 @@ -1569,7 +1569,7 @@ isif_pad_set_crop(struct v4l2_subdev *sd, struct 
 v4l2_subdev_fh *fh,
 crop-rect.width = format-width;
 crop-rect.height = format-height;
 }
 -   /* adjust the width to 16 pixel boundry */
 +   /* adjust the width to 16 pixel boundary */
 crop-rect.width = ((crop-rect.width + 15)  ~0xf);
 vpfe_isif-crop = crop-rect;
 if (crop-which == V4L2_SUBDEV_FORMAT_ACTIVE) {
 diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
 b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 index 99ccbeb..c91d356 100644
 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 @@ -357,7 +357,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline 
 *pipe)
   *
   * Set the pipeline to the given stream state.
   *
 - * Return 0 if successfull, or the return value of the failed video::s_stream
 + * Return 0 if successful, or the return value of the failed video::s_stream
   * operation otherwise.
   */
  static int vpfe_pipeline_set_stream(struct vpfe_pipeline *pipe,
 @@ -644,7 +644,7 @@ static int vpfe_g_fmt(struct file *file, void *priv,
   * fills v4l2_fmtdesc structure with output format set on adjacent subdev,
   * only one format is enumearted as subdevs are already configured
   *
 - * Return 0 if successfull, error code otherwise
 + * Return 0 if successful, error code otherwise
   */
  static int vpfe_enum_fmt(struct file *file, void  *priv,
struct v4l2_fmtdesc *fmt)
 @@ -769,7 +769,7 @@ static int vpfe_try_fmt(struct file *file, void *priv,
   * fills v4l2_input structure with input available on media chain,
   * only one input is enumearted as media chain is setup by this time
   *
 - * Return 0 if successfull, -EINVAL is media chain is invalid
 + * Return 0 if successful, -EINVAL is media chain is invalid
   */
  static int vpfe_enum_input(struct file *file, void *priv,
  struct v4l2_input *inp)
 @@ -779,7 +779,7 @@ static int vpfe_enum_input(struct file *file, void *priv,
 struct vpfe_device *vpfe_dev = video-vpfe_dev;

 v4l2_dbg(1, debug, vpfe_dev-v4l2_dev, vpfe_enum_input\n);
 -   /* enumerate from the subdev user has choosen through mc */
 +   /* enumerate from the subdev user has chosen through mc */
 if (inp-index  sdinfo-num_inputs) {
 memcpy(inp, sdinfo-inputs[inp-index],
sizeof(struct v4l2_input));
 diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h 
 

[PATCH] media: v4l2-ctrls: add control for dpcm predictor

2012-08-29 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..2d7bc15 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple Predictor,
+   Advanced Predictor,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DPCM_PREDICTOR:
+   return dpcm_predictor;
 
default:
return NULL;
@@ -732,6 +739,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_IMAGE_PROC_CLASS: return Image Processing 
Controls;
case V4L2_CID_LINK_FREQ:return Link Frequency;
case V4L2_CID_PIXEL_RATE:   return Pixel Rate;
+   case V4L2_CID_DPCM_PREDICTOR:   return DPCM Predictor;
 
default:
return NULL;
@@ -832,6 +840,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_ISO_SENSITIVITY_AUTO:
case V4L2_CID_EXPOSURE_METERING:
case V4L2_CID_SCENE_MODE:
+   case V4L2_CID_DPCM_PREDICTOR:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6d6dfa7..4edb941 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2000,6 +2000,11 @@ enum v4l2_jpeg_chroma_subsampling {
 
 #define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 1)
 #define V4L2_CID_PIXEL_RATE(V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 2)
+#define V4L2_CID_DPCM_PREDICTOR
(V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
+enum v4l2_dpcm_predictor {
+   V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
+   V4L2_DPCM_PREDICTOR_ADVANCE = 1,
+};
 
 /*
  * T U N I N G
-- 
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


Re: [PATCH] media: v4l2-ctrls: add control for dpcm predictor

2012-08-29 Thread Prabhakar Lad
Hi Sylwester,

On Wednesday 29 August 2012 06:13 PM, Sylwester Nawrocki wrote:
 Hi Prabhakar,
 
 On 08/29/2012 02:31 PM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.
 
 Thanks for the patch. I was expecting to find some information about
 this new control in its DocBook documentation, but this part seems
 to be missing here. :) Could you please add relevant entries in
 Documentation/DocBook/media/v4l/controls.xml as well ?
 
Thanks for the catch :) I'll add it for v2.

Thanks and Regards,
--Prabhakar

 --
 
 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] [media] davinci: vpfe: Add documentation

2012-08-29 Thread Prabhakar Lad
Hi Sakari,

On Thu, Aug 16, 2012 at 9:53 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Manju,

 On Thu, Aug 09, 2012 at 09:13:52AM +0530, Manjunath Hadli wrote:
 Hi Sakari,

  Thank you for the comments.

 Thanks for the graphs!

 On Thursday 02 August 2012 05:37 AM, Sakari Ailus wrote:
  Hi Manju,
 
  Thanks for the patch.
 
  Please make sure these patches reach linux-media next time. If they do
  not,
  it severely limits the number of potential reviewers. I don't know
  why, but
  the original patch isn't on linux-media even if the list was cc'd.
 
  Dropping linux-kernel from cc.
 
  Manjunath Hadli wrote:
  Add documentation on the Davinci VPFE driver. Document the subdevs,
  and private IOTCLs the driver implements
 
  Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
  Signed-off-by: Lad, Prabhakar prabhakar@ti.com
  ---
Documentation/video4linux/davinci-vpfe-mc.txt |  263
  +
1 files changed, 263 insertions(+), 0 deletions(-)
create mode 100644 Documentation/video4linux/davinci-vpfe-mc.txt
 
  diff --git a/Documentation/video4linux/davinci-vpfe-mc.txt
  b/Documentation/video4linux/davinci-vpfe-mc.txt
  new file mode 100644
  index 000..968194f
  --- /dev/null
  +++ b/Documentation/video4linux/davinci-vpfe-mc.txt
  @@ -0,0 +1,263 @@
  +Davinci Video processing Front End (VPFE) driver
  +
  +Copyright (C) 2012 Texas Instruments Inc
  +
  +Contacts: Manjunath Hadli manjunath.ha...@ti.com
  +
  +Introduction
  +
  +
  +This file documents the Texas Instruments Davinci Video processing
  Front End
  +(VPFE) driver located under drivers/media/video/davinci. The
  original driver
  +exists for Davinci VPFE, which is now being changed to Media Controller
  +Framework.
  +
  +Currently the driver has been successfully used on the following
  version of Davinci:
  +
  +DM365/DM368
  +
  +The driver implements V4L2, Media controller and v4l2_subdev
  interfaces.
  +Sensor, lens and flash drivers using the v4l2_subdev interface in
  the kernel
  +are supported.
  +
  +
  +Split to subdevs
  +
  +
  +The Davinic VPFE is split into V4L2 subdevs, each of the blocks
  inside the VPFE
  +having one subdev to represent it. Each of the subdevs provide a
  V4L2 subdev
  +interface to userspace.
  +
  +DAVINCI CCDC
  +DAVINCI PREVIEWER
  +DAVINCI RESIZER
  +DAVINCI AEW
  +DAVINCI AF
  +
  +Each possible link in the VPFE is modeled by a link in the Media
  controller
  +interface. For an example program see [1].
  +
  +
  +Private IOCTLs
  +==
  +
  +The Davinci Video processing Front End (VPFE) driver supports
  standard V4L2
  +IOCTLs and controls where possible and practical. Much of the
  functions provided
  +by the VPFE, however, does not fall under the standard IOCTLs.
  +
  +In general, there is a private ioctl for configuring each of the blocks
  +containing hardware-dependent functions.
  +
  +The following private IOCTLs are supported:
  +
  +1: IOCTL: PREV_S_PARAM/PREV_G_PARAM
  +Description:
  +Sets/Gets the parameters required by the previewer module
  +Parameter:
  +/**
  + * struct prev_module_param- structure to configure preview modules
  + * @version: Version of the preview module
  + * @len: Length of the module config structure
  + * @module_id: Module id
  + * @param: pointer to module config parameter.
  + */
  +struct prev_module_param {
  +char version[IMP_MAX_NAME_SIZE];
  +unsigned short len;
  +unsigned short module_id;
  +void *param;
  +};
 
  In addition to what Laurent commented on this, could the version
  information be passed in struct media_entity_desc instead?
 I plan to leave out the version.
 
  As a general comment, it's a bad idea to design an API that allows
  passing
  blobs, especially when the expected size of the blobs isn't known. That
  really equals to asking for trouble.
 
  That said, I know this is an area where complete documentation is acarce,
  but I think that at least the memory layout of the current blob pointers
  should be visible in the struct definitions whenever possible. See
  e.g. the
  OMAP 3 ISP driver.
 I have proposed using a union of structures instead of the void  blob.
 I also saw the OMAP implementation, and they are pointers (but not void).
 To me the union approach looks better as it keeps the architecture
 intact and does not necessitate an
 explicit copy_from_user. Which of these ways do you suggest?

 I would suggest to use the approach taken in the OMAP 3 ISP driver as it has
 one obvious advantage over the union of pointers: it makes it possible to
 perform atomic changes to the configuration.

 However, changes to configuration done through controls and the private
 IOCTL can never be atomic as they're done using a different IOCTL. This is
 something that will require some work at the API level in the future.

 I'm fine with both union of struct pointers 

Re: [PATCH] media: v4l2-ctrls: add control for dpcm predictor

2012-08-29 Thread Prabhakar Lad
Hi Sakari,

Thanks for the review.

On Wed, Aug 29, 2012 at 7:51 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Prabhakar,

 Thanks for the patch.

 On Wed, Aug 29, 2012 at 06:01:07PM +0530, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 ---
  This patches has one checkpatch warning for line over
  80 characters altough it can be avoided I have kept it
  for consistency.

  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +
  2 files changed, 14 insertions(+), 0 deletions(-)

 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index b6a2ee7..2d7bc15 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
   Gray,
   NULL,
   };
 + static const char * const dpcm_predictor[] = {
 + Simple Predictor,
 + Advanced Predictor,
 + NULL,
 + };

   switch (id) {
   case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
 @@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
   return mpeg4_profile;
   case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
   return jpeg_chroma_subsampling;
 + case V4L2_CID_DPCM_PREDICTOR:
 + return dpcm_predictor;

   default:
   return NULL;
 @@ -732,6 +739,7 @@ const char *v4l2_ctrl_get_name(u32 id)
   case V4L2_CID_IMAGE_PROC_CLASS: return Image Processing 
 Controls;
   case V4L2_CID_LINK_FREQ:return Link Frequency;
   case V4L2_CID_PIXEL_RATE:   return Pixel Rate;
 + case V4L2_CID_DPCM_PREDICTOR:   return DPCM Predictor;

   default:
   return NULL;
 @@ -832,6 +840,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
 v4l2_ctrl_type *type,
   case V4L2_CID_ISO_SENSITIVITY_AUTO:
   case V4L2_CID_EXPOSURE_METERING:
   case V4L2_CID_SCENE_MODE:
 + case V4L2_CID_DPCM_PREDICTOR:
   *type = V4L2_CTRL_TYPE_MENU;
   break;
   case V4L2_CID_LINK_FREQ:
 diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
 index 6d6dfa7..4edb941 100644
 --- a/include/linux/videodev2.h
 +++ b/include/linux/videodev2.h
 @@ -2000,6 +2000,11 @@ enum v4l2_jpeg_chroma_subsampling {

  #define V4L2_CID_LINK_FREQ   
 (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
  #define V4L2_CID_PIXEL_RATE  
 (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
 +#define V4L2_CID_DPCM_PREDICTOR  
 (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
 +enum v4l2_dpcm_predictor {
 + V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
 + V4L2_DPCM_PREDICTOR_ADVANCE = 1,
 +};

 s/ADVANCE/ADVANCED/ perhaps?

Ok I'll make it ADVANCED.

 To add to Sylwester's comment on the documentation, I think this control
 belongs to the image processing controls class.

I have added it as part of image processing control class itself
(#define V4L2_CID_DPCM_PREDICTOR  (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)),
 I'll include the same in documentation as well.

Thanks and Regards,
--Prabhakar Lad

 Kind regards,

 --
 Sakari Ailus
 e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
 ___
 Davinci-linux-open-source mailing list
 davinci-linux-open-sou...@linux.davincidsp.com
 http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
--
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] media: v4l2-ctrls: add control for dpcm predictor

2012-08-30 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v2: 
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   25 -
 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +
 3 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..84746d0 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,30 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-dpcm-predictor
+   entry spanname=descr DPCM Predictor: depicts what type of 
prediction
+   is used simple or advanced.
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/entry/row
/tbody
   /tgroup
   /table
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..2d7bc15 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple Predictor,
+   Advanced Predictor,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DPCM_PREDICTOR:
+   return dpcm_predictor;
 
default:
return NULL;
@@ -732,6 +739,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_IMAGE_PROC_CLASS: return Image Processing 
Controls;
case V4L2_CID_LINK_FREQ:return Link Frequency;
case V4L2_CID_PIXEL_RATE:   return Pixel Rate;
+   case V4L2_CID_DPCM_PREDICTOR:   return DPCM Predictor;
 
default:
return NULL;
@@ -832,6 +840,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_ISO_SENSITIVITY_AUTO:
case V4L2_CID_EXPOSURE_METERING:
case V4L2_CID_SCENE_MODE:
+   case V4L2_CID_DPCM_PREDICTOR:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6d6dfa7..ca9fb78 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2000,6 +2000,11 @@ enum v4l2_jpeg_chroma_subsampling {
 
 #define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 1)
 #define V4L2_CID_PIXEL_RATE(V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 2)
+#define V4L2_CID_DPCM_PREDICTOR
(V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
+enum v4l2_dpcm_predictor {
+   V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
+   V4L2_DPCM_PREDICTOR_ADVANCED= 1,
+};
 
 /*
  * T U N I N G
-- 
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


Re: [PATCH] [media] davinci: vpfe: Add documentation

2012-09-01 Thread Prabhakar Lad
Hi Laurent,

On Sat, Sep 1, 2012 at 7:52 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Sakari,

 On Saturday 01 September 2012 12:57:07 Sakari Ailus wrote:
 On Wed, Aug 29, 2012 at 08:11:50PM +0530, Prabhakar Lad wrote:

 [snip]

  For test pattern you meant control to enable/disable it ?

 There are two approaches I can think of.

 One is a menu control which can be used to choose the test pattern (or
 disable it). The control could be standardised but the menu items would have
 to be hardware-specific since the test patterns themselves are not
 standardised.

 Agreed. The test patterns themselves are highly hardware-specific.

 From personal experience with sensors, most devices implement a small, fixed
 set of test patterns that can be exposed through a menu control. However, some
 devices also implement more configurable test patterns. For instance the
 MT9V032 can generate horizontal, vertical or diagonal test patterns, or a
 uniform grey test pattern with a user-configurable value. This would then
 require two controls.

two controls I didn't get it ? When we have menu itself with a list of standard
patterns why would two controls be required ?

Thx,
--Prabhakar Lad

 The alternative is to have a boolean control to enable (and disable) the
 test pattern and then a menu control to choose which one to use. Using or
 implemeting the control to select the test pattern isn't even strictly
 necessary to get a test pattern out of the device: one can enable it without
 knowing which one it is.

 So which one would be better? Similar cases include V4L2_CID_SCENE_MODE
 which is used to choose the scene mode from a list of alternatives. The main
 difference to this case is that the menu items of the scene mode control
 are standardised, too.

 I'd be inclined to have a single menu control, even if the other menu items
 will be device-specific. The first value (0) still has to be documented to
 mean the test pattern is disabled.

 Laurent, Hans: what do you think?

 A menu control with value 0 meaning test pattern disabled has my preference as
 well.

 --
 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 v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
Cc: HeungJun Kim riverful@samsung.com
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   48 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +++
 3 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..f704218 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,53 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-dpcm-predictor
+   entry spanname=descr Differential pulse-code modulation (DPCM) 
is a signal
+   encoder that uses the baseline of pulse-code modulation (PCM) but 
adds some
+   functionalities based on the prediction of the samples of the 
signal. The input
+   can be an analog signal or a digital signal.
+
+   paraIf the input is a continuous-time
+   analog signal, it needs to be sampled first so that a discrete-time 
signal is
+   the input to the DPCM encoder./para
+
+   paraSimple: take the values of two
+   consecutive samples; if they are analog samples, quantize them; 
calculate the
+   difference between the first one and the next; the output is the 
difference, and
+   it can be further entropy coded./para
+
+   paraAdvanced: instead of taking a difference relative to a 
previous input sample,
+   take the difference relative to the output of a local model of the 
decoder process;
+   in this option, the difference can be quantized, which allows a 
good way to
+   incorporate a controlled loss in the encoding./para
+
+   paraApplying one of these two processes, short-term redundancy 
(positive correlation of
+   nearby values) of the signal is eliminated; compression ratios on 
the order of 2 to 4
+   can be achieved if differences are subsequently entropy coded, 
because the entropy of
+   the difference signal is much smaller than that of the original 
discrete signal treated
+   as independent samples.For more information about DPCM see ulink
+   
url=http://en.wikipedia.org/wiki/Differential_pulse-code_modulation;Wikipedia/ulink./para
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/entry/row
/tbody
   /tgroup
   /table
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..2d7bc15 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple Predictor,
+   Advanced Predictor,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DPCM_PREDICTOR:
+   return 

[PATCH] media: v4l2-ctrls: add control for test pattern

2012-09-03 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_TEST_PATTERN of type menu, which determines
the internal test pattern selected by the device.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
Cc: HeungJun Kim riverful@samsung.com
Cc: Rob Landley r...@landley.net
---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Documentation/DocBook/media/v4l/controls.xml |   52 ++
 drivers/media/v4l2-core/v4l2-ctrls.c |   16 
 include/linux/videodev2.h|   12 ++
 3 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index f704218..06f16e7 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4313,6 +4313,58 @@ interface and may change in the future./para
  /tbody
/entrytbl
  /row
+ row
+   entry 
spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-test-pattern
+   entry spanname=descr The capture devices/sensors have the 
capability to
+   generate internal test patterns. This test patterns are used to 
test a device
+   is properly working and can generate the desired waveforms that it 
supports.
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_TEST_PATTERN_DISABLED/constant/entry
+ entryTest pattern generation is disabled/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_VERTICAL_LINES/constant/entry
+ entryGenerate vertical lines as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_HORIZONTAL_LINES/constant/entry
+ entryGenerate horizontal lines as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_DIAGONAL_LINES/constant/entry
+ entryGenerate diagonal lines as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_SOLID_BLACK/constant/entry
+ entryGenerate solid black color as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_SOLID_WHITE/constant/entry
+ entryGenerate solid white color as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_SOLID_BLUE/constant/entry
+ entryGenerate solid blue color as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_SOLID_RED/constant/entry
+ entryGenerate solid red color as test pattern/entry
+   /row
+   row
+ 
entryconstantV4L2_TEST_PATTERN_CHECKER_BOARD/constant/entry
+ entryGenerate a checker board as test pattern/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
rowentry/entry/row
/tbody
   /tgroup
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 2d7bc15..ae709d1 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -430,6 +430,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Advanced Predictor,
NULL,
};
+   static const char * const test_pattern[] = {
+   Test Pattern Disabled,
+   Vertical Lines,
+   Horizontal Lines,
+   Diagonal Lines,
+   Solid Black,
+   Solid White,
+   Solid Blue,
+   Solid Red,
+   Checker Board,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -509,6 +521,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return jpeg_chroma_subsampling;
case V4L2_CID_DPCM_PREDICTOR:
return dpcm_predictor;
+   case V4L2_CID_TEST_PATTERN:
+   return test_pattern;
 
default:
return NULL;
@@ -740,6 +754,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_LINK_FREQ:return 

Re: [PATCH v3] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Prabhakar Lad
Hi Sylwester,

Thanks for the review.

On Monday 03 September 2012 02:51 PM, Sylwester Nawrocki wrote:
 On 09/03/2012 09:20 AM, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com
 
 Looks good.
 
 Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
 
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Changes for v3:
 1: Added better explanation for DPCM, pointed by Hans.

 Changes for v2:
 1: Added documentaion in controls.xml pointed by Sylwester.
 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
pointed by Sakari.

  Documentation/DocBook/media/v4l/controls.xml |   48 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 61 insertions(+), 1 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..f704218 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,53 @@ interface and may change in the future./para
  pixels / second.
  /entry
/row
 -  rowentry/entry/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 +entrymenu/entry
 +  /row
 +  row id=v4l2-dpcm-predictor
 +entry spanname=descr Differential pulse-code modulation (DPCM) 
 is a signal
 +encoder that uses the baseline of pulse-code modulation (PCM) but 
 adds some
 +functionalities based on the prediction of the samples of the 
 signal. The input
 +can be an analog signal or a digital signal.
 +
 +paraIf the input is a continuous-time
 +analog signal, it needs to be sampled first so that a discrete-time 
 signal is
 +the input to the DPCM encoder./para
 
 nit: this whole paragraph could fit in 2 lines.
 
thanks for the catch ,I'll post a v4 fixing this.

Thanks and Regards,
--Prabhakar Lad

 +
 +paraSimple: take the values of two
 +consecutive samples; if they are analog samples, quantize them; 
 calculate the
 +difference between the first one and the next; the output is the 
 difference, and
 +it can be further entropy coded./para
 +
 +paraAdvanced: instead of taking a difference relative to a 
 previous input sample,
 +take the difference relative to the output of a local model of the 
 decoder process;
 +in this option, the difference can be quantized, which allows a 
 good way to
 +incorporate a controlled loss in the encoding./para
 +
 +paraApplying one of these two processes, short-term redundancy 
 (positive correlation of
 +nearby values) of the signal is eliminated; compression ratios on 
 the order of 2 to 4
 +can be achieved if differences are subsequently entropy coded, 
 because the entropy of
 +the difference signal is much smaller than that of the original 
 discrete signal treated
 +as independent samples.For more information about DPCM see ulink
 +
 url=http://en.wikipedia.org/wiki/Differential_pulse-code_modulation;Wikipedia/ulink./para
 +/entry
 +  /row
 +  row
 +entrytbl spanname=descr cols=2
 +  tbody valign=top
 +row
 + entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
 +  entryPredictor type is simple/entry
 +/row
 +row
 +  
 entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
 +  entryPredictor type is advanced/entry
 +/row
 +  /tbody
 +/entrytbl
 +  /row
 +rowentry/entry/row
  /tbody
/tgroup
/table
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index b6a2ee7..2d7bc15 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  Gray,
  NULL,
  };
 +static const char * const dpcm_predictor[] = {
 +Simple Predictor,
 +Advanced Predictor,
 +NULL

Re: [PATCH] media: v4l2-ctrls: add control for test pattern

2012-09-03 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Monday 03 September 2012 02:52 PM, Hans Verkuil wrote:
 On Mon September 3 2012 11:16:17 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_TEST_PATTERN of type menu, which determines
 the internal test pattern selected by the device.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
  This patches has one checkpatch warning for line over
  80 characters altough it can be avoided I have kept it
  for consistency.

  Documentation/DocBook/media/v4l/controls.xml |   52 
 ++
  drivers/media/v4l2-core/v4l2-ctrls.c |   16 
  include/linux/videodev2.h|   12 ++
  3 files changed, 80 insertions(+), 0 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index f704218..06f16e7 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4313,6 +4313,58 @@ interface and may change in the future./para
/tbody
  /entrytbl
/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
 +entrymenu/entry
 +  /row
 +  row id=v4l2-test-pattern
 +entry spanname=descr The capture devices/sensors have the 
 capability to
 
 Test patterns are also applicable to output devices, not just capture and 
 sensor devices.
 
Agreed. I'll make it 'capture/display/sensors'.

 +generate internal test patterns. This test patterns are used to 
 test a device
 +is properly working and can generate the desired waveforms that it 
 supports.
 +/entry
 +  /row
 +  row
 +entrytbl spanname=descr cols=2
 +  tbody valign=top
 +row
 + entryconstantV4L2_TEST_PATTERN_DISABLED/constant/entry
 +  entryTest pattern generation is disabled/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_VERTICAL_LINES/constant/entry
 +  entryGenerate vertical lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_HORIZONTAL_LINES/constant/entry
 +  entryGenerate horizontal lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_DIAGONAL_LINES/constant/entry
 +  entryGenerate diagonal lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_BLACK/constant/entry
 +  entryGenerate solid black color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_WHITE/constant/entry
 +  entryGenerate solid white color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_BLUE/constant/entry
 +  entryGenerate solid blue color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_RED/constant/entry
 +  entryGenerate solid red color as test pattern/entry
 +/row
 
 Just wondering: is there no SOLID_GREEN available with this sensor?
 
Not sure I guess it should be.

Thanks and Regards,
--Prabhakar Lad

 Regards,
 
   Hans
 
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_CHECKER_BOARD/constant/entry
 +  entryGenerate a checker board as test pattern/entry
 +/row
 +  /tbody
 +/entrytbl
 +  /row
  rowentry/entry/row
  /tbody
/tgroup
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index 2d7bc15..ae709d1 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -430,6 +430,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  Advanced Predictor,
  NULL,
  };
 +static const char * const test_pattern[] = {
 +Test Pattern Disabled,
 +Vertical Lines,
 +Horizontal Lines,
 +Diagonal Lines,
 +Solid Black,
 +Solid White,
 +Solid Blue,
 +Solid Red,
 +Checker Board,
 +NULL,
 +};
  
  switch (id) {
  case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
 @@ -509,6 +521,8 @@ const char * const *v4l2_ctrl_get_menu

Re: [PATCH] media: v4l2-ctrls: add control for test pattern

2012-09-03 Thread Prabhakar Lad
Hi Sylwester,

Thanks for the review.

On Monday 03 September 2012 02:55 PM, Sylwester Nawrocki wrote:
 On 09/03/2012 11:16 AM, Prabhakar Lad wrote:
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index 2d7bc15..ae709d1 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -430,6 +430,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  Advanced Predictor,
  NULL,
  };
 +static const char * const test_pattern[] = {
 +Test Pattern Disabled,
 
 How about just Disabled ?
 
Ok.

Thanks and Regards,
--Prabhakar Lad

 +Vertical Lines,
 +Horizontal Lines,
 +Diagonal Lines,
 +Solid Black,
 +Solid White,
 +Solid Blue,
 +Solid Red,
 +Checker Board,
 +NULL,
 +};
 
 --
 
 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] media: v4l2-ctrls: add control for test pattern

2012-09-03 Thread Prabhakar Lad
Hi Sakari,

Thanks for the review.

On Tuesday 04 September 2012 01:09 AM, Sakari Ailus wrote:
 Hi Prabhakar,
 
 Thanks for the patch.
 
 On Mon, Sep 03, 2012 at 02:46:17PM +0530, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_TEST_PATTERN of type menu, which determines
 the internal test pattern selected by the device.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 Cc: HeungJun Kim riverful@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
  This patches has one checkpatch warning for line over
  80 characters altough it can be avoided I have kept it
  for consistency.

  Documentation/DocBook/media/v4l/controls.xml |   52 
 ++
  drivers/media/v4l2-core/v4l2-ctrls.c |   16 
  include/linux/videodev2.h|   12 ++
  3 files changed, 80 insertions(+), 0 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index f704218..06f16e7 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4313,6 +4313,58 @@ interface and may change in the future./para
/tbody
  /entrytbl
/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
 +entrymenu/entry
 +  /row
 +  row id=v4l2-test-pattern
 +entry spanname=descr The capture devices/sensors have the 
 capability to
 +generate internal test patterns. This test patterns are used to 
 test a device
 +is properly working and can generate the desired waveforms that it 
 supports.
 +/entry
 +  /row
 +  row
 +entrytbl spanname=descr cols=2
 +  tbody valign=top
 +row
 + entryconstantV4L2_TEST_PATTERN_DISABLED/constant/entry
 +  entryTest pattern generation is disabled/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_VERTICAL_LINES/constant/entry
 +  entryGenerate vertical lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_HORIZONTAL_LINES/constant/entry
 +  entryGenerate horizontal lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_DIAGONAL_LINES/constant/entry
 +  entryGenerate diagonal lines as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_BLACK/constant/entry
 +  entryGenerate solid black color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_WHITE/constant/entry
 +  entryGenerate solid white color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_BLUE/constant/entry
 +  entryGenerate solid blue color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_SOLID_RED/constant/entry
 +  entryGenerate solid red color as test pattern/entry
 +/row
 +row
 +  
 entryconstantV4L2_TEST_PATTERN_CHECKER_BOARD/constant/entry
 +  entryGenerate a checker board as test pattern/entry
 +/row
 
 You're defining 8 different test patterns based on a single device, I guess? 
 
No.

 As the test patterns are not standardised, I'd suppose that if another
 driver implements the same control, it would require another n menu items
 added to the same standard menu. That way we'd run quickly out of menu items
 as the maximum is 32.
 
Agreed the test patterns are not standardized and are hardware
dependent, but this entries which have been added are generally common
across capture/display/sensors.

 For this reason I'd leave the items in the menu up to the driver that
 implements the control, until we have more information on the test patterns
 different devices implement --- as discussed earlier.
 
Assuming that I only added disable test pattern and if a driver wants to
implement this control and wants add  an item to this menu, on what
basis an entry to this menu will be qualified then ?

Thanks and Regards,
--Prabhakar Lad

 Kind regards,
 

--
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 v4] media: v4l2-ctrls: add control for dpcm predictor

2012-09-03 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v4:
1: Aligned the description to fit appropriately in the
para tag, pointed by Sylwester.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   46 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +++
 3 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..ad873ea 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,51 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-dpcm-predictor
+   entry spanname=descr Differential pulse-code modulation (DPCM) 
is a signal
+   encoder that uses the baseline of pulse-code modulation (PCM) but 
adds some
+   functionalities based on the prediction of the samples of the 
signal. The input
+   can be an analog signal or a digital signal.
+
+   paraIf the input is a continuous-time analog signal, it needs to 
be sampled
+   first so that a discrete-time signal is the input to the DPCM 
encoder./para
+
+   paraSimple: take the values of two consecutive samples; if they 
are analog
+   samples, quantize them; calculate the difference between the first 
one and the
+   next; the output is the difference, and it can be further entropy 
coded./para
+
+   paraAdvanced: instead of taking a difference relative to a 
previous input sample,
+   take the difference relative to the output of a local model of the 
decoder process;
+   in this option, the difference can be quantized, which allows a 
good way to
+   incorporate a controlled loss in the encoding./para
+
+   paraApplying one of these two processes, short-term redundancy 
(positive correlation of
+   nearby values) of the signal is eliminated; compression ratios on 
the order of 2 to 4
+   can be achieved if differences are subsequently entropy coded, 
because the entropy of
+   the difference signal is much smaller than that of the original 
discrete signal treated
+   as independent samples.For more information about DPCM see ulink
+   
url=http://en.wikipedia.org/wiki/Differential_pulse-code_modulation;Wikipedia/ulink./para
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/entry/row
/tbody
   /tgroup
   /table
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..2d7bc15 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple Predictor,
+   Advanced Predictor,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+ 

Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor

2012-09-04 Thread Prabhakar Lad
Hi Sakari,

Thanks for the review.

On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:
 Hi Prabhakar,
 
 Thanks for the patch. I've got a few comments below.
 
 On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Acked-by: Hans Verkuil hans.verk...@cisco.com
 Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Changes for v4:
 1: Aligned the description to fit appropriately in the
 para tag, pointed by Sylwester.

 Changes for v3:
 1: Added better explanation for DPCM, pointed by Hans.

 Changes for v2:
 1: Added documentaion in controls.xml pointed by Sylwester.
 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
pointed by Sakari.

  Documentation/DocBook/media/v4l/controls.xml |   46 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 59 insertions(+), 1 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..ad873ea 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,51 @@ interface and may change in the future./para
  pixels / second.
  /entry
/row
 -  rowentry/entry/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 +entrymenu/entry
 +  /row
 +  row id=v4l2-dpcm-predictor
 +entry spanname=descr Differential pulse-code modulation (DPCM) 
 is a signal
 +encoder that uses the baseline of pulse-code modulation (PCM) but 
 adds some
 +functionalities based on the prediction of the samples of the 
 signal. The input
 +can be an analog signal or a digital signal.
 +
 +paraIf the input is a continuous-time analog signal, it needs to 
 be sampled
 +first so that a discrete-time signal is the input to the DPCM 
 encoder./para
 +
 +paraSimple: take the values of two consecutive samples; if they 
 are analog
 +samples, quantize them; calculate the difference between the first 
 one and the
 +next; the output is the difference, and it can be further entropy 
 coded./para
 +
 +paraAdvanced: instead of taking a difference relative to a 
 previous input sample,
 +take the difference relative to the output of a local model of the 
 decoder process;
 +in this option, the difference can be quantized, which allows a 
 good way to
 +incorporate a controlled loss in the encoding./para
 
 This is directly from Wikipedia, isn't it?
 
Yes.

 What comes to the content, DPCM in the context of V4L2 media bus codes, as a
 digital interface, is always digital. So there's no need to document it.
 Entropy coding is also out of the question: the samples of the currently
 defined formats are equal in size.
 
Ok.

 Another thing what I'm not sure is the definition of the simple and advanced
 encoders. I've seen sensors that allow you to choose which one to use, but
 the documentation hasn't stated what the actual implementation is. Does TI
 documentation do so?
 
Couldn't find much apart from this 'The DPCM compression system uses two
different predictors; one is simple and the other is complex. Predictor1
is very simple, so the processing power and the memory requirements are
reduced with it (when the image quality is already high enough).
Predictor2 gives a slightly better prediction for pixel value and the
image quality can be improved with it.'

 In V4L2 documentation we should state what is common in the hardware
 documentation, and that is mostly limited to simple and advanced. I
 really don't know enough that I could say what the exact implamentation of
 those two are in all of the cases.
 
 I suggest we leave just a few words of the DPCM compression itself (roughly
 the factual content of the first paragraph with the exception of the
 reference to analogue signal) and a link to Wikipedia.
 
Ok.

 +paraApplying one of these two processes, short-term redundancy 
 (positive correlation of
 +nearby values) of the signal is eliminated; compression ratios on 
 the order of 2 to 4
 +can be achieved if differences are subsequently

Re: Camera not detected on linux-next

2012-09-06 Thread Prabhakar Lad
Hi Sylwester,

On Wed, Sep 5, 2012 at 9:47 PM, Sylwester Nawrocki
s.nawro...@samsung.com wrote:
 Hi,

 On 09/05/2012 06:06 PM, Fabio Estevam wrote:
 I am running linux-next 20120905 on a mx31pdk board with a ov2640 CMOS
 and I am not able to get the ov2640 to be probed:

 soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
 mx3-camera mx3-camera.0: MX3 Camera driver attached to camera 0
 mx3-camera mx3-camera.0: MX3 Camera driver detached from camera 0
  (no messages showing ov2640 being probed)

 I noticed that Kconfig changed the way to select the Sensors used on
 soc_camera driver and I selected ov2640 in the .config.

 camera worked fine on this board running 3.5.3. So before start
 bisecting, I would like to know if there is anything obvious I am
 missing.

 Also tested on a mx27pdk and ov2640 could not be probed there as well.

 Maybe this is about the sensor/host driver linking order.
 If so, then this patch should help

 http://git.linuxtv.org/snawrocki/media.git/commitdiff/458b9b5ab8cb970887c9d1f1fddf88399b2d9ef2

Thanks for the patch.  I too had created one but didnt submit. I guess you will
post the patch soon to the list.

Thanks and Regards,
--Prabhakar Lad

 --

 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
--
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: Camera not detected on linux-next

2012-09-06 Thread Prabhakar Lad
Hi Sylwester,

On Thu, Sep 6, 2012 at 4:19 PM, Sylwester Nawrocki
s.nawro...@samsung.com wrote:
 Hi Prabhakar,

 On 09/06/2012 11:16 AM, Prabhakar Lad wrote:
 Thanks for the patch.  I too had created one but didnt submit. I guess you 
 will
 post the patch soon to the list.

 I've posted it a few days ago, it's already queued in the patchwork:
 http://patchwork.linuxtv.org/patch/14046/

Thanks for pointing.

Regards,
--Prabhakar Lad


 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 10/12] [media] move i2c files into drivers/media/i2c

2012-09-06 Thread Prabhakar Lad
Hi Mauro,

Thanks for the patch.

On Thu, Sep 6, 2012 at 7:37 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 Em 24-08-2012 20:44, Sylwester Nawrocki escreveu:
 From: Sylwester Nawrocki sylvester.nawro...@gmail.com
 Date: Sat, 25 Aug 2012 01:23:14 +0200
 Subject: [PATCH] [media] Fix link order of the V4L2 bridge and I2C modules

 All I2C modules must be linked first to ensure proper module
 initialization order. With platform devices linked before I2C
 modules I2C subdev registration fails as the subdev drivers
 are not yet initialized during bridge driver's probing.

 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.

 Signed-off-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 ---
  drivers/media/Makefile |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..92a8bcf 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -8,8 +8,9 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
  endif

 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-y += common/ rc/ i2c/
 +obj-y += tuners/ platform/ pci/ usb/ mmc/ firewire/ parport/

 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 +obj-$(CONFIG_VIDEO_DEV) += radio/
  obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/
 -- 1.7.4.1

 Hmm... This change seems incomplete on my eyes: tuners and dvb-frontends
 are also I2C drivers. So, while this fixes the issue for platform drivers,
 other drivers will still suffer this issue, at least on drivers that doesn't
 depend on drivers located outside the media subsystem[1]

 [1] thankfully, staging compiles after media, so the drivers there
 shouldn't be affected. Also, drivers that use alsa won't be affected, as
 alsa core (with is compiled after media) uses subsys_initcall().

 IMO, the correct fix is the one below. Could you please test it?

 Regards,
 Mauro

 -

 [media] Fix init order for I2C drivers

 Based on a patch from Sylvester Nawrocki

 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.

 The linked order affect what drivers will be initialized first, when
 they're built-in at Kernel. While there are macros that allow changing
 the init order, like subsys_initcall(), late_initcall()  friends,
 when all drivers  linked belong to the same subsystem, it is easier
 to change the order at the Makefile.

 All I2C modules must be linked before any drivers that actually use it,
 in order to ensure proper module initialization order.

 Also, the core drivers should be initialized before the drivers that use
 them.

 This patch reorders the drivers init, in order to fulfill the above
 requirements.

 Reported-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

Acked-by: Prabhakar Lad prabhakar@ti.com


Thanks and Regards,
--Prabhakar Lad

 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..620f275 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -4,12 +4,30 @@

  media-objs := media-device.o media-devnode.o media-entity.o

 +#
 +# I2C drivers should come before other drivers, otherwise they'll fail
 +# when compiled as builtin drivers
 +#
 +obj-y += i2c/ tuners/
 +obj-$(CONFIG_DVB_CORE)  += dvb-frontends/
 +
 +#
 +# Now, let's link-in the media core
 +#
  ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
  endif

 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-$(CONFIG_DVB_CORE)  += dvb-core/
 +
 +# There are both core and drivers at RC subtree - merge before drivers
 +obj-y += rc/
 +
 +#
 +# Finally, merge the drivers that require the core
 +#
 +
 +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += radio/

 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 -obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/


--
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] media: v4l2-ctrls: add control for test pattern

2012-09-07 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_TEST_PATTERN of type menu, which determines
the internal test pattern selected by the device.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v2:
1: Included display devices in the description for test pattern
   as pointed by Hans.
2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
   pointed by Sylwester.
3: Removed the test patterns from menu as the are hardware specific
   as pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   20 
 drivers/media/v4l2-core/v4l2-ctrls.c |8 
 include/linux/videodev2.h|4 
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index ad873ea..173934e 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4311,6 +4311,26 @@ interface and may change in the future./para
  /tbody
/entrytbl
  /row
+ row
+   entry 
spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-test-pattern
+   entry spanname=descr The Capture/Display/Sensors have the 
capability
+   to generate internal test patterns and this are hardware specific. 
This
+   test patterns are used to test a device is properly working and can 
generate
+   the desired waveforms that it supports./entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_TEST_PATTERN_DISABLED/constant/entry
+ entryTest pattern generation is disabled/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
rowentry/entry/row
/tbody
   /tgroup
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 8f2f40b..d731422 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -430,6 +430,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Advanced,
NULL,
};
+   static const char * const test_pattern[] = {
+   Disabled,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -509,6 +513,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return jpeg_chroma_subsampling;
case V4L2_CID_DPCM_PREDICTOR:
return dpcm_predictor;
+   case V4L2_CID_TEST_PATTERN:
+   return test_pattern;
 
default:
return NULL;
@@ -740,6 +746,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_LINK_FREQ:return Link Frequency;
case V4L2_CID_PIXEL_RATE:   return Pixel Rate;
case V4L2_CID_DPCM_PREDICTOR:   return DPCM Predictor;
+   case V4L2_CID_TEST_PATTERN: return Test Pattern;
 
default:
return NULL;
@@ -841,6 +848,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_EXPOSURE_METERING:
case V4L2_CID_SCENE_MODE:
case V4L2_CID_DPCM_PREDICTOR:
+   case V4L2_CID_TEST_PATTERN:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ca9fb78..6a2d499 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2005,6 +2005,10 @@ enum v4l2_dpcm_predictor {
V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
V4L2_DPCM_PREDICTOR_ADVANCED= 1,
 };
+#define V4L2_CID_TEST_PATTERN  (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 4)
+enum v4l2_test_pattern {
+   V4L2_TEST_PATTERN_DISABLED  = 0,
+};
 
 /*
  * T U N I N G
-- 
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


Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor

2012-09-07 Thread Prabhakar Lad
Hi Sakari,

On Sat, Sep 8, 2012 at 12:16 AM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Prabhakar,


 Prabhakar Lad wrote:

 Hi Sakari,

 Thanks for the review.

 On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:

 Hi Prabhakar,

 Thanks for the patch. I've got a few comments below.

 On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:

 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Acked-by: Hans Verkuil hans.verk...@cisco.com
 Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Changes for v4:
 1: Aligned the description to fit appropriately in the
 para tag, pointed by Sylwester.

 Changes for v3:
 1: Added better explanation for DPCM, pointed by Hans.

 Changes for v2:
 1: Added documentaion in controls.xml pointed by Sylwester.
 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
 pointed by Sakari.

   Documentation/DocBook/media/v4l/controls.xml |   46
 +-
   drivers/media/v4l2-core/v4l2-ctrls.c |9 +
   include/linux/videodev2.h|5 +++
   3 files changed, 59 insertions(+), 1 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..ad873ea 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,51 @@ interface and may change in the future./para
 pixels / second.
 /entry
   /row
 - rowentry/entry/row
 + row
 +   entry
 spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
 +   entrymenu/entry
 + /row
 + row id=v4l2-dpcm-predictor
 +   entry spanname=descr Differential pulse-code modulation
 (DPCM) is a signal
 +   encoder that uses the baseline of pulse-code modulation
 (PCM) but adds some
 +   functionalities based on the prediction of the samples of
 the signal. The input
 +   can be an analog signal or a digital signal.
 +
 +   paraIf the input is a continuous-time analog signal, it
 needs to be sampled
 +   first so that a discrete-time signal is the input to the
 DPCM encoder./para
 +
 +   paraSimple: take the values of two consecutive samples; if
 they are analog
 +   samples, quantize them; calculate the difference between the
 first one and the
 +   next; the output is the difference, and it can be further
 entropy coded./para
 +
 +   paraAdvanced: instead of taking a difference relative to a
 previous input sample,
 +   take the difference relative to the output of a local model
 of the decoder process;
 +   in this option, the difference can be quantized, which
 allows a good way to
 +   incorporate a controlled loss in the encoding./para


 This is directly from Wikipedia, isn't it?

 Yes.

 What comes to the content, DPCM in the context of V4L2 media bus codes,
 as a
 digital interface, is always digital. So there's no need to document it.
 Entropy coding is also out of the question: the samples of the currently
 defined formats are equal in size.

 Ok.


 Could you replace the above with this text (with appropriate indentation
 etc.) while keeping the reference to Wikipedia?

 --8--
 Differential pulse-code modulation (DPCM) compression can be used to
 compress the samples into fewer bits than they would otherwise require. This
 is done by calculating the difference between consecutive samples and
 outputting the difference which in average is much smaller than the values
 of the samples themselves since there is generally lots of correlation
 between adjacent pixels. In decompression the original samples are
 reconstructed. The process isn't lossless as the encoded sample size in bits
 is less than the original.

 Formats using DPCM compression include xref linkend=pixfmt-srggb10dpcm8
 /.

 This control is used to select the predictor used to encode the samples.

 The main difference between the simple and the advanced predictors is image
 quality, with advanced predictor supposed to produce better quality images
 as a result. Simple predictor can be used e.g. for testing purposes.
 --8--

Thanks for the definition. :)

Thanks and Regards,
--Prabhakar Lad


 Kind regards,

 --
 Sakari Ailus

Re: [PATCH v2] media: v4l2-ctrls: add control for test pattern

2012-09-07 Thread Prabhakar Lad
Hi Sakari,

Thanks for the review.

On Fri, Sep 7, 2012 at 11:50 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Prabhakar,

 Thanks for the patch!


 Prabhakar Lad wrote:

 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_TEST_PATTERN of type menu, which determines
 the internal test pattern selected by the device.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Changes for v2:
 1: Included display devices in the description for test pattern
 as pointed by Hans.
 2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
 pointed by Sylwester.
 3: Removed the test patterns from menu as the are hardware specific
 as pointed by Sakari.

   Documentation/DocBook/media/v4l/controls.xml |   20 
   drivers/media/v4l2-core/v4l2-ctrls.c |8 
   include/linux/videodev2.h|4 
   3 files changed, 32 insertions(+), 0 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index ad873ea..173934e 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4311,6 +4311,26 @@ interface and may change in the future./para
   /tbody
 /entrytbl
   /row
 + row
 +   entry
 spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
 +   entrymenu/entry
 + /row
 + row id=v4l2-test-pattern
 +   entry spanname=descr The Capture/Display/Sensors have the
 capability
 +   to generate internal test patterns and this are hardware
 specific. This
 +   test patterns are used to test a device is properly working
 and can generate
 +   the desired waveforms that it supports./entry
 + /row
 + row
 +   entrytbl spanname=descr cols=2
 + tbody valign=top
 +   row
 +
 entryconstantV4L2_TEST_PATTERN_DISABLED/constant/entry
 + entryTest pattern generation is disabled/entry
 +   /row
 + /tbody
 +   /entrytbl
 + /row
 rowentry/entry/row
 /tbody
 /tgroup
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index 8f2f40b..d731422 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -430,6 +430,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 Advanced,
 NULL,
 };
 +   static const char * const test_pattern[] = {
 +   Disabled,
 +   NULL,
 +   };

 switch (id) {
 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
 @@ -509,6 +513,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 return jpeg_chroma_subsampling;
 case V4L2_CID_DPCM_PREDICTOR:
 return dpcm_predictor;
 +   case V4L2_CID_TEST_PATTERN:
 +   return test_pattern;


 I think it's not necessary to define test_pattern (nor be prepared to return
 it) since the menu is going to be device specific. So the driver is
 responsible for all of the menu items. Such menus are created using
 v4l2_ctrl_new_custom() instead of v4l2_ctrl_new_std_menu().

Ok.

Regrads,
--Prabhakar Lad

 Looks good to me otherwise.

 Kind regards,

 --
 Sakari Ailus
 sakari.ai...@iki.fi

 ___
 Davinci-linux-open-source mailing list
 davinci-linux-open-sou...@linux.davincidsp.com
 http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
--
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 v5] media: v4l2-ctrls: add control for dpcm predictor

2012-09-09 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v5:
1: Changed the control's name to 'Simple' and  'Advanced'
   as pointed by Sakari.
2: Changed the description of DPCM. Thanks to Sakari for
   providing the description.

Changes for v4:
1: Aligned the description to fit appropriately in the
   para tag, pointed by Sylwester.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   39 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |9 ++
 include/linux/videodev2.h|5 +++
 3 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..2c1599f 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,44 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_DPCM_PREDICTOR/constant/entry
+   entrymenu/entry
+ /row
+ row id=v4l2-dpcm-predictor
+   entry spanname=descr Differential pulse-code modulation (DPCM) 
compression can
+   be used to compress the samples into fewer bits than they would 
otherwise require.
+   This is done by calculating the difference between consecutive 
samples and outputting
+   the difference which in average is much smaller than the values of 
the samples
+   themselves since there is generally lots of correlation between 
adjacent pixels. In
+   decompression the original samples are reconstructed. The process 
isn't lossless as
+   the encoded sample size in bits is less than the original.
+
+   paraFormats using DPCM compression include xref 
linkend=pixfmt-srggb10dpcm8 /./para
+
+   paraThis control is used to select the predictor used to encode 
the samples./para
+
+   paraThe main difference between the simple and the advanced 
predictors is image quality,
+   with advanced predictor supposed to produce better quality images 
as a result. Simple
+   predictor can be used e.g. for testing purposes. For more 
information about DPCM see ulink
+   
url=http://en.wikipedia.org/wiki/Differential_pulse-code_modulation;Wikipedia/ulink./para
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/entry/row
/tbody
   /tgroup
   /table
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..8f2f40b 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple,
+   Advanced,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DPCM_PREDICTOR:
+   return dpcm_predictor;
 
default:
return NULL;
@@ -732,6 +739,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_IMAGE_PROC_CLASS: return Image Processing 
Controls;
case 

[PATCH] media: v4l2-ctrl: add a helper fucntion to modify the menu

2012-09-10 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
---
 Documentation/video4linux/v4l2-controls.txt |   26 +
 drivers/media/v4l2-core/v4l2-ctrls.c|   28 +++
 include/media/v4l2-ctrls.h  |   14 +
 3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 43da22b..54a9539 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -196,6 +196,32 @@ the error code at the end. Saves a lot of repetitive error 
checking.
 It is recommended to add controls in ascending control ID order: it will be
 a bit faster that way.
 
+2.1) Changing the menu of a standard control:
+There are suitations when the control is standard but the menu items may be
+device specific, in such cases the framework provides the helper to do that.
+
+struct v4l2_ctrl * v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl,
+   const char * const *qmenu, s32 min, s32 max,
+   u32 menu_skip_mask, s32 def);
+
+This helper, function is used to modify the menu, min, max, mask and
+the default value to set.
+Example for usage:
+   static const char * const test_pattern[] = {
+   Disabled,
+   Vertical Bars,
+   Vertical Bars,
+   Solid Black,
+   Solid White,
+   NULL
+   };
+   struct v4l2_ctrl *test_pattern_ctrl =
+   v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
+   V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
+   V4L2_TEST_PATTERN_DISABLED);
+
+   v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 0, 5, 0x3, 0);
+
 3) Optionally force initial control setup:
 
v4l2_ctrl_handler_setup(foo-ctrl_handler);
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index d731422..ac0fb28 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2666,3 +2666,31 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct 
poll_table_struct *wait)
return 0;
 }
 EXPORT_SYMBOL(v4l2_ctrl_poll);
+
+/* Helper function for standard menu controls to modify the menu */
+struct v4l2_ctrl *v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl,
+const char * const *qmenu, s32 min,
+s32 max, u32 menu_skip_mask, s32 def)
+{
+   if (ctrl-type != V4L2_CTRL_TYPE_MENU)
+   return NULL;
+
+   if (qmenu == NULL)
+   return NULL;
+
+   /* Determine if it is standard menu control */
+   if (!v4l2_ctrl_get_menu(ctrl-id))
+   return NULL;
+
+   if ((def  max) || (max  min))
+   return NULL;
+
+   ctrl-qmenu = qmenu;
+   ctrl-minimum = min;
+   ctrl-maximum = max;
+   ctrl-menu_skip_mask = menu_skip_mask;
+   ctrl-cur.val = ctrl-val = ctrl-default_value = def;
+
+   return ctrl;
+}
+EXPORT_SYMBOL(v4l2_ctrl_modify_menu);
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 776605f..5b0ea04 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -488,6 +488,20 @@ static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
mutex_unlock(ctrl-handler-lock);
 }
 
+/**
+ * v4l2_ctrl_modify_menu() - Modify the menu. This function is used when the
+ * control is standard but the menu is specific to device.
+ * @ctrl:  The control to change the menu.
+ * @qmenu: The menu to which control will point to.
+ * @min:   Minimum value of the control.
+ * @max:   Maximum valur of the control.
+ * @menu_skip_mask:The control's skip mask for menu controls.
+ * @def:   The default value for control.
+ */
+struct v4l2_ctrl *v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl,
+const char * const *qmenu, s32 min,
+s32 max, u32 menu_skip_mask, s32 def);
+
 /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from 
within a driver.
   * @ctrl: The control.
   *
-- 
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


[PATCH v6] media: v4l2-ctrls: add control for dpcm predictor

2012-09-10 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
Acked-by: Sakari Ailus sakari.ai...@iki.fi
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Rob Landley r...@landley.net
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v6:
1: Fitted the description within 80 characters per line,
   pointed by Sakari.

Changes for v5:
1: Changed the control's name to 'Simple' and  'Advanced'
   as pointed by Sakari.
2: Changed the description of DPCM. Thanks to Sakari for
   providing the description.

Changes for v4:
1: Aligned the description to fit appropriately in the
   para tag, pointed by Sylwester.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
   pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   48 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |9 +
 include/linux/videodev2.h|5 +++
 3 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..f0fb08d 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,53 @@ interface and may change in the future./para
pixels / second.
/entry
  /row
- rowentry/entry/row
+ row
+   entry spanname=id
+ constantV4L2_CID_DPCM_PREDICTOR/constant
+   /entry
+   entrymenu/entry
+ /row
+ row id=v4l2-dpcm-predictor
+   entry spanname=descr Differential pulse-code modulation (DPCM)
+   compression can be used to compress the samples into fewer bits
+   than they would otherwise require. This is done by calculating the
+   difference between consecutive samples and outputting the
+   difference which in average is much smaller than the values of the
+   samples themselves since there is generally lots of correlation
+   between adjacent pixels. In decompression the original samples are
+   reconstructed. The process isn't lossless as the encoded sample
+   size in bits is less than the original.
+
+   paraFormats using DPCM compression include
+   xref linkend=pixfmt-srggb10dpcm8 /./para
+
+   paraThis control is used to select the predictor used to encode
+   the samples./para
+
+   paraThe main difference between the simple and the advanced
+   predictors is image quality, with advanced predictor supposed to
+   produce better quality images as a result. Simple predictor can be
+   used e.g. for testing purposes. For more information about DPCM see
+   ulink url=
+   http://en.wikipedia.org/wiki/Differential_pulse-code_modulation;
+   Wikipedia/ulink./para
+   /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+entryconstantV4L2_DPCM_PREDICTOR_SIMPLE/constant/entry
+ entryPredictor type is simple/entry
+   /row
+   row
+ 
entryconstantV4L2_DPCM_PREDICTOR_ADVANCED/constant/entry
+ entryPredictor type is advanced/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+   rowentry/entry/row
/tbody
   /tgroup
   /table
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..8f2f40b 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -425,6 +425,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Gray,
NULL,
};
+   static const char * const dpcm_predictor[] = {
+   Simple,
+   Advanced,
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +507,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DPCM_PREDICTOR:
+   return dpcm_predictor;
 

Re: [PATCH] media: v4l2-ctrl: add a helper fucntion to modify the menu

2012-09-10 Thread Prabhakar Lad
On Monday 10 September 2012 06:06 PM, Manjunath Hadli wrote:
 Hi Hans,
 
 Thanks for the review.
 
 On Monday 10 September 2012 05:43 PM, Hans Verkuil wrote:
 On Mon September 10 2012 13:57:36 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
  Documentation/video4linux/v4l2-controls.txt |   26 
 +
  drivers/media/v4l2-core/v4l2-ctrls.c|   28 
 +++
  include/media/v4l2-ctrls.h  |   14 +
  3 files changed, 68 insertions(+), 0 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-controls.txt 
 b/Documentation/video4linux/v4l2-controls.txt
 index 43da22b..54a9539 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -196,6 +196,32 @@ the error code at the end. Saves a lot of repetitive 
 error checking.
  It is recommended to add controls in ascending control ID order: it will be
  a bit faster that way.
  
 +2.1) Changing the menu of a standard control:
 +There are suitations when the control is standard but the menu items may be
 +device specific, in such cases the framework provides the helper to do 
 that.

 The Menu Controls section in this file would be a better place to add this.

 Ok.
 
 +
 +struct v4l2_ctrl * v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl,
 +   const char * const *qmenu, s32 min, s32 max,
 +   u32 menu_skip_mask, s32 def);
 +
 +This helper, function is used to modify the menu, min, max, mask and
 +the default value to set.
 +Example for usage:
 +   static const char * const test_pattern[] = {
 +   Disabled,
 +   Vertical Bars,
 +   Vertical Bars,
 +   Solid Black,
 +   Solid White,
 +   NULL
 +   };
 +   struct v4l2_ctrl *test_pattern_ctrl =
 +   v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
 +   V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
 +   V4L2_TEST_PATTERN_DISABLED);
 +
 +   v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 0, 5, 0x3, 0);
 +
  3) Optionally force initial control setup:
  
 v4l2_ctrl_handler_setup(foo-ctrl_handler);
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index d731422..ac0fb28 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -2666,3 +2666,31 @@ unsigned int v4l2_ctrl_poll(struct file *file, 
 struct poll_table_struct *wait)
 return 0;
  }
  EXPORT_SYMBOL(v4l2_ctrl_poll);
 +
 +/* Helper function for standard menu controls to modify the menu */
 +struct v4l2_ctrl *v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl,
 +const char * const *qmenu, s32 min,

 The minimum is always 0 for menu controls, so this argument should be
 removed. It's not part of v4l2_ctrl_new_std_menu either.

 There is no need to return the pointer here, so just set the return to void.

 Ok.
 
 +s32 max, u32 menu_skip_mask, s32 def)
 +{
 +   if (ctrl-type != V4L2_CTRL_TYPE_MENU)
 +   return NULL;
 +
 +   if (qmenu == NULL)
 +   return NULL;

 Change this to:

  if (WARN_ON(ctrl-type != V4L2_CTRL_TYPE_MENU || qmenu == NULL))
  return;

 Ok.
 
 +
 +   /* Determine if it is standard menu control */
 +   if (!v4l2_ctrl_get_menu(ctrl-id))
 +   return NULL;

 This test can be removed. Why should we prohibit calling this function for
 non-standard controls?

 Any how how if its custom control, the menu will be provided by user
 itself, so why would he fell the necessity of this function ? But
 providing an option wont harm I'll remove it.
 
 +
 +   if ((def  max) || (max  min))
 +   return NULL;

 Also replace with if (WARN_ON(def  0 || def  max)).

 All these errors are driver errors and so should just report it in the kernel
 log and then bail out.

 Ok.
 
 +
 +   ctrl-qmenu = qmenu;
 +   ctrl-minimum = min;

 No need to set minimum. It's already 0.

 Ok.
 
 Regards,
 --Prabhakar Lad
 
My Bad :(. Replied with Manju's ID.

Thanks,
--Prabhakar

 +   ctrl-maximum = max;
 +   ctrl-menu_skip_mask = menu_skip_mask;
 +   ctrl-cur.val = ctrl-val = ctrl-default_value = def;
 +
 +   return ctrl;
 +}
 +EXPORT_SYMBOL(v4l2_ctrl_modify_menu);
 diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
 index 776605f..5b0ea04 100644
 --- a/include/media/v4l2-ctrls.h
 +++ b/include/media/v4l2-ctrls.h
 @@ -488,6 +488,20 @@ static inline void v4l2_ctrl_unlock

[PATCH v2] media: v4l2-ctrl: add a helper function to modify the menu

2012-09-11 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Add a helper function to modify the menu, max and default value
to set.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Rob Landley r...@landley.net
---
Changes for v2:
1: Fixed review comments from Hans, to have return type as
   void, add WARN_ON() for fail conditions, allow this fucntion
   to modify the menu of custom controls.

 Documentation/video4linux/v4l2-controls.txt |   30 +++
 drivers/media/v4l2-core/v4l2-ctrls.c|   17 +++
 include/media/v4l2-ctrls.h  |   11 +
 3 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 43da22b..160368a 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -367,6 +367,36 @@ it to 0 means that all menu items are supported.
 You set this mask either through the v4l2_ctrl_config struct for a custom
 control, or by calling v4l2_ctrl_new_std_menu().
 
+Changing the menu:
+There are situations when menu items may be device specific, in such cases the
+framework provides the helper function to change the menu.
+
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+   s32 max, u32 menu_skip_mask, s32 def);
+
+A good example is the test pattern generation, the capture/display/sensors have
+the capability to generate test patterns. This test patterns are hardware
+specific, In such case the menu will vary from device to device.
+
+This helper, function is used to modify the menu, max, mask and the default
+value to set.
+
+Example for usage:
+   static const char * const test_pattern[] = {
+   Disabled,
+   Vertical Bars,
+   Vertical Bars,
+   Solid Black,
+   Solid White,
+   NULL
+   };
+   struct v4l2_ctrl *test_pattern_ctrl =
+   v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
+   V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
+   V4L2_TEST_PATTERN_DISABLED);
+
+   v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 5, 0x3, 1);
+
 
 Custom Controls
 ===
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index d731422..d89b460 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2666,3 +2666,20 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct 
poll_table_struct *wait)
return 0;
 }
 EXPORT_SYMBOL(v4l2_ctrl_poll);
+
+/* Helper function for modifying the menu */
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+  s32 max, u32 menu_skip_mask, s32 def)
+{
+   if (WARN_ON(ctrl-type != V4L2_CTRL_TYPE_MENU || qmenu == NULL))
+   return;
+
+   if (WARN_ON(def  0 || def  max))
+   return;
+
+   ctrl-qmenu = qmenu;
+   ctrl-maximum = max;
+   ctrl-menu_skip_mask = menu_skip_mask;
+   ctrl-cur.val = ctrl-val = ctrl-default_value = def;
+}
+EXPORT_SYMBOL(v4l2_ctrl_modify_menu);
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 776605f..0c91b4e 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -488,6 +488,17 @@ static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
mutex_unlock(ctrl-handler-lock);
 }
 
+/**
+ * v4l2_ctrl_modify_menu() - This function is used to modify the menu.
+ * @ctrl:  The control of which menu should be changed.
+ * @qmenu: The new menu to which control will point to.
+ * @max:   Maximum value of the control.
+ * @menu_skip_mask:The control's skip mask for menu controls.
+ * @def:   The default value for control to be set.
+ */
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+  s32 max, u32 menu_skip_mask, s32 def);
+
 /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from 
within a driver.
   * @ctrl: The control.
   *
-- 
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


Re: [PATCH v2] media: v4l2-ctrl: add a helper function to modify the menu

2012-09-11 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Tue, Sep 11, 2012 at 1:25 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Pradhakar,

 Looks good, but I have a number of style/grammar issues which I've corrected
 below.

 On Tue 11 September 2012 09:39:02 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Add a helper function to modify the menu, max and default value
 to set.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Cc: Rob Landley r...@landley.net
 ---
 Changes for v2:
 1: Fixed review comments from Hans, to have return type as
void, add WARN_ON() for fail conditions, allow this fucntion
to modify the menu of custom controls.

  Documentation/video4linux/v4l2-controls.txt |   30 
 +++
  drivers/media/v4l2-core/v4l2-ctrls.c|   17 +++
  include/media/v4l2-ctrls.h  |   11 +
  3 files changed, 58 insertions(+), 0 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-controls.txt 
 b/Documentation/video4linux/v4l2-controls.txt
 index 43da22b..160368a 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -367,6 +367,36 @@ it to 0 means that all menu items are supported.
  You set this mask either through the v4l2_ctrl_config struct for a custom
  control, or by calling v4l2_ctrl_new_std_menu().

 +Changing the menu:
 +There are situations when menu items may be device specific, in such cases 
 the
 +framework provides the helper function to change the menu.
 +
 +void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const 
 *qmenu,
 + s32 max, u32 menu_skip_mask, s32 def);
 +
 +A good example is the test pattern generation, the capture/display/sensors 
 have
 +the capability to generate test patterns. This test patterns are hardware
 +specific, In such case the menu will vary from device to device.
 +
 +This helper, function is used to modify the menu, max, mask and the default
 +value to set.
 +
 +Example for usage:
 + static const char * const test_pattern[] = {
 + Disabled,
 + Vertical Bars,
 + Vertical Bars,
 + Solid Black,
 + Solid White,
 + NULL
 + };
 + struct v4l2_ctrl *test_pattern_ctrl =
 + v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
 + V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
 + V4L2_TEST_PATTERN_DISABLED);
 +
 + v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 5, 0x3, 1);
 +

 There are a number of style/grammar issues with the text above. I've
 corrected them in the revised version below. That replaces your version
 completely. So just to make it clear: I've dropped the first line ('Changing
 the menu:') because I don't think that line is necessary.

Thanks for the text :) I'll fix it for v3.

 New text:

 There are situations where menu items may be device specific. In such cases 
 the
 framework provides a helper function to change the menu:

 void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
 s32 max, u32 menu_skip_mask, s32 def);

 A good example is the test pattern control for capture/display/sensors devices
 that have the capability to generate test patterns. These test patterns are
 hardware specific, so the contents of the menu will vary from device to 
 device.

 This helper function is used to modify the menu, max, mask and the default
 value of the control.

 Example:

 static const char * const test_pattern[] = {
 Disabled,
 Vertical Bars,
 Solid Black,
 Solid White,
 NULL
 };
 struct v4l2_ctrl *test_pattern_ctrl =
 v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
 V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
 V4L2_TEST_PATTERN_DISABLED);

 v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 3, 0,
 V4L2_TEST_PATTERN_DISABLED);


  Custom Controls
  ===
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index d731422..d89b460 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -2666,3 +2666,20 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct 
 poll_table_struct *wait)
   return 0;
  }
  EXPORT_SYMBOL(v4l2_ctrl_poll);
 +
 +/* Helper function for modifying the menu */
 +void

[PATCH v3] media: v4l2-ctrl: add a helper function to modify the menu

2012-09-11 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Add a helper function to modify the menu, max and default value
to set.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Rob Landley r...@landley.net
---
Changes for v3:
1: Fixed style/grammer issues as pointed by Hans.
   Thanks Hans for providing the description.

Changes for v2:
1: Fixed review comments from Hans, to have return type as
   void, add WARN_ON() for fail conditions, allow this fucntion
   to modify the menu of custom controls.

 Documentation/video4linux/v4l2-controls.txt |   29 +++
 drivers/media/v4l2-core/v4l2-ctrls.c|   17 +++
 include/media/v4l2-ctrls.h  |   11 ++
 3 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 43da22b..01d0a82 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -367,6 +367,35 @@ it to 0 means that all menu items are supported.
 You set this mask either through the v4l2_ctrl_config struct for a custom
 control, or by calling v4l2_ctrl_new_std_menu().
 
+There are situations where menu items may be device specific. In such cases the
+framework provides a helper function to change the menu:
+
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+   s32 max, u32 menu_skip_mask, s32 def);
+
+A good example is the test pattern control for capture/display/sensors devices
+that have the capability to generate test patterns. These test patterns are
+hardware specific, so the contents of the menu will vary from device to device.
+
+This helper function is used to modify the menu, max, mask and the default
+value of the control.
+
+Example:
+
+   static const char * const test_pattern[] = {
+   Disabled,
+   Vertical Bars,
+   Solid Black,
+   Solid White,
+   NULL,
+   };
+   struct v4l2_ctrl *test_pattern_ctrl =
+   v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
+   V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
+   V4L2_TEST_PATTERN_DISABLED);
+
+   v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 3, 0,
+   V4L2_TEST_PATTERN_DISABLED);
 
 Custom Controls
 ===
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index d731422..d89b460 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2666,3 +2666,20 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct 
poll_table_struct *wait)
return 0;
 }
 EXPORT_SYMBOL(v4l2_ctrl_poll);
+
+/* Helper function for modifying the menu */
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+  s32 max, u32 menu_skip_mask, s32 def)
+{
+   if (WARN_ON(ctrl-type != V4L2_CTRL_TYPE_MENU || qmenu == NULL))
+   return;
+
+   if (WARN_ON(def  0 || def  max))
+   return;
+
+   ctrl-qmenu = qmenu;
+   ctrl-maximum = max;
+   ctrl-menu_skip_mask = menu_skip_mask;
+   ctrl-cur.val = ctrl-val = ctrl-default_value = def;
+}
+EXPORT_SYMBOL(v4l2_ctrl_modify_menu);
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 776605f..5303489 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -488,6 +488,17 @@ static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
mutex_unlock(ctrl-handler-lock);
 }
 
+/**
+ * v4l2_ctrl_modify_menu() - This function is used to modify the menu.
+ * @ctrl:  The control whose menu should be modified.
+ * @qmenu: The new menu.
+ * @max:   Maximum value of the control.
+ * @menu_skip_mask:The control's skip mask for menu controls.
+ * @def:   The default value for control to be set.
+ */
+void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const *qmenu,
+  s32 max, u32 menu_skip_mask, s32 def);
+
 /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from 
within a driver.
   * @ctrl: The control.
   *
-- 
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


Re: [PATCH v3] media: v4l2-ctrl: add a helper function to modify the menu

2012-09-13 Thread Prabhakar Lad
Hi Laurent,

Thanks for the review.

On Thursday 13 September 2012 06:45 AM, Laurent Pinchart wrote:
 Hi Prabhakar,
 
 Thanks for the patch.
 
 On Tuesday 11 September 2012 19:53:38 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Add a helper function to modify the menu, max and default value
 to set.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Cc: Rob Landley r...@landley.net
 ---
 Changes for v3:
 1: Fixed style/grammer issues as pointed by Hans.
Thanks Hans for providing the description.

 Changes for v2:
 1: Fixed review comments from Hans, to have return type as
void, add WARN_ON() for fail conditions, allow this fucntion
to modify the menu of custom controls.

  Documentation/video4linux/v4l2-controls.txt |   29 
  drivers/media/v4l2-core/v4l2-ctrls.c|   17 +++
  include/media/v4l2-ctrls.h  |   11 ++
  3 files changed, 57 insertions(+), 0 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-controls.txt
 b/Documentation/video4linux/v4l2-controls.txt index 43da22b..01d0a82 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -367,6 +367,35 @@ it to 0 means that all menu items are supported.
  You set this mask either through the v4l2_ctrl_config struct for a custom
  control, or by calling v4l2_ctrl_new_std_menu().

 +There are situations where menu items may be device specific. In such cases
 the
 +framework provides a helper function to change the menu:
 +
 +void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const
 *qmenu,
 +s32 max, u32 menu_skip_mask, s32 def);
 
 Sorry if this is a stupid question, but wouldn't it be better to add a 
 function to create a custom menu instead of modifying it afterwards ?
 
Create a custom menu? eventually everything boils down to modifying the
menu itself.

Regards,
--Prabhakar Lad

 +
 +A good example is the test pattern control for capture/display/sensors
 devices
 +that have the capability to generate test patterns. These test patterns are
 +hardware specific, so the contents of the menu will vary from device to
 device.
 +
 +This helper function is used to modify the menu, max, mask and the default
 +value of the control.
 +
 +Example:
 +
 +static const char * const test_pattern[] = {
 +Disabled,
 +Vertical Bars,
 +Solid Black,
 +Solid White,
 +NULL,
 +};
 +struct v4l2_ctrl *test_pattern_ctrl =
 +v4l2_ctrl_new_std_menu(foo-ctrl_handler, foo_ctrl_ops,
 +V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
 +V4L2_TEST_PATTERN_DISABLED);
 +
 +v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 3, 0,
 +V4L2_TEST_PATTERN_DISABLED);

  Custom Controls
  ===
 

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


[PATCH] v4l: change path of video drivers

2012-09-14 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

due to structure change for video drivers, change the
description with correct path.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Rob Landley r...@landley.net
---
 Documentation/video4linux/CQcam.txt   |2 +-
 Documentation/video4linux/README.davinci-vpbe |   20 ++--
 Documentation/video4linux/fimc.txt|   16 
 Documentation/video4linux/omap3isp.txt|2 +-
 Documentation/video4linux/v4l2-framework.txt  |2 +-
 Documentation/video4linux/videobuf|2 +-
 6 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Documentation/video4linux/CQcam.txt 
b/Documentation/video4linux/CQcam.txt
index 6e680fe..0b69e4e 100644
--- a/Documentation/video4linux/CQcam.txt
+++ b/Documentation/video4linux/CQcam.txt
@@ -18,7 +18,7 @@ Table of Contents
 
 1.0 Introduction
 
-  The file ../../drivers/media/video/c-qcam.c is a device driver for
+  The file ../../drivers/media/parport/c-qcam.c is a device driver for
 the Logitech (nee Connectix) parallel port interface color CCD camera.
 This is a fairly inexpensive device for capturing images.  Logitech
 does not currently provide information for developers, but many people
diff --git a/Documentation/video4linux/README.davinci-vpbe 
b/Documentation/video4linux/README.davinci-vpbe
index 7a460b0..dc9a297 100644
--- a/Documentation/video4linux/README.davinci-vpbe
+++ b/Documentation/video4linux/README.davinci-vpbe
@@ -5,22 +5,22 @@
  File partitioning
  -
  V4L2 display device driver
- drivers/media/video/davinci/vpbe_display.c
- drivers/media/video/davinci/vpbe_display.h
+ drivers/media/platform/davinci/vpbe_display.c
+ drivers/media/platform/davinci/vpbe_display.h
 
  VPBE display controller
- drivers/media/video/davinci/vpbe.c
- drivers/media/video/davinci/vpbe.h
+ drivers/media/platform/davinci/vpbe.c
+ drivers/media/platform/davinci/vpbe.h
 
  VPBE venc sub device driver
- drivers/media/video/davinci/vpbe_venc.c
- drivers/media/video/davinci/vpbe_venc.h
- drivers/media/video/davinci/vpbe_venc_regs.h
+ drivers/media/platform/davinci/vpbe_venc.c
+ drivers/media/platform/davinci/vpbe_venc.h
+ drivers/media/platform/davinci/vpbe_venc_regs.h
 
  VPBE osd driver
- drivers/media/video/davinci/vpbe_osd.c
- drivers/media/video/davinci/vpbe_osd.h
- drivers/media/video/davinci/vpbe_osd_regs.h
+ drivers/media/platform/davinci/vpbe_osd.c
+ drivers/media/platform/davinci/vpbe_osd.h
+ drivers/media/platform/davinci/vpbe_osd_regs.h
 
  Functional partitioning
  ---
diff --git a/Documentation/video4linux/fimc.txt 
b/Documentation/video4linux/fimc.txt
index eb04970..fd02d9a 100644
--- a/Documentation/video4linux/fimc.txt
+++ b/Documentation/video4linux/fimc.txt
@@ -10,7 +10,7 @@ data from LCD controller (FIMD) through the SoC internal 
writeback data
 path.  There are multiple FIMC instances in the SoCs (up to 4), having
 slightly different capabilities, like pixel alignment constraints, rotator
 availability, LCD writeback support, etc. The driver is located at
-drivers/media/video/s5p-fimc directory.
+drivers/media/platform/s5p-fimc directory.
 
 1. Supported SoCs
 =
@@ -36,21 +36,21 @@ Not currently supported:
 =
 
 - media device driver
-  drivers/media/video/s5p-fimc/fimc-mdevice.[ch]
+  drivers/media/platform/s5p-fimc/fimc-mdevice.[ch]
 
  - camera capture video device driver
-  drivers/media/video/s5p-fimc/fimc-capture.c
+  drivers/media/platform/s5p-fimc/fimc-capture.c
 
  - MIPI-CSI2 receiver subdev
-  drivers/media/video/s5p-fimc/mipi-csis.[ch]
+  drivers/media/platform/s5p-fimc/mipi-csis.[ch]
 
  - video post-processor (mem-to-mem)
-  drivers/media/video/s5p-fimc/fimc-core.c
+  drivers/media/platform/s5p-fimc/fimc-core.c
 
  - common files
-  drivers/media/video/s5p-fimc/fimc-core.h
-  drivers/media/video/s5p-fimc/fimc-reg.h
-  drivers/media/video/s5p-fimc/regs-fimc.h
+  drivers/media/platform/s5p-fimc/fimc-core.h
+  drivers/media/platform/s5p-fimc/fimc-reg.h
+  drivers/media/platform/s5p-fimc/regs-fimc.h
 
 4. User space interfaces
 
diff --git a/Documentation/video4linux/omap3isp.txt 
b/Documentation/video4linux/omap3isp.txt
index 5dd1439..b9a9f83 100644
--- a/Documentation/video4linux/omap3isp.txt
+++ b/Documentation/video4linux/omap3isp.txt
@@ -12,7 +12,7 @@ Introduction
 
 
 This file documents the Texas Instruments OMAP 3 Image Signal Processor (ISP)
-driver located under drivers/media/video/omap3isp. The original driver was
+driver located under 

[PATCH 00/14] Media Controller capture driver for DM365

2012-09-14 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

This patch set adds media controller based capture driver for
DM365.

This driver bases its design on Laurent Pinchart's Media Controller Design
whose patches for Media Controller and subdev enhancements form the base.
The driver also takes copious elements taken from Laurent Pinchart and
others' OMAP ISP driver based on Media Controller. So thank you all the
people who are responsible for the Media Controller and the OMAP ISP driver.

Also, the core functionality of the driver comes from the arago vpfe capture
driver of which the CCDC capture was based on V4L2, with other drivers like
Previwer, and Resizer.

The current driver caters to dm6446,dm355 and dm365 of which the current
implementation works for dm365. The three VPFE IPs have some common elements
in terms of some high level functionality but there are differences in terms
of register definitions and some core blocks.

The individual specifications for each of these can be found here:
dm365  vpfe: http://www.ti.com/litv/pdf/sprufg8c
dm6446 vpfe: http://www.ti.com/litv/pdf/sprue38h
dm355  vpfe: http://www.ti.com/litv/pdf/spruf71a

This patch set has undergone reviewed several revisions.
(http://davinci-linux-open-source.1494791.n2.nabble.com/
RESEND-RFC-PATCH-v4-00-15-RFC-for-Media-Controller-capture-
driver-for-DM365-td7003648.html). This patches might be appearing
new due to the new folder structure changes to video drivers.

Manjunath Hadli (14):
  davinci: vpfe: add dm3xx IPIPEIF hardware support module
  davinci: vpfe: add IPIPE hardware layer support
  davinci: vpfe: add IPIPE support for media controller driver
  davinci: vpfe: add support for CCDC hardware for dm365
  davinci: vpfe: add ccdc driver with media controller interface
  davinci: vpfe: add v4l2 video driver support
  davinci: vpfe: v4l2 capture driver with media interface
  davinci: vpfe: previewer driver based on v4l2 media controller
framework
  davinci: vpfe: resizer driver based on media framework
  dm365: vpss: setup ISP registers
  dm365: vpss: set vpss clk ctrl
  dm365: vpss: add vpss helper functions to be used in the main driver
for setting hardware parameters
  davinci: vpfe: build infrastructure for dm365
  [media] davinci: vpfe: Add documentation

 Documentation/video4linux/davinci-vpfe-mc.txt|   95 +
 drivers/media/platform/davinci/Kconfig   |   40 +-
 drivers/media/platform/davinci/Makefile  |9 +
 drivers/media/platform/davinci/ccdc_hw_device.h  |   11 +-
 drivers/media/platform/davinci/dm355_ccdc.c  |2 +-
 drivers/media/platform/davinci/dm365_ccdc.c  | 1424 +
 drivers/media/platform/davinci/dm365_ccdc.h  |  137 +
 drivers/media/platform/davinci/dm365_ccdc_regs.h |  314 ++
 drivers/media/platform/davinci/dm365_def_para.c  |  294 ++
 drivers/media/platform/davinci/dm365_def_para.h  |   49 +
 drivers/media/platform/davinci/dm365_ipipe.c | 3673 ++
 drivers/media/platform/davinci/dm365_ipipe.h |  430 +++
 drivers/media/platform/davinci/dm365_ipipe_hw.c  |  936 ++
 drivers/media/platform/davinci/dm365_ipipe_hw.h  |  538 
 drivers/media/platform/davinci/dm3xx_ipipeif.c   |  318 ++
 drivers/media/platform/davinci/dm3xx_ipipeif.h   |  262 ++
 drivers/media/platform/davinci/dm644x_ccdc.c |2 +-
 drivers/media/platform/davinci/imp_hw_if.h   |  180 ++
 drivers/media/platform/davinci/isif.c|2 +-
 drivers/media/platform/davinci/vpfe_capture.c|2 +-
 drivers/media/platform/davinci/vpfe_ccdc.c   |  903 ++
 drivers/media/platform/davinci/vpfe_ccdc.h   |   87 +
 drivers/media/platform/davinci/vpfe_imp_common.h |   84 +
 drivers/media/platform/davinci/vpfe_mc_capture.c |  764 +
 drivers/media/platform/davinci/vpfe_mc_capture.h |  104 +
 drivers/media/platform/davinci/vpfe_previewer.c  | 1041 ++
 drivers/media/platform/davinci/vpfe_previewer.h  |   71 +
 drivers/media/platform/davinci/vpfe_resizer.c| 1080 +++
 drivers/media/platform/davinci/vpfe_resizer.h|   66 +
 drivers/media/platform/davinci/vpfe_video.c  | 1725 ++
 drivers/media/platform/davinci/vpfe_video.h  |  150 +
 drivers/media/platform/davinci/vpss.c|   56 +
 include/linux/davinci_vpfe.h |  929 ++
 include/linux/dm365_ccdc.h   |  592 
 include/linux/dm3xx_ipipeif.h|   62 +
 include/media/davinci/vpfe.h |   84 +
 include/media/davinci/vpss.h |   16 +
 37 files changed, 16518 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/video4linux/davinci-vpfe-mc.txt
 create mode 100644 drivers/media/platform/davinci/dm365_ccdc.c
 create mode 100644 drivers/media/platform/davinci/dm365_ccdc.h
 create mode 100644 drivers/media/platform/davinci/dm365_ccdc_regs.h
 create mode 100644 drivers/media/platform/davinci/dm365_def_para.c
 create mode 100644 

[PATCH 01/14] davinci: vpfe: add dm3xx IPIPEIF hardware support module

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

add support for dm3xx IPIPEIF hardware setup. This is the
lowest software layer for the dm3x vpfe driver which directly
accesses hardware. Add support for features like default
pixel correction, dark frame substraction and hardware setup.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/dm3xx_ipipeif.c |  318 
 drivers/media/platform/davinci/dm3xx_ipipeif.h |  262 +++
 include/linux/dm3xx_ipipeif.h  |   62 +
 3 files changed, 642 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/dm3xx_ipipeif.c
 create mode 100644 drivers/media/platform/davinci/dm3xx_ipipeif.h
 create mode 100644 include/linux/dm3xx_ipipeif.h

diff --git a/drivers/media/platform/davinci/dm3xx_ipipeif.c 
b/drivers/media/platform/davinci/dm3xx_ipipeif.c
new file mode 100644
index 000..7961a74
--- /dev/null
+++ b/drivers/media/platform/davinci/dm3xx_ipipeif.c
@@ -0,0 +1,318 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/io.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/uaccess.h
+#include linux/v4l2-mediabus.h
+#include linux/platform_device.h
+
+#include dm3xx_ipipeif.h
+
+static void *__iomem ipipeif_base_addr;
+
+static inline u32 regr_if(u32 offset)
+{
+   return readl(ipipeif_base_addr + offset);
+}
+
+static inline void regw_if(u32 val, u32 offset)
+{
+   writel(val, ipipeif_base_addr + offset);
+}
+
+void ipipeif_set_enable()
+{
+   regw_if(1, IPIPEIF_ENABLE);
+}
+
+u32 ipipeif_get_enable(void)
+{
+   return regr_if(IPIPEIF_ENABLE);
+}
+
+int ipipeif_set_address(struct ipipeif *params, unsigned int address)
+{
+   u32 val;
+
+   if (params-source == 0)
+   return -EINVAL;
+
+   val = (params-adofs  5)  IPIPEIF_ADOFS_LSB_MASK;
+   regw_if(val, IPIPEIF_ADOFS);
+
+   /* lower sixteen bit */
+   val = (address  IPIPEIF_ADDRL_SHIFT)  IPIPEIF_ADDRL_MASK;
+   regw_if(val, IPIPEIF_ADDRL);
+
+   /* upper next seven bit */
+   val = (address  IPIPEIF_ADDRU_SHIFT)  IPIPEIF_ADDRU_MASK;
+   regw_if(val, IPIPEIF_ADDRU);
+
+   return 0;
+}
+
+static void ipipeif_config_dpc(struct ipipeif_dpc *dpc)
+{
+   u32 val = 0;
+
+   if (dpc-en) {
+   val = (dpc-en  1)  IPIPEIF_DPC2_EN_SHIFT;
+   val |= dpc-thr  IPIPEIF_DPC2_THR_MASK;
+   }
+
+   regw_if(val, IPIPEIF_DPC2);
+}
+
+#define RD_DATA_15_2   0x7
+
+/*
+ * ipipeif_hw_setup() - This function sets up IPIPEIF
+ */
+int ipipeif_hw_setup(struct ipipeif *params, int device_type)
+{
+   enum v4l2_mbus_pixelcode isif_port_if;
+   unsigned int val;
+
+   if (params == NULL)
+   return -EINVAL;
+
+   /* Enable clock to IPIPEIF and IPIPE */
+   if (device_type == DM365)
+   vpss_enable_clock(VPSS_IPIPEIF_CLOCK, 1);
+
+   /* Combine all the fields to make CFG1 register of IPIPEIF */
+   val = params-mode  ONESHOT_SHIFT;
+   val |= params-source  INPSRC_SHIFT;
+   val |= params-clock_select  CLKSEL_SHIFT;
+   val |= params-avg_filter  AVGFILT_SHIFT;
+   val |= params-decimation  DECIM_SHIFT;
+
+   if (device_type == DM355) {
+   val |= params-var.if_base.ialaw  IALAW_SHIFT;
+   val |= params-var.if_base.pack_mode  PACK8IN_SHIFT;
+   val |= params-var.if_base.clk_div  CLKDIV_SHIFT;
+   val |= params-var.if_base.data_shift  DATASFT_SHIFT;
+   } else {
+   /* DM365 IPIPE 5.1 */
+   val |= params-var.if_5_1.pack_mode  PACK8IN_SHIFT;
+   val |= params-var.if_5_1.source1  INPSRC1_SHIFT;
+   if (params-source != IPIPEIF_SDRAM_YUV)
+   val |= params-var.if_5_1.data_shift  DATASFT_SHIFT;
+   else
+   val = ~(RD_DATA_15_2  DATASFT_SHIFT);
+   }
+   regw_if(val, IPIPEIF_CFG1);
+
+   switch (params-source) {
+   case IPIPEIF_CCDC:
+   regw_if(params-gain, IPIPEIF_GAIN);
+   break;
+   case IPIPEIF_SDRAM_RAW

[PATCH 02/14] davinci: vpfe: add IPIPE hardware layer support

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

add dm365 IPIPE hardware support. IPIPE is the hardware IP which
implements the functionality required for resizer, previewer and
the associated feature support. This is built along with the vpfe
driver, and implements hardware setup including coeffcient
programming for various hardware filters, gamma, cfa and clock
enable.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/dm365_ipipe_hw.c |  936 +++
 drivers/media/platform/davinci/dm365_ipipe_hw.h |  538 +
 2 files changed, 1474 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/dm365_ipipe_hw.c
 create mode 100644 drivers/media/platform/davinci/dm365_ipipe_hw.h

diff --git a/drivers/media/platform/davinci/dm365_ipipe_hw.c 
b/drivers/media/platform/davinci/dm365_ipipe_hw.c
new file mode 100644
index 000..4ce6d95
--- /dev/null
+++ b/drivers/media/platform/davinci/dm365_ipipe_hw.c
@@ -0,0 +1,936 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/errno.h
+#include linux/delay.h
+#include linux/device.h
+#include linux/v4l2-mediabus.h
+
+#include dm365_ipipe.h
+#include dm3xx_ipipeif.h
+#include dm365_ipipe_hw.h
+
+static void ipipe_clock_enable(void)
+{
+   /* enable IPIPE MMR for register write access */
+   regw_ip(IPIPE_GCK_MMR_DEFAULT, IPIPE_GCK_MMR);
+   /* enable the clock wb,cfa,dfc,d2f,pre modules */
+   regw_ip(IPIPE_GCK_PIX_DEFAULT, IPIPE_GCK_PIX);
+   /* enable RSZ MMR for register write access */
+}
+
+/* Set input channel format to either 420 Y or C format */
+void rsz_set_in_pix_format(unsigned char y_c)
+{
+   u32 val;
+
+   val = regr_rsz(RSZ_SRC_FMT1);
+   val |= y_c  1;
+   regw_rsz(val, RSZ_SRC_FMT1);
+}
+
+static void rsz_set_common_params(struct ipipe_params *params)
+{
+   struct rsz_common_params *rsz_common = params-rsz_common;
+   u32 val;
+
+   /* Set mode */
+   regw_rsz(params-ipipe_mode, RSZ_SRC_MODE);
+
+   /* data source selection  and bypass */
+   val = (rsz_common-passthrough  RSZ_BYPASS_SHIFT) |
+   rsz_common-source;
+
+   regw_rsz(val, RSZ_SRC_FMT0);
+   val = regr_rsz(RSZ_SRC_MODE);
+   /* src image selection */
+   val = (rsz_common-raw_flip  1) |
+   (rsz_common-src_img_fmt  RSZ_SRC_IMG_FMT_SHIFT) |
+   ((rsz_common-y_c  1)  RSZ_SRC_Y_C_SEL_SHIFT);
+
+   regw_rsz(val, RSZ_SRC_FMT1);
+   regw_rsz(rsz_common-vps  IPIPE_RSZ_VPS_MASK, RSZ_SRC_VPS);
+   regw_rsz(rsz_common-hps  IPIPE_RSZ_HPS_MASK, RSZ_SRC_HPS);
+   regw_rsz(rsz_common-vsz  IPIPE_RSZ_VSZ_MASK, RSZ_SRC_VSZ);
+   regw_rsz(rsz_common-hsz  IPIPE_RSZ_HSZ_MASK, RSZ_SRC_HSZ);
+   regw_rsz(rsz_common-yuv_y_min, RSZ_YUV_Y_MIN);
+   regw_rsz(rsz_common-yuv_y_max, RSZ_YUV_Y_MAX);
+   regw_rsz(rsz_common-yuv_c_min, RSZ_YUV_C_MIN);
+   regw_rsz(rsz_common-yuv_c_max, RSZ_YUV_C_MAX);
+   /* chromatic position */
+   regw_rsz(rsz_common-out_chr_pos, RSZ_YUV_PHS);
+   val = regr_rsz(RSZ_SRC_MODE);
+}
+
+static void rsz_set_rsz_regs(unsigned int rsz_id, struct ipipe_params *params)
+{
+   struct ipipe_rsz_rescale_param *rsc_params;
+   struct ipipe_ext_mem_param *ext_mem;
+   struct ipipe_rsz_resize2rgb *rgb;
+   u32 reg_base;
+   u32 val;
+
+   val = regr_rsz(RSZ_SEQ);
+   rsc_params = params-rsz_rsc_param[rsz_id];
+   rgb = params-rsz2rgb[rsz_id];
+   ext_mem = params-ext_mem_param[rsz_id];
+
+   if (rsz_id == RSZ_A) {
+   val = rsc_params-h_flip  RSZA_H_FLIP_SHIFT;
+   val |= rsc_params-v_flip  RSZA_V_FLIP_SHIFT;
+   reg_base = RSZ_EN_A;
+   } else {
+   val = rsc_params-h_flip  RSZB_H_FLIP_SHIFT;
+   val |= rsc_params-v_flip  RSZB_V_FLIP_SHIFT;
+   reg_base = RSZ_EN_B;
+   }
+   /* update flip settings */
+   regw_rsz(val, RSZ_SEQ);
+
+   regw_rsz(rsc_params-mode, reg_base + RSZ_MODE);
+   val = (rsc_params-cen  RSZ_CEN_SHIFT) | rsc_params-yen;
+   regw_rsz(val, reg_base + RSZ_420

[PATCH 08/14] davinci: vpfe: previewer driver based on v4l2 media controller framework

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

Add the video previewer driver with the v4l2 media controller framework
which takes care of converting the video frames from bayer to YUV or RGB.
The driver supports both continuous mode where it works in tandem with
the CCDC and single shot mode where it can be used in isolation. The
driver underneath uses the dm365 IPIPE module for programming the
hardware. The driver supports previewer as a subdevice and a media entity,
and the enumerable pads are 2(1 input and 1 output). The driver supports
streaing and all the pad and link related operations. Specific functions
like defect pixel correction, LUT are supported through private ioctls.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpfe_previewer.c | 1041 +++
 drivers/media/platform/davinci/vpfe_previewer.h |   71 ++
 2 files changed, 1112 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/vpfe_previewer.c
 create mode 100644 drivers/media/platform/davinci/vpfe_previewer.h

diff --git a/drivers/media/platform/davinci/vpfe_previewer.c 
b/drivers/media/platform/davinci/vpfe_previewer.c
new file mode 100644
index 000..4a0fc8e
--- /dev/null
+++ b/drivers/media/platform/davinci/vpfe_previewer.c
@@ -0,0 +1,1041 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/slab.h
+#include linux/videodev2.h
+#include linux/v4l2-mediabus.h
+#include linux/platform_device.h
+#include linux/davinci_vpfe.h
+
+#include media/v4l2-device.h
+#include media/davinci/vpss.h
+#include media/media-entity.h
+#include media/davinci/vpfe_types.h
+
+#include vpfe_mc_capture.h
+#include imp_hw_if.h
+
+#define MIN_OUT_WIDTH  32
+#define MIN_OUT_HEIGHT 32
+
+static int serializer_initialized;
+static struct imp_serializer imp_serializer_info;
+
+/* previewer input format descriptions */
+static const unsigned int prev_input_fmts[] = {
+   V4L2_MBUS_FMT_UYVY8_2X8,
+   V4L2_MBUS_FMT_SGRBG12_1X12,
+};
+
+/* previewer ouput format descriptions */
+static const unsigned int prev_output_fmts[] = {
+   V4L2_MBUS_FMT_UYVY8_2X8,
+};
+
+/*
+ * imp_set_preview_config() - set previewer config
+ * @sd: Pointer previewer subdevice
+ * @chan_config: previewer channel configuration
+ */
+static int
+imp_set_preview_config(struct v4l2_subdev *sd,
+  struct vpfe_prev_config *chan_config)
+{
+   struct vpfe_previewer_device *previewer = v4l2_get_subdevdata(sd);
+   struct imp_logical_channel *channel = previewer-channel;
+   struct imp_hw_interface *imp_hw_if = previewer-imp_hw_if;
+   struct vpfe_device *vpfe_dev = to_vpfe_device(previewer);
+   struct device *dev = previewer-subdev.v4l2_dev-dev;
+   int ret;
+
+   if (channel-config_state == STATE_NOT_CONFIGURED) {
+   channel-config = imp_hw_if-alloc_config_block(dev,
+   vpfe_dev-ipipe);
+   /* allocate buffer for holding user configuration */
+   channel-user_config = imp_hw_if-alloc_user_config_block(dev,
+   vpfe_dev-ipipe, IMP_PREVIEWER);
+   if (!channel-user_config) {
+   dev_err(dev,
+   Failed to allocate memory for user config\n);
+   return -EFAULT;
+   }
+   }
+
+   if (!chan_config-ipipeif_config) {
+   dev_dbg(dev, imp_set_preview_config: default configuration 
set\n);
+   /* put defaults for user configuration */
+   imp_hw_if-set_user_config_defaults(dev, vpfe_dev-ipipe,
+   IMP_PREVIEWER, channel-user_config);
+   } else {
+   dev_dbg(dev, imp_set_preview_config: user configuration 
set\n);
+   if (copy_from_user(channel-user_config,
+   chan_config-ipipeif_config,
+   sizeof(struct prev_ipipeif_config)))
+   return -EFAULT;
+   }
+
+   /* Update the user configuration in the hw config block

[PATCH 10/14] dm365: vpss: setup ISP registers

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

enable PPCR, enbale ISIF out on BCR and disable all events.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpss.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/davinci/vpss.c 
b/drivers/media/platform/davinci/vpss.c
index 146e4b0..34ad7bd 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -52,9 +52,11 @@ MODULE_AUTHOR(Texas Instruments);
 #define DM355_VPSSBL_EVTSEL_DEFAULT0x4
 
 #define DM365_ISP5_PCCR0x04
+#define DM365_ISP5_BCR 0x08
 #define DM365_ISP5_INTSEL1 0x10
 #define DM365_ISP5_INTSEL2 0x14
 #define DM365_ISP5_INTSEL3 0x18
+#define DM365_ISP5_EVTSEL  0x1c
 #define DM365_ISP5_CCDCMUX 0x20
 #define DM365_ISP5_PG_FRAME_SIZE   0x28
 #define DM365_VPBE_CLK_CTRL0x00
@@ -357,6 +359,10 @@ void dm365_vpss_set_pg_frame_size(struct 
vpss_pg_frame_size frame_size)
 }
 EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size);
 
+#define DM365_ISP5_EVTSEL_EVT_DISABLE  0x
+#define DM365_ISP5_BCR_ISIF_OUT_ENABLE 0x0002
+#define DM365_ISP5_PCCR_CLK_ENABLE 0x007f
+
 static int __devinit vpss_probe(struct platform_device *pdev)
 {
struct resource *r1, *r2;
@@ -426,9 +432,16 @@ static int __devinit vpss_probe(struct platform_device 
*pdev)
oper_cfg.hw_ops.enable_clock = dm365_enable_clock;
oper_cfg.hw_ops.select_ccdc_source = dm365_select_ccdc_source;
/* Setup vpss interrupts */
+   isp5_write((isp5_read(DM365_ISP5_PCCR) |
+   DM365_ISP5_PCCR_CLK_ENABLE), DM365_ISP5_PCCR);
+   isp5_write((isp5_read(DM365_ISP5_BCR) |
+DM365_ISP5_BCR_ISIF_OUT_ENABLE), DM365_ISP5_BCR);
isp5_write(DM365_ISP5_INTSEL1_DEFAULT, DM365_ISP5_INTSEL1);
isp5_write(DM365_ISP5_INTSEL2_DEFAULT, DM365_ISP5_INTSEL2);
isp5_write(DM365_ISP5_INTSEL3_DEFAULT, DM365_ISP5_INTSEL3);
+   /* No event selected */
+   isp5_write((isp5_read(DM365_ISP5_EVTSEL) |
+   DM365_ISP5_EVTSEL_EVT_DISABLE), DM365_ISP5_EVTSEL);
} else
oper_cfg.hw_ops.clear_wbl_overflow = dm644x_clear_wbl_overflow;
 
-- 
1.7.4.1

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


[PATCH 12/14] dm365: vpss: add vpss helper functions to be used in the main driver for setting hardware parameters

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

add function to set sync polarity , interrupt completion and
pageframe size in vpss to be used by the main driver.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpss.c |   32 
 include/media/davinci/vpss.h  |   16 
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/davinci/vpss.c 
b/drivers/media/platform/davinci/vpss.c
index 49bb045..3c195c0 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -97,6 +97,12 @@ struct vpss_hw_ops {
void (*select_ccdc_source)(enum vpss_ccdc_source_sel src_sel);
/* clear wbl overflow bit */
int (*clear_wbl_overflow)(enum vpss_wbl_sel wbl_sel);
+   /* set sync polarity */
+   void (*set_sync_pol)(struct vpss_sync_pol);
+   /* set the PG_FRAME_SIZE register*/
+   void (*set_pg_frame_size)(struct vpss_pg_frame_size);
+   /* check and clear interrupt if occured */
+   int (*dma_complete_interrupt)(void);
 };
 
 /* vpss configuration */
@@ -161,6 +167,14 @@ static void dm355_select_ccdc_source(enum 
vpss_ccdc_source_sel src_sel)
bl_regw(src_sel  VPSS_HSSISEL_SHIFT, DM355_VPSSBL_CCDCMUX);
 }
 
+int vpss_dma_complete_interrupt(void)
+{
+   if (!oper_cfg.hw_ops.dma_complete_interrupt)
+   return 2;
+   return oper_cfg.hw_ops.dma_complete_interrupt();
+}
+EXPORT_SYMBOL(vpss_dma_complete_interrupt);
+
 int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
 {
if (!oper_cfg.hw_ops.select_ccdc_source)
@@ -186,6 +200,15 @@ static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel 
wbl_sel)
return 0;
 }
 
+void vpss_set_sync_pol(struct vpss_sync_pol sync)
+{
+   if (!oper_cfg.hw_ops.set_sync_pol)
+   return;
+
+   oper_cfg.hw_ops.set_sync_pol(sync);
+}
+EXPORT_SYMBOL(vpss_set_sync_pol);
+
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
 {
if (!oper_cfg.hw_ops.clear_wbl_overflow)
@@ -351,6 +374,15 @@ void dm365_vpss_set_sync_pol(struct vpss_sync_pol sync)
 }
 EXPORT_SYMBOL(dm365_vpss_set_sync_pol);
 
+void vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
+{
+   if (!oper_cfg.hw_ops.set_pg_frame_size)
+   return;
+
+   oper_cfg.hw_ops.set_pg_frame_size(frame_size);
+}
+EXPORT_SYMBOL(vpss_set_pg_frame_size);
+
 void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
 {
int current_reg = ((frame_size.hlpfr  1) - 1)  16;
diff --git a/include/media/davinci/vpss.h b/include/media/davinci/vpss.h
index b586495..c5f6d9a 100644
--- a/include/media/davinci/vpss.h
+++ b/include/media/davinci/vpss.h
@@ -105,4 +105,20 @@ enum vpss_wbl_sel {
 };
 /* clear wbl overflow flag for DM6446 */
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
+
+/* set sync polarity*/
+void vpss_set_sync_pol(struct vpss_sync_pol sync);
+/* set the PG_FRAME_SIZE register */
+void vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size);
+/**
+ * vpss_check_and_clear_interrupt - check and clear interrupt
+ * @irq - common enumerator for IRQ
+ *
+ * Following return values used:-
+ * 0 - interrupt occured and cleared
+ * 1 - interrupt not occured
+ * 2 - interrupt status not available
+ */
+int vpss_dma_complete_interrupt(void);
+
 #endif
-- 
1.7.4.1

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


[PATCH 13/14] davinci: vpfe: build infrastructure for dm365

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

add build infrastructure for dm365 specific modules
such as IPIPE, AEW, AF.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/Kconfig  |   40 +-
 drivers/media/platform/davinci/Makefile |9 +++
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/Kconfig 
b/drivers/media/platform/davinci/Kconfig
index 78e26d2..4eddb00 100644
--- a/drivers/media/platform/davinci/Kconfig
+++ b/drivers/media/platform/davinci/Kconfig
@@ -56,7 +56,7 @@ config VIDEO_VPFE_CAPTURE
 
 config VIDEO_DM6446_CCDC
tristate DM6446 CCDC HW module
-   depends on VIDEO_VPFE_CAPTURE
+   depends on VIDEO_VPFE_CAPTURE  ARCH_DAVINCI_DM644x
select VIDEO_VPSS_SYSTEM
default y
help
@@ -85,7 +85,7 @@ config VIDEO_DM355_CCDC
   module will be called vpfe.
 
 config VIDEO_ISIF
-   tristate ISIF HW module
+   tristate DM365 ISIF HW module
depends on ARCH_DAVINCI_DM365  VIDEO_VPFE_CAPTURE
select VIDEO_VPSS_SYSTEM
default y
@@ -119,3 +119,39 @@ config VIDEO_VPBE_DISPLAY
 
To compile this driver as a module, choose M here: the
module will be called vpbe_display.
+
+
+config VIDEO_365_CCDC
+   tristate DM365 CCDC HW module
+   depends on ARCH_DAVINCI_DM365  VIDEO_VPFE_MC_CAPTURE
+   select VIDEO_VPSS_SYSTEM
+   default y
+   help
+  Enables ISIF hw module. This is the hardware module for
+  configuring ISIF in VPFE to capture Raw Bayer RGB data  from
+  a image sensor or YUV data from a YUV source.
+
+  To compile this driver as a module, choose M here: the
+  module will be called vpfe.
+
+config DM365_IPIPE
+   depends on ARCH_DAVINCI  ARCH_DAVINCI_DM365  VIDEO_VPFE_MC_CAPTURE
+   tristate DM365 IPIPE
+   help
+ dm365 IPIPE hardware module.
+
+ This is the hardware module that implements imp_hw_interface
+ for DM365. This hardware module provides previewer and resizer
+ functionality for image processing.
+
+config VIDEO_VPFE_MC_CAPTURE
+   tristate VPFE Media Controller Capture Driver
+   depends on VIDEO_V4L2  (ARCH_DAVINCI)  !VIDEO_VPFE_CAPTURE
+   select VIDEOBUF_DMA_CONTIG
+   help
+ Support for DMx/AMx VPFE based Media Controller Capture driver. This 
is the
+ common V4L2 module for following DMx/AMx SoCs from Texas
+ Instruments:- DM6446, DM365, DM355  AM3517/05.
+
+ To compile this driver as a module, choose M here: the
+ module will be called vpfe-mc-capture.
diff --git a/drivers/media/platform/davinci/Makefile 
b/drivers/media/platform/davinci/Makefile
index 74ed92d..955f63d 100644
--- a/drivers/media/platform/davinci/Makefile
+++ b/drivers/media/platform/davinci/Makefile
@@ -16,5 +16,14 @@ obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o
 obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o
 obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o
 obj-$(CONFIG_VIDEO_ISIF) += isif.o
+obj-$(CONFIG_VIDEO_365_CCDC) += dm365_ccdc.o
+obj-$(CONFIG_VIDEO_VPFE_MC_CAPTURE) += vpfe_mc_capture.o \
+   vpfe_ccdc.o vpfe_resizer.o vpfe_previewer.o \
+   vpfe_video.o
+
+dm365_imp-objs := dm365_ipipe.o dm365_def_para.o \
+   dm365_ipipe_hw.o dm3xx_ipipeif.o
+obj-$(CONFIG_DM365_IPIPE) += dm365_imp.o
+
 obj-$(CONFIG_VIDEO_DM644X_VPBE) += vpbe.o vpbe_osd.o vpbe_venc.o
 obj-$(CONFIG_VIDEO_VPBE_DISPLAY) += vpbe_display.o
-- 
1.7.4.1

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


[PATCH 11/14] dm365: vpss: set vpss clk ctrl

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

request_mem_region for VPSS_CLK_CTRL register and ioremap.
and enable clocks appropriately.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpss.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/davinci/vpss.c 
b/drivers/media/platform/davinci/vpss.c
index 34ad7bd..49bb045 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -103,6 +103,7 @@ struct vpss_hw_ops {
 struct vpss_oper_config {
__iomem void *vpss_regs_base0;
__iomem void *vpss_regs_base1;
+   resource_size_t *vpss_regs_base2;
enum vpss_platform_type platform;
spinlock_t vpss_lock;
struct vpss_hw_ops hw_ops;
@@ -484,11 +485,21 @@ static struct platform_driver vpss_driver = {
 
 static void vpss_exit(void)
 {
+   iounmap(oper_cfg.vpss_regs_base2);
+   release_mem_region(*oper_cfg.vpss_regs_base2, 4);
platform_driver_unregister(vpss_driver);
 }
 
+#define VPSS_CLK_CTRL  0x01c40044
+
 static int __init vpss_init(void)
 {
+   if (request_mem_region(VPSS_CLK_CTRL, 4, vpss_clock_control)) {
+   oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
+   __raw_writel(0x18, oper_cfg.vpss_regs_base2);
+   } else {
+   return -EBUSY;
+   }
return platform_driver_register(vpss_driver);
 }
 subsys_initcall(vpss_init);
-- 
1.7.4.1

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


[PATCH 09/14] davinci: vpfe: resizer driver based on media framework

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

Add the video resizer driver with the v4l2 media controller framework
which takes care of resizing the video frames with both up-scaling
downscaling facility. The formats that is supported is YUV422.
The driver supports both continuous mode where it works in
tandem with the CCDC and previewer and single shot mode where
it can be used in isolation or with previewer. The driver underneath
uses the dm365 IPIPE module for programming the hardware.
The driver supports resizer as a subdevice and a media entity,
and the enumerable pads are 2(1 input and 1 output). The driver
supports streaming and all the pad and link related operations.
Specific filter functionality including filter types are set
through private ioctls.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpfe_resizer.c | 1080 +
 drivers/media/platform/davinci/vpfe_resizer.h |   66 ++
 2 files changed, 1146 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/vpfe_resizer.c
 create mode 100644 drivers/media/platform/davinci/vpfe_resizer.h

diff --git a/drivers/media/platform/davinci/vpfe_resizer.c 
b/drivers/media/platform/davinci/vpfe_resizer.c
new file mode 100644
index 000..8b98ff5
--- /dev/null
+++ b/drivers/media/platform/davinci/vpfe_resizer.c
@@ -0,0 +1,1080 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/slab.h
+#include linux/videodev2.h
+#include linux/platform_device.h
+#include linux/v4l2-mediabus.h
+
+#include media/v4l2-device.h
+#include media/media-entity.h
+#include media/davinci/vpss.h
+#include media/davinci/vpfe_types.h
+
+#include vpfe_mc_capture.h
+#include imp_hw_if.h
+
+
+#define MIN_IN_WIDTH   32
+#define MIN_IN_HEIGHT  32
+#define MAX_IN_WIDTH   4095
+#define MAX_IN_HEIGHT  4095
+#define MIN_OUT_WIDTH  16
+#define MIN_OUT_HEIGHT 2
+
+/* resizer pixel formats */
+static const unsigned int resz_input_fmts[] = {
+   V4L2_MBUS_FMT_UYVY8_2X8,
+#ifdef CONFIG_ARCH_DAVINCI_DM365
+   V4L2_MBUS_FMT_Y8_1X8,
+   V4L2_MBUS_FMT_UV8_1X8,
+#endif
+};
+
+static const unsigned int resz_output_fmts[] = {
+   V4L2_MBUS_FMT_UYVY8_2X8,
+#ifdef CONFIG_ARCH_DAVINCI_DM365
+   V4L2_MBUS_FMT_Y8_1X8,
+   V4L2_MBUS_FMT_UV8_1X8,
+   V4L2_MBUS_FMT_YDYUYDYV8_1X16,
+#endif
+};
+
+static char resizer_chained;
+/*
+ * imp_set_resizer_config() - set resizer config
+ * @resizer: vpfe resizer device pointer
+ * @channel: image processor logical channel
+ * @chan_config: resizer channel configuration
+ */
+static int imp_set_resizer_config(struct vpfe_resizer_device *resizer,
+  struct imp_logical_channel *channel,
+  struct vpfe_rsz_config *chan_config)
+{
+   struct imp_hw_interface *imp_hw_if = resizer-imp_hw_if;
+   struct device *dev = resizer-subdev.v4l2_dev-dev;
+   struct vpfe_device *vpfe_dev = to_vpfe_device(resizer);
+   int ret;
+
+   if (channel-config_state == STATE_NOT_CONFIGURED) {
+   channel-config =
+   imp_hw_if-alloc_config_block(dev, vpfe_dev-ipipe);
+
+   if (!channel-config) {
+   dev_err(dev,
+   Failed to allocate memory for channel config\n);
+   return -EFAULT;
+   }
+   /* allocate buffer for holding user configuration */
+   channel-user_config = imp_hw_if-alloc_user_config_block(dev,
+   vpfe_dev-ipipe, IMP_RESIZER);
+
+   if (!channel-user_config) {
+   dev_err(dev,
+   Failed to allocate memory for user config\n);
+   if (!resizer_chained)
+   kfree(channel-config);
+   return -EFAULT;
+   }
+   }
+
+   if (!chan_config-config) {
+   /* put defaults for user configuration */
+   imp_hw_if-set_user_config_defaults(dev, vpfe_dev-ipipe

[PATCH 05/14] davinci: vpfe: add ccdc driver with media controller interface

2012-09-14 Thread Prabhakar Lad
 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/videodev2.h
+#include linux/v4l2-mediabus.h
+#include linux/platform_device.h
+
+#include media/v4l2-device.h
+#include media/media-entity.h
+#include media/davinci/vpfe_types.h
+
+#include vpfe_mc_capture.h
+#include ccdc_hw_device.h
+
+#define MAX_WIDTH  4096
+#define MAX_HEIGHT 4096
+
+static const unsigned int ccdc_fmts[] = {
+   V4L2_MBUS_FMT_YUYV8_2X8,
+   V4L2_MBUS_FMT_UYVY8_2X8,
+   V4L2_MBUS_FMT_YUYV8_1X16,
+   V4L2_MBUS_FMT_YUYV10_1X20,
+   V4L2_MBUS_FMT_SGRBG12_1X12,
+   V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8,
+#ifdef CONFIG_ARCH_DAVINCI_DM365
+   V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8,
+#endif
+};
+
+/*
+ * CCDC helper functions
+ */
+
+/* get field id in ccdc hardware */
+enum v4l2_field ccdc_get_fid(struct vpfe_device *vpfe_dev)
+{
+   struct vpfe_ccdc_device *ccdc = vpfe_dev-vpfe_ccdc;
+   struct ccdc_hw_device *ccdc_dev = ccdc-ccdc_dev;
+
+   return ccdc_dev-hw_ops.getfid();
+}
+
+/* Retrieve active or try pad format based on query */
+static struct v4l2_mbus_framefmt *
+__ccdc_get_format(struct vpfe_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
+ unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+   if (which == V4L2_SUBDEV_FORMAT_TRY) {
+   struct v4l2_subdev_format fmt;
+
+   fmt.pad = pad;
+   fmt.which = which;
+
+   return v4l2_subdev_get_try_format(fh, pad);
+   }
+   return ccdc-formats[pad];
+}
+
+/* configure format in ccdc hardware */
+static int
+vpfe_config_ccdc_format(struct vpfe_device *vpfe_dev, unsigned int pad)
+{
+   struct ccdc_hw_device *ccdc_dev = vpfe_dev-vpfe_ccdc.ccdc_dev;
+   struct vpfe_ccdc_device *vpfe_ccdc = vpfe_dev-vpfe_ccdc;
+   enum ccdc_frmfmt frm_fmt = CCDC_FRMFMT_INTERLACED;
+   struct v4l2_pix_format format;
+   int ret = 0;
+
+   v4l2_fill_pix_format(format, vpfe_dev-vpfe_ccdc.formats[pad]);
+   mbus_to_pix(vpfe_dev-vpfe_ccdc.formats[pad], format);
+
+   if (ccdc_dev-hw_ops.set_pixel_format(
+   format.pixelformat)  0) {
+   v4l2_err(vpfe_dev-v4l2_dev,
+   Failed to set pix format in ccdc\n);
+   return -EINVAL;
+   }
+
+   /* call for s_crop will override these values */
+   vpfe_ccdc-crop.left = 0;
+   vpfe_ccdc-crop.top = 0;
+   vpfe_ccdc-crop.width = format.width;
+   vpfe_ccdc-crop.height = format.height;
+
+   /* configure the image window */
+   ccdc_dev-hw_ops.set_image_window(vpfe_ccdc-crop);
+
+   switch (vpfe_dev-vpfe_ccdc.formats[pad].field) {
+   case V4L2_FIELD_INTERLACED:
+   /* do nothing, since it is default */
+   ret = ccdc_dev-hw_ops.set_buftype(
+   CCDC_BUFTYPE_FLD_INTERLEAVED);
+   break;
+   case V4L2_FIELD_NONE:
+   frm_fmt = CCDC_FRMFMT_PROGRESSIVE;
+   /* buffer type only applicable for interlaced scan */
+   break;
+   case V4L2_FIELD_SEQ_TB:
+   ret = ccdc_dev-hw_ops.set_buftype(
+   CCDC_BUFTYPE_FLD_SEPARATED);
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   /* set the frame format */
+   if (!ret)
+   ret = ccdc_dev-hw_ops.set_frame_format(frm_fmt);
+
+   return ret;
+}
+
+/*
+ * ccdc_try_format() - Try video format on a pad
+ * @ccdc: VPFE CCDC device
+ * @fh : V4L2 subdev file handle
+ * @pad: Pad number
+ * @fmt: Format
+ */
+static void
+ccdc_try_format(struct vpfe_ccdc_device *vpfe_ccdc, struct v4l2_subdev_fh *fh,
+   struct v4l2_subdev_format *fmt)
+{
+   unsigned int width = fmt-format.width;
+   unsigned int height = fmt-format.height;
+   unsigned int i;
+
+   for (i = 0; i  ARRAY_SIZE(ccdc_fmts); i++) {
+   if (fmt-format.code == ccdc_fmts[i])
+   break;
+   }
+
+   /* If not found, use YUYV8_2x8 as default */
+   if (i = ARRAY_SIZE(ccdc_fmts))
+   fmt-format.code = V4L2_MBUS_FMT_YUYV8_2X8;
+
+   /* Clamp the size. */
+   fmt-format.width = clamp_t(u32, width, 32, MAX_WIDTH);
+   fmt-format.height = clamp_t(u32, height, 32, MAX_HEIGHT);
+
+   /* The data formatter truncates the number of horizontal output
+   * pixels to a multiple of 16. To avoid clipping data, allow
+   * callers to request an output size bigger than the input size
+   * up to the nearest multiple of 16.
+   */
+   if (fmt-pad == CCDC_PAD_SOURCE)
+   fmt-format.width = ~15

[PATCH 06/14] davinci: vpfe: add v4l2 video driver support

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

add a generic video driver functionality to be used by all the vpfe
drivers for davinci SoCs. The functionality includes all the
standard v4l2 interfaces including streaming. The video node
interface can be used both as an input and output node for both
continuous and single shot modes.Also supports dv_presets to include
HD modes, wth support for both user pointer IO and mmap.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpfe_video.c | 1725 +++
 drivers/media/platform/davinci/vpfe_video.h |  150 +++
 2 files changed, 1875 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/vpfe_video.c
 create mode 100644 drivers/media/platform/davinci/vpfe_video.h

diff --git a/drivers/media/platform/davinci/vpfe_video.c 
b/drivers/media/platform/davinci/vpfe_video.c
new file mode 100644
index 000..2e696a0
--- /dev/null
+++ b/drivers/media/platform/davinci/vpfe_video.c
@@ -0,0 +1,1725 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ */
+
+#include linux/slab.h
+#include linux/module.h
+#include linux/platform_device.h
+
+#include media/v4l2-common.h
+#include media/v4l2-mediabus.h
+#include media/media-entity.h
+#include media/media-device.h
+#include media/davinci/vpfe_types.h
+
+#include mach/cputype.h
+
+#include vpfe_mc_capture.h
+#include ccdc_hw_device.h
+
+/* minimum number of buffers needed in cont-mode */
+#define CONT_MIN_NUM_BUFFERS   3
+
+static int debug;
+
+/* get v4l2 subdev pointer to external subdev which is active */
+static struct media_entity *vpfe_get_input_entity
+   (struct vpfe_video_device *video)
+{
+   struct vpfe_device *vpfe_dev = video-vpfe_dev;
+   struct media_pad *remote;
+
+   remote = media_entity_remote_source(vpfe_dev-vpfe_ccdc.pads[0]);
+   if (remote == NULL) {
+   pr_err(Invalid media connection to ccdc\n);
+   return NULL;
+   }
+
+   return remote-entity;
+}
+
+/* updates external subdev(sensor/decoder) which is active */
+static int vpfe_update_current_ext_subdev(struct vpfe_video_device *video)
+{
+   struct vpfe_device *vpfe_dev = video-vpfe_dev;
+   struct vpfe_config *vpfe_cfg;
+   struct v4l2_subdev *subdev;
+   struct media_pad *remote;
+   int i;
+
+   remote = media_entity_remote_source(vpfe_dev-vpfe_ccdc.pads[0]);
+   if (remote == NULL) {
+   pr_err(Invalid media connection to ccdc\n);
+   return -EINVAL;
+   }
+
+   subdev = media_entity_to_v4l2_subdev(remote-entity);
+
+   vpfe_cfg = vpfe_dev-pdev-platform_data;
+
+   for (i = 0; i  vpfe_cfg-num_subdevs; i++) {
+   if (!strcmp(vpfe_cfg-sub_devs[i].module_name, subdev-name)) {
+   video-current_ext_subdev = vpfe_cfg-sub_devs[i];
+   break;
+   }
+   }
+
+   /* if user not linked decoder/sensor to ccdc */
+   if (i == vpfe_cfg-num_subdevs) {
+   pr_err(Invalid media chain connection to ccdc\n);
+   return -EINVAL;
+   }
+
+   /* find the v4l2 subdev pointer */
+   for (i = 0; i  vpfe_dev-num_ext_subdevs; i++) {
+   if (!strcmp(video-current_ext_subdev-module_name,
+   vpfe_dev-sd[i]-name))
+   video-current_ext_subdev-subdev = vpfe_dev-sd[i];
+   }
+
+   return 0;
+}
+
+/* get the subdev which is connected to the output video node */
+static struct v4l2_subdev *
+vpfe_video_remote_subdev(struct vpfe_video_device *video, u32 *pad)
+{
+   struct media_pad *remote;
+
+   remote = media_entity_remote_source(video-pad);
+
+   if (remote == NULL || remote-entity-type != MEDIA_ENT_T_V4L2_SUBDEV)
+   return NULL;
+
+   if (pad)
+   *pad = remote-index;
+
+   return media_entity_to_v4l2_subdev(remote-entity);
+}
+
+/* get the format set at ouput pad of the adjacent subdev */
+static int
+__vpfe_video_get_format(struct vpfe_video_device *video,
+   struct v4l2_format *format)
+{
+   struct

[PATCH 07/14] davinci: vpfe: v4l2 capture driver with media interface

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

Add the vpfe capture driver which implements media controller
interface. The driver suports all the setup functionality for
all all units nnamely- ccdc, previewer, resizer, h3a, aew.
The driver supports both dm365 and Dm355. The driver does isr
registration, v4l2 device registration, media registration and
platform driver registrations. It calls the appropriate subdevs
from here to cerate the appropriate subdevices and media entities.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpfe_mc_capture.c |  764 ++
 drivers/media/platform/davinci/vpfe_mc_capture.h |  104 +++
 include/media/davinci/vpfe.h |   84 +++
 3 files changed, 952 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/platform/davinci/vpfe_mc_capture.c
 create mode 100644 drivers/media/platform/davinci/vpfe_mc_capture.h
 create mode 100644 include/media/davinci/vpfe.h

diff --git a/drivers/media/platform/davinci/vpfe_mc_capture.c 
b/drivers/media/platform/davinci/vpfe_mc_capture.c
new file mode 100644
index 000..306d45f
--- /dev/null
+++ b/drivers/media/platform/davinci/vpfe_mc_capture.c
@@ -0,0 +1,764 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contributors:
+ *  Manjunath Hadli manjunath.ha...@ti.com
+ *  Prabhakar Lad prabhakar@ti.com
+ *
+ *
+ * Driver name : VPFE Capture driver
+ *VPFE Capture driver allows applications to capture and stream video
+ *frames on DaVinci SoCs (DM6446, DM355 etc) from a YUV source such as
+ *TVP5146 or  Raw Bayer RGB image data from an image sensor
+ *such as Microns' MT9T001, MT9T031 etc.
+ *
+ *These SoCs have, in common, a Video Processing Subsystem (VPSS) that
+ *consists of a Video Processing Front End (VPFE) for capturing
+ *video/raw image data and Video Processing Back End (VPBE) for displaying
+ *YUV data through an in-built analog encoder or Digital LCD port. This
+ *driver is for capture through VPFE. A typical EVM using these SoCs have
+ *following high level configuration.
+ *
+ *decoder(TVP5146/ YUV/
+ * MT9T001)   --  Raw Bayer RGB --- MUX - VPFE (CCDC/ISIF)
+ * data input  |  |
+ * V  |
+ *   SDRAM|
+ *V
+ *Image Processor
+ *|
+ *V
+ *  SDRAM
+ *The data flow happens from a decoder connected to the VPFE over a
+ *YUV embedded (BT.656/BT.1120) or separate sync or raw bayer rgb interface
+ *and to the input of VPFE through an optional MUX (if more inputs are
+ *to be interfaced on the EVM). The input data is first passed through
+ *CCDC (CCD Controller, a.k.a Image Sensor Interface, ISIF). The CCDC
+ *does very little or no processing on YUV data and does pre-process Raw
+ *Bayer RGB data through modules such as Defect Pixel Correction (DFC)
+ *Color Space Conversion (CSC), data gain/offset etc. After this, data
+ *can be written to SDRAM or can be connected to the image processing
+ *block such as IPIPE (on DM355/DM365 only).
+ *
+ *Features supported
+ * - MMAP IO
+ * - USERPTR IO
+ * - Capture using TVP5146 over BT.656
+ * - Support for interfacing decoders using sub device model
+ * - Work with DM365 or DM355 or DM6446 CCDC to do Raw Bayer
+ *   RGB/YUV data capture to SDRAM.
+ * - Chaining of Image Processor
+ * - SINGLE-SHOT mode
+ */
+
+#include linux/io.h
+#include linux/slab.h
+#include linux/init.h
+#include linux/module.h
+#include linux/version.h
+#include linux/interrupt.h
+#include linux/platform_device.h
+
+#include media/v4l2-common.h
+#include media/media-entity.h
+#include media/media-device.h
+#include media/davinci/vpfe_types.h
+
+#include vpfe_mc_capture.h
+
+static bool debug

[PATCH 14/14] [media] davinci: vpfe: Add documentation

2012-09-14 Thread Prabhakar Lad
From: Manjunath Hadli manjunath.ha...@ti.com

Add documentation on the Davinci VPFE driver. Document the subdevs,
and private IOTCLs the driver implements

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Cc: Rob Landley r...@landley.net
Cc: linux-...@vger.kernel.org
---
 Documentation/video4linux/davinci-vpfe-mc.txt |   95 +
 1 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/video4linux/davinci-vpfe-mc.txt

diff --git a/Documentation/video4linux/davinci-vpfe-mc.txt 
b/Documentation/video4linux/davinci-vpfe-mc.txt
new file mode 100644
index 000..9dfc4f9
--- /dev/null
+++ b/Documentation/video4linux/davinci-vpfe-mc.txt
@@ -0,0 +1,95 @@
+Davinci Video processing Front End (VPFE) driver
+
+Copyright (C) 2012 Texas Instruments Inc
+
+Contacts: Manjunath Hadli manjunath.ha...@ti.com
+
+
+Introduction
+
+
+This file documents the Texas Instruments Davinci Video processing Front End
+(VPFE) driver located under drivers/media/platform/davinci. The original driver
+exists for Davinci VPFE, which is now being changed to Media Controller
+Framework.
+
+Currently the driver has been successfully used on the following
+version of Davinci:
+
+   DM365/DM368
+
+The driver implements V4L2, Media controller and v4l2_subdev interfaces. 
Sensor,
+lens and flash drivers using the v4l2_subdev interface in the kernel are
+supported.
+
+
+Split to subdevs
+
+
+The Davinci VPFE is split into V4L2 subdevs, each of the blocks inside the VPFE
+having one subdev to represent it. Each of the subdevs provide a V4L2 subdev
+interface to userspace.
+
+   DAVINCI CCDC
+   DAVINCI PREVIEWER
+   DAVINCI RESIZER
+
+Each possible link in the VPFE is modeled by a link in the Media controller
+interface. For an example program see [1].
+
+
+Private IOCTLs
+==
+
+The Davinci Video processing Front End (VPFE) driver supports standard V4L2
+IOCTLs and controls where possible and practical. Much of the functions 
provided
+by the VPFE, however, does not fall under the standard IOCTL's.
+
+In general, there is a private ioctl for configuring each of the blocks
+containing hardware-dependent functions.
+
+The following private IOCTLs are supported:
+
+   VIDIOC_VPFE_CCDC_[S/G]_RAW_PARAMS
+   VIDIOC_VPFE_PRV_[S/G]_CONFIG
+   VIDIOC_VPFE_RSZ_[S/G]_CONFIG
+
+The parameter structures used by these ioctl's are described in
+include/linux/davinci_vpfe.h and include/linux/dm365_ccdc.h.
+
+The VIDIOC_VPFE_CCDC_S_RAW_PARAMS, VIDIOC_VPFE_PRV_S_CONFIG and
+VIDIOC_VPFE_RSZ_S_CONFIG are used to configure, enable and disable functions in
+the CCDC, preview and resizer blocks respectively. These IOCTL's control 
several
+functions in the blocks they control. VIDIOC_VPFE_CCDC_S_RAW_PARAMS IOCTL
+accepts a pointer to struct ccdc_config_params_raw as its argument. Similarly
+VIDIOC_VPFE_PRV_S_CONFIG accepts a pointer to struct vpfe_prev_config. And
+VIDIOC_VPFE_RSZ_S_CONFIG accepts a pointer to struct vpfe_rsz_config as its
+argument. Similarly VIDIOC_VPFE_CCDC_G_RAW_PARAMS, VIDIOC_VPFE_PRV_G_CONFIG and
+VIDIOC_VPFE_RSZ_G_CONFIG are used to get the current configuration set
+in the CCDC, preview and resizer blocks respectively.
+
+The detailed functions of the VPFE itself related to a given VPFE block is
+described in the Technical Reference Manuals (TRMs) --- see the end of the
+document for those.
+
+
+Technical reference manuals (TRMs) and other documentation
+==
+
+Davinci DM365 TRM:
+URL:http://www.ti.com/lit/ds/sprs457e/sprs457e.pdf
+Referenced MARCH 2009-REVISED JUNE 2011
+
+Davinci DM368 TRM:
+URL:http://www.ti.com/lit/ds/sprs668c/sprs668c.pdf
+Referenced APRIL 2010-REVISED JUNE 2011
+
+Davinci Video Processing Front End (VPFE) DM36x
+URL:http://www.ti.com/lit/ug/sprufg8c/sprufg8c.pdf
+
+
+References
+==
+
+[1] http://git.ideasonboard.org/?p=media-ctl.git;a=summary
+[2] include/linux/davinci_vpfe.h  include/linux/dm365_ccdc.h
-- 
1.7.4.1

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


[PATCH] davinci: vpif: capture/display: fix race condition

2012-09-14 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

channel_first_int[][] variable is used as a flag for the ISR,
This flag was being set after enabling the interrupts, There
where suitaions when the isr ocuurend even before the flag was set
dues to which it was causing the applicaiotn hang.
This patch sets  channel_first_int[][] flag just before enabling the
interrupt.

Reported-by: David Oleszkiewicz doles...@adsyscontrols.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/platform/davinci/vpif_capture.c |2 +-
 drivers/media/platform/davinci/vpif_display.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index 1b625b0..f64919b 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -339,6 +339,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
unsigned int count)
 * Set interrupt for both the fields in VPIF Register enable channel in
 * VPIF register
 */
+   channel_first_int[VPIF_VIDEO_INDEX][ch-channel_id] = 1;
if ((VPIF_CHANNEL0_VIDEO == ch-channel_id)) {
channel0_intr_assert();
channel0_intr_enable(1);
@@ -350,7 +351,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
unsigned int count)
channel1_intr_enable(1);
enable_channel1(1);
}
-   channel_first_int[VPIF_VIDEO_INDEX][ch-channel_id] = 1;
 
return 0;
 }
diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index 4a24848..523a840 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -302,6 +302,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
unsigned int count)
 
/* Set interrupt for both the fields in VPIF
Register enable channel in VPIF register */
+   channel_first_int[VPIF_VIDEO_INDEX][ch-channel_id] = 1;
if (VPIF_CHANNEL2_VIDEO == ch-channel_id) {
channel2_intr_assert();
channel2_intr_enable(1);
@@ -318,7 +319,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
unsigned int count)
if (vpif_config_data-ch3_clip_en)
channel3_clipping_enable(1);
}
-   channel_first_int[VPIF_VIDEO_INDEX][ch-channel_id] = 1;
 
return 0;
 }
-- 
1.7.4.1

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


[PATCH] davinci: vpif: remove unwanted header file inclusion

2012-09-14 Thread Prabhakar Lad
From: Hans Verkuil hans.verk...@cisco.com

Remove old videobuf-core.h includes.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
---
 drivers/media/platform/davinci/vpif_capture.h |1 -
 drivers/media/platform/davinci/vpif_display.h |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.h 
b/drivers/media/platform/davinci/vpif_capture.h
index 3511510..15a06dc 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -25,7 +25,6 @@
 #include linux/videodev2.h
 #include media/v4l2-common.h
 #include media/v4l2-device.h
-#include media/videobuf-core.h
 #include media/videobuf2-dma-contig.h
 #include media/davinci/vpif_types.h
 
diff --git a/drivers/media/platform/davinci/vpif_display.h 
b/drivers/media/platform/davinci/vpif_display.h
index 8967ffb..dfda5bd 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -20,7 +20,6 @@
 #include linux/videodev2.h
 #include media/v4l2-common.h
 #include media/v4l2-device.h
-#include media/videobuf-core.h
 #include media/videobuf2-dma-contig.h
 #include media/davinci/vpif_types.h
 
-- 
1.7.4.1

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


Re: [PATCH] vpif: replace preset with the timings API.

2012-09-17 Thread Prabhakar Lad
Hi Mauro,

On Wed, Aug 8, 2012 at 5:39 PM, Prabhakar Lad prabhakar@ti.com wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 ---
  drivers/media/video/davinci/vpif.c |   16 ++--
  drivers/media/video/davinci/vpif.h |4 +-
  drivers/media/video/davinci/vpif_capture.c |  114 
 +---
  drivers/media/video/davinci/vpif_capture.h |3 +-
  drivers/media/video/davinci/vpif_display.c |  102 +++--
  drivers/media/video/davinci/vpif_display.h |3 +-
  6 files changed, 43 insertions(+), 199 deletions(-)


Can you pull these patch ? Please inform me if anything is needed
from my side.

Regards,
--Prabhakar

 diff --git a/drivers/media/video/davinci/vpif.c 
 b/drivers/media/video/davinci/vpif.c
 index b3637af..b95bff7 100644
 --- a/drivers/media/video/davinci/vpif.c
 +++ b/drivers/media/video/davinci/vpif.c
 @@ -25,6 +25,8 @@
  #include linux/io.h
  #include linux/clk.h
  #include linux/err.h
 +#include linux/v4l2-dv-timings.h
 +
  #include mach/hardware.h

  #include vpif.h
 @@ -65,7 +67,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_480P59_94,
 +   .dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
 },
 {
 .name = 576p50,
 @@ -82,7 +84,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_576P50,
 +   .dv_timings = V4L2_DV_BT_CEA_720X576P50,
 },
 {
 .name = 720p50,
 @@ -99,7 +101,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_720P50,
 +   .dv_timings = V4L2_DV_BT_CEA_1280X720P50,
 },
 {
 .name = 720p60,
 @@ -116,7 +118,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_720P60,
 +   .dv_timings = V4L2_DV_BT_CEA_1280X720P60,
 },
 {
 .name = 1080I50,
 @@ -136,7 +138,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_1080I50,
 +   .dv_timings = V4L2_DV_BT_CEA_1920X1080I50,
 },
 {
 .name = 1080I60,
 @@ -156,7 +158,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_1080I60,
 +   .dv_timings = V4L2_DV_BT_CEA_1920X1080I60,
 },
 {
 .name = 1080p60,
 @@ -173,7 +175,7 @@ const struct vpif_channel_config_params ch_params[] = {
 .capture_format = 0,
 .vbi_supported = 0,
 .hd_sd = 1,
 -   .dv_preset = V4L2_DV_1080P60,
 +   .dv_timings = V4L2_DV_BT_CEA_1920X1080P60,
 },

 /* SDTV formats */
 diff --git a/drivers/media/video/davinci/vpif.h 
 b/drivers/media/video/davinci/vpif.h
 index c2ce4d9..a1ab6a0 100644
 --- a/drivers/media/video/davinci/vpif.h
 +++ b/drivers/media/video/davinci/vpif.h
 @@ -533,7 +533,7 @@ static inline void channel2_clipping_enable(int enable)
 }
  }

 -/* function to enable clipping (for both active and blanking regions) on ch 
 2 */
 +/* function to enable clipping (for both active and blanking regions) on ch 
 3 */
  static inline void channel3_clipping_enable(int enable)
  {
 if (enable) {
 @@ -634,7 +634,7 @@ struct vpif_channel_config_params {
  * supports capturing vbi or not */
 u8 hd_sd;   /* HDTV (1) or SDTV (0) format */
 v4l2_std_id stdid;  /* SDTV format */
 -   u32 dv_preset;  /* HDTV format */
 +   struct v4l2_dv_timings dv_timings;  /* HDTV format */
  };

  extern const unsigned int vpif_ch_params_count;
 diff --git a/drivers/media/video/davinci/vpif_capture.c 
 b/drivers/media/video/davinci/vpif_capture.c
 index 266025e..e684c48 100644
 --- a/drivers/media/video/davinci/vpif_capture.c
 +++ b/drivers/media/video/davinci/vpif_capture.c
 @@ -551,7 +551,8 @@ static int vpif_update_std_info(struct channel_obj *ch)
 }
 } else {
 vpif_dbg(2

Re: [PATCH 0/2] Replace the obsolete preset API by timings API

2012-09-17 Thread Prabhakar Lad
Hi Mauro/Sekhar

On Wed, Aug 8, 2012 at 6:00 PM, Prabhakar Lad prabhakar@ti.com wrote:
 This first patch replaces the obsolete preset API by timings
 API for davinci VPBE, appropriate chnages in machine file for
 dm644x in which VPBE is enabled. And the second patch adds support for
 timings API for ths7303 driver. Sending them as s series
 since VPBE uses the ths7303 driver.

 Hans Verkuil (1):
   dm644x: replace the obsolete preset API by the timings API.

 Manjunath Hadli (1):
   ths7303: enable THS7303 for HD modes

Can you pull this patchset ? Please inform me if anything is
needed from my side.

Regards,
--Prabhakar

  arch/arm/mach-davinci/board-dm644x-evm.c   |   15 ++--
  arch/arm/mach-davinci/dm644x.c |   17 +---
  drivers/media/video/davinci/vpbe.c |  110 
 
  drivers/media/video/davinci/vpbe_display.c |   60 +++
  drivers/media/video/davinci/vpbe_venc.c|   25 +++---
  drivers/media/video/ths7303.c  |  107 +++
  include/media/davinci/vpbe.h   |   14 ++--
  include/media/davinci/vpbe_types.h |8 +--
  include/media/davinci/vpbe_venc.h  |2 +-
  9 files changed, 202 insertions(+), 156 deletions(-)

 ___
 Davinci-linux-open-source mailing list
 davinci-linux-open-sou...@linux.davincidsp.com
 http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
--
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: v4l2-ctrls: add control for dpcm predictor

2012-09-18 Thread Prabhakar Lad
Hi Sakari,

On Thu, Sep 13, 2012 at 6:29 AM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Sakari,

 On Friday 07 September 2012 21:46:44 Sakari Ailus wrote:

 Could you replace the above with this text (with appropriate indentation
 etc.) while keeping the reference to Wikipedia?

 --8--
 Differential pulse-code modulation (DPCM) compression can be used to
 compress the samples into fewer bits than they would otherwise require.
 This is done by calculating the difference between consecutive samples
 and outputting the difference which in average is much smaller than the
 values of the samples themselves since there is generally lots of
 correlation between adjacent pixels. In decompression the original
 samples are reconstructed. The process isn't lossless as the encoded
 sample size in bits is less than the original.

 Formats using DPCM compression include xref
 linkend=pixfmt-srggb10dpcm8 /.

 This control is used to select the predictor used to encode the samples.

 If I remember correctly this control will be used on the receiver side on
 DaVinci, to decode pixels not encode them. How is the predictor used in that
 case ? Must it match the predictor used on the encoding side ? If so I expect
 documentation to be available somewhere.

 The OMAP3 ISP supports both DPCM encoding and decoding, and documents the
 predictors as

 - The simple predictor

 This predictor uses only the previous same color component value as a
 prediction value. Therefore, only two-pixel memory is required.

 - The advanced predictor

 This predictor uses four previous pixel values, when the prediction value is
 evaluated. This means that also the other color component values are used,
 when the prediction value has been defined.

 It also states the the simple predictor is preferred for 10-8-10 conversion,
 and the advanced predictor for 10-7-10 and 10-6-10 conversion.

What do you suggest ?

Regards,
--Prabhakar Lad

 The main difference between the simple and the advanced predictors is
 image quality, with advanced predictor supposed to produce better
 quality images as a result. Simple predictor can be used e.g. for
 testing purposes.
 --8--

 --
 Regards,

 Laurent Pinchart

 ___
 Davinci-linux-open-source mailing list
 davinci-linux-open-sou...@linux.davincidsp.com
 http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
--
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 v4] media: v4l2-ctrl: add a helper function to add standard control with driver specific menu

2012-09-18 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Add helper function v4l2_ctrl_new_std_menu_items(), which adds
a standard menu control, with driver specific menu.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans de Goede hdego...@redhat.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Rob Landley r...@landley.net
---
Changes for v4:
1: Rather then adding a function to modify the menu, added a helper
   function, that creates a new standard control with user specific
   menu.

Changes for v3:
1: Fixed style/grammer issues as pointed by Hans.
   Thanks Hans for providing the description.

Changes for v2:
1: Fixed review comments from Hans, to have return type as
   void, add WARN_ON() for fail conditions, allow this fucntion
   to modify the menu of custom controls.

 Documentation/video4linux/v4l2-controls.txt |   25 
 drivers/media/v4l2-core/v4l2-ctrls.c|   28 +++
 include/media/v4l2-ctrls.h  |   23 ++
 3 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 43da22b..ad8e172 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -136,11 +136,25 @@ Or alternatively for integer menu controls, by calling 
v4l2_ctrl_new_int_menu:
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 def, const s64 *qmenu_int);
 
+Standard menu controls with driver specific menu are added by calling
+v4l2_ctrl_new_std_menu_items:
+
+   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
+   struct v4l2_ctrl_handler *hdl,
+   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
+   s32 skip_mask, s32 def, const char * const *qmenu_user);
+
 These functions are typically called right after the v4l2_ctrl_handler_init:
 
static const s64 exp_bias_qmenu[] = {
   -2, -1, 0, 1, 2
};
+   static const char * const test_pattern[] = {
+   Disabled,
+   Vertical Bars,
+   Solid Black,
+   Solid White,
+   };
 
v4l2_ctrl_handler_init(foo-ctrl_handler, nr_of_controls);
v4l2_ctrl_new_std(foo-ctrl_handler, foo_ctrl_ops,
@@ -156,6 +170,9 @@ These functions are typically called right after the 
v4l2_ctrl_handler_init:
ARRAY_SIZE(exp_bias_qmenu) - 1,
ARRAY_SIZE(exp_bias_qmenu) / 2 - 1,
exp_bias_qmenu);
+   v4l2_ctrl_new_std_menu_items(foo-ctrl_handler, foo_ctrl_ops,
+   V4L2_CID_TEST_PATTERN, ARRAY_SIZE(test_pattern) - 1, 0,
+   0, test_pattern);
...
if (foo-ctrl_handler.error) {
int err = foo-ctrl_handler.error;
@@ -185,6 +202,14 @@ v4l2_ctrl_new_std_menu in that it doesn't have the mask 
argument and takes
 as the last argument an array of signed 64-bit integers that form an exact
 menu item list.
 
+The v4l2_ctrl_new_std_menu_items funtion is very similar as
+v4l2_ctrl_new_std_menu but takes a extra parameter qmenu_user, which is
+driver specific menu but yet a standard menu control.
+A good example for this control is the test pattern control for
+capture/display/sensors devices that have the capability to generate test
+patterns. These test patterns are hardware specific, so the contents of the
+menu will vary from device to device.
+
 Note that if something fails, the function will return NULL or an error and
 set ctrl_handler-error to the error code. If ctrl_handler-error was already
 set, then it will just return and do nothing. This is also true for
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index d731422..9ac1b75 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1649,6 +1649,34 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct 
v4l2_ctrl_handler *hdl,
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
 
+/* Helper function for standard menu controls with user defined menu */
+struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
+   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
+   s32 mask, s32 def, const char * const *qmenu_user)
+{
+   const char * const *qmenu = v4l2_ctrl_get_menu(id);
+   const char *name;
+   enum v4l2_ctrl_type type;
+   s32 min;
+   s32 step;
+   u32 flags;
+
+   if (!qmenu) {
+   handler_set_err(hdl, -EINVAL);
+   

Re: [PATCH v4] media: v4l2-ctrl: add a helper function to add standard control with driver specific menu

2012-09-19 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Wed, Sep 19, 2012 at 1:23 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 I found some grammar issues, but also some (small) things that should be 
 changed.


 On Tue 18 September 2012 20:54:38 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Add helper function v4l2_ctrl_new_std_menu_items(), which adds
 a standard menu control, with driver specific menu.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Cc: Rob Landley r...@landley.net
 ---
 Changes for v4:
 1: Rather then adding a function to modify the menu, added a helper
function, that creates a new standard control with user specific
menu.

 Changes for v3:
 1: Fixed style/grammer issues as pointed by Hans.
Thanks Hans for providing the description.

 Changes for v2:
 1: Fixed review comments from Hans, to have return type as
void, add WARN_ON() for fail conditions, allow this fucntion
to modify the menu of custom controls.

  Documentation/video4linux/v4l2-controls.txt |   25 
  drivers/media/v4l2-core/v4l2-ctrls.c|   28 
 +++
  include/media/v4l2-ctrls.h  |   23 ++
  3 files changed, 76 insertions(+), 0 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-controls.txt 
 b/Documentation/video4linux/v4l2-controls.txt
 index 43da22b..ad8e172 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -136,11 +136,25 @@ Or alternatively for integer menu controls, by calling 
 v4l2_ctrl_new_int_menu:
   const struct v4l2_ctrl_ops *ops,
   u32 id, s32 max, s32 def, const s64 *qmenu_int);

 +Standard menu controls with driver specific menu are added by calling

 with driver - with a driver

Ok.

 +v4l2_ctrl_new_std_menu_items:
 +
 + struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
 + struct v4l2_ctrl_handler *hdl,
 + const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
 + s32 skip_mask, s32 def, const char * const *qmenu_user);

 I would recommend that qmenu_user is just renamed to qmenu.
 The _user suffix suggests that this is a userspace-provided menu, which
 is not the case.

Ok.

 +
  These functions are typically called right after the v4l2_ctrl_handler_init:

   static const s64 exp_bias_qmenu[] = {
  -2, -1, 0, 1, 2
   };
 + static const char * const test_pattern[] = {
 + Disabled,
 + Vertical Bars,
 + Solid Black,
 + Solid White,
 + };

   v4l2_ctrl_handler_init(foo-ctrl_handler, nr_of_controls);
   v4l2_ctrl_new_std(foo-ctrl_handler, foo_ctrl_ops,
 @@ -156,6 +170,9 @@ These functions are typically called right after the 
 v4l2_ctrl_handler_init:
   ARRAY_SIZE(exp_bias_qmenu) - 1,
   ARRAY_SIZE(exp_bias_qmenu) / 2 - 1,
   exp_bias_qmenu);
 + v4l2_ctrl_new_std_menu_items(foo-ctrl_handler, foo_ctrl_ops,
 + V4L2_CID_TEST_PATTERN, ARRAY_SIZE(test_pattern) - 1, 0,
 + 0, test_pattern);
   ...
   if (foo-ctrl_handler.error) {
   int err = foo-ctrl_handler.error;
 @@ -185,6 +202,14 @@ v4l2_ctrl_new_std_menu in that it doesn't have the mask 
 argument and takes
  as the last argument an array of signed 64-bit integers that form an exact
  menu item list.

 +The v4l2_ctrl_new_std_menu_items funtion is very similar as

 funtion - function
 similar as - similar to

Ok.
 +v4l2_ctrl_new_std_menu but takes a extra parameter qmenu_user, which is

 a extra - an extra

 +driver specific menu but yet a standard menu control.

 the driver specific menu for an otherwise standard menu control.

Ok.

 +A good example for this control is the test pattern control for
 +capture/display/sensors devices that have the capability to generate test
 +patterns. These test patterns are hardware specific, so the contents of the
 +menu will vary from device to device.
 +
  Note that if something fails, the function will return NULL or an error and
  set ctrl_handler-error to the error code. If ctrl_handler-error was 
 already
  set, then it will just return and do nothing. This is also true for
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index d731422..9ac1b75 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -1649,6 +1649,34 @@ struct v4l2_ctrl

Re: [PATCH 01/14] davinci: vpfe: add dm3xx IPIPEIF hardware support module

2012-09-21 Thread Prabhakar Lad
Hi Laurent,

Thanks for the review.

On Thu, Sep 20, 2012 at 3:31 AM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 Thanks for the patch.

 On Friday 14 September 2012 18:16:31 Prabhakar Lad wrote:
 From: Manjunath Hadli manjunath.ha...@ti.com

 add support for dm3xx IPIPEIF hardware setup. This is the
 lowest software layer for the dm3x vpfe driver which directly
 accesses hardware. Add support for features like default
 pixel correction, dark frame substraction and hardware setup.

 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 ---
  drivers/media/platform/davinci/dm3xx_ipipeif.c |  318 +
  drivers/media/platform/davinci/dm3xx_ipipeif.h |  262 +++
  include/linux/dm3xx_ipipeif.h  |   62 +


  3 files changed, 642 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/platform/davinci/dm3xx_ipipeif.c
  create mode 100644 drivers/media/platform/davinci/dm3xx_ipipeif.h
  create mode 100644 include/linux/dm3xx_ipipeif.h

 diff --git a/drivers/media/platform/davinci/dm3xx_ipipeif.c
 b/drivers/media/platform/davinci/dm3xx_ipipeif.c new file mode 100644
 index 000..7961a74
 --- /dev/null
 +++ b/drivers/media/platform/davinci/dm3xx_ipipeif.c

 [snip]

 +#include linux/io.h
 +#include linux/module.h
 +#include linux/kernel.h
 +#include linux/uaccess.h
 +#include linux/v4l2-mediabus.h
 +#include linux/platform_device.h

 Just a side note, I usually sort headers alphabetically, but feel free to use
 whatever convention you like.

Ok I'll sort to.

 +#include dm3xx_ipipeif.h
 +
 +static void *__iomem ipipeif_base_addr;

 That's not good. You shouldn't have global constants like that. The value
 should instead be stored in your device structure, that you will need to pass
 around to all functions.

Ok.

 +static inline u32 regr_if(u32 offset)
 +{
 + return readl(ipipeif_base_addr + offset);
 +}
 +
 +static inline void regw_if(u32 val, u32 offset)
 +{
 + writel(val, ipipeif_base_addr + offset);
 +}

 Maybe ipipeif_read() and ipipeif_write() ?

 +void ipipeif_set_enable()
 +{
 + regw_if(1, IPIPEIF_ENABLE);
 +}

 Please define constants in a header file for register values, masks and shifts
 instead of hardcoding the raw numbers.

Ok.

 [snip]

 +static int __devinit dm3xx_ipipeif_probe(struct platform_device *pdev)
 +{
 + static resource_size_t  res_len;
 + struct resource *res;
 + int status;
 +
 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 + if (!res)
 + return -ENOENT;
 +
 + res_len = resource_size(res);
 +
 + res = request_mem_region(res-start, res_len, res-name);
 + if (!res)
 + return -EBUSY;
 +
 + ipipeif_base_addr = ioremap_nocache(res-start, res_len);
 + if (!ipipeif_base_addr) {
 + status = -EBUSY;
 + goto fail;
 + }
 + return 0;
 +
 +fail:
 + release_mem_region(res-start, res_len);
 +
 + return status;
 +}
 +
 +static int dm3xx_ipipeif_remove(struct platform_device *pdev)
 +{
 + struct resource *res;
 +
 + iounmap(ipipeif_base_addr);
 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 + if (res)
 + release_mem_region(res-start, resource_size(res));
 + return 0;
 +}
 +
 +static struct platform_driver dm3xx_ipipeif_driver = {
 + .driver = {
 + .name   = dm3xx_ipipeif,
 + .owner = THIS_MODULE,
 + },
 + .remove = __devexit_p(dm3xx_ipipeif_remove),
 + .probe = dm3xx_ipipeif_probe,
 +};
 +
 +static int dm3xx_ipipeif_init(void)
 +{
 + return platform_driver_register(dm3xx_ipipeif_driver);
 +}
 +
 +static void dm3xx_ipipeif_exit(void)
 +{
 + platform_driver_unregister(dm3xx_ipipeif_driver);
 +}
 +
 +module_init(dm3xx_ipipeif_init);
 +module_exit(dm3xx_ipipeif_exit);

 I'm not sure to like this. You're registering a module for a device that
 essentially sits there without doing anything, except providing functions that
 can be called by other modules.

 I somehow feel that the way the code is split amongst the different layers
 isn't optimal. Could you briefly explain the rationale behind the current
 architecture ?

 (BTW, please use the module_platform_driver() macro instead of
 module_init/module_exit)

As discussed over the IRC, I am working on new design, hopefully
you will be happy this time :)

 [snip]

 diff --git a/include/linux/dm3xx_ipipeif.h b/include/linux/dm3xx_ipipeif.h
 new file mode 100644
 index 000..1c1a830
 --- /dev/null
 +++ b/include/linux/dm3xx_ipipeif.h

 [snip]

 +#include media/davinci/vpfe_types.h
 +#include media/davinci/vpfe.h

 This header file defines part of the userspace API, but includes media/
 headers that are not exported to userspace.

 Header files should be split between 3 directories:

 - Definitions required by platform data used to go to media/ but the new
 include/linux/platform_data/ directory might

Re: [RFCv2 PATCH 00/14] davinci: clean up input/output/subdev config

2012-09-22 Thread Prabhakar Lad
Hi Hans,

Thanks for the patchset.

On Thu, Sep 20, 2012 at 5:36 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 This is the second patch series for a vpif driver cleanup.

 The first version can be found here:

 http://www.mail-archive.com/linux-media@vger.kernel.org/msg52136.html

 Changes since RFCv1:

 - rebased to a newer git repo:
   
 http://git.linuxtv.org/mhadli/v4l-dvb-davinci_devices.git/shortlog/refs/heads/da850_vpif_machine

 - fixed probe() cleanup code in both display and capture that was seriously
   broken.

 - fixed a broken s_routing implementation in the tvp514x driver: if there
   is no incoming video signal, then s_routing would return EINVAL and
   leave the driver with an inconsistent internal state. This has always
   been a problem, but with this patch series it suddenly became really
   noticable. s_routing shouldn't try to wait for a valid signal, that's
   not what s_routing should do.

 This patch series does some driver cleanup and reorganizes the config
 structs that are used to set up subdevices.

 The current driver associates an input or output with a subdev, but multiple
 inputs may use the same subdev and some inputs may not use a subdev at all
 (this is the case for our hardware).

 Several other things were also configured in the wrong structure. For
 example the vpif_interface struct is really part of the channel config
 and has nothing to do with the subdev.


Acked-by: Prabhakar Lad prabhakar@ti.com
Tested-by: Prabhakar Lad prabhakar@ti.com

 What is missing here is that the output doesn't have the same flexibility
 as the input when it comes to configuration. It would be good if someone
 can pick this up as a follow-up since it's unlikely I'll be working on
 that.

Working on it.

Regards,
--Prabhakar Lad

 What would also be nice is that by leaving the inputs or outputs for the
 second channel empty (NULL) in the configuration you can disable the second
 video node, e.g. trying to use it will always result in ENODEV or something.

 This patch series will at least make things more flexible.

 Regards,

 Hans

--
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 00/14] Media Controller capture driver for DM365

2012-09-23 Thread Prabhakar Lad
Hi Sakari,

On Sun, Sep 23, 2012 at 8:46 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Hi Prabhakar,


 Prabhakar Lad wrote:

 From: Lad, Prabhakar prabhakar@ti.com

 This patch set adds media controller based capture driver for
 DM365.


 Thanks for the set. Do you happen to have an updated version of the same
 documentation you posted to the list a while ago?

Yes I have included the documentation patch in same series.
'Documentation/video4linux/davinci-vpfe-mc.txt' is the one
which contains the documentation.

Regards,
--Prabhakar Lad

 Kind regards,

 --
 Sakari Ailus
 sakari.ai...@iki.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] media: davinci: vpif: display: separate out subdev from output

2012-09-24 Thread Prabhakar Lad
,
 + s_routing, input, output, 0);

 Darn, I should have checked this when I did my previous review. You should
 use v4l2_subdev_call(sd, ...) here. The s_routing op is one where you cannot
 just try and call all subdevs, you need to give it to a specific subdev. The
 reason is that the arguments to the s_routing op are subdev specific. And
 since you've got the subdev pointer anyway...

Agreed, I'll soon respin v2 with the above change.

Thanks and Regards,
--Prabhakar Lad

 Regards,

 Hans

 +
 + if (ret  0) {
 + vpif_err(Failed to set output\n);
 + return ret;
 + }
 +
 + }
 + ch-output_idx = index;
 + ch-sd = sd;
 + return 0;
 +}
 +
  static int vpif_s_output(struct file *file, void *priv, unsigned int i)
  {
 + struct vpif_display_config *config = vpif_dev-platform_data;
 + struct vpif_display_chan_config *chan_cfg;
   struct vpif_fh *fh = priv;
   struct channel_obj *ch = fh-channel;
   struct common_obj *common = ch-common[VPIF_VIDEO_INDEX];
 - int ret = 0;
 +
 + chan_cfg = config-chan_config[ch-channel_id];
 +
 + if (i = chan_cfg-output_count)
 + return -EINVAL;

   if (common-started) {
   vpif_err(Streaming in progress\n);
   return -EBUSY;
   }

 - ret = v4l2_device_call_until_err(vpif_obj.v4l2_dev, 1, video,
 - s_routing, 0, i, 0);
 -
 - if (ret  0)
 - vpif_err(Failed to set output standard\n);
 -
 - ch-output_idx = i;
 - if (vpif_obj.sd[i])
 - ch-sd = vpif_obj.sd[i];
 - return ret;
 + return vpif_set_output(config, ch, i);
  }

  static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
 @@ -1291,9 +1372,12 @@ vpif_enum_dv_timings(struct file *file, void *priv,
  {
   struct vpif_fh *fh = priv;
   struct channel_obj *ch = fh-channel;
 + int ret;

 - return v4l2_subdev_call(vpif_obj.sd[ch-output_idx],
 - video, enum_dv_timings, timings);
 + ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings);
 + if (ret == -ENOIOCTLCMD  ret == -ENODEV)
 + return -EINVAL;
 + return ret;
  }

  /**
 @@ -1320,12 +1404,9 @@ static int vpif_s_dv_timings(struct file *file, void 
 *priv,

   /* Configure subdevice timings, if any */
   ret = v4l2_subdev_call(ch-sd, video, s_dv_timings, timings);
 - if (ret == -ENOIOCTLCMD) {
 - vpif_dbg(2, debug, Custom DV timings not supported by 
 - subdevice\n);
 - return -ENODATA;
 - }
 - if (ret  0  ret != -ENODEV) {
 + if (ret == -ENOIOCTLCMD || ret == -ENODEV)
 + ret = 0;
 + if (ret  0) {
   vpif_dbg(2, debug, Error setting custom DV timings\n);
   return ret;
   }
 @@ -1754,6 +1835,11 @@ static __init int vpif_probe(struct platform_device 
 *pdev)
   ch-video_dev-lock = common-lock;
   video_set_drvdata(ch-video_dev, ch);

 + /* select output 0 */
 + err = vpif_set_output(config, ch, 0);
 + if (err)
 + goto probe_out;
 +
   /* register video device */
   vpif_dbg(1, debug, channel=%x,channel-video_dev=%x\n,
   (int)ch, (int)ch-video_dev);
 diff --git a/include/media/davinci/vpif_types.h 
 b/include/media/davinci/vpif_types.h
 index 65e8fe1..4b297eb 100644
 --- a/include/media/davinci/vpif_types.h
 +++ b/include/media/davinci/vpif_types.h
 @@ -20,6 +20,7 @@
  #include linux/i2c.h

  #define VPIF_CAPTURE_MAX_CHANNELS2
 +#define VPIF_DISPLAY_MAX_CHANNELS2

  enum vpif_if_type {
   VPIF_IF_BT656,
 @@ -39,15 +40,26 @@ struct vpif_subdev_info {
   struct i2c_board_info board_info;
  };

 +struct vpif_output {
 + struct v4l2_output output;
 + const char *subdev_name;
 + u32 input_route;
 + u32 output_route;
 +};
 +
 +struct vpif_display_chan_config {
 + struct vpif_interface vpif_if;
 + const struct vpif_output *outputs;
 + int output_count;
 + bool clip_en;
 +};
 +
  struct vpif_display_config {
   int (*set_clock)(int, int);
   struct vpif_subdev_info *subdevinfo;
   int subdev_count;
 - const char **output;
 - int output_count;
 + struct vpif_display_chan_config chan_config[VPIF_DISPLAY_MAX_CHANNELS];
   const char *card_name;
 - bool ch2_clip_en;
 - bool ch3_clip_en;
  };

  struct vpif_input {

 --
 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: [PATCH v2] media: davinci: vpif: display: separate out subdev from output

2012-09-24 Thread Prabhakar Lad
 an output
  + * @vpif_cfg - global config ptr
  + * @ch - channel
  + * @index - Given output index from application
  + *
  + * Select the given output.
  + */
  +static int vpif_set_output(struct vpif_display_config *vpif_cfg,
  + struct channel_obj *ch, int index)
  +{
  +   struct vpif_display_chan_config *chan_cfg =
  +   vpif_cfg-chan_config[ch-channel_id];
  +   struct vpif_subdev_info *subdev_info = NULL;
  +   struct v4l2_subdev *sd = NULL;
  +   u32 input = 0, output = 0;
  +   int sd_index;
  +   int ret;
  +
  +   sd_index = vpif_output_to_subdev(vpif_cfg, chan_cfg, index);
  +   if (sd_index = 0) {
  +   sd = vpif_obj.sd[sd_index];
  +   subdev_info = vpif_cfg-subdevinfo[sd_index];
  +   }
  +
  +   if (sd) {
  +   input = chan_cfg-outputs[index].input_route;
  +   output = chan_cfg-outputs[index].output_route;
  +   ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0);
  +   if (ret  0) {

 Replace with:

 if (ret  0  ret != -ENOIOCTLCMD) {

 It's OK if the subdev doesn't support this s_routing operation.

Ok

  +   vpif_err(Failed to set output\n);
  +   return ret;
  +   }
  +
  +   }
  +   ch-output_idx = index;
  +   ch-sd = sd;

 Just like in the capture case you should update tvnorms:

 ch-video_dev-tvnorms = chan_cfg-inputs[index].output.std;

 Make sure tvnorms is no longer set in vpif_video_template.
 Ditto for current_norm. Since vpif_display.c supports g_std the current_norm
 field shouldn't be used anymore.

 The capture case also updates vpifparams.iface:

 ch-vpifparams.iface = chan_cfg-vpif_if;

 Isn't that needed for output as well?

The iface is never used  in display, so there isnt any necessity to assign it.

Regards,
--Prabhakar Lad

  +   return 0;
  +}
  +
   static int vpif_s_output(struct file *file, void *priv, unsigned int i)
   {
  +   struct vpif_display_config *config = vpif_dev-platform_data;
  +   struct vpif_display_chan_config *chan_cfg;
  struct vpif_fh *fh = priv;
  struct channel_obj *ch = fh-channel;
  struct common_obj *common = ch-common[VPIF_VIDEO_INDEX];
  -   int ret = 0;
  +
  +   chan_cfg = config-chan_config[ch-channel_id];
  +
  +   if (i = chan_cfg-output_count)
  +   return -EINVAL;
 
  if (common-started) {
  vpif_err(Streaming in progress\n);
  return -EBUSY;
  }
 
  -   ret = v4l2_device_call_until_err(vpif_obj.v4l2_dev, 1, video,
  -   s_routing, 0, i, 0);
  -
  -   if (ret  0)
  -   vpif_err(Failed to set output standard\n);
  -
  -   ch-output_idx = i;
  -   if (vpif_obj.sd[i])
  -   ch-sd = vpif_obj.sd[i];
  -   return ret;
  +   return vpif_set_output(config, ch, i);
   }
 
   static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
  @@ -1291,9 +1370,12 @@ vpif_enum_dv_timings(struct file *file, void *priv,
   {
  struct vpif_fh *fh = priv;
  struct channel_obj *ch = fh-channel;
  +   int ret;
 
  -   return v4l2_subdev_call(vpif_obj.sd[ch-output_idx],
  -   video, enum_dv_timings, timings);
  +   ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings);
  +   if (ret == -ENOIOCTLCMD  ret == -ENODEV)
  +   return -EINVAL;
  +   return ret;
   }
 
   /**
  @@ -1320,12 +1402,9 @@ static int vpif_s_dv_timings(struct file *file, 
  void *priv,
 
  /* Configure subdevice timings, if any */
  ret = v4l2_subdev_call(ch-sd, video, s_dv_timings, timings);
  -   if (ret == -ENOIOCTLCMD) {
  -   vpif_dbg(2, debug, Custom DV timings not supported by 
  -   subdevice\n);
  -   return -ENODATA;
  -   }
  -   if (ret  0  ret != -ENODEV) {
  +   if (ret == -ENOIOCTLCMD || ret == -ENODEV)
  +   ret = 0;
  +   if (ret  0) {
  vpif_dbg(2, debug, Error setting custom DV timings\n);
  return ret;
  }
  @@ -1754,6 +1833,11 @@ static __init int vpif_probe(struct platform_device 
  *pdev)
  ch-video_dev-lock = common-lock;
  video_set_drvdata(ch-video_dev, ch);
 
  +   /* select output 0 */
  +   err = vpif_set_output(config, ch, 0);
  +   if (err)
  +   goto probe_out;
  +
  /* register video device */
  vpif_dbg(1, debug, channel=%x,channel-video_dev=%x\n,
  (int)ch, (int)ch-video_dev);

 Regards,

 Hans
 --
 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: Gain controls in v4l2-ctrl framework

2012-09-24 Thread Prabhakar Lad
Hi Hans,

On Mon, Sep 24, 2012 at 4:25 PM, Hans de Goede hdego...@redhat.com wrote:
 Hi,


 On 09/23/2012 01:26 PM, Prabhakar Lad wrote:

 Hi All,

 The CCD/Sensors have the capability to adjust the R/ye, Gr/Cy, Gb/G,
 B/Mg gain values.
 Since these control can be re-usable I am planning to add the
 following gain controls as part
 of the framework:

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE


 Not all sensors have separate V4L2_CID_GAIN_GREEN_RED /
 V4L2_CID_GAIN_GREEN_BLUE,
 so we will need a separate control for sensors which have one combined gain
 called simply V4L2_CID_GAIN_GREEN

Agreed

 Also do we really need separate V4L2_CID_GAIN_GREEN_RED /
 V4L2_CID_GAIN_GREEN_BLUE
 controls? I know hardware has them, but in my experience that is only done
 as it
 is simpler to make the hardware this way (fully symmetric sensor grid), have
 you ever
 tried actually using different gain settings for the 2 different green rows
 ?

Never tried it.

 I've and that always results in an ugly checker board pattern. So I think we
 can
 and should only have a V4L2_CID_GAIN_GREEN, and for sensors with 2 green
 gains
 have that control both, forcing both to always have the same setting, which
 is
 really what you want anyways ...

Agreed.

Regards,
--Prabhakar Lad

 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET


 GAIN_OFFSET that sounds a bit weird... GAIN_OFFSET sounds like it is
 a number which gets added to the 3/4 gain settings before the gain gets
 applied,
 but I assume that you just mean a number which gets added to the value from
 the pixel, either before or after the gain is applied and I must admit I
 cannot
 come up with a better name.

 I believe (not sure) that some sensors have these per color ... The question
 is if it makes sense to actually control this per color though, I don't
 think it
 does as it is meant to compensate for any fixed measuring errors, which are
 the
 same for all 3/4 colors. Note that all the sensor cells are exactly the
 same,
 later on a color grid gets added on top of the sensors to turn them into
 r/g/b
 cells, but physically they are the same cells, so with the same process and
 temperature caused measuring errors...

 Regards,

 Hans
--
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] media: davinci: vpif: display: separate out subdev from output

2012-09-24 Thread Prabhakar Lad
Hi Hans,

On Mon, Sep 24, 2012 at 7:02 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 On Mon September 24 2012 15:21:44 Prabhakar Lad wrote:
 Hi Hans,

 On Mon, Sep 24, 2012 at 5:20 PM, Hans Verkuil hverk...@xs4all.nl wrote:
  On Mon September 24 2012 12:59:11 Hans Verkuil wrote:
  On Mon September 24 2012 12:44:11 Prabhakar wrote:
   From: Lad, Prabhakar prabhakar@ti.com
  
   vpif_display relied on a 1-1 mapping of output and subdev. This is not
   necessarily the case. Separate the two. So there is a list of subdevs
   and a list of outputs. Each output refers to a subdev and has routing
   information. An output does not have to have a subdev.
  
   The initial output for each channel is set to the fist output.
  
   Currently missing is support for associating multiple subdevs with
   an output.
  
   Signed-off-by: Lad, Prabhakar prabhakar@ti.com
   Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
   Cc: Hans Verkuil hans.verk...@cisco.com
   Cc: Sekhar Nori nsek...@ti.com
 
  Acked-by: Hans Verkuil hans.verk...@cisco.com
 
  I'm retracting this Ack. I did see something that wasn't right but I 
  thought
  it was harmless, but after thinking some more I believe it should be fixed.
  Luckily, it's easy to fix. See below. Since we need a new version anyway I
  also added a comment to a few minor issues that can be fixed at the same 
  time.
 
 
  Regards,
 
Hans
 
   ---
This patch is dependent on the patch series from Hans
(http://www.mail-archive.com/linux-media@vger.kernel.org/msg52270.html)
  
Changes for V2:
1: Changed v4l2_device_call_until_err() call to v4l2_subdev_call() for
   s_routing, since this call is for specific subdev, pointed out by 
   Hans.
  
arch/arm/mach-davinci/board-da850-evm.c   |   29 +-
arch/arm/mach-davinci/board-dm646x-evm.c  |   39 ++-
drivers/media/platform/davinci/vpif_display.c |  136 
   -
include/media/davinci/vpif_types.h|   20 +++-
4 files changed, 183 insertions(+), 41 deletions(-)
  
   diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
   b/arch/arm/mach-davinci/board-da850-evm.c
   index 3081ea4..23a7012 100644
   --- a/arch/arm/mach-davinci/board-da850-evm.c
   +++ b/arch/arm/mach-davinci/board-da850-evm.c
   @@ -46,6 +46,7 @@
#include mach/spi.h
  
#include media/tvp514x.h
   +#include media/adv7343.h
  
#define DA850_EVM_PHY_ID   davinci_mdio-0:00
#define DA850_LCD_PWR_PIN  GPIO_TO_PIN(2, 8)
   @@ -1257,16 +1258,34 @@ static struct vpif_subdev_info 
   da850_vpif_subdev[] = {
   },
};
  
   -static const char const *vpif_output[] = {
   -   Composite,
   -   S-Video,
   +static const struct vpif_output da850_ch0_outputs[] = {
   +   {
   +   .output = {
   +   .index = 0,
   +   .name = Composite,
   +   .type = V4L2_OUTPUT_TYPE_ANALOG,
   +   },
   +   .subdev_name = adv7343,
   +   .output_route = ADV7343_COMPOSITE_ID,
   +   },
   +   {
   +   .output = {
   +   .index = 1,
   +   .name = S-Video,
   +   .type = V4L2_OUTPUT_TYPE_ANALOG,
   +   },
   +   .subdev_name = adv7343,
   +   .output_route = ADV7343_SVIDEO_ID,
   +   },
};
  
static struct vpif_display_config da850_vpif_display_config = {
   .subdevinfo   = da850_vpif_subdev,
   .subdev_count = ARRAY_SIZE(da850_vpif_subdev),
   -   .output   = vpif_output,
   -   .output_count = ARRAY_SIZE(vpif_output),
   +   .chan_config[0] = {
   +   .outputs = da850_ch0_outputs,
   +   .output_count = ARRAY_SIZE(da850_ch0_outputs),
   +   },
   .card_name= DA850/OMAP-L138 Video Display,
};
  
   diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c 
   b/arch/arm/mach-davinci/board-dm646x-evm.c
   index ad249c7..c206768 100644
   --- a/arch/arm/mach-davinci/board-dm646x-evm.c
   +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
   @@ -26,6 +26,7 @@
#include linux/i2c/pcf857x.h
  
#include media/tvp514x.h
   +#include media/adv7343.h
  
#include linux/mtd/mtd.h
#include linux/mtd/nand.h
   @@ -496,18 +497,44 @@ static struct vpif_subdev_info 
   dm646x_vpif_subdev[] = {
   },
};
  
   -static const char *output[] = {
   -   Composite,
   -   Component,
   -   S-Video,
   +static const struct vpif_output dm6467_ch0_outputs[] = {
   +   {
   +   .output = {
   +   .index = 0,
   +   .name = Composite,
   +   .type = V4L2_OUTPUT_TYPE_ANALOG,
   +   },
   +   .subdev_name = adv7343,
   +   .output_route = ADV7343_COMPOSITE_ID,
   +   },
   +   {
   +   .output = {
   +   .index = 1,
   +   .name = Component,
   +   .type = V4L2_OUTPUT_TYPE_ANALOG

Re: [PATCH v3] media: v4l2-ctrls: add control for test pattern

2012-09-24 Thread Prabhakar Lad
Hi Hans,

Thanks for the review,

On Mon, Sep 24, 2012 at 7:07 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 On Mon September 24 2012 14:53:41 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 add V4L2_CID_TEST_PATTERN of type menu, which determines
 the internal test pattern selected by the device.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Acked-by: Sakari Ailus sakari.ai...@iki.fi
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Cc: Hans de Goede hdego...@redhat.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Rob Landley r...@landley.net
 ---
  This patches has one checkpatch warning for line over
  80 characters altough it can be avoided I have kept it
  for consistency.

  Changes for v3:
  1: Removed the menu for test pattern, pointed by Sakari.

  Changes for v2:
  1: Included display devices in the description for test pattern
as pointed by Hans.
  2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
pointed by Sylwester.
  3: Removed the test patterns from menu as the are hardware specific
as pointed by Sakari.

  Documentation/DocBook/media/v4l/controls.xml |   10 ++
  drivers/media/v4l2-core/v4l2-ctrls.c |2 ++
  include/linux/videodev2.h|1 +
  3 files changed, 13 insertions(+), 0 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index f0fb08d..51e9c4e 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4313,6 +4313,16 @@ interface and may change in the future./para
 /tbody
   /entrytbl
 /row
 +   row
 + entry 
 spanname=idconstantV4L2_CID_TEST_PATTERN/constant/entry
 + entrymenu/entry
 +   /row
 +   row id=v4l2-test-pattern
 + entry spanname=descr The Capture/Display/Sensors have the 
 capability
 + to generate internal test patterns and this are hardware specific. 
 This
 + test patterns are used to test a device is properly working and 
 can generate
 + the desired waveforms that it supports./entry

 Some grammar/style fixes:

 entry spanname=descr Some capture/display/sensor devices have 
 the
 capability to generate test pattern images. These hardware 
 specific
 test patterns can be used to test if a device is working 
 properly./entry

I'll fix it in next version.

Regards,
--Prabhakar Lad


 +   /row
   rowentry/entry/row
   /tbody
/tgroup
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index 8f2f40b..41b7732 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -740,6 +740,7 @@ const char *v4l2_ctrl_get_name(u32 id)
   case V4L2_CID_LINK_FREQ:return Link Frequency;
   case V4L2_CID_PIXEL_RATE:   return Pixel Rate;
   case V4L2_CID_DPCM_PREDICTOR:   return DPCM Predictor;
 + case V4L2_CID_TEST_PATTERN: return Test Pattern;

   default:
   return NULL;
 @@ -841,6 +842,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
 v4l2_ctrl_type *type,
   case V4L2_CID_EXPOSURE_METERING:
   case V4L2_CID_SCENE_MODE:
   case V4L2_CID_DPCM_PREDICTOR:
 + case V4L2_CID_TEST_PATTERN:
   *type = V4L2_CTRL_TYPE_MENU;
   break;
   case V4L2_CID_LINK_FREQ:
 diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
 index ca9fb78..7014c0b 100644
 --- a/include/linux/videodev2.h
 +++ b/include/linux/videodev2.h
 @@ -2005,6 +2005,7 @@ enum v4l2_dpcm_predictor {
   V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
   V4L2_DPCM_PREDICTOR_ADVANCED= 1,
  };
 +#define V4L2_CID_TEST_PATTERN
 (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4)

  /*
   *   T U N I N G


 Regards,

 Hans
 --
 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: [PATCH v2] media: davinci: vpif: display: separate out subdev from output

2012-09-25 Thread Prabhakar Lad
Hi Hans,

On Tue, Sep 25, 2012 at 11:59 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 On Tue September 25 2012 07:38:12 Prabhakar Lad wrote:
 Hi Hans,

 On Mon, Sep 24, 2012 at 7:02 PM, Hans Verkuil hverk...@xs4all.nl wrote:
  On Mon September 24 2012 15:21:44 Prabhakar Lad wrote:
  Hi Hans,
 
  On Mon, Sep 24, 2012 at 5:20 PM, Hans Verkuil hverk...@xs4all.nl wrote:
   On Mon September 24 2012 12:59:11 Hans Verkuil wrote:
   On Mon September 24 2012 12:44:11 Prabhakar wrote:
From: Lad, Prabhakar prabhakar@ti.com
   
vpif_display relied on a 1-1 mapping of output and subdev. This is 
not
necessarily the case. Separate the two. So there is a list of subdevs
and a list of outputs. Each output refers to a subdev and has routing
information. An output does not have to have a subdev.
   
The initial output for each channel is set to the fist output.
   
Currently missing is support for associating multiple subdevs with
an output.
   
Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Sekhar Nori nsek...@ti.com
  
   Acked-by: Hans Verkuil hans.verk...@cisco.com
  
   I'm retracting this Ack. I did see something that wasn't right but I 
   thought
   it was harmless, but after thinking some more I believe it should be 
   fixed.
   Luckily, it's easy to fix. See below. Since we need a new version 
   anyway I
   also added a comment to a few minor issues that can be fixed at the 
   same time.
  
  
   Regards,
  
 Hans
  
---
 This patch is dependent on the patch series from Hans
 
(http://www.mail-archive.com/linux-media@vger.kernel.org/msg52270.html)
   
 Changes for V2:
 1: Changed v4l2_device_call_until_err() call to v4l2_subdev_call() 
for
s_routing, since this call is for specific subdev, pointed out 
by Hans.
   
 arch/arm/mach-davinci/board-da850-evm.c   |   29 +-
 arch/arm/mach-davinci/board-dm646x-evm.c  |   39 ++-
 drivers/media/platform/davinci/vpif_display.c |  136 
-
 include/media/davinci/vpif_types.h|   20 +++-
 4 files changed, 183 insertions(+), 41 deletions(-)
   
diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
b/arch/arm/mach-davinci/board-da850-evm.c
index 3081ea4..23a7012 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -46,6 +46,7 @@
 #include mach/spi.h
   
 #include media/tvp514x.h
+#include media/adv7343.h
   
 #define DA850_EVM_PHY_ID   davinci_mdio-0:00
 #define DA850_LCD_PWR_PIN  GPIO_TO_PIN(2, 8)
@@ -1257,16 +1258,34 @@ static struct vpif_subdev_info 
da850_vpif_subdev[] = {
},
 };
   
-static const char const *vpif_output[] = {
-   Composite,
-   S-Video,
+static const struct vpif_output da850_ch0_outputs[] = {
+   {
+   .output = {
+   .index = 0,
+   .name = Composite,
+   .type = V4L2_OUTPUT_TYPE_ANALOG,
+   },
+   .subdev_name = adv7343,
+   .output_route = ADV7343_COMPOSITE_ID,
+   },
+   {
+   .output = {
+   .index = 1,
+   .name = S-Video,
+   .type = V4L2_OUTPUT_TYPE_ANALOG,
+   },
+   .subdev_name = adv7343,
+   .output_route = ADV7343_SVIDEO_ID,
+   },
 };
   
 static struct vpif_display_config da850_vpif_display_config = {
.subdevinfo   = da850_vpif_subdev,
.subdev_count = ARRAY_SIZE(da850_vpif_subdev),
-   .output   = vpif_output,
-   .output_count = ARRAY_SIZE(vpif_output),
+   .chan_config[0] = {
+   .outputs = da850_ch0_outputs,
+   .output_count = ARRAY_SIZE(da850_ch0_outputs),
+   },
.card_name= DA850/OMAP-L138 Video Display,
 };
   
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c 
b/arch/arm/mach-davinci/board-dm646x-evm.c
index ad249c7..c206768 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -26,6 +26,7 @@
 #include linux/i2c/pcf857x.h
   
 #include media/tvp514x.h
+#include media/adv7343.h
   
 #include linux/mtd/mtd.h
 #include linux/mtd/nand.h
@@ -496,18 +497,44 @@ static struct vpif_subdev_info 
dm646x_vpif_subdev[] = {
},
 };
   
-static const char *output[] = {
-   Composite,
-   Component,
-   S-Video,
+static const struct vpif_output dm6467_ch0_outputs[] = {
+   {
+   .output = {
+   .index = 0,
+   .name = Composite,
+   .type = V4L2_OUTPUT_TYPE_ANALOG

Re: [PATCH] media: davinci: vpif: set device capabilities

2012-09-25 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Tue, Sep 25, 2012 at 5:13 PM, Hans Verkuil hansv...@cisco.com wrote:
 On Tue 25 September 2012 13:16:24 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/platform/davinci/vpif_capture.c |4 +++-
  drivers/media/platform/davinci/vpif_display.c |4 +++-
  2 files changed, 6 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/platform/davinci/vpif_capture.c 
 b/drivers/media/platform/davinci/vpif_capture.c
 index 482..faeca98 100644
 --- a/drivers/media/platform/davinci/vpif_capture.c
 +++ b/drivers/media/platform/davinci/vpif_capture.c
 @@ -1630,7 +1630,9 @@ static int vpif_querycap(struct file *file, void  
 *priv,
  {
   struct vpif_capture_config *config = vpif_dev-platform_data;

 - cap-capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 + cap-device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
 + V4L2_CAP_READWRITE;
 + cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
   strlcpy(cap-driver, vpif capture, sizeof(cap-driver));

 This should be the real driver name which is 'vpif_capture'.

Ok.

   strlcpy(cap-bus_info, VPIF Platform, sizeof(cap-bus_info));

 For bus_info I would use: platform:vpif_capture.

 The 'platform:' prefix is going to be the standard for platform drivers.

Ok.

   strlcpy(cap-card, config-card_name, sizeof(cap-card));
 diff --git a/drivers/media/platform/davinci/vpif_display.c 
 b/drivers/media/platform/davinci/vpif_display.c
 index d94b8a2..171e449 100644
 --- a/drivers/media/platform/davinci/vpif_display.c
 +++ b/drivers/media/platform/davinci/vpif_display.c
 @@ -827,7 +827,9 @@ static int vpif_querycap(struct file *file, void  *priv,
  {
   struct vpif_display_config *config = vpif_dev-platform_data;

 - cap-capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
 + cap-device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING |
 + V4L2_CAP_READWRITE;
 + cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
   strlcpy(cap-driver, vpif display, sizeof(cap-driver));

 vpif_driver

   strlcpy(cap-bus_info, Platform, sizeof(cap-bus_info));

 Ditto: platform:vpif_driver.

   strlcpy(cap-card, config-card_name, sizeof(cap-card));


Ok, I'll respin v2 with all the changes.

Regards,
--Prabhakar Lad

 Regards,

 Hans
--
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: davinci: vpif: set device capabilities

2012-09-25 Thread Prabhakar Lad
Hi Hans/Laurent

On Tue, Sep 25, 2012 at 5:24 PM, Hans Verkuil hansv...@cisco.com wrote:
 On Tue 25 September 2012 13:49:16 Laurent Pinchart wrote:
 Hi Hans,

 On Tuesday 25 September 2012 13:43:36 Hans Verkuil wrote:
  On Tue 25 September 2012 13:16:24 Prabhakar wrote:
   From: Lad, Prabhakar prabhakar@ti.com
  
   Signed-off-by: Lad, Prabhakar prabhakar@ti.com
   Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
   Cc: Hans Verkuil hans.verk...@cisco.com
   ---
  
drivers/media/platform/davinci/vpif_capture.c |4 +++-
drivers/media/platform/davinci/vpif_display.c |4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
  
   diff --git a/drivers/media/platform/davinci/vpif_capture.c
   b/drivers/media/platform/davinci/vpif_capture.c index 482..faeca98
   100644
   --- a/drivers/media/platform/davinci/vpif_capture.c
   +++ b/drivers/media/platform/davinci/vpif_capture.c
   @@ -1630,7 +1630,9 @@ static int vpif_querycap(struct file *file, void
   *priv,
{
  
 struct vpif_capture_config *config = vpif_dev-platform_data;
  
   - cap-capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
   + cap-device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
   + V4L2_CAP_READWRITE;
   + cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
  
 strlcpy(cap-driver, vpif capture, sizeof(cap-driver));
 
  This should be the real driver name which is 'vpif_capture'.
 
 strlcpy(cap-bus_info, VPIF Platform, sizeof(cap-bus_info));
 
  For bus_info I would use: platform:vpif_capture.
 
  The 'platform:' prefix is going to be the standard for platform drivers.

 What about

 snprintf(cap-driver, sizeof(cap-driver), platform:%s, 
 dev_name(vpif_dev));

 That would handle cases where multiple platform devices of the same type are
 present.

 Sure, that's even better. You do have to check that this gives you what you'd
 expect (i.e., that you don't end up with platform:platform:vpif_capture).

But the driver field is max 16, should i extend it to 32 ?

Regards,
--Prabhakar Lad

 Regards,

 Hans
--
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: davinci: vpif: set device capabilities

2012-09-25 Thread Prabhakar Lad
On Tue, Sep 25, 2012 at 7:20 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 On Tuesday 25 September 2012 15:48:10 Hans Verkuil wrote:
 On Tue 25 September 2012 15:26:11 Prabhakar Lad wrote:
  On Tue, Sep 25, 2012 at 5:24 PM, Hans Verkuil hansv...@cisco.com wrote:
   On Tue 25 September 2012 13:49:16 Laurent Pinchart wrote:
   Hi Hans,
  
   On Tuesday 25 September 2012 13:43:36 Hans Verkuil wrote:
On Tue 25 September 2012 13:16:24 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 ---

  drivers/media/platform/davinci/vpif_capture.c |4 +++-
  drivers/media/platform/davinci/vpif_display.c |4 +++-
  2 files changed, 6 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/platform/davinci/vpif_capture.c
 b/drivers/media/platform/davinci/vpif_capture.c index
 482..faeca98
 100644
 --- a/drivers/media/platform/davinci/vpif_capture.c
 +++ b/drivers/media/platform/davinci/vpif_capture.c
 @@ -1630,7 +1630,9 @@ static int vpif_querycap(struct file *file,
 void
 *priv,

  {

   struct vpif_capture_config *config = vpif_dev-platform_data;

 - cap-capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 + cap-device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
 + V4L2_CAP_READWRITE;
 + cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;

   strlcpy(cap-driver, vpif capture, sizeof(cap-driver));
   
This should be the real driver name which is 'vpif_capture'.
   
   strlcpy(cap-bus_info, VPIF Platform, sizeof(cap-bus_info));
   
For bus_info I would use: platform:vpif_capture.
   
The 'platform:' prefix is going to be the standard for platform
drivers.
  
   What about
  
   snprintf(cap-driver, sizeof(cap-driver), platform:%s,
   dev_name(vpif_dev));
  
   That would handle cases where multiple platform devices of the same
   type are present.
  
   Sure, that's even better. You do have to check that this gives you what
   you'd expect (i.e., that you don't end up with
   platform:platform:vpif_capture).
  But the driver field is max 16, should i extend it to 32 ?

 I'm certain Laurent meant to say:

 snprintf(cap-bus_info, sizeof(cap-bus_info), platform:%s,
 dev_name(vpif_dev));

 Yes that's what I meant, sorry.

Ok thanks for clarifying.

Regards,
--Prabhakar Lad

 It makes no sense to use cap-driver.

 --
 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] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control

2012-09-26 Thread Prabhakar Lad
;

 This will need to be kept.

   }

   return mt9v032_write(client, MT9V032_TEST_PATTERN, data);
 +
 + case V4L2_CID_PARAMETRIC_TEST_PATTERN:
 + if (mt9v032-test_pattern != 4)
 + return 0;

 No need to check that, just write the test pattern color to the
 MT9V032_TEST_PATTERN_DATA field without changing the rest of the register. You
 could also put the two test pattern controls in a cluster.

Agreed.

 + data = (ctrl-val  MT9V032_TEST_PATTERN_DATA_SHIFT)
 +  | MT9V032_TEST_PATTERN_USE_DATA
 +  | MT9V032_TEST_PATTERN_ENABLE
 +  | MT9V032_TEST_PATTERN_FLIP;
 + return mt9v032_write(client, MT9V032_TEST_PATTERN, data);
   }

   return 0;
 @@ -579,16 +585,24 @@ static struct v4l2_ctrl_ops mt9v032_ctrl_ops = {
   .s_ctrl = mt9v032_s_ctrl,
  };

 +static const char * const mt9v032_test_pattern_menu[] = {
 + Disabled,
 + Gray Vertical Shade,
 + Gray Horizontal Shade,
 + Gray Diagonal Shade,
 + Parametric Test Pattern,

 I would just say Plain.

Ok I'll make it 'Plain'

 +};
 +
  static const struct v4l2_ctrl_config mt9v032_ctrls[] = {
   {
   .ops= mt9v032_ctrl_ops,
 - .id = V4L2_CID_TEST_PATTERN,
 + .id = V4L2_CID_PARAMETRIC_TEST_PATTERN,
   .type   = V4L2_CTRL_TYPE_INTEGER,
 - .name   = Test pattern,
 - .min= 0,
 + .name   = Parametric Test Pattern Values,

 Test Pattern Color

Ok.

Regards,
--Prabhakar Lad

 + .min= 4,
   .max= 1023,
   .step   = 1,
 - .def= 0,
 + .def= 4,
   .flags  = 0,
   }
  };
 @@ -741,7 +755,7 @@ static int mt9v032_probe(struct i2c_client *client,
   mutex_init(mt9v032-power_lock);
   mt9v032-pdata = pdata;

 - v4l2_ctrl_handler_init(mt9v032-ctrls, ARRAY_SIZE(mt9v032_ctrls) + 8);
 + v4l2_ctrl_handler_init(mt9v032-ctrls, ARRAY_SIZE(mt9v032_ctrls) + 9);

   v4l2_ctrl_new_std(mt9v032-ctrls, mt9v032_ctrl_ops,
 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
 @@ -763,6 +777,10 @@ static int mt9v032_probe(struct i2c_client *client,
 V4L2_CID_VBLANK, MT9V032_VERTICAL_BLANKING_MIN,
 MT9V032_VERTICAL_BLANKING_MAX, 1,
 MT9V032_VERTICAL_BLANKING_DEF);
 + v4l2_ctrl_new_std_menu_items(mt9v032-ctrls, mt9v032_ctrl_ops,
 + V4L2_CID_TEST_PATTERN,
 + ARRAY_SIZE(mt9v032_test_pattern_menu) - 1, 0,
 + 0, mt9v032_test_pattern_menu);

   mt9v032-pixel_rate =
   v4l2_ctrl_new_std(mt9v032-ctrls, mt9v032_ctrl_ops,
 --
 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: Gain controls in v4l2-ctrl framework

2012-09-26 Thread Prabhakar Lad
Hi All,

On Sun, Sep 23, 2012 at 4:56 PM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi All,

 The CCD/Sensors have the capability to adjust the R/ye, Gr/Cy, Gb/G,
 B/Mg gain values.
 Since these control can be re-usable I am planning to add the
 following gain controls as part
 of the framework:

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE
 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET

 I need your opinion's to get moving to add them.


I am listing out the gain controls which is the outcome of above discussion:-

1: V4L2_CID_GAIN_RED
2: V4L2_CID_GAIN_GREEN_RED
3: V4L2_CID_GAIN_GREEN_BLUE
4: V4L2_CID_GAIN_BLUE
5: V4L2_CID_GAIN_OFFSET
6: V4L2_CID_BLUE_OFFSET
7: V4L2_CID_RED_OFFSET
8: V4L2_CID_GREEN_OFFSET

Please let me know for any addition/deletion.

Regards,
--Prabhakar Lad

 Thanks and Regards,
 --Prabhakar Lad
--
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: Gain controls in v4l2-ctrl framework

2012-09-26 Thread Prabhakar Lad
Hi Chris,

On Wed, Sep 26, 2012 at 12:23 PM, Chris MacGregor ch...@cybermato.com wrote:
 Hi All.


 On 09/25/2012 11:44 PM, Prabhakar Lad wrote:

 Hi All,

 On Sun, Sep 23, 2012 at 4:56 PM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:

 Hi All,

 The CCD/Sensors have the capability to adjust the R/ye, Gr/Cy, Gb/G,
 B/Mg gain values.
 Since these control can be re-usable I am planning to add the
 following gain controls as part
 of the framework:

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE
 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET

 I need your opinion's to get moving to add them.

 I am listing out the gain controls which is the outcome of above
 discussion:-

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE
 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET
 6: V4L2_CID_BLUE_OFFSET
 7: V4L2_CID_RED_OFFSET
 8: V4L2_CID_GREEN_OFFSET

 Please let me know for any addition/deletion.


 I thought the consensus was that we would also need a V4L2_CID_GAIN_GREEN,
 to handle devices for which there are not two separate greens.

Ok, I'll add it too.

 Also, should there be a V4L2_CID_GREEN_RED_OFFSET and
 V4L2_CID_GREEN_BLUE_OFFSET, for consistency and to handle hardware that has
 such offsets?

+1 (But I would like opinions form others too for these control)

 (Perhaps I missed an email in this thread, but I thought I caught them all.)

May be I missed out :(

Thanks And Regards,
--Prabhakar Lad

 Regards,
 --Prabhakar Lad


 Cheers,
 Chris MacGregor (the Seattle one)
--
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: Gain controls in v4l2-ctrl framework

2012-09-26 Thread Prabhakar Lad
Hi Sakari,

On Wed, Sep 26, 2012 at 1:12 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 On Wed, Sep 26, 2012 at 12:14:36PM +0530, Prabhakar Lad wrote:
 Hi All,

 On Sun, Sep 23, 2012 at 4:56 PM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:
  Hi All,
 
  The CCD/Sensors have the capability to adjust the R/ye, Gr/Cy, Gb/G,
  B/Mg gain values.
  Since these control can be re-usable I am planning to add the
  following gain controls as part
  of the framework:
 
  1: V4L2_CID_GAIN_RED
  2: V4L2_CID_GAIN_GREEN_RED
  3: V4L2_CID_GAIN_GREEN_BLUE
  4: V4L2_CID_GAIN_BLUE
  5: V4L2_CID_GAIN_OFFSET
 
  I need your opinion's to get moving to add them.
 

 I am listing out the gain controls which is the outcome of above discussion:-

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE
 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET
 6: V4L2_CID_BLUE_OFFSET
 7: V4L2_CID_RED_OFFSET
 8: V4L2_CID_GREEN_OFFSET

 Hi Prabhakar,

 As these are low level controls, I wonder whether it would make sense to
 make a difference between digital and analogue gain. I admit I'm not quite
 as certain whether there's such a large difference as there is for global
 gains for the camera control algorithms.

 Which ones do you need now?

Currently I am need of following,

 1: V4L2_CID_GAIN_RED
 2: V4L2_CID_GAIN_GREEN_RED
 3: V4L2_CID_GAIN_GREEN_BLUE
 4: V4L2_CID_GAIN_BLUE
 5: V4L2_CID_GAIN_OFFSET

Regards,
--Prabhakar Lad

 Kind regards,

 --
 Sakari Ailus
 e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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: Gain controls in v4l2-ctrl framework

2012-09-26 Thread Prabhakar Lad
On Wed, Sep 26, 2012 at 1:24 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 On Wed, Sep 26, 2012 at 01:16:08PM +0530, Prabhakar Lad wrote:
 ...
 Currently I am need of following,

  1: V4L2_CID_GAIN_RED
  2: V4L2_CID_GAIN_GREEN_RED
  3: V4L2_CID_GAIN_GREEN_BLUE
  4: V4L2_CID_GAIN_BLUE
  5: V4L2_CID_GAIN_OFFSET

 Are they analogue or digital?

digital

Regards,
--Prabhakar

 --
 Sakari Ailus
 e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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 0/1 v2] media/video: vpif: fixing function name start to vpif_config_params

2012-09-26 Thread Prabhakar Lad
Hi Dror,

On Thu, Sep 27, 2012 at 1:50 AM, Mauro Carvalho Chehab
mche...@infradead.org wrote:
 Em Mon, 13 Aug 2012 19:43:29 +0530
 Manjunath Hadli manjunath.ha...@ti.com escreveu:

 Hi Dror,

 Thanks for the patch.

 Mauro,

 I'll queue this patch for v3.7 through my tree.

 Sure.


 On Thursday 09 August 2012 12:03 PM, Dror Cohen wrote:
  This patch address the issue that a function named config_vpif_params 
  should
  be vpif_config_params. However this name is shared with two structures 
  defined
  already. So I changed the structures to config_vpif_params (origin was
  vpif_config_params)
 
  v2 changes: softer wording in description and the structs are now
  defined without _t

 Hmm... I didn't understand what you're wanting with this change. Before this 
 patch,
 there are:

 v4l@pedra ~/v4l/patchwork $ git grep config_vpif_params
 drivers/media/platform/davinci/vpif.c:/* config_vpif_params
 drivers/media/platform/davinci/vpif.c:static void config_vpif_params(struct 
 vpif_params *vpifparams,
 drivers/media/platform/davinci/vpif.c:config_vpif_params(vpifparams, 
 channel_id, found);
 v4l@pedra ~/v4l/patchwork $ git grep vpif_config_params
 drivers/media/platform/davinci/vpif_capture.c:static struct 
 vpif_config_params config_params = {
 drivers/media/platform/davinci/vpif_capture.h:struct vpif_config_params {
 drivers/media/platform/davinci/vpif_display.c:static struct 
 vpif_config_params config_params = {
 drivers/media/platform/davinci/vpif_display.h:struct vpif_config_params {

 After that, there are:

 v4l@pedra ~/v4l/patchwork $ git grep vpif_config_params
 drivers/media/platform/davinci/vpif.c:/* vpif_config_params
 drivers/media/platform/davinci/vpif.c:static void vpif_config_params(struct 
 vpif_params *vpifparams,
 drivers/media/platform/davinci/vpif.c:vpif_config_params(vpifparams, 
 channel_id, found);
 v4l@pedra ~/v4l/patchwork $ git grep config_vpif_params
 drivers/media/platform/davinci/vpif_capture.c:static struct 
 config_vpif_params config_params = {
 drivers/media/platform/davinci/vpif_capture.h:struct config_vpif_params {
 drivers/media/platform/davinci/vpif_display.c:static struct 
 config_vpif_params config_params = {
 drivers/media/platform/davinci/vpif_display.h:struct config_vpif_params {

 So, I can't really see any improvement on avoiding duplicate names.

 IMHO, the better would be to name those functions as:

 vpif:   vpif_config_params (or, even better, vpif_core_config_params)
 vpif_capture:   vpif_capture_config_params
 vpif_display:   vpif_display_config_params

 This way, duplication will be avoided and will avoid the confusing inversion 
 between
 vpif and config.

I agree with Mauro here, Can you do the above changes and post
a v2.( Rebase it on
http://git.linuxtv.org/media_tree.git/shortlog/refs/heads/staging/for_v3.7
branch)

Regards,
--Prabhakar Lad

 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
--
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: davinci: vpif: add check for NULL handler

2012-09-26 Thread Prabhakar Lad
Hi Mauro,

On Thu, Sep 27, 2012 at 1:37 AM, Mauro Carvalho Chehab
mche...@infradead.org wrote:
 Em Thu, 16 Aug 2012 19:32:00 +0530
 Prabhakar Lad prabhakar@ti.com escreveu:

 It is amazing how many SOB's/acks are in this patch and nobody
 asked you to provide a patch description... the subject just
 tells what the code is also telling. Could you please provide
 a better patch description?

My bad I'll post a v2.

Regards,
--Prabhakar Lad

 Thanks!
 Mauro

 From: Lad, Prabhakar prabhakar@ti.com

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/video/davinci/vpif_capture.c |   12 +++-
  drivers/media/video/davinci/vpif_display.c |   14 --
  2 files changed, 15 insertions(+), 11 deletions(-)

 diff --git a/drivers/media/video/davinci/vpif_capture.c 
 b/drivers/media/video/davinci/vpif_capture.c
 index 266025e..a87b7a5 100644
 --- a/drivers/media/video/davinci/vpif_capture.c
 +++ b/drivers/media/video/davinci/vpif_capture.c
 @@ -311,12 +311,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
 unsigned int count)
   }

   /* configure 1 or 2 channel mode */
 - ret = vpif_config_data-setup_input_channel_mode
 - (vpif-std_info.ycmux_mode);
 + if (vpif_config_data-setup_input_channel_mode) {
 + ret = vpif_config_data-setup_input_channel_mode
 + (vpif-std_info.ycmux_mode);

 - if (ret  0) {
 - vpif_dbg(1, debug, can't set vpif channel mode\n);
 - return ret;
 + if (ret  0) {
 + vpif_dbg(1, debug, can't set vpif channel mode\n);
 + return ret;
 + }
   }

   /* Call vpif_set_params function to set the parameters and addresses */
 diff --git a/drivers/media/video/davinci/vpif_display.c 
 b/drivers/media/video/davinci/vpif_display.c
 index e129c98..1e35f92 100644
 --- a/drivers/media/video/davinci/vpif_display.c
 +++ b/drivers/media/video/davinci/vpif_display.c
 @@ -280,12 +280,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
 unsigned int count)
   }

   /* clock settings */
 - ret =
 - vpif_config_data-set_clock(ch-vpifparams.std_info.ycmux_mode,
 - ch-vpifparams.std_info.hd_sd);
 - if (ret  0) {
 - vpif_err(can't set clock\n);
 - return ret;
 + if (vpif_config_data-set_clock) {
 + ret =
 + vpif_config_data-set_clock(ch-vpifparams.std_info.ycmux_mode,
 + ch-vpifparams.std_info.hd_sd);
 + if (ret  0) {
 + vpif_err(can't set clock\n);
 + return ret;
 + }
   }

   /* set the parameters and addresses */




 Cheers,
 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
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/media: Remove unnecessary semicolon

2012-09-27 Thread Prabhakar Lad
Hi Peter,

Thanks for the patch.

On Thu, Sep 27, 2012 at 5:00 PM, Peter Senna Tschudin
peter.se...@gmail.com wrote:
 Remove unnecessary semicolon

 And:
 drivers/media/dvb-frontends/stv0900_core.c: remove unnecessary whitespace 
 before a
 quoted newline

 Found by http://coccinelle.lip6.fr/

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

 ---
  drivers/media/dvb-core/dvb_frontend.c |2
  drivers/media/dvb-frontends/a8293.c   |2
  drivers/media/dvb-frontends/af9013.c  |6 +-
  drivers/media/dvb-frontends/bcm3510.c |2
  drivers/media/dvb-frontends/cx24110.c |6 +-
  drivers/media/dvb-frontends/drxd_hard.c   |2
  drivers/media/dvb-frontends/isl6405.c |2
  drivers/media/dvb-frontends/isl6421.c |2
  drivers/media/dvb-frontends/itd1000.c |2
  drivers/media/dvb-frontends/lnbp21.c  |4 -
  drivers/media/dvb-frontends/lnbp22.c  |2
  drivers/media/dvb-frontends/si21xx.c  |4 -
  drivers/media/dvb-frontends/sp8870.c  |6 +-
  drivers/media/dvb-frontends/sp887x.c  |6 +-
  drivers/media/dvb-frontends/stv0299.c |6 +-
  drivers/media/dvb-frontends/stv0900_core.c|2
  drivers/media/dvb-frontends/tda8083.c |4 -
  drivers/media/i2c/cx25840/cx25840-core.c  |2
  drivers/media/pci/bt8xx/dst_ca.c  |2
  drivers/media/pci/cx23885/altera-ci.c |4 -
  drivers/media/pci/cx23885/cimax2.c|2
  drivers/media/pci/cx88/cx88-blackbird.c   |6 +-
  drivers/media/pci/cx88/cx88-dvb.c |2
  drivers/media/pci/cx88/cx88-mpeg.c|2
  drivers/media/pci/cx88/cx88-tvaudio.c |4 -
  drivers/media/pci/cx88/cx88-video.c   |2
  drivers/media/pci/saa7134/saa7134-video.c |2
  drivers/media/platform/davinci/vpif_capture.c |   78 
 +-

I dont see any diff for this file in the patch.

  drivers/media/platform/exynos-gsc/gsc-regs.c  |4 -
  drivers/media/platform/fsl-viu.c  |   18 +++---
ditto

  drivers/media/platform/vivi.c |2
ditto and some more

Is it a valid patch or is it that I am missing something ?

Regards,
--Prabhakar Lad

  drivers/media/radio/si470x/radio-si470x-i2c.c |2
  drivers/media/radio/si470x/radio-si470x-usb.c |2
  drivers/media/radio/si4713-i2c.c  |   12 ++--
  drivers/media/usb/dvb-usb-v2/af9015.c |4 -
  drivers/media/usb/dvb-usb-v2/af9035.c |2
  drivers/media/usb/dvb-usb/cinergyT2-fe.c  |6 --
  37 files changed, 106 insertions(+), 112 deletions(-)

 diff -u -p a/drivers/media/i2c/cx25840/cx25840-core.c 
 b/drivers/media/i2c/cx25840/cx25840-core.c
 --- a/drivers/media/i2c/cx25840/cx25840-core.c
 +++ b/drivers/media/i2c/cx25840/cx25840-core.c
 @@ -599,7 +599,7 @@ static void cx23885_initialize(struct i2
 cx25840_write4(client, 0x114, 0x01bf0c9e);
 cx25840_write4(client, 0x110, 0x000a030c);
 break;
 -   };
 +   }

 /* ADC2 input select */
 cx25840_write(client, 0x102, 0x10);
 diff -u -p a/drivers/media/usb/dvb-usb-v2/af9015.c 
 b/drivers/media/usb/dvb-usb-v2/af9015.c
 --- a/drivers/media/usb/dvb-usb-v2/af9015.c
 +++ b/drivers/media/usb/dvb-usb-v2/af9015.c
 @@ -500,7 +500,7 @@ static int af9015_read_config(struct dvb
 case 3:
 state-af9013_config[i].clock = 2500;
 break;
 -   };
 +   }
 dev_dbg(d-udev-dev, %s: [%d] xtal=%d set clock=%d\n,
 __func__, i, val,
 state-af9013_config[i].clock);
 @@ -568,7 +568,7 @@ static int af9015_read_config(struct dvb
 supported, please report!\n,
 KBUILD_MODNAME, val);
 return -ENODEV;
 -   };
 +   }

 state-af9013_config[i].tuner = val;
 dev_dbg(d-udev-dev, %s: [%d] tuner id=%d\n,
 diff -u -p a/drivers/media/usb/dvb-usb-v2/af9035.c 
 b/drivers/media/usb/dvb-usb-v2/af9035.c
 --- a/drivers/media/usb/dvb-usb-v2/af9035.c
 +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
 @@ -519,7 +519,7 @@ static int af9035_read_config(struct dvb
 dev_warn(d-udev-dev, %s: tuner id=%02x not  \
 supported, please report!,
 KBUILD_MODNAME, tmp);
 -   };
 +   }

 /* tuner IF frequency */
 ret = af9035_rd_reg(d, EEPROM_1_IFFREQ_L + eeprom_shift, 
 tmp);
 diff -u -p a/drivers/media/dvb-core/dvb_frontend.c 
 b/drivers/media/dvb-core/dvb_frontend.c
 --- a/drivers/media/dvb-core/dvb_frontend.c
 +++ b/drivers/media/dvb-core/dvb_frontend.c
 @@ -2288,7 +2288,7

Re: [PATCH 1/2] dm644x: replace the obsolete preset API by the timings API.

2012-09-28 Thread Prabhakar Lad
Hi Kevin,

On Wed, Aug 8, 2012 at 6:00 PM, Prabhakar Lad prabhakar@ti.com wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 ---
  arch/arm/mach-davinci/board-dm644x-evm.c   |   15 ++--
  arch/arm/mach-davinci/dm644x.c |   17 +---
  drivers/media/video/davinci/vpbe.c |  110 
 
  drivers/media/video/davinci/vpbe_display.c |   60 +++
  drivers/media/video/davinci/vpbe_venc.c|   25 +++---
  include/media/davinci/vpbe.h   |   14 ++--
  include/media/davinci/vpbe_types.h |8 +--
  include/media/davinci/vpbe_venc.h  |2 +-
  8 files changed, 111 insertions(+), 140 deletions(-)

Can you ACK this patch? Since this patch needs to go from Mauro's tree
due to changes in media drivers folder structure.

Regards,
--Prabhakar Lad

 diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
 b/arch/arm/mach-davinci/board-dm644x-evm.c
 index d34ed55..3baf56d 100644
 --- a/arch/arm/mach-davinci/board-dm644x-evm.c
 +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
 @@ -23,6 +23,7 @@
  #include linux/phy.h
  #include linux/clk.h
  #include linux/videodev2.h
 +#include linux/v4l2-dv-timings.h
  #include linux/export.h

  #include media/tvp514x.h
 @@ -620,7 +621,7 @@ static struct vpbe_enc_mode_info 
 dm644xevm_enc_std_timing[] = {
 {
 .name   = ntsc,
 .timings_type   = VPBE_ENC_STD,
 -   .timings= {V4L2_STD_525_60},
 +   .std_id = V4L2_STD_525_60,
 .interlaced = 1,
 .xres   = 720,
 .yres   = 480,
 @@ -632,7 +633,7 @@ static struct vpbe_enc_mode_info 
 dm644xevm_enc_std_timing[] = {
 {
 .name   = pal,
 .timings_type   = VPBE_ENC_STD,
 -   .timings= {V4L2_STD_625_50},
 +   .std_id = V4L2_STD_625_50,
 .interlaced = 1,
 .xres   = 720,
 .yres   = 576,
 @@ -647,8 +648,8 @@ static struct vpbe_enc_mode_info 
 dm644xevm_enc_std_timing[] = {
  static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
 {
 .name   = 480p59_94,
 -   .timings_type   = VPBE_ENC_DV_PRESET,
 -   .timings= {V4L2_DV_480P59_94},
 +   .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
 +   .dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
 .interlaced = 0,
 .xres   = 720,
 .yres   = 480,
 @@ -659,8 +660,8 @@ static struct vpbe_enc_mode_info 
 dm644xevm_enc_preset_timing[] = {
 },
 {
 .name   = 576p50,
 -   .timings_type   = VPBE_ENC_DV_PRESET,
 -   .timings= {V4L2_DV_576P50},
 +   .timings_type   = VPBE_ENC_CUSTOM_TIMINGS,
 +   .dv_timings = V4L2_DV_BT_CEA_720X576P50,
 .interlaced = 0,
 .xres   = 720,
 .yres   = 576,
 @@ -698,7 +699,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = {
 .index  = 1,
 .name   = Component,
 .type   = V4L2_OUTPUT_TYPE_ANALOG,
 -   .capabilities   = V4L2_OUT_CAP_PRESETS,
 +   .capabilities   = V4L2_OUT_CAP_CUSTOM_TIMINGS,
 },
 .subdev_name= VPBE_VENC_SUBDEV_NAME,
 .default_mode   = 480p59_94,
 diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
 index c8b8666..79d2880 100644
 --- a/arch/arm/mach-davinci/dm644x.c
 +++ b/arch/arm/mach-davinci/dm644x.c
 @@ -701,7 +701,7 @@ static struct resource dm644x_venc_resources[] = {
  #define DM644X_VPSS_DACCLKEN  BIT(4)

  static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
 -  unsigned int mode)
 +  unsigned int pclock)
  {
 int ret = 0;
 u32 v = DM644X_VPSS_VENCLKEN;
 @@ -711,27 +711,18 @@ static int dm644x_venc_setup_clock(enum 
 vpbe_enc_timings_type type,
 v |= DM644X_VPSS_DACCLKEN;
 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
 break;
 -   case VPBE_ENC_DV_PRESET:
 -   switch (mode) {
 -   case V4L2_DV_480P59_94:
 -   case V4L2_DV_576P50:
 +   case VPBE_ENC_CUSTOM_TIMINGS:
 +   if (pclock = 2700) {
 v |= DM644X_VPSS_MUXSEL_PLL2_MODE |
  DM644X_VPSS_DACCLKEN;
 writel(v, DAVINCI_SYSMOD_VIRT

Re: [PATCH 1/2] dm644x: replace the obsolete preset API by the timings API.

2012-09-28 Thread Prabhakar Lad
Hi Hans,

On Fri, Sep 28, 2012 at 6:22 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar!

 On Fri September 28 2012 14:44:59 Prabhakar Lad wrote:
 Hi Kevin,

 On Wed, Aug 8, 2012 at 6:00 PM, Prabhakar Lad prabhakar@ti.com wrote:
  From: Hans Verkuil hans.verk...@cisco.com
 
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  Signed-off-by: Lad, Prabhakar prabhakar@ti.com
  Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
  ---
   arch/arm/mach-davinci/board-dm644x-evm.c   |   15 ++--
   arch/arm/mach-davinci/dm644x.c |   17 +---
   drivers/media/video/davinci/vpbe.c |  110 
  
   drivers/media/video/davinci/vpbe_display.c |   60 +++
   drivers/media/video/davinci/vpbe_venc.c|   25 +++---
   include/media/davinci/vpbe.h   |   14 ++--
   include/media/davinci/vpbe_types.h |8 +--
   include/media/davinci/vpbe_venc.h  |2 +-
   8 files changed, 111 insertions(+), 140 deletions(-)
 
 Can you ACK this patch? Since this patch needs to go from Mauro's tree
 due to changes in media drivers folder structure.

 Regards,
 --Prabhakar Lad


 ...

  -static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev,
  -struct v4l2_dv_preset *dv_preset)
  +static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
  +struct v4l2_dv_timings *dv_timings)
   {
  struct vpbe_config *cfg = vpbe_dev-cfg;
  int out_index = vpbe_dev-current_out_index;
  +   struct vpbe_output *output = cfg-outputs[out_index];
  int sd_index = vpbe_dev-current_sd_index;
  -   int ret;
  +   int ret, i;
 
 
  if (!(cfg-outputs[out_index].output.capabilities 
  -   V4L2_OUT_CAP_PRESETS))
  +   V4L2_OUT_CAP_CUSTOM_TIMINGS))

 Can you make a follow-up patch that renames V4L2_IN/OUT_CAP_CUSTOM_TIMINGS to
 V4L2_IN/OUT_CAP_DV_TIMINGS? The old name for this define is deprecated, so it
 would be nice to fix this in this driver as well.

 The code that adds the new define names went in just two days ago, so as far
 as I am concerned there is no need to modify the patch again. A follow-up
 patch is sufficient.

Ok, I'll create a follow up patch.

Regards,
--Prabhakar

 Regards,

 Hans
 --
 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: [PATCH v3] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control

2012-10-01 Thread Prabhakar Lad
Hi Laurent,

Thanks for the review.

On Mon, Oct 1, 2012 at 3:12 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 Thanks for the patch.

 On Monday 01 October 2012 13:31:59 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Paul Gortmaker paul.gortma...@windriver.com
 Cc: Jean Delvare kh...@linux-fr.org
 ---
  Changes for v3:
  1: Used cluster in mt9v032 for test pattern,
  pointed by Laurent.

  Changes for v2:
  1: Fixed review comments pointed by Laurent.

  drivers/media/i2c/mt9p031.c |   19 +++--
  drivers/media/i2c/mt9t001.c |   22 ++-
  drivers/media/i2c/mt9v032.c |   60 +---
  3 files changed, 58 insertions(+), 43 deletions(-)

 diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
 index 2c0f407..e328332 100644
 --- a/drivers/media/i2c/mt9p031.c
 +++ b/drivers/media/i2c/mt9p031.c
 @@ -574,7 +574,6 @@ static int mt9p031_set_crop(struct v4l2_subdev *subdev,
   * V4L2 subdev control operations
   */

 -#define V4L2_CID_TEST_PATTERN(V4L2_CID_USER_BASE | 0x1001)
  #define V4L2_CID_BLC_AUTO(V4L2_CID_USER_BASE | 0x1002)
  #define V4L2_CID_BLC_TARGET_LEVEL(V4L2_CID_USER_BASE | 0x1003)
  #define V4L2_CID_BLC_ANALOG_OFFSET   (V4L2_CID_USER_BASE | 0x1004)
 @@ -740,18 +739,6 @@ static const char * const mt9p031_test_pattern_menu[] =
 { static const struct v4l2_ctrl_config mt9p031_ctrls[] = {
   {
   .ops= mt9p031_ctrl_ops,
 - .id = V4L2_CID_TEST_PATTERN,
 - .type   = V4L2_CTRL_TYPE_MENU,
 - .name   = Test Pattern,
 - .min= 0,
 - .max= ARRAY_SIZE(mt9p031_test_pattern_menu) - 1,
 - .step   = 0,
 - .def= 0,
 - .flags  = 0,
 - .menu_skip_mask = 0,
 - .qmenu  = mt9p031_test_pattern_menu,
 - }, {
 - .ops= mt9p031_ctrl_ops,
   .id = V4L2_CID_BLC_AUTO,
   .type   = V4L2_CTRL_TYPE_BOOLEAN,
   .name   = BLC, Auto,
 @@ -950,7 +937,7 @@ static int mt9p031_probe(struct i2c_client *client,
   mt9p031-model = did-driver_data;
   mt9p031-reset = -1;

 - v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 5);
 + v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6);

   v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops,
 V4L2_CID_EXPOSURE, MT9P031_SHUTTER_WIDTH_MIN,
 @@ -966,6 +953,10 @@ static int mt9p031_probe(struct i2c_client *client,
   v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops,
 V4L2_CID_PIXEL_RATE, pdata-target_freq,
 pdata-target_freq, 1, pdata-target_freq);
 + v4l2_ctrl_new_std_menu_items(mt9p031-ctrls, mt9p031_ctrl_ops,
 +   V4L2_CID_TEST_PATTERN,
 +   ARRAY_SIZE(mt9p031_test_pattern_menu) - 1, 0,
 +   0, mt9p031_test_pattern_menu);

   for (i = 0; i  ARRAY_SIZE(mt9p031_ctrls); ++i)
   v4l2_ctrl_new_custom(mt9p031-ctrls, mt9p031_ctrls[i], NULL);
 diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
 index 6d343ad..2e189d8 100644
 --- a/drivers/media/i2c/mt9t001.c
 +++ b/drivers/media/i2c/mt9t001.c
 @@ -371,7 +371,7 @@ static int mt9t001_set_crop(struct v4l2_subdev *subdev,
   * V4L2 subdev control operations
   */

 -#define V4L2_CID_TEST_PATTERN(V4L2_CID_USER_BASE | 0x1001)
 +#define V4L2_CID_TEST_PATTERN_COLOR  (V4L2_CID_USER_BASE | 0x1001)
  #define V4L2_CID_BLACK_LEVEL_AUTO(V4L2_CID_USER_BASE | 0x1002)
  #define V4L2_CID_BLACK_LEVEL_OFFSET  (V4L2_CID_USER_BASE | 0x1003)
  #define V4L2_CID_BLACK_LEVEL_CALIBRATE   (V4L2_CID_USER_BASE | 0x1004)
 @@ -487,12 +487,11 @@ static int mt9t001_s_ctrl(struct v4l2_ctrl *ctrl)
ctrl-val  16);

   case V4L2_CID_TEST_PATTERN:
 - ret = mt9t001_set_output_control(mt9t001,
 + return mt9t001_set_output_control(mt9t001,
   ctrl-val ? 0 : MT9T001_OUTPUT_CONTROL_TEST_DATA,
   ctrl-val ? MT9T001_OUTPUT_CONTROL_TEST_DATA : 0);
 - if (ret  0)
 - return ret;

 + case V4L2_CID_TEST_PATTERN_COLOR:
   return mt9t001_write(client, MT9T001_TEST_DATA, ctrl-val  
 2);

   case V4L2_CID_BLACK_LEVEL_AUTO:
 @@ -533,12 +532,17 @@ static struct v4l2_ctrl_ops mt9t001_ctrl_ops = {
   .s_ctrl = mt9t001_s_ctrl,
  };

 +static const char * const mt9t001_test_pattern_menu[] = {
 + Disabled,
 + Enabled,
 +};
 +
  static const 

Re: [PATCH] media: davinci: vpbe: fix build warning

2012-10-03 Thread Prabhakar Lad
Hi Hans,

On Wed, Oct 3, 2012 at 12:10 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 On Wed October 3 2012 08:27:38 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 recent patch with commit id 4f996594ceaf6c3f9bc42b40c40b0f7f87b79c86
 which makes vidioc_s_crop const, was causing a following build warning,

 vpbe_display.c: In function 'vpbe_display_s_crop':
 vpbe_display.c:640: warning: initialization discards qualifiers from pointer 
 target type

 This patch fixes the above build warning.

 Acked-by: Hans Verkuil hans.verk...@cisco.com

 Prabhaker, can you make a pull request for this patch, the CUSTOM_TIMINGS
 rename patch and the earlier vpfe: fix build error patch? These things
 should be fast-tracked.

Yes I will issue a pull request today.

Regards,
--Prabhakar Lad

 Regards,

 Hans

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 ---
  drivers/media/platform/davinci/vpbe_display.c |   20 ++--
  1 files changed, 10 insertions(+), 10 deletions(-)

 diff --git a/drivers/media/platform/davinci/vpbe_display.c 
 b/drivers/media/platform/davinci/vpbe_display.c
 index 1b238fe..161c776 100644
 --- a/drivers/media/platform/davinci/vpbe_display.c
 +++ b/drivers/media/platform/davinci/vpbe_display.c
 @@ -637,7 +637,7 @@ static int vpbe_display_s_crop(struct file *file, void 
 *priv,
   struct vpbe_device *vpbe_dev = disp_dev-vpbe_dev;
   struct osd_layer_config *cfg = layer-layer_info.config;
   struct osd_state *osd_device = disp_dev-osd_device;
 - struct v4l2_rect *rect = crop-c;
 + struct v4l2_rect rect = crop-c;
   int ret;

   v4l2_dbg(1, debug, vpbe_dev-v4l2_dev,
 @@ -648,21 +648,21 @@ static int vpbe_display_s_crop(struct file *file, void 
 *priv,
   return -EINVAL;
   }

 - if (rect-top  0)
 - rect-top = 0;
 - if (rect-left  0)
 - rect-left = 0;
 + if (rect.top  0)
 + rect.top = 0;
 + if (rect.left  0)
 + rect.left = 0;

 - vpbe_disp_check_window_params(disp_dev, rect);
 + vpbe_disp_check_window_params(disp_dev, rect);

   osd_device-ops.get_layer_config(osd_device,
   layer-layer_info.id, cfg);

   vpbe_disp_calculate_scale_factor(disp_dev, layer,
 - rect-width,
 - rect-height);
 - vpbe_disp_adj_position(disp_dev, layer, rect-top,
 - rect-left);
 + rect.width,
 + rect.height);
 + vpbe_disp_adj_position(disp_dev, layer, rect.top,
 + rect.left);
   ret = osd_device-ops.set_layer_config(osd_device,
   layer-layer_info.id, cfg);
   if (ret  0) {

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


[GIT PULL FOR v3.7] Davinci VPFE bug fix

2012-10-03 Thread Prabhakar Lad
Hi Mauro,

Can you please pull the following patch for VPFE, Which
fixes build error for VPFE driver.

Thanks and Regards,
--Prabhakar Lad

The following changes since commit 2425bb3d4016ed95ce83a90b53bd92c7f31091e4:

  em28xx: regression fix: use DRX-K sync firmware requests on em28xx
(2012-10-02 17:15:22 -0300)

are available in the git repository at:
  git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git vpfe_3.7_pull

Lad, Prabhakar (1):
  media: davinci: vpfe: fix build error

 drivers/media/platform/davinci/vpfe_capture.c |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)
--
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.7] Davinci VPBE feature enhancement and fixes

2012-10-03 Thread Prabhakar Lad
Hi Mauro,

Can you please pull the following patches for davinci VPBE driver.
Some of the patches include platform changes for which Sekhar has Acked it.

Thanks and Regards,
--Prabhakar Lad

The following changes since commit 2425bb3d4016ed95ce83a90b53bd92c7f31091e4:

  em28xx: regression fix: use DRX-K sync firmware requests on em28xx
(2012-10-02 17:15:22 -0300)

are available in the git repository at:
  git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git vpbe_3.7_pull

Hans Verkuil (1):
  dm644x: replace the obsolete preset API by the timings API.

Lad, Prabhakar (2):
  media: davinci: vpbe: fix build warning
  davinci: vpbe: replace V4L2_OUT_CAP_CUSTOM_TIMINGS with
V4L2_OUT_CAP_DV_TIMINGS

Manjunath Hadli (1):
  ths7303: enable THS7303 for HD modes

 arch/arm/mach-davinci/board-dm644x-evm.c  |   15 ++--
 arch/arm/mach-davinci/dm644x.c|   17 +---
 drivers/media/i2c/ths7303.c   |  106

 drivers/media/platform/davinci/vpbe.c |  110
+++--
 drivers/media/platform/davinci/vpbe_display.c |   80 +-
 drivers/media/platform/davinci/vpbe_venc.c|   25 +++---
 include/media/davinci/vpbe.h  |   14 ++--
 include/media/davinci/vpbe_types.h|8 +--
 include/media/davinci/vpbe_venc.h |2 +-
 9 files changed, 211 insertions(+), 166 deletions(-)
--
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 v5] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control

2012-10-03 Thread Prabhakar Lad
Hi Laurent,

On Wed, Oct 3, 2012 at 7:43 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 03 October 2012 19:23:05 Prabhakar wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 V4L2_CID_TEST_PATTERN is now a standard control.
 This patch replaces the user defined control for test
 pattern to make use of standard control V4L2_CID_TEST_PATTERN.

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Sakari Ailus sakari.ai...@iki.fi
 Cc: Paul Gortmaker paul.gortma...@windriver.com
 Cc: Jean Delvare kh...@linux-fr.org

 Should I push this patch through my tree ? If so I'll wait until the
 V4L2_CID_TEST_PATTERN control patch hits Mauro's tree.

I will issue a pull request for this patch plus
V4L2_CID_TEST_PATTERN today thanks.

Regards,
--Prabhakar

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


[GIT PULL FOR v3.7] v4l2-ctrl feature enhancement

2012-10-03 Thread Prabhakar Lad
Hi Mauro,

Can you please pull the following patches which adds a new feature and
a new control to v4l2-ctrl framework. One of the patch includes usage of
the new control in the driver.

Thanks and Regards,
--Prabhakar Lad


The following changes since commit 2425bb3d4016ed95ce83a90b53bd92c7f31091e4:

  em28xx: regression fix: use DRX-K sync firmware requests on em28xx
(2012-10-02 17:15:22 -0300)

are available in the git repository at:
  git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git v4l2-ctrls-pull

Lad, Prabhakar (3):
  media: v4l2-ctrls: add control for test pattern
  media: v4l2-ctrl: add a helper function to add standard control
with driver specific menu
  media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test
pattern control

 Documentation/DocBook/media/v4l/controls.xml |   10 +
 Documentation/video4linux/v4l2-controls.txt  |   24 +++
 drivers/media/i2c/mt9p031.c  |   19 ++---
 drivers/media/i2c/mt9t001.c  |   22 +++---
 drivers/media/i2c/mt9v032.c  |   54
+-
 drivers/media/v4l2-core/v4l2-ctrls.c |   32 +++
 include/linux/v4l2-controls.h|1 +
 include/media/v4l2-ctrls.h   |   23 +++
 8 files changed, 145 insertions(+), 40 deletions(-)
--
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.7] Davinci VPIF driver cleanup

2012-10-04 Thread Prabhakar Lad
Hi Mauro,

Can you please pull the following patches for davinci VPIF driver.
There are patches which affect davinci platform code, on top
of which cleanup was done, So to avoid conflicts these patches
need to go through media tree. Patches affecting davinci platform
code have been Acked by Sekhar.

Thanks and Regards,
--Prabhakar Lad

The following changes since commit 2425bb3d4016ed95ce83a90b53bd92c7f31091e4:

  em28xx: regression fix: use DRX-K sync firmware requests on em28xx
(2012-10-02 17:15:22 -0300)

are available in the git repository at:
  git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git da850_vpif_machine

Hans Verkuil (14):
  vpif_capture: remove unused data structure.
  vpif_display: remove unused data structures.
  vpif_capture: move input_idx to channel_obj.
  vpif_display: move output_id to channel_obj.
  vpif_capture: remove unnecessary can_route flag.
  vpif_capture: move routing info from subdev to input.
  vpif_capture: first init subdevs, then register device nodes.
  vpif_display: first init subdevs, then register device nodes.
  vpif_display: fix cleanup code.
  vpif_capture: fix cleanup code.
  vpif_capture: separate subdev from input.
  vpif_display: use a v4l2_subdev pointer to call a subdev.
  davinci: move struct vpif_interface to chan_cfg.
  tvp514x: s_routing should just change routing, not try to detect a
signal.

Lad, Prabhakar (4):
  media: davinci: vpif: add check for NULL handler
  media: davinci: vpif: display: separate out subdev from output
  media: davinci: vpif: Add return code check at vb2_queue_init()
  media: davinci: vpif: set device capabilities

Manjunath Hadli (2):
  ARM: davinci: da850: Add SoC related definitions for VPIF
  ARM: davinci: da850 evm: Add EVM specific code for VPIF to work

 arch/arm/mach-davinci/Kconfig |7 +
 arch/arm/mach-davinci/board-da850-evm.c   |  179 
 arch/arm/mach-davinci/board-dm646x-evm.c  |   80 --
 arch/arm/mach-davinci/da850.c |  152 ++
 arch/arm/mach-davinci/include/mach/da8xx.h|   11 +
 arch/arm/mach-davinci/include/mach/mux.h  |   42 +++
 arch/arm/mach-davinci/include/mach/psc.h  |1 +
 drivers/media/i2c/tvp514x.c   |   77 +-
 drivers/media/platform/davinci/vpif_capture.c |  370
-
 drivers/media/platform/davinci/vpif_capture.h |   16 +-
 drivers/media/platform/davinci/vpif_display.c |  275 --
 drivers/media/platform/davinci/vpif_display.h |   18 +-
 include/media/davinci/vpif_types.h|   26 ++-
 13 files changed, 837 insertions(+), 417 deletions(-)
--
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:davinci: clk - {prepare/unprepare} for common clk framework

2012-10-20 Thread Prabhakar Lad
Hi Murali,

On Friday 19 October 2012 11:42 PM, Murali Karicheri wrote:
 As a first step towards migrating davinci platforms to use common clock
 framework, replace all instances of clk_enable() with clk_prepare_enable()
 and clk_disable() with clk_disable_unprepare().
 
 Also fixes some issues related to clk clean up in the driver
 
 Signed-off-by: Murali Karicheri m-kariche...@ti.com
 ---
  drivers/media/video/davinci/dm355_ccdc.c  |8 ++--
  drivers/media/video/davinci/dm644x_ccdc.c |   16 ++--
  drivers/media/video/davinci/isif.c|5 -
  drivers/media/video/davinci/vpbe.c|   10 +++---
  drivers/media/video/davinci/vpif.c|8 
  5 files changed, 31 insertions(+), 16 deletions(-)
 
Thanks for the patch. Can you rebase this patch on 3.7, Since
the folder structure for media drivers has been reorganised.
And for some reason this patch hasn't reached any mailing list.

Thanks And Regards,
--Prabhakar Lad

 diff --git a/drivers/media/video/davinci/dm355_ccdc.c 
 b/drivers/media/video/davinci/dm355_ccdc.c
 index 5b68847..af88cce 100644
 --- a/drivers/media/video/davinci/dm355_ccdc.c
 +++ b/drivers/media/video/davinci/dm355_ccdc.c
 @@ -1003,7 +1003,7 @@ static int __init dm355_ccdc_probe(struct 
 platform_device *pdev)
   status = PTR_ERR(ccdc_cfg.mclk);
   goto fail_nomap;
   }
 - if (clk_enable(ccdc_cfg.mclk)) {
 + if (clk_prepare_enable(ccdc_cfg.mclk)) {
   status = -ENODEV;
   goto fail_mclk;
   }
 @@ -1014,7 +1014,7 @@ static int __init dm355_ccdc_probe(struct 
 platform_device *pdev)
   status = PTR_ERR(ccdc_cfg.sclk);
   goto fail_mclk;
   }
 - if (clk_enable(ccdc_cfg.sclk)) {
 + if (clk_prepare_enable(ccdc_cfg.sclk)) {
   status = -ENODEV;
   goto fail_sclk;
   }
 @@ -1034,8 +1034,10 @@ static int __init dm355_ccdc_probe(struct 
 platform_device *pdev)
   printk(KERN_NOTICE %s is registered with vpfe.\n, ccdc_hw_dev.name);
   return 0;
  fail_sclk:
 + clk_disable_unprepare(ccdc_cfg.sclk);
   clk_put(ccdc_cfg.sclk);
  fail_mclk:
 + clk_disable_unprepare(ccdc_cfg.mclk);
   clk_put(ccdc_cfg.mclk);
  fail_nomap:
   iounmap(ccdc_cfg.base_addr);
 @@ -1050,6 +1052,8 @@ static int dm355_ccdc_remove(struct platform_device 
 *pdev)
  {
   struct resource *res;
  
 + clk_disable_unprepare(ccdc_cfg.sclk);
 + clk_disable_unprepare(ccdc_cfg.mclk);
   clk_put(ccdc_cfg.mclk);
   clk_put(ccdc_cfg.sclk);
   iounmap(ccdc_cfg.base_addr);
 diff --git a/drivers/media/video/davinci/dm644x_ccdc.c 
 b/drivers/media/video/davinci/dm644x_ccdc.c
 index 9303fe5..24388fa 100644
 --- a/drivers/media/video/davinci/dm644x_ccdc.c
 +++ b/drivers/media/video/davinci/dm644x_ccdc.c
 @@ -994,7 +994,7 @@ static int __init dm644x_ccdc_probe(struct 
 platform_device *pdev)
   status = PTR_ERR(ccdc_cfg.mclk);
   goto fail_nomap;
   }
 - if (clk_enable(ccdc_cfg.mclk)) {
 + if (clk_prepare_enable(ccdc_cfg.mclk)) {
   status = -ENODEV;
   goto fail_mclk;
   }
 @@ -1005,7 +1005,7 @@ static int __init dm644x_ccdc_probe(struct 
 platform_device *pdev)
   status = PTR_ERR(ccdc_cfg.sclk);
   goto fail_mclk;
   }
 - if (clk_enable(ccdc_cfg.sclk)) {
 + if (clk_prepare_enable(ccdc_cfg.sclk)) {
   status = -ENODEV;
   goto fail_sclk;
   }
 @@ -1013,8 +1013,10 @@ static int __init dm644x_ccdc_probe(struct 
 platform_device *pdev)
   printk(KERN_NOTICE %s is registered with vpfe.\n, ccdc_hw_dev.name);
   return 0;
  fail_sclk:
 + clk_disable_unprepare(ccdc_cfg.sclk);
   clk_put(ccdc_cfg.sclk);
  fail_mclk:
 + clk_disable_unprepare(ccdc_cfg.mclk);
   clk_put(ccdc_cfg.mclk);
  fail_nomap:
   iounmap(ccdc_cfg.base_addr);
 @@ -1029,6 +1031,8 @@ static int dm644x_ccdc_remove(struct platform_device 
 *pdev)
  {
   struct resource *res;
  
 + clk_disable_unprepare(ccdc_cfg.mclk);
 + clk_disable_unprepare(ccdc_cfg.sclk);
   clk_put(ccdc_cfg.mclk);
   clk_put(ccdc_cfg.sclk);
   iounmap(ccdc_cfg.base_addr);
 @@ -1046,8 +1050,8 @@ static int dm644x_ccdc_suspend(struct device *dev)
   /* Disable CCDC */
   ccdc_enable(0);
   /* Disable both master and slave clock */
 - clk_disable(ccdc_cfg.mclk);
 - clk_disable(ccdc_cfg.sclk);
 + clk_disable_unprepare(ccdc_cfg.mclk);
 + clk_disable_unprepare(ccdc_cfg.sclk);
  
   return 0;
  }
 @@ -1055,8 +1059,8 @@ static int dm644x_ccdc_suspend(struct device *dev)
  static int dm644x_ccdc_resume(struct device *dev)
  {
   /* Enable both master and slave clock */
 - clk_enable(ccdc_cfg.mclk);
 - clk_enable(ccdc_cfg.sclk);
 + clk_prepare_enable(ccdc_cfg.mclk);
 + clk_prepare_enable(ccdc_cfg.sclk);
   /* Restore CCDC context */
   ccdc_restore_context();
  
 diff

[PATCH] media: davinci: vpbe: fix build warning

2012-10-20 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Warnings were generated because of the following commit changed data type for
address pointer

195bbca ARM: 7500/1: io: avoid writeback addressing modes for __raw_ accessors
add  __iomem annotation to fix following warnings

drivers/media/platform/davinci/vpbe_osd.c: In function ‘osd_read’:
drivers/media/platform/davinci/vpbe_osd.c:49:2: warning: passing
 argument 1 of ‘__raw_readl’ makes pointer from integer without a cast [enabled 
by default]
arch/arm/include/asm/io.h:104:19: note: expected ‘const volatile
 void *’ but argument is of type ‘long unsigned int’

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
 drivers/media/platform/davinci/vpbe_osd.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_osd.c 
b/drivers/media/platform/davinci/vpbe_osd.c
index bba299d..9ab9280 100644
--- a/drivers/media/platform/davinci/vpbe_osd.c
+++ b/drivers/media/platform/davinci/vpbe_osd.c
@@ -46,14 +46,14 @@ static inline u32 osd_read(struct osd_state *sd, u32 offset)
 {
struct osd_state *osd = sd;
 
-   return readl(osd-osd_base + offset);
+   return readl(IOMEM(osd-osd_base + offset));
 }
 
 static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset)
 {
struct osd_state *osd = sd;
 
-   writel(val, osd-osd_base + offset);
+   writel(val, IOMEM(osd-osd_base + offset));
 
return val;
 }
@@ -63,9 +63,9 @@ static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 
offset)
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 val = readl(addr) | mask;
+   u32 val = readl(IOMEM(addr)) | mask;
 
-   writel(val, addr);
+   writel(val, IOMEM(addr));
 
return val;
 }
@@ -75,9 +75,9 @@ static inline u32 osd_clear(struct osd_state *sd, u32 mask, 
u32 offset)
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 val = readl(addr)  ~mask;
+   u32 val = readl(IOMEM(addr))  ~mask;
 
-   writel(val, addr);
+   writel(val, IOMEM(addr));
 
return val;
 }
@@ -88,9 +88,9 @@ static inline u32 osd_modify(struct osd_state *sd, u32 mask, 
u32 val,
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 new_val = (readl(addr)  ~mask) | (val  mask);
+   u32 new_val = (readl(IOMEM(addr))  ~mask) | (val  mask);
 
-   writel(new_val, addr);
+   writel(new_val, IOMEM(addr));
 
return new_val;
 }
-- 
1.7.4.1

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


[PATCH 1/2] media: davinci: vpbe: migrate driver to videobuf2

2012-10-20 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

This patch migrates VPBE display driver to videobuf2 framework.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
 drivers/media/platform/davinci/Kconfig|2 +-
 drivers/media/platform/davinci/vpbe_display.c |  296 +++--
 include/media/davinci/vpbe_display.h  |   15 +-
 3 files changed, 188 insertions(+), 125 deletions(-)

diff --git a/drivers/media/platform/davinci/Kconfig 
b/drivers/media/platform/davinci/Kconfig
index 78e26d2..3c56037 100644
--- a/drivers/media/platform/davinci/Kconfig
+++ b/drivers/media/platform/davinci/Kconfig
@@ -101,7 +101,7 @@ config VIDEO_DM644X_VPBE
tristate DM644X VPBE HW module
depends on ARCH_DAVINCI_DM644x
select VIDEO_VPSS_SYSTEM
-   select VIDEOBUF_DMA_CONTIG
+   select VIDEOBUF2_DMA_CONTIG
help
Enables VPBE modules used for display on a DM644x
SoC.
diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 161c776..974957f 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -47,6 +47,9 @@ static int debug;
 
 module_param(debug, int, 0644);
 
+static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev,
+   struct vpbe_layer *layer);
+
 static int venc_is_second_field(struct vpbe_display *disp_dev)
 {
struct vpbe_device *vpbe_dev = disp_dev-vpbe_dev;
@@ -73,10 +76,11 @@ static void vpbe_isr_even_field(struct vpbe_display 
*disp_obj,
if (layer-cur_frm == layer-next_frm)
return;
ktime_get_ts(timevalue);
-   layer-cur_frm-ts.tv_sec = timevalue.tv_sec;
-   layer-cur_frm-ts.tv_usec = timevalue.tv_nsec / NSEC_PER_USEC;
-   layer-cur_frm-state = VIDEOBUF_DONE;
-   wake_up_interruptible(layer-cur_frm-done);
+   layer-cur_frm-vb.v4l2_buf.timestamp.tv_sec =
+   timevalue.tv_sec;
+   layer-cur_frm-vb.v4l2_buf.timestamp.tv_usec =
+   timevalue.tv_nsec / NSEC_PER_USEC;
+   vb2_buffer_done(layer-cur_frm-vb, VB2_BUF_STATE_DONE);
/* Make cur_frm pointing to next_frm */
layer-cur_frm = layer-next_frm;
 }
@@ -99,16 +103,14 @@ static void vpbe_isr_odd_field(struct vpbe_display 
*disp_obj,
 * otherwise hold on current frame
 * Get next from the buffer queue
 */
-   layer-next_frm = list_entry(
-   layer-dma_queue.next,
-   struct  videobuf_buffer,
-   queue);
+   layer-next_frm = list_entry(layer-dma_queue.next,
+ struct  vpbe_disp_buffer, list);
/* Remove that from the buffer queue */
-   list_del(layer-next_frm-queue);
+   list_del(layer-next_frm-list);
spin_unlock(disp_obj-dma_queue_lock);
/* Mark state of the frame to active */
-   layer-next_frm-state = VIDEOBUF_ACTIVE;
-   addr = videobuf_to_dma_contig(layer-next_frm);
+   layer-next_frm-vb.state = VB2_BUF_STATE_ACTIVE;
+   addr = vb2_dma_contig_plane_dma_addr(layer-next_frm-vb, 0);
osd_device-ops.start_layer(osd_device,
layer-layer_info.id,
addr,
@@ -199,39 +201,29 @@ static irqreturn_t venc_isr(int irq, void *arg)
 
 /*
  * vpbe_buffer_prepare()
- * This is the callback function called from videobuf_qbuf() function
+ * This is the callback function called from vb2_qbuf() function
  * the buffer is prepared and user space virtual address is converted into
  * physical address
  */
-static int vpbe_buffer_prepare(struct videobuf_queue *q,
- struct videobuf_buffer *vb,
- enum v4l2_field field)
+static int vpbe_buffer_prepare(struct vb2_buffer *vb)
 {
-   struct vpbe_fh *fh = q-priv_data;
+   struct vpbe_fh *fh = vb2_get_drv_priv(vb-vb2_queue);
+   struct vb2_queue *q = vb-vb2_queue;
struct vpbe_layer *layer = fh-layer;
struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
unsigned long addr;
-   int ret;
 
v4l2_dbg(1, debug, vpbe_dev-v4l2_dev,
vpbe_buffer_prepare\n);
 
-   /* If buffer is not initialized, initialize it */
-   if (VIDEOBUF_NEEDS_INIT == vb-state) {
-   vb-width = layer-pix_fmt.width;
-   vb-height = layer-pix_fmt.height;
-   vb-size = layer-pix_fmt.sizeimage;
-   vb-field = field;
-
-   ret = videobuf_iolock(q, vb, NULL);
-   if (ret  0) {
-   v4l2_err(vpbe_dev-v4l2_dev, Failed to map \
-   user address\n);
+   if (vb-state != VB2_BUF_STATE_ACTIVE 
+   vb-state != VB2_BUF_STATE_PREPARED) {
+   vb2_set_plane_payload(vb, 0, 

[PATCH 2/2] media: davinci: vpbe: set device capabilities

2012-10-20 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

set device_caps and also change the driver and
bus_info to proper values as per standard.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
 drivers/media/platform/davinci/vpbe_display.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 974957f..2bfde79 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -702,9 +702,12 @@ static int vpbe_display_querycap(struct file *file, void  
*priv,
struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
 
cap-version = VPBE_DISPLAY_VERSION_CODE;
-   cap-capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
-   strlcpy(cap-driver, VPBE_DISPLAY_DRIVER, sizeof(cap-driver));
-   strlcpy(cap-bus_info, platform, sizeof(cap-bus_info));
+   cap-device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+   cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
+   snprintf(cap-driver, sizeof(cap-driver), %s,
+   dev_name(vpbe_dev-pdev));
+   snprintf(cap-bus_info, sizeof(cap-bus_info), platform:%s,
+dev_name(vpbe_dev-pdev));
strlcpy(cap-card, vpbe_dev-cfg-module_name, sizeof(cap-card));
 
return 0;
-- 
1.7.4.1

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


[PATCH] ARM: dm365: replace V4L2_OUT_CAP_CUSTOM_TIMINGS with V4L2_OUT_CAP_DV_TIMINGS

2012-10-20 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

This patch replaces V4L2_OUT_CAP_CUSTOM_TIMINGS macro with
V4L2_OUT_CAP_DV_TIMINGS. As V4L2_OUT_CAP_CUSTOM_TIMINGS is being phased
out.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sekhar Nori nsek...@ti.com
---
 This patch is based on the following patch series,
 ARM: davinci: dm365 EVM: add support for VPBE display
 (https://patchwork.kernel.org/patch/1295071/)

 arch/arm/mach-davinci/board-dm365-evm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index 2924d61..771abb5 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -514,7 +514,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = {
.index  = 1,
.name   = Component,
.type   = V4L2_OUTPUT_TYPE_ANALOG,
-   .capabilities   = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+   .capabilities   =  V4L2_OUT_CAP_DV_TIMINGS,
},
.subdev_name= VPBE_VENC_SUBDEV_NAME,
.default_mode   = 480p59_94,
-- 
1.7.4.1

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


[PATCH RESEND] ARM: dm365: replace V4L2_OUT_CAP_CUSTOM_TIMINGS with V4L2_OUT_CAP_DV_TIMINGS

2012-10-22 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

This patch replaces V4L2_OUT_CAP_CUSTOM_TIMINGS macro with
V4L2_OUT_CAP_DV_TIMINGS. As V4L2_OUT_CAP_CUSTOM_TIMINGS is being phased
out.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Cc: Sekhar Nori nsek...@ti.com
---
 Resending the patch since, it didn't reach the DLOS mailing list.

 This patch is based on the following patch series,
 ARM: davinci: dm365 EVM: add support for VPBE display
 (https://patchwork.kernel.org/patch/1295071/)

 arch/arm/mach-davinci/board-dm365-evm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index 2924d61..771abb5 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -514,7 +514,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = {
.index  = 1,
.name   = Component,
.type   = V4L2_OUTPUT_TYPE_ANALOG,
-   .capabilities   = V4L2_OUT_CAP_CUSTOM_TIMINGS,
+   .capabilities   =  V4L2_OUT_CAP_DV_TIMINGS,
},
.subdev_name= VPBE_VENC_SUBDEV_NAME,
.default_mode   = 480p59_94,
-- 
1.7.4.1

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


[PATCH RESEND] media: davinci: vpbe: fix build warning

2012-10-22 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

Warnings were generated because of the following commit changed data type for
address pointer

195bbca ARM: 7500/1: io: avoid writeback addressing modes for __raw_ accessors
add  __iomem annotation to fix following warnings

drivers/media/platform/davinci/vpbe_osd.c: In function ‘osd_read’:
drivers/media/platform/davinci/vpbe_osd.c:49:2: warning: passing
 argument 1 of ‘__raw_readl’ makes pointer from integer without a cast [enabled 
by default]
arch/arm/include/asm/io.h:104:19: note: expected ‘const volatile
 void *’ but argument is of type ‘long unsigned int’

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
  Resending the patch since, it didn't reach the DLOS mailing list.

 drivers/media/platform/davinci/vpbe_osd.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_osd.c 
b/drivers/media/platform/davinci/vpbe_osd.c
index bba299d..9ab9280 100644
--- a/drivers/media/platform/davinci/vpbe_osd.c
+++ b/drivers/media/platform/davinci/vpbe_osd.c
@@ -46,14 +46,14 @@ static inline u32 osd_read(struct osd_state *sd, u32 offset)
 {
struct osd_state *osd = sd;
 
-   return readl(osd-osd_base + offset);
+   return readl(IOMEM(osd-osd_base + offset));
 }
 
 static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset)
 {
struct osd_state *osd = sd;
 
-   writel(val, osd-osd_base + offset);
+   writel(val, IOMEM(osd-osd_base + offset));
 
return val;
 }
@@ -63,9 +63,9 @@ static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 
offset)
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 val = readl(addr) | mask;
+   u32 val = readl(IOMEM(addr)) | mask;
 
-   writel(val, addr);
+   writel(val, IOMEM(addr));
 
return val;
 }
@@ -75,9 +75,9 @@ static inline u32 osd_clear(struct osd_state *sd, u32 mask, 
u32 offset)
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 val = readl(addr)  ~mask;
+   u32 val = readl(IOMEM(addr))  ~mask;
 
-   writel(val, addr);
+   writel(val, IOMEM(addr));
 
return val;
 }
@@ -88,9 +88,9 @@ static inline u32 osd_modify(struct osd_state *sd, u32 mask, 
u32 val,
struct osd_state *osd = sd;
 
u32 addr = osd-osd_base + offset;
-   u32 new_val = (readl(addr)  ~mask) | (val  mask);
+   u32 new_val = (readl(IOMEM(addr))  ~mask) | (val  mask);
 
-   writel(new_val, addr);
+   writel(new_val, IOMEM(addr));
 
return new_val;
 }
-- 
1.7.4.1

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


[PATCH RESEND 0/2] Davinci VPBE migration to vb2 and setting the device caps

2012-10-22 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

The first patch of the series migrates the VPBE driver to usage of
videobuf2 framework. Second patch sets the device caps.

Resending the series, since it didn't reach the DLOS mailing list.

Lad, Prabhakar (2):
  media: davinci: vpbe: migrate driver to videobuf2
  media: davinci: vpbe: set device capabilities

 drivers/media/platform/davinci/Kconfig|2 +-
 drivers/media/platform/davinci/vpbe_display.c |  305 +++--
 include/media/davinci/vpbe_display.h  |   15 +-
 3 files changed, 194 insertions(+), 128 deletions(-)

-- 
1.7.4.1

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


[PATCH RESEND 1/2] media: davinci: vpbe: migrate driver to videobuf2

2012-10-22 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

This patch migrates VPBE display driver to videobuf2 framework.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
 drivers/media/platform/davinci/Kconfig|2 +-
 drivers/media/platform/davinci/vpbe_display.c |  296 +++--
 include/media/davinci/vpbe_display.h  |   15 +-
 3 files changed, 188 insertions(+), 125 deletions(-)

diff --git a/drivers/media/platform/davinci/Kconfig 
b/drivers/media/platform/davinci/Kconfig
index 78e26d2..3c56037 100644
--- a/drivers/media/platform/davinci/Kconfig
+++ b/drivers/media/platform/davinci/Kconfig
@@ -101,7 +101,7 @@ config VIDEO_DM644X_VPBE
tristate DM644X VPBE HW module
depends on ARCH_DAVINCI_DM644x
select VIDEO_VPSS_SYSTEM
-   select VIDEOBUF_DMA_CONTIG
+   select VIDEOBUF2_DMA_CONTIG
help
Enables VPBE modules used for display on a DM644x
SoC.
diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 161c776..974957f 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -47,6 +47,9 @@ static int debug;
 
 module_param(debug, int, 0644);
 
+static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev,
+   struct vpbe_layer *layer);
+
 static int venc_is_second_field(struct vpbe_display *disp_dev)
 {
struct vpbe_device *vpbe_dev = disp_dev-vpbe_dev;
@@ -73,10 +76,11 @@ static void vpbe_isr_even_field(struct vpbe_display 
*disp_obj,
if (layer-cur_frm == layer-next_frm)
return;
ktime_get_ts(timevalue);
-   layer-cur_frm-ts.tv_sec = timevalue.tv_sec;
-   layer-cur_frm-ts.tv_usec = timevalue.tv_nsec / NSEC_PER_USEC;
-   layer-cur_frm-state = VIDEOBUF_DONE;
-   wake_up_interruptible(layer-cur_frm-done);
+   layer-cur_frm-vb.v4l2_buf.timestamp.tv_sec =
+   timevalue.tv_sec;
+   layer-cur_frm-vb.v4l2_buf.timestamp.tv_usec =
+   timevalue.tv_nsec / NSEC_PER_USEC;
+   vb2_buffer_done(layer-cur_frm-vb, VB2_BUF_STATE_DONE);
/* Make cur_frm pointing to next_frm */
layer-cur_frm = layer-next_frm;
 }
@@ -99,16 +103,14 @@ static void vpbe_isr_odd_field(struct vpbe_display 
*disp_obj,
 * otherwise hold on current frame
 * Get next from the buffer queue
 */
-   layer-next_frm = list_entry(
-   layer-dma_queue.next,
-   struct  videobuf_buffer,
-   queue);
+   layer-next_frm = list_entry(layer-dma_queue.next,
+ struct  vpbe_disp_buffer, list);
/* Remove that from the buffer queue */
-   list_del(layer-next_frm-queue);
+   list_del(layer-next_frm-list);
spin_unlock(disp_obj-dma_queue_lock);
/* Mark state of the frame to active */
-   layer-next_frm-state = VIDEOBUF_ACTIVE;
-   addr = videobuf_to_dma_contig(layer-next_frm);
+   layer-next_frm-vb.state = VB2_BUF_STATE_ACTIVE;
+   addr = vb2_dma_contig_plane_dma_addr(layer-next_frm-vb, 0);
osd_device-ops.start_layer(osd_device,
layer-layer_info.id,
addr,
@@ -199,39 +201,29 @@ static irqreturn_t venc_isr(int irq, void *arg)
 
 /*
  * vpbe_buffer_prepare()
- * This is the callback function called from videobuf_qbuf() function
+ * This is the callback function called from vb2_qbuf() function
  * the buffer is prepared and user space virtual address is converted into
  * physical address
  */
-static int vpbe_buffer_prepare(struct videobuf_queue *q,
- struct videobuf_buffer *vb,
- enum v4l2_field field)
+static int vpbe_buffer_prepare(struct vb2_buffer *vb)
 {
-   struct vpbe_fh *fh = q-priv_data;
+   struct vpbe_fh *fh = vb2_get_drv_priv(vb-vb2_queue);
+   struct vb2_queue *q = vb-vb2_queue;
struct vpbe_layer *layer = fh-layer;
struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
unsigned long addr;
-   int ret;
 
v4l2_dbg(1, debug, vpbe_dev-v4l2_dev,
vpbe_buffer_prepare\n);
 
-   /* If buffer is not initialized, initialize it */
-   if (VIDEOBUF_NEEDS_INIT == vb-state) {
-   vb-width = layer-pix_fmt.width;
-   vb-height = layer-pix_fmt.height;
-   vb-size = layer-pix_fmt.sizeimage;
-   vb-field = field;
-
-   ret = videobuf_iolock(q, vb, NULL);
-   if (ret  0) {
-   v4l2_err(vpbe_dev-v4l2_dev, Failed to map \
-   user address\n);
+   if (vb-state != VB2_BUF_STATE_ACTIVE 
+   vb-state != VB2_BUF_STATE_PREPARED) {
+   vb2_set_plane_payload(vb, 0, 

[PATCH RESEND 2/2] media: davinci: vpbe: set device capabilities

2012-10-22 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

set device_caps and also change the driver and
bus_info to proper values as per standard.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
---
 drivers/media/platform/davinci/vpbe_display.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 974957f..2bfde79 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -702,9 +702,12 @@ static int vpbe_display_querycap(struct file *file, void  
*priv,
struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
 
cap-version = VPBE_DISPLAY_VERSION_CODE;
-   cap-capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
-   strlcpy(cap-driver, VPBE_DISPLAY_DRIVER, sizeof(cap-driver));
-   strlcpy(cap-bus_info, platform, sizeof(cap-bus_info));
+   cap-device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+   cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
+   snprintf(cap-driver, sizeof(cap-driver), %s,
+   dev_name(vpbe_dev-pdev));
+   snprintf(cap-bus_info, sizeof(cap-bus_info), platform:%s,
+dev_name(vpbe_dev-pdev));
strlcpy(cap-card, vpbe_dev-cfg-module_name, sizeof(cap-card));
 
return 0;
-- 
1.7.4.1

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


Re: [PATCH RESEND] ARM: dm365: replace V4L2_OUT_CAP_CUSTOM_TIMINGS with V4L2_OUT_CAP_DV_TIMINGS

2012-10-23 Thread Prabhakar Lad
Hi Sergei,

On Tue, Oct 23, 2012 at 3:18 PM, Sergei Shtylyov sshtyl...@mvista.com wrote:
 Hello.


 On 22-10-2012 16:12, Prabhakar Lad wrote:

 From: Lad, Prabhakar prabhakar@ti.com


 This patch replaces V4L2_OUT_CAP_CUSTOM_TIMINGS macro with
 V4L2_OUT_CAP_DV_TIMINGS. As V4L2_OUT_CAP_CUSTOM_TIMINGS is being phased
 out.


 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Sekhar Nori nsek...@ti.com
 ---
   Resending the patch since, it didn't reach the DLOS mailing list.


   This patch is based on the following patch series,
   ARM: davinci: dm365 EVM: add support for VPBE display
   (https://patchwork.kernel.org/patch/1295071/)


   arch/arm/mach-davinci/board-dm365-evm.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/arch/arm/mach-davinci/board-dm365-evm.c
 b/arch/arm/mach-davinci/board-dm365-evm.c
 index 2924d61..771abb5 100644
 --- a/arch/arm/mach-davinci/board-dm365-evm.c
 +++ b/arch/arm/mach-davinci/board-dm365-evm.c
 @@ -514,7 +514,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = {
 .index  = 1,
 .name   = Component,
 .type   = V4L2_OUTPUT_TYPE_ANALOG,
 -   .capabilities   = V4L2_OUT_CAP_CUSTOM_TIMINGS,
 +   .capabilities   =  V4L2_OUT_CAP_DV_TIMINGS,


Why this extra space after '='?

My Bad, I'll post a v2 fixing it.

Regards,
--Prabhakar

 WBR, Sergei

--
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 RESEND] media: davinci: vpbe: fix build warning

2012-10-23 Thread Prabhakar Lad
Hi Laurent,

On Mon, Oct 22, 2012 at 5:53 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Monday 22 October 2012 17:47:51 Prabhakar Lad wrote:
 From: Lad, Prabhakar prabhakar@ti.com

 Warnings were generated because of the following commit changed data type
 for address pointer

 195bbca ARM: 7500/1: io: avoid writeback addressing modes for __raw_
 accessors add  __iomem annotation to fix following warnings

 drivers/media/platform/davinci/vpbe_osd.c: In function ‘osd_read’:
 drivers/media/platform/davinci/vpbe_osd.c:49:2: warning: passing
  argument 1 of ‘__raw_readl’ makes pointer from integer without a cast
 [enabled by default] arch/arm/include/asm/io.h:104:19: note: expected
 ‘const volatile
  void *’ but argument is of type ‘long unsigned int’

 Signed-off-by: Lad, Prabhakar prabhakar@ti.com
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 ---
   Resending the patch since, it didn't reach the DLOS mailing list.

  drivers/media/platform/davinci/vpbe_osd.c |   16 
  1 files changed, 8 insertions(+), 8 deletions(-)

 diff --git a/drivers/media/platform/davinci/vpbe_osd.c
 b/drivers/media/platform/davinci/vpbe_osd.c index bba299d..9ab9280 100644
 --- a/drivers/media/platform/davinci/vpbe_osd.c
 +++ b/drivers/media/platform/davinci/vpbe_osd.c
 @@ -46,14 +46,14 @@ static inline u32 osd_read(struct osd_state *sd, u32
 offset) {
   struct osd_state *osd = sd;

 - return readl(osd-osd_base + offset);
 + return readl(IOMEM(osd-osd_base + offset));

 A better fix, in my opinion, would be to change the osd-osd_base field to be
 a void __iomem * instead of long unsigned int.

Ok I'll make it as void * and post a v2.

Regards,
--Prabhakar

  }

  static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset)
  {
   struct osd_state *osd = sd;

 - writel(val, osd-osd_base + offset);
 + writel(val, IOMEM(osd-osd_base + offset));

   return val;
  }
 @@ -63,9 +63,9 @@ static inline u32 osd_set(struct osd_state *sd, u32 mask,
 u32 offset) struct osd_state *osd = sd;

   u32 addr = osd-osd_base + offset;
 - u32 val = readl(addr) | mask;
 + u32 val = readl(IOMEM(addr)) | mask;

 - writel(val, addr);
 + writel(val, IOMEM(addr));

   return val;
  }
 @@ -75,9 +75,9 @@ static inline u32 osd_clear(struct osd_state *sd, u32
 mask, u32 offset) struct osd_state *osd = sd;

   u32 addr = osd-osd_base + offset;
 - u32 val = readl(addr)  ~mask;
 + u32 val = readl(IOMEM(addr))  ~mask;

 - writel(val, addr);
 + writel(val, IOMEM(addr));

   return val;
  }
 @@ -88,9 +88,9 @@ static inline u32 osd_modify(struct osd_state *sd, u32
 mask, u32 val, struct osd_state *osd = sd;

   u32 addr = osd-osd_base + offset;
 - u32 new_val = (readl(addr)  ~mask) | (val  mask);
 + u32 new_val = (readl(IOMEM(addr))  ~mask) | (val  mask);

 - writel(new_val, addr);
 + writel(new_val, IOMEM(addr));

   return new_val;
  }
 --
 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


<    1   2   3   4   5   6   7   >