]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: imx219: Adjust PLL settings based on the number of MIPI lanes
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 23 Jan 2025 15:37:49 +0000 (15:37 +0000)
committerHans Verkuil <hverkuil@xs4all.nl>
Sat, 15 Feb 2025 14:22:59 +0000 (15:22 +0100)
commit591a07588c03437dbcc3addfff07675de95a461e
tree8b086205047bd34314bba87df325a008c2c317f3
parentda1e42d3fe6fecbde2a69b0c015aa68e30d02ff6
media: imx219: Adjust PLL settings based on the number of MIPI lanes

Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
added support for device tree to allow configuration of the sensor to
use 4 lanes with a link frequency of 363MHz, and amended the advertised
pixel rate to 280.8MPix/s.

However it didn't change any of the PLL settings, so actually it would
have been running overclocked in the MIPI block, and with the frame
rate and exposure calculations being wrong as the pixel rate was
unchanged.

The pixel rate and link frequency advertised were taken from the "Clock
Setting Example" section of the datasheet. However those are based on an
external clock of 12MHz, and are unachievable with a clock of 24MHz - it
seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the
automatic configuration documented in "9-1-2 EXCK_FREQ setting depend on
INCK frequency", not by writing the registers.
The closest we can get with a 24MHz clock is 281.6MPix/s and 364MHz.

Dropping all support for the 363MHz link frequency would cause problems
for existing users, so allow it, but log a warning that the requested
value is being changed to the supported one.

Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation")
Cc: stable@vger.kernel.org
Co-developed-by: Peyton Howe <peyton.howe@bellsouth.net>
Signed-off-by: Peyton Howe <peyton.howe@bellsouth.net>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/i2c/imx219.c