Skip to content

Commit 53654ae

Browse files
6by9pelwell
authored andcommitted
media: i2c: imx290: Limit analogue gain according to module
Commit ec75fd9 upstream. The imx327 only supports up to 29.4dB of analogue gain, vs the imx290 going up to 30dB. Both are in 0.3dB steps. As we now have model specific config, fix this mismatch, and delete the comment referencing it. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 44cb781 commit 53654ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/media/i2c/imx290.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ struct imx290_model_info {
178178
enum imx290_colour_variant colour_variant;
179179
const struct cci_reg_sequence *init_regs;
180180
size_t init_regs_num;
181+
unsigned int max_analog_gain;
181182
const char *name;
182183
};
183184

@@ -878,14 +879,10 @@ static int imx290_ctrl_init(struct imx290 *imx290)
878879
* up to 72.0dB (240) add further digital gain. Limit the range to
879880
* analog gain only, support for digital gain can be added separately
880881
* if needed.
881-
*
882-
* The IMX327 and IMX462 are largely compatible with the IMX290, but
883-
* have an analog gain range of 0.0dB to 29.4dB and 42dB of digital
884-
* gain. When support for those sensors gets added to the driver, the
885-
* gain control should be adjusted accordingly.
886882
*/
887883
v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops,
888-
V4L2_CID_ANALOGUE_GAIN, 0, 100, 1, 0);
884+
V4L2_CID_ANALOGUE_GAIN, 0,
885+
imx290->model->max_analog_gain, 1, 0);
889886

890887
/*
891888
* Correct range will be determined through imx290_ctrl_update setting
@@ -1440,18 +1437,21 @@ static const struct imx290_model_info imx290_models[] = {
14401437
.colour_variant = IMX290_VARIANT_COLOUR,
14411438
.init_regs = imx290_global_init_settings_290,
14421439
.init_regs_num = ARRAY_SIZE(imx290_global_init_settings_290),
1440+
.max_analog_gain = 100,
14431441
.name = "imx290",
14441442
},
14451443
[IMX290_MODEL_IMX290LLR] = {
14461444
.colour_variant = IMX290_VARIANT_MONO,
14471445
.init_regs = imx290_global_init_settings_290,
14481446
.init_regs_num = ARRAY_SIZE(imx290_global_init_settings_290),
1447+
.max_analog_gain = 100,
14491448
.name = "imx290",
14501449
},
14511450
[IMX290_MODEL_IMX327LQR] = {
14521451
.colour_variant = IMX290_VARIANT_COLOUR,
14531452
.init_regs = imx290_global_init_settings_327,
14541453
.init_regs_num = ARRAY_SIZE(imx290_global_init_settings_327),
1454+
.max_analog_gain = 98,
14551455
.name = "imx327",
14561456
},
14571457
};

0 commit comments

Comments
 (0)