WSL2-Linux-Kernel/drivers/media/i2c
Bryan O'Donoghue dba5dc8a3b media: i2c: Fix imx412 exposure control
[ Upstream commit a1956bf53a2774014ee1768b484af2c38c633a25 ]

Currently we have the following algorithm to calculate what value should be
written to the exposure control of imx412.

lpfr = imx412->vblank + imx412->cur_mode->height;
shutter = lpfr - exposure;

The 'shutter' value is given to IMX412_REG_EXPOSURE_CIT however, the above
algorithm will result in the value given to IMX412_REG_EXPOSURE_CIT
decreasing as the requested exposure value from user-space goes up.

e.g.
[ 2255.713989] imx412 20-001a: Received exp 1608, analog gain 0
[ 2255.714002] imx412 20-001a: Set exp 1608, analog gain 0, shutter 1938, lpfr 3546
[ 2256.302770] imx412 20-001a: Received exp 2586, analog gain 100
[ 2256.302800] imx412 20-001a: Set exp 2586, analog gain 100, shutter 960, lpfr 3546
[ 2256.753755] imx412 20-001a: Received exp 3524, analog gain 110
[ 2256.753772] imx412 20-001a: Set exp 3524, analog gain 110, shutter 22, lpfr 3546

This behaviour results in the image having less exposure as the requested
exposure value from user-space increases.

Other sensor drivers such as ov5675, imx218, hid556 and others take the
requested exposure value and use the value directly.

Take the example of the above cited sensor drivers and directly apply the
requested exposure value from user-space. The 'lpfr' variable still
functions as before but the 'shutter' variable can be dispensed with as a
result.

Once done a similar run of the test application requesting higher exposure
looks like this, with 'exp' written directly to the sensor.

[  133.207884] imx412 20-001a: Received exp 1608, analog gain 0
[  133.207899] imx412 20-001a: Set exp 1608, analog gain 0, lpfr 3546
[  133.905309] imx412 20-001a: Received exp 2844, analog gain 100
[  133.905344] imx412 20-001a: Set exp 2844, analog gain 100, lpfr 3546
[  134.241705] imx412 20-001a: Received exp 3524, analog gain 110
[  134.241775] imx412 20-001a: Set exp 3524, analog gain 110, lpfr 3546

The result is then setting the sensor exposure to lower values results in
darker, less exposure images and vice versa with higher exposure values.

