diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-05-07 11:34:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-23 13:53:31 -0400 |
commit | 8bf54c4321dd6c57d4117f425890e5c6d49c103a (patch) | |
tree | 7bc2ae1eaf5721848d2ef791b7a6083956a325e5 /drivers/media/i2c/mt9p031.c | |
parent | 536954f1e9b26a135c17e6a8a03f2a40a069df27 (diff) |
[media] mt9p031: Really disable Black Level Calibration in test pattern mode
The digital side of the Black Level Calibration (BLC) function must be
disabled when generating a test pattern to avoid artifacts in the image.
The driver disables BLC correctly at the hardware level, but the feature
gets reenabled by v4l2_ctrl_handler_setup() the next time the device is
powered on.
Fix this by marking the BLC controls as inactive when generating a test
pattern, and ignoring control set requests on inactive controls.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c/mt9p031.c')
-rw-r--r-- | drivers/media/i2c/mt9p031.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 33daace81297..9102b2346f7c 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c | |||
@@ -655,6 +655,9 @@ static int mt9p031_s_ctrl(struct v4l2_ctrl *ctrl) | |||
655 | u16 data; | 655 | u16 data; |
656 | int ret; | 656 | int ret; |
657 | 657 | ||
658 | if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE) | ||
659 | return 0; | ||
660 | |||
658 | switch (ctrl->id) { | 661 | switch (ctrl->id) { |
659 | case V4L2_CID_EXPOSURE: | 662 | case V4L2_CID_EXPOSURE: |
660 | ret = mt9p031_write(client, MT9P031_SHUTTER_WIDTH_UPPER, | 663 | ret = mt9p031_write(client, MT9P031_SHUTTER_WIDTH_UPPER, |
@@ -709,8 +712,16 @@ static int mt9p031_s_ctrl(struct v4l2_ctrl *ctrl) | |||
709 | MT9P031_READ_MODE_2_ROW_MIR, 0); | 712 | MT9P031_READ_MODE_2_ROW_MIR, 0); |
710 | 713 | ||
711 | case V4L2_CID_TEST_PATTERN: | 714 | case V4L2_CID_TEST_PATTERN: |
715 | /* The digital side of the Black Level Calibration function must | ||
716 | * be disabled when generating a test pattern to avoid artifacts | ||
717 | * in the image. Activate (deactivate) the BLC-related controls | ||
718 | * when the test pattern is enabled (disabled). | ||
719 | */ | ||
720 | v4l2_ctrl_activate(mt9p031->blc_auto, ctrl->val == 0); | ||
721 | v4l2_ctrl_activate(mt9p031->blc_offset, ctrl->val == 0); | ||
722 | |||
712 | if (!ctrl->val) { | 723 | if (!ctrl->val) { |
713 | /* Restore the black level compensation settings. */ | 724 | /* Restore the BLC settings. */ |
714 | if (mt9p031->blc_auto->cur.val != 0) { | 725 | if (mt9p031->blc_auto->cur.val != 0) { |
715 | ret = mt9p031_s_ctrl(mt9p031->blc_auto); | 726 | ret = mt9p031_s_ctrl(mt9p031->blc_auto); |
716 | if (ret < 0) | 727 | if (ret < 0) |
@@ -735,9 +746,7 @@ static int mt9p031_s_ctrl(struct v4l2_ctrl *ctrl) | |||
735 | if (ret < 0) | 746 | if (ret < 0) |
736 | return ret; | 747 | return ret; |
737 | 748 | ||
738 | /* Disable digital black level compensation when using a test | 749 | /* Disable digital BLC when generating a test pattern. */ |
739 | * pattern. | ||
740 | */ | ||
741 | ret = mt9p031_set_mode2(mt9p031, MT9P031_READ_MODE_2_ROW_BLC, | 750 | ret = mt9p031_set_mode2(mt9p031, MT9P031_READ_MODE_2_ROW_BLC, |
742 | 0); | 751 | 0); |
743 | if (ret < 0) | 752 | if (ret < 0) |