aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ov7740.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-08 11:13:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-08 11:13:17 -0700
commite7a1414f9dc3498c4c35b9ca266d539e8bccab53 (patch)
treef50a78785859182f9916c93dcf97c6539dbe3f3e /drivers/media/i2c/ov7740.c
parentMerge tag 'for-linus-5.2' of git://github.com/cminyard/linux-ipmi (diff)
parentmedia: dt-bindings: aspeed-video: Add missing memory-region property (diff)
downloadlinux-dev-e7a1414f9dc3498c4c35b9ca266d539e8bccab53.tar.xz
linux-dev-e7a1414f9dc3498c4c35b9ca266d539e8bccab53.zip
Merge tag 'media/v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - remove the deprecated Zoran driver from staging - new I2C driver: ST MIPID02 CSI-2 camera bridge - new platform driver: Amlogic Meson AO CEC G12A Controller - add support for USB audio via the media controller - au0828 driver is now supported via the media controller on both on media and on usbaudio - new kernel test for the media device allocator - add support for stateless decoder at vicodec driver - lots of other driver improvements fixes and cleanups * tag 'media/v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (218 commits) media: dt-bindings: aspeed-video: Add missing memory-region property media: platform: Aspeed: Make reserved memory optional media: platform: Aspeed: Remove use of reset line media: stm32-dcmi: return appropriate error codes during probe media: vsp1: Add support for missing 16-bit RGB555 formats media: vsp1: Add support for missing 16-bit RGB444 formats media: vsp1: Add support for missing 32-bit RGB formats media: v4l: Add definitions for missing 16-bit RGB555 formats media: v4l: Add definitions for missing 16-bit RGB4444 formats media: v4l: Add definitions for missing 32-bit RGB formats media: zoran: remove deprecated driver media: MAINTAINERS: Update AO CEC with ao-cec-g12a driver media: platform: meson: Add Amlogic Meson G12A AO CEC Controller driver media: dt-bindings: media: meson-ao-cec: Add G12A AO-CEC-B Compatible media: cros-ec-cec: decrement HDMI device refcount media: seco-cec: decrement HDMI device refcount media: tegra_cec: use new cec_notifier_parse_hdmi_phandle helper media: stih_cec: use new cec_notifier_parse_hdmi_phandle helper media: s5p_cec: use new cec_notifier_parse_hdmi_phandle helper media: meson: ao-cec: use new cec_notifier_parse_hdmi_phandle helper ...
Diffstat (limited to 'drivers/media/i2c/ov7740.c')
-rw-r--r--drivers/media/i2c/ov7740.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index dfece91ce96b..54e80a60aa57 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -448,6 +448,27 @@ static int ov7740_get_gain(struct ov7740 *ov7740, struct v4l2_ctrl *ctrl)
return 0;
}
+static int ov7740_get_exp(struct ov7740 *ov7740, struct v4l2_ctrl *ctrl)
+{
+ struct regmap *regmap = ov7740->regmap;
+ unsigned int value0, value1;
+ int ret;
+
+ if (ctrl->val == V4L2_EXPOSURE_MANUAL)
+ return 0;
+
+ ret = regmap_read(regmap, REG_AEC, &value0);
+ if (ret)
+ return ret;
+ ret = regmap_read(regmap, REG_HAEC, &value1);
+ if (ret)
+ return ret;
+
+ ov7740->exposure->val = (value1 << 8) | (value0 & 0xff);
+
+ return 0;
+}
+
static int ov7740_set_exp(struct regmap *regmap, int value)
{
int ret;
@@ -494,6 +515,9 @@ static int ov7740_get_volatile_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_AUTOGAIN:
ret = ov7740_get_gain(ov7740, ctrl);
break;
+ case V4L2_CID_EXPOSURE_AUTO:
+ ret = ov7740_get_exp(ov7740, ctrl);
+ break;
default:
ret = -EINVAL;
break;
@@ -991,8 +1015,6 @@ static int ov7740_init_controls(struct ov7740 *ov7740)
ov7740->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov7740_ctrl_ops,
V4L2_CID_EXPOSURE, 0, 65535, 1, 500);
- if (ov7740->exposure)
- ov7740->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE;
ov7740->auto_exposure = v4l2_ctrl_new_std_menu(ctrl_hdlr,
&ov7740_ctrl_ops,
@@ -1003,7 +1025,7 @@ static int ov7740_init_controls(struct ov7740 *ov7740)
v4l2_ctrl_auto_cluster(3, &ov7740->auto_wb, 0, false);
v4l2_ctrl_auto_cluster(2, &ov7740->auto_gain, 0, true);
v4l2_ctrl_auto_cluster(2, &ov7740->auto_exposure,
- V4L2_EXPOSURE_MANUAL, false);
+ V4L2_EXPOSURE_MANUAL, true);
v4l2_ctrl_cluster(2, &ov7740->hflip);
if (ctrl_hdlr->error) {