linux/drivers/media
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
..
cec media: cec: keep track of outstanding transmits 2018-11-23 05:56:14 -05:00
common media: vb2: be sure to unlock mutex on errors 2018-11-23 07:29:54 -05:00
dvb-core media: dvb_frontend: add debug message for frequency intervals 2018-11-23 11:59:45 -05:00
dvb-frontends media: remove redundant include moduleparam.h 2018-12-05 04:33:45 -05:00
firewire media: firewire: Fix app_info parameter type in avc_ca{,_app}_info 2018-12-05 05:34:33 -05:00
i2c media: ov5640: Compute the clock rate at runtime 2018-12-05 06:47:33 -05:00
mmc media: siano: use GFP_DMA only for smssdio 2018-05-15 08:04:42 -04:00
pci media: ddbridge: remove another duplicate of io.h and sort includes 2018-12-05 05:04:49 -05:00
platform media: sti/bdisp: don't pass GFP_DMA32 to dma_alloc_attrs 2018-12-05 05:31:46 -05:00
radio media: replace strcpy() by strscpy() 2018-09-11 13:32:17 -04:00
rc media: rc: ensure close() is called on rc_unregister_device 2018-11-22 13:33:24 -05:00
spi media: cxd2880-spi: Add optional vcc regulator 2018-12-03 13:33:16 -05:00
tuners media: si2157: declare its own pads 2018-09-17 13:16:19 -04:00
usb media: usb: dvb-usb: remove old friio driver 2018-12-05 03:25:41 -05:00
v4l2-core media: v4l2-fwnode: Demote warning to debug level 2018-12-05 06:33:24 -05:00
Kconfig media: cec: Kconfig coding style issue 2018-05-09 16:26:50 -04:00
Makefile media: media-request: implement media requests 2018-08-31 11:04:51 -04:00
media-device.c media updates for v4.20-rc1 2018-10-31 10:53:29 -07:00
media-devnode.c MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
media-entity.c media: v4l2-mc: switch it to use the new approach to setup pipelines 2018-09-17 13:16:19 -04:00
media-request.c media: media-request: EPERM -> EACCES/EBUSY 2018-09-11 09:57:29 -04:00