media: i2c: Clarify that gain is Analogue gain in OV7251
Subsystems (2)
PATCH 1/1 media: i2c: Clarify that gain is Analogue gain in OV7251
From: Daniel Scally <[email protected]>
Update the control ID for the gain control in the ov7251 driver to V4L2_CID_ANALOGUE_GAIN.
---
Notes:
This patch is not mine. It has been carried out of tree in the linux-surface patch set since 2023 (patches/<ver>/0013-cameras.patch) and has never been sent here as far as I can find. Daniel's Signed-off-by is from the original; I am passing it on and have added mine. Daniel, if you would rather send it yourself, or if there is a reason it was never submitted, please say so and I will drop it.
One deviation from the original: the second hunk now wraps, because leaving the call on one line puts it at 82 columns and the media subsystem asks for checkpatch --strict --max-line-length=80. The wrap follows the style used in commit d938b2f29be6 for ov8865.
Testing: Surface Pro 4, which has three OmniVision sensors on one IPU3, ov8865 (INT347A), ov5693 (INT33BE) and ov7251 (INT347E). With this patch the ov7251 subdev reports
analogue_gain 0x009e0903 (int) : min=16 max=1023 step=1 default=16
matching the other two. Without it ov7251 is the only one of the three that reports plain gain for the same kind of control, which is the inconsistency this fixes on real hardware.
Built with W=1, no new warnings. checkpatch --strict --max-line-length=80 clean. Based on media/next at 7.4-rc1.
drivers/media/i2c/ov7251.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/ov7251.c +3 -2
@@ -1052,7 +1052,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_EXPOSURE : ret =ov7251_set_exposure (ov7251, ctrl->val);break ; -case V4L2_CID_GAIN : +case V4L2_CID_ANALOGUE_GAIN : ret =ov7251_set_gain (ov7251, ctrl->val);break ;case V4L2_CID_TEST_PATTERN :
@@ -1580,7 +1580,8 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251) ov7251->exposure =v4l2_ctrl_new_std (&ov7251->ctrls, &ov7251_ctrl_ops,V4L2_CID_EXPOSURE ,1 ,32 ,1 ,32 ); ov7251->gain =v4l2_ctrl_new_std (&ov7251->ctrls, &ov7251_ctrl_ops, -V4L2_CID_GAIN ,16 ,1023 ,1 ,16 ); +V4L2_CID_ANALOGUE_GAIN ,16 ,1023 ,1 , +16 ); v4l2_ctrl_new_std_menu_items(&ov7251->ctrls, &ov7251_ctrl_ops, V4L2_CID_TEST_PATTERN, ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
Signature · 1 line
2.56.0