Fixes: 9214e86c0c ("media: i2c: Add imx412 camera sensor driver")
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # qrb5165-rb5/imx577
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <quic_grosikop@quicinc.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-19 05:45:00 +02:00
..
adv748x media: adv748x: afe: Select input port when initializing AFE 2022-12-31 13:14:06 +01:00
ccs media: ccs: Correctly initialise try compose rectangle 2023-11-28 16:56:34 +00:00
cx25840 media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
et8ek8 media: i2c: et8ek8: use DEVICE_ATTR_RO() helper macro 2021-08-04 14:43:50 +02:00
m5mols media: m5mols: fix off-by-one loop termination error 2023-03-22 13:31:30 +01:00
s5c73m3 media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
Kconfig media: i2c: ths8200 needs V4L2_ASYNC 2021-11-18 19:16:28 +01:00
Makefile media: i2c: Add ov9282 camera sensor driver 2021-08-04 14:43:50 +02:00
ad5820.c media: ad5820: Drop unsupported ad5823 from i2c_ and of_device_id tables 2023-09-19 12:22:43 +02:00
ad9389b.c
adp1653.c
adv7170.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
adv7175.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
adv7180.c media: i2c: adv7180: fix adv7280 BT.656-4 compatibility 2021-07-22 11:40:46 +02:00
adv7183.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
adv7183_regs.h
adv7343.c
adv7343_regs.h
adv7393.c
adv7393_regs.h
adv7511-v4l2.c media: video/hdmi: handle short reads of hdmi info frame. 2022-04-08 14:23:16 +02:00
adv7604.c media: video/hdmi: handle short reads of hdmi info frame. 2022-04-08 14:23:16 +02:00
adv7842.c media: video/hdmi: handle short reads of hdmi info frame. 2022-04-08 14:23:16 +02:00
ak881x.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ak7375.c media: i2c: ak7375: use pm_runtime_resume_and_get() 2021-05-19 09:51:40 +02:00
aptina-pll.c
aptina-pll.h
bt819.c
bt856.c
bt866.c
ccs-pll.c
ccs-pll.h
cs53l32a.c
cs3308.c
cs5345.c
dw9714.c media: i2c: dw9714: use pm_runtime_resume_and_get() 2021-05-19 09:51:40 +02:00
dw9768.c media: i2c: dw9768: use pm_runtime_resume_and_get() 2021-05-19 09:51:40 +02:00
dw9807-vcm.c media: i2c: dw9807-vcm: use pm_runtime_resume_and_get() 2021-05-19 09:51:40 +02:00
hi556.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx208.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx214.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx219.c media: i2c: imx219: Fix binning for RAW8 capture 2023-03-10 09:39:45 +01:00
imx258.c media: imx258: Fix getting clock frequency 2021-11-18 19:16:28 +01:00
imx274.c media: i2c: imx274: fix s_frame_interval runtime resume not requested 2022-01-27 11:03:19 +01:00
imx290.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx319.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx334.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
imx335.c media: i2c: imx335: Fix hblank min/max values 2024-02-23 08:54:48 +01:00
imx355.c media: imx355: Enable runtime PM before registering async sub-device 2024-02-23 08:54:24 +01:00
imx412.c media: i2c: Fix imx412 exposure control 2024-08-19 05:45:00 +02:00
ir-kbd-i2c.c media: ir-kbd-i2c: improve responsiveness of hauppauge zilog receivers 2021-11-18 19:15:53 +01:00
ks0127.c
ks0127.h
lm3560.c
lm3646.c
m52790.c
max2175.c media: media/i2c: remove unneeded variable: "ret" 2021-03-11 11:59:43 +01:00
max2175.h
max9271.c media: i2c: max9271: Introduce wake_up() function 2021-06-17 11:30:21 +02:00
max9271.h media: i2c: max9271: Introduce wake_up() function 2021-06-17 11:30:21 +02:00
max9286.c media: i2c: max9286: Fix some redundant of_node_put() calls 2023-11-20 11:08:27 +01:00
ml86v7667.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
msp3400-driver.c
msp3400-driver.h
msp3400-kthreads.c
mt9m001.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9m032.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9m111.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9p031.c media: mt9p031: Fix corrupted frame after restarting stream 2021-11-18 19:16:12 +01:00
mt9t001.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9t112.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9v011.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9v032.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
mt9v111.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
noon010pc30.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov02a10.c i2c/drivers/ov02q10: use HZ macros 2021-09-08 11:50:26 -07:00
ov772x.c media: i2c: ov772x: Fix memleak in ov772x_probe() 2023-03-10 09:39:45 +01:00
ov2640.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov2659.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov2680.c media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors 2023-09-19 12:22:47 +02:00
ov2685.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov2740.c media: ov2740: Fix memleak in ov2740_init_controls() 2023-03-10 09:39:44 +01:00
ov5640.c media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() 2023-09-19 12:22:46 +02:00
ov5645.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov5647.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov5648.c media: i2c: ov5648: fix wrong pointer passed to IS_ERR() and PTR_ERR() 2022-06-09 10:22:59 +02:00
ov5670.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov5675.c media: ov5675: Fix memleak in ov5675_init_controls() 2023-03-10 09:39:44 +01:00
ov5695.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov6650.c media: ov6650: Fix crop rectangle affected by set format 2022-04-08 14:24:15 +02:00
ov7251.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov7640.c
ov7670.c media: i2c: ov7670: 0 instead of -EINVAL was returned 2023-03-10 09:39:46 +01:00
ov7740.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov8856.c media: ov8856: ignore gpio and regulator for ov8856 with ACPI 2021-08-04 14:43:51 +02:00
ov8865.c media: i2c: ov8865: Fix lockdep error 2022-01-27 11:03:19 +01:00
ov9282.c media: i2c: Add ov9282 camera sensor driver 2021-08-04 14:43:50 +02:00
ov9640.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov9640.h media: ov9640: Use the generic clock framework 2021-02-06 09:38:05 +01:00
ov9650.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
ov9734.c media: ov9734: Enable runtime PM before registering async sub-device 2024-02-23 08:54:24 +01:00
ov13858.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
rdacm20.c media: i2c: rdacm2x: properly set subdev entity function 2022-06-09 10:22:58 +02:00
rdacm21.c media: i2c: rdacm21: Fix uninitialized value 2023-09-19 12:22:47 +02:00
rj54n1cb0c.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
s5k4ecgx.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
s5k5baf.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
s5k6a3.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
s5k6aa.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
saa711x_regs.h
saa717x.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
saa6588.c media: subdev: disallow ioctl for saa6588/davinci 2021-06-17 10:18:37 +02:00
saa6752hs.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
saa7110.c
saa7115.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
saa7127.c
saa7185.c
sony-btf-mpx.c
sr030pc30.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
st-mipid02.c media: i2c: Correct format propagation for st-mipid02 2023-07-23 13:47:22 +02:00
tc358743.c media: tc358743: register v4l2 async device only after successful setup 2024-03-26 18:21:25 -04:00
tc358743_regs.h
tda1997x.c media: TDA1997x: handle short reads of hdmi info frame. 2021-11-18 19:16:28 +01:00
tda1997x_regs.h
tda7432.c
tda9840.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
ths7303.c
ths8200.c
ths8200_regs.h
tlv320aic23b.c
tvaudio.c
tvp514x.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
tvp514x_regs.h media: media/i2c: fix kerneldoc issues for media i2c headers 2021-03-22 10:23:43 +01:00
tvp5150.c media: i2c: tvp5150: check return value of devm_kasprintf() 2023-09-19 12:22:43 +02:00
tvp5150_reg.h
tvp7002.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
tvp7002_reg.h
tw2804.c
tw9903.c
tw9906.c
tw9910.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
uda1342.c
upd64031a.c
upd64083.c
video-i2c.c media: i2c: video-i2c: use pm_runtime_resume_and_get() 2021-05-19 09:51:42 +02:00
vp27smpx.c
vpx3220.c
vs6624.c media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
vs6624_regs.h
wm8739.c
wm8775.c