9751370e628169ed0e4def68b636dbbf33366668
[openwrt/staging/jow.git] /
1 From 741fb135f1f1746a9e20b6b2445a798c1a296b75 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Tue, 18 Jan 2022 13:13:14 +0000
4 Subject: [PATCH] drivers: bcm2835_unicam: Disable trigger mode
5 operation
6
7 On a Pi3 B/B+ platform the imx219 sensor frequently generates a single corrupt
8 frame when the sensor first starts. This can either be a missing line, or
9 invalid samples within the line. This only occurrs using the Unicam kernel
10 driver.
11
12 Disabling trigger mode elimiates this corruption. Since trigger mode is a
13 legacy feature copied from the firmware driver and not expected to be needed,
14 remove it. Tested on the Raspberry Pi cameras and shows no ill effects.
15
16 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
17 ---
18 drivers/media/platform/bcm2835/bcm2835-unicam.c | 14 +-------------
19 1 file changed, 1 insertion(+), 13 deletions(-)
20
21 --- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
22 +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
23 @@ -983,11 +983,6 @@ static irqreturn_t unicam_isr(int irq, v
24 }
25 }
26
27 - if (reg_read(unicam, UNICAM_ICTL) & UNICAM_FCM) {
28 - /* Switch out of trigger mode if selected */
29 - reg_write_field(unicam, UNICAM_ICTL, 1, UNICAM_TFC);
30 - reg_write_field(unicam, UNICAM_ICTL, 0, UNICAM_FCM);
31 - }
32 return IRQ_HANDLED;
33 }
34
35 @@ -2297,8 +2292,7 @@ static void unicam_start_rx(struct unica
36
37 reg_write_field(dev, UNICAM_ANA, 0, UNICAM_DDL);
38
39 - /* Always start in trigger frame capture mode (UNICAM_FCM set) */
40 - val = UNICAM_FSIE | UNICAM_FEIE | UNICAM_FCM | UNICAM_IBOB;
41 + val = UNICAM_FSIE | UNICAM_FEIE | UNICAM_IBOB;
42 set_field(&val, line_int_freq, UNICAM_LCIE_MASK);
43 reg_write(dev, UNICAM_ICTL, val);
44 reg_write(dev, UNICAM_STA, UNICAM_STA_MASK_ALL);
45 @@ -2411,12 +2405,6 @@ static void unicam_start_rx(struct unica
46 /* Load embedded data buffer pointers if needed */
47 if (dev->node[METADATA_PAD].streaming && dev->sensor_embedded_data)
48 reg_write_field(dev, UNICAM_DCS, 1, UNICAM_LDP);
49 -
50 - /*
51 - * Enable trigger only for the first frame to
52 - * sync correctly to the FS from the source.
53 - */
54 - reg_write_field(dev, UNICAM_ICTL, 1, UNICAM_TFC);
55 }
56
57 static void unicam_disable(struct unicam_device *dev)