linux/drivers/media/i2c
Maxime Ripard dfbfb7aa83 media: ov5640: Compute the clock rate at runtime
The clock rate, while hardcoded until now, is actually a function of the
resolution, framerate and bytes per pixel. Now that we have an algorithm to
adjust our clock rate, we can select it dynamically when we change the
mode.

This changes a bit the clock rate being used, with the following effect:

+------+------+------+------+-----+-----------------+----------------+-----------+
| Hact | Vact | Htot | Vtot | FPS | Hardcoded clock | Computed clock | Deviation |
+------+------+------+------+-----+-----------------+----------------+-----------+
|  640 |  480 | 1896 | 1080 |  15 |        56000000 |       61430400 | 8.84 %    |
|  640 |  480 | 1896 | 1080 |  30 |       112000000 |      122860800 | 8.84 %    |
| 1024 |  768 | 1896 | 1080 |  15 |        56000000 |       61430400 | 8.84 %    |
| 1024 |  768 | 1896 | 1080 |  30 |       112000000 |      122860800 | 8.84 %    |
|  320 |  240 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  320 |  240 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  176 |  144 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  176 |  144 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  720 |  480 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  720 |  480 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  720 |  576 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  720 |  576 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
| 1280 |  720 | 1892 |  740 |  15 |        42000000 |       42002400 | 0.01 %    |
| 1280 |  720 | 1892 |  740 |  30 |        84000000 |       84004800 | 0.01 %    |
| 1920 | 1080 | 2500 | 1120 |  15 |        84000000 |       84000000 | 0.00 %    |
| 1920 | 1080 | 2500 | 1120 |  30 |       168000000 |      168000000 | 0.00 %    |
| 2592 | 1944 | 2844 | 1944 |  15 |        84000000 |      165862080 | 49.36 %   |
+------+------+------+------+-----+-----------------+----------------+-----------+

Only the 640x480, 1024x768 and 2592x1944 modes are significantly affected
by the new formula.

In this case, 640x480 and 1024x768 are actually fixed by this change.
Indeed, the sensor was sending data at, for example, 27.33fps instead of
30fps. This is -9%, which is roughly what we're seeing in the array.
Testing these modes with the new clock setup actually fix that error, and
data are now sent at around 30fps.

2592x1944, on the other hand, is probably due to the fact that this mode
can only be used using MIPI-CSI2, in a two lane mode, and never really
tested with a DVP bus.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-12-05 06:47:33 -05:00
..
adv748x media: i2c: adv748x: fix typo in comment for TXB CSI-2 transmitter power down 2018-10-04 14:51:03 -04:00
cx25840 media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macros 2018-10-04 14:22:27 -04:00
et8ek8 media: media/i2c: add missing entity functions 2018-07-25 08:04:00 -04:00
m5mols media: v4l: i2c: Add a comment not to use static sub-device names in the future 2018-10-03 11:55:44 -04:00
s5c73m3 media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
smiapp media: smiapp: Query the V4L2 endpoint for a specific bus type 2018-10-04 16:24:25 -04:00
soc_camera media: rename soc_camera I2C drivers 2018-10-19 08:07:46 -04:00
ad5820.c media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
ad9389b.c media: adv*/tc358743/ths8200: fill in min width/height/pixelclock 2018-11-23 06:20:55 -05:00
adp1653.c
adv7170.c
adv7175.c
adv7180.c media: adv7180: add g_skip_frames support 2018-12-03 14:26:27 -05:00
adv7183_regs.h
adv7183.c
adv7343_regs.h
adv7343.c
adv7393_regs.h
adv7393.c
adv7511.c media: adv*/tc358743/ths8200: fill in min width/height/pixelclock 2018-11-23 06:20:55 -05:00
adv7604.c media: adv7604 added include of linux/interrupt.h 2018-12-03 14:42:59 -05:00
adv7842.c media: adv*/tc358743/ths8200: fill in min width/height/pixelclock 2018-11-23 06:20:55 -05:00
ak881x.c media: v4l: Remove support for crop default target in subdev drivers 2018-10-03 11:58:24 -04:00
ak7375.c media: ak7375: Add ak7375 lens voice coil driver 2018-07-04 07:13:34 -04:00
aptina-pll.c
aptina-pll.h
bt819.c
bt856.c
bt866.c
cs53l32a.c media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
cs3308.c
cs5345.c
dw9714.c media: dw9714: Remove useless error message 2018-10-08 11:51:05 -04:00
dw9807-vcm.c media: dw9807-vcm: Fix probe error handling 2018-10-08 11:51:31 -04:00
imx214.c media: imx214: Remove unnecessary self assignment in for loop 2018-11-23 04:41:41 -05:00
imx258.c media: unify some sony camera sensors pattern naming 2018-12-05 06:34:26 -05:00
imx274.c media: imx274: declare the correct number of controls 2018-12-05 06:35:20 -05:00
imx319.c media: unify some sony camera sensors pattern naming 2018-12-05 06:34:26 -05:00
imx355.c media: unify some sony camera sensors pattern naming 2018-12-05 06:34:26 -05:00
ir-kbd-i2c.c media: rc: probe zilog transmitter when zilog receiver is found 2018-05-04 08:22:36 -04:00
Kconfig media: mt9m111: allow to setup pixclk polarity 2018-12-05 06:42:31 -05:00
ks0127.c
ks0127.h
lm3560.c media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
lm3646.c media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
m52790.c
Makefile media: imx214: Add imx214 camera sensor driver 2018-11-06 07:15:12 -05:00
max2175.c media: i2c: max2175: convert to SPDX identifiers 2018-09-12 10:51:18 -04:00
max2175.h media: i2c: max2175: convert to SPDX identifiers 2018-09-12 10:51:18 -04:00
ml86v7667.c
msp3400-driver.c media: msp3400: declare its own pads 2018-09-17 13:16:19 -04:00
msp3400-driver.h media: msp3400: declare its own pads 2018-09-17 13:16:19 -04:00
msp3400-kthreads.c
mt9m032.c media: media/i2c: add missing entity functions 2018-07-25 08:04:00 -04:00
mt9m111.c media: mt9m111: allow to setup pixclk polarity 2018-12-05 06:42:31 -05:00
mt9p031.c media: media/i2c: add missing entity functions 2018-07-25 08:04:00 -04:00
mt9t001.c media: media/i2c: add missing entity functions 2018-07-25 08:04:00 -04:00
mt9t112.c media: v4l: Remove support for crop default target in subdev drivers 2018-10-03 11:58:24 -04:00
mt9v011.c
mt9v032.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
mt9v111.c media: i2c: mt9v111: Fix v4l2-ctrl error handling 2018-09-10 12:13:41 -04:00
noon010pc30.c media: v4l: i2c: Add a comment not to use static sub-device names in the future 2018-10-03 11:55:44 -04:00
ov772x.c media: ov772x: support log_status ioctl and event interface 2018-11-23 04:47:45 -05:00
ov2640.c media: ov2640: support log_status ioctl and event interface 2018-11-23 04:46:20 -05:00
ov2659.c media: v4l: fwnode: Let the caller provide V4L2 fwnode endpoint 2018-10-04 16:08:09 -04:00
ov2680.c media: ov2680: fix null dereference at power on 2018-11-23 05:16:29 -05:00
ov2685.c media: i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers 2018-08-31 09:23:53 -04:00
ov5640.c media: ov5640: Compute the clock rate at runtime 2018-12-05 06:47:33 -05:00
ov5645.c media: ov5645: constify v4l2_ctrl_ops structure 2018-11-06 07:16:38 -05:00
ov5647.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
ov5670.c media: i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers 2018-08-31 09:23:53 -04:00
ov5695.c media: i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers 2018-08-31 09:23:53 -04:00
ov6650.c media: v4l: Remove support for crop default target in subdev drivers 2018-10-03 11:58:24 -04:00
ov7251.c media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY 2018-10-04 16:06:15 -04:00
ov7640.c
ov7670.c media: ov7670: support log_status ioctl and event interface 2018-11-23 04:47:11 -05:00
ov7740.c media: ov7740: constify structures stored in fields of v4l2_subdev_ops structure 2018-11-06 07:17:02 -05:00
ov9650.c media: ov9650: avoid maybe-uninitialized warnings 2018-10-05 11:04:39 -04:00
ov13858.c media: ov13858: Check for possible null pointer 2018-11-06 07:15:53 -05:00
rj54n1cb0c.c media: v4l: Remove support for crop default target in subdev drivers 2018-10-03 11:58:24 -04:00
s5k4ecgx.c media: v4l: i2c: Add a comment not to use static sub-device names in the future 2018-10-03 11:55:44 -04:00
s5k5baf.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
s5k6a3.c
s5k6aa.c media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY 2018-10-04 16:06:15 -04:00
saa711x_regs.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
saa717x.c
saa6588.c
saa6752hs.c
saa7110.c
saa7115.c media: saa7115: declare its own pads 2018-09-17 13:16:19 -04:00
saa7127.c media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
saa7185.c
smiapp-pll.c
smiapp-pll.h
sony-btf-mpx.c
sr030pc30.c media: sr030pc30: remove NULL in sr030pc30_base_config() 2018-09-17 15:19:10 -04:00
tc358743_regs.h
tc358743.c media: adv*/tc358743/ths8200: fill in min width/height/pixelclock 2018-11-23 06:20:55 -05:00
tda1997x_regs.h
tda1997x.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
tda7432.c media: tda7432: fix spelling mistake "maximium" -> "maximum" 2018-12-03 14:44:54 -05:00
tda9840.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
ths7303.c
ths8200_regs.h
ths8200.c media: adv*/tc358743/ths8200: fill in min width/height/pixelclock 2018-11-23 06:20:55 -05:00
tlv320aic23b.c
tvaudio.c media: use strscpy() instead of strlcpy() 2018-09-11 13:32:17 -04:00
tvp514x_regs.h
tvp514x.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
tvp5150_reg.h media: tvp5150: Add sync lock interrupt handling 2018-09-17 13:30:28 -04:00
tvp5150.c media: tvp5150: fix irq_request error path during probe 2018-12-05 04:40:10 -05:00
tvp7002_reg.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
tvp7002.c media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero 2018-10-04 16:21:02 -04:00
tw2804.c
tw9903.c
tw9906.c
tw9910.c
uda1342.c
upd64031a.c
upd64083.c
video-i2c.c media: video-i2c: hwmon: constify vb2_ops structure 2018-11-23 04:34:13 -05:00
vp27smpx.c
vpx3220.c
vs6624_regs.h
vs6624.c media: i2c: vs6624: Replace mdelay() with msleep() and usleep_range() in vs6624_probe() 2018-07-27 08:11:57 -04:00
wm8739.c
wm8775.c