aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/mt9t001.c
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.lad@ti.com>2012-09-25 08:35:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-05 20:49:32 -0400
commitb28d70176e9f05fb94256678b4ff5b3527e81b7f (patch)
treec97cca79efc860b95eaea6c726abe3db93342809 /drivers/media/i2c/mt9t001.c
parent117a711a2c37a0309a3e39fbd13486642b63453b (diff)
[media] media: mt9p031/mt9t001/mt9v032: use V4L2_CID_TEST_PATTERN for test pattern control
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.lad@ti.com> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/mt9t001.c')
-rw-r--r--drivers/media/i2c/mt9t001.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 6d343adf891d..2e189d8b71bb 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,
371 * V4L2 subdev control operations 371 * V4L2 subdev control operations
372 */ 372 */
373 373
374#define V4L2_CID_TEST_PATTERN (V4L2_CID_USER_BASE | 0x1001) 374#define V4L2_CID_TEST_PATTERN_COLOR (V4L2_CID_USER_BASE | 0x1001)
375#define V4L2_CID_BLACK_LEVEL_AUTO (V4L2_CID_USER_BASE | 0x1002) 375#define V4L2_CID_BLACK_LEVEL_AUTO (V4L2_CID_USER_BASE | 0x1002)
376#define V4L2_CID_BLACK_LEVEL_OFFSET (V4L2_CID_USER_BASE | 0x1003) 376#define V4L2_CID_BLACK_LEVEL_OFFSET (V4L2_CID_USER_BASE | 0x1003)
377#define V4L2_CID_BLACK_LEVEL_CALIBRATE (V4L2_CID_USER_BASE | 0x1004) 377#define V4L2_CID_BLACK_LEVEL_CALIBRATE (V4L2_CID_USER_BASE | 0x1004)
@@ -487,12 +487,11 @@ static int mt9t001_s_ctrl(struct v4l2_ctrl *ctrl)
487 ctrl->val >> 16); 487 ctrl->val >> 16);
488 488
489 case V4L2_CID_TEST_PATTERN: 489 case V4L2_CID_TEST_PATTERN:
490 ret = mt9t001_set_output_control(mt9t001, 490 return mt9t001_set_output_control(mt9t001,
491 ctrl->val ? 0 : MT9T001_OUTPUT_CONTROL_TEST_DATA, 491 ctrl->val ? 0 : MT9T001_OUTPUT_CONTROL_TEST_DATA,
492 ctrl->val ? MT9T001_OUTPUT_CONTROL_TEST_DATA : 0); 492 ctrl->val ? MT9T001_OUTPUT_CONTROL_TEST_DATA : 0);
493 if (ret < 0)
494 return ret;
495 493
494 case V4L2_CID_TEST_PATTERN_COLOR:
496 return mt9t001_write(client, MT9T001_TEST_DATA, ctrl->val << 2); 495 return mt9t001_write(client, MT9T001_TEST_DATA, ctrl->val << 2);
497 496
498 case V4L2_CID_BLACK_LEVEL_AUTO: 497 case V4L2_CID_BLACK_LEVEL_AUTO:
@@ -533,12 +532,17 @@ static struct v4l2_ctrl_ops mt9t001_ctrl_ops = {
533 .s_ctrl = mt9t001_s_ctrl, 532 .s_ctrl = mt9t001_s_ctrl,
534}; 533};
535 534
535static const char * const mt9t001_test_pattern_menu[] = {
536 "Disabled",
537 "Enabled",
538};
539
536static const struct v4l2_ctrl_config mt9t001_ctrls[] = { 540static const struct v4l2_ctrl_config mt9t001_ctrls[] = {
537 { 541 {
538 .ops = &mt9t001_ctrl_ops, 542 .ops = &mt9t001_ctrl_ops,
539 .id = V4L2_CID_TEST_PATTERN, 543 .id = V4L2_CID_TEST_PATTERN_COLOR,
540 .type = V4L2_CTRL_TYPE_INTEGER, 544 .type = V4L2_CTRL_TYPE_INTEGER,
541 .name = "Test pattern", 545 .name = "Test Pattern Color",
542 .min = 0, 546 .min = 0,
543 .max = 1023, 547 .max = 1023,
544 .step = 1, 548 .step = 1,
@@ -741,7 +745,7 @@ static int mt9t001_probe(struct i2c_client *client,
741 return -ENOMEM; 745 return -ENOMEM;
742 746
743 v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) + 747 v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) +
744 ARRAY_SIZE(mt9t001_gains) + 3); 748 ARRAY_SIZE(mt9t001_gains) + 4);
745 749
746 v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops, 750 v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
747 V4L2_CID_EXPOSURE, MT9T001_SHUTTER_WIDTH_MIN, 751 V4L2_CID_EXPOSURE, MT9T001_SHUTTER_WIDTH_MIN,
@@ -752,6 +756,10 @@ static int mt9t001_probe(struct i2c_client *client,
752 v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops, 756 v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
753 V4L2_CID_PIXEL_RATE, pdata->ext_clk, pdata->ext_clk, 757 V4L2_CID_PIXEL_RATE, pdata->ext_clk, pdata->ext_clk,
754 1, pdata->ext_clk); 758 1, pdata->ext_clk);
759 v4l2_ctrl_new_std_menu_items(&mt9t001->ctrls, &mt9t001_ctrl_ops,
760 V4L2_CID_TEST_PATTERN,
761 ARRAY_SIZE(mt9t001_test_pattern_menu) - 1, 0,
762 0, mt9t001_test_pattern_menu);
755 763
756 for (i = 0; i < ARRAY_SIZE(mt9t001_ctrls); ++i) 764 for (i = 0; i < ARRAY_SIZE(mt9t001_ctrls); ++i)
757 v4l2_ctrl_new_custom(&mt9t001->ctrls, &mt9t001_ctrls[i], NULL); 765 v4l2_ctrl_new_custom(&mt9t001->ctrls, &mt9t001_ctrls[i], NULL);