brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/dedeckeh.git] / target / linux / brcm2708 / patches-4.4 / 0429-fix-auto-sense-in-lirc_rpi-driver.patch
1 From 7e5bbf1a74ec6bbaa25fe6cadf715946e3e4d692 Mon Sep 17 00:00:00 2001
2 From: Ingo Kresse <ingo.kresse@gmail.com>
3 Date: Fri, 29 Jul 2016 22:50:21 +0000
4 Subject: [PATCH] fix auto-sense in lirc_rpi driver
5
6 On a Raspberry Pi 2, the lirc_rpi driver might receive spurious
7 interrupts and change it's low-active / high-active setting.
8 When this happens, the IR remote control stops working.
9
10 This patch disables this auto-detection if the 'sense' parameter
11 was set in the device tree, making the driver robust to such
12 spurious interrupts.
13 ---
14 drivers/staging/media/lirc/lirc_rpi.c | 6 +++++-
15 1 file changed, 5 insertions(+), 1 deletion(-)
16
17 --- a/drivers/staging/media/lirc/lirc_rpi.c
18 +++ b/drivers/staging/media/lirc/lirc_rpi.c
19 @@ -79,6 +79,7 @@ static bool invert = 0;
20
21 struct gpio_chip *gpiochip;
22 static int irq_num;
23 +static int auto_sense = 1;
24
25 /* forward declarations */
26 static long send_pulse(unsigned long length);
27 @@ -279,7 +280,9 @@ static irqreturn_t irq_handler(int i, vo
28 * detecting pulse while this
29 * MUST be a space!
30 */
31 - sense = sense ? 0 : 1;
32 + if (auto_sense) {
33 + sense = sense ? 0 : 1;
34 + }
35 }
36 } else {
37 data = (int) (deltv*1000000 +
38 @@ -417,6 +420,7 @@ static int init_port(void)
39 printk(KERN_INFO LIRC_DRIVER_NAME
40 ": manually using active %s receiver on GPIO pin %d\n",
41 sense ? "low" : "high", gpio_in_pin);
42 + auto_sense = 0;
43 }
44
45 return 0;