d10a41d3e6556fb7b9c42d35127ee132236755e3
[openwrt/staging/blogic.git] /
1 From 70198f4ed03a3df670d5e12ab78bb3c4c2520396 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 @@ -984,11 +984,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 @@ -2298,8 +2293,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 @@ -2412,12 +2406,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)