[PATCH v5] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control

2012-10-03 Thread Prabhakar
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
---
 Changes for v5:
 1: Fixed the min value of mt9v032_test_pattern_color control
to zero which wrongly set to 4, pointed out by Laurent.

 Changes for v4:
 1: Fixed some grammatical issues, pointed by Laurent.

 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 |   54 +++---
 3 files changed, 55 insertions(+), 40 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 

Re: [PATCH v5] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control

2012-10-03 Thread Laurent Pinchart
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.

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

2012-10-03 Thread Sakari Ailus

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


Thanks!

Acked-by: Sakari Ailus sakari.ai...@iki.fi

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