bcm27xx: switch to kernel v6.1
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0408-media-i2c-imx290-Fix-the-pixel-rate-at-148.5Mpix-s.patch
1 From ae89f74e9c2583b2d49ea0c6d5653aa820083c4e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 17 Jun 2021 13:00:39 +0100
4 Subject: [PATCH] media: i2c: imx290: Fix the pixel rate at 148.5Mpix/s
5
6 Whilst the datasheet lists the link frequency changing between
7 1080p and 720p modes, reality is that with the default blanking
8 we have
9 (1920 + 280) * (1080 + 45) * 60fps = 148.5MPix/s
10 and
11 (1280 + 2020) * (720 + 30) * 60fps = 148.5MPix/s
12 and this reflects reality whether in 10 or 12 bit readout modes.
13
14 How this relates to link frequency is unclear as it differs
15 from the datasheet, but all exposure and frame rate calcs need
16 the pixel rate to be correct, so make it so.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 ---
20 drivers/media/i2c/imx290.c | 16 +---------------
21 1 file changed, 1 insertion(+), 15 deletions(-)
22
23 --- a/drivers/media/i2c/imx290.c
24 +++ b/drivers/media/i2c/imx290.c
25 @@ -853,23 +853,9 @@ static inline u8 imx290_get_link_freq_in
26 return imx290->current_mode->link_freq_index;
27 }
28
29 -static s64 imx290_get_link_freq(struct imx290 *imx290)
30 -{
31 - u8 index = imx290_get_link_freq_index(imx290);
32 -
33 - return *(imx290_link_freqs_ptr(imx290) + index);
34 -}
35 -
36 static u64 imx290_calc_pixel_rate(struct imx290 *imx290)
37 {
38 - s64 link_freq = imx290_get_link_freq(imx290);
39 - u8 nlanes = imx290->nlanes;
40 - u64 pixel_rate;
41 -
42 - /* pixel rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
43 - pixel_rate = link_freq * 2 * nlanes;
44 - do_div(pixel_rate, imx290->bpp);
45 - return pixel_rate;
46 + return 148500000;
47 }
48
49 static int imx290_set_fmt(struct v4l2_subdev *sd,