0428-fix-auto-sense-in-lirc_rpi-driver.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 413e42754e61620eb75e0bd632c697b89ff0ffb9 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. On a Raspberry Pi 2, the lirc_rpi driver might receive spurious
  6. interrupts and change it's low-active / high-active setting.
  7. When this happens, the IR remote control stops working.
  8. This patch disables this auto-detection if the 'sense' parameter
  9. was set in the device tree, making the driver robust to such
  10. spurious interrupts.
  11. ---
  12. drivers/staging/media/lirc/lirc_rpi.c | 6 +++++-
  13. 1 file changed, 5 insertions(+), 1 deletion(-)
  14. --- a/drivers/staging/media/lirc/lirc_rpi.c
  15. +++ b/drivers/staging/media/lirc/lirc_rpi.c
  16. @@ -79,6 +79,7 @@ static bool invert = 0;
  17. struct gpio_chip *gpiochip;
  18. static int irq_num;
  19. +static int auto_sense = 1;
  20. /* forward declarations */
  21. static long send_pulse(unsigned long length);
  22. @@ -279,7 +280,9 @@ static irqreturn_t irq_handler(int i, vo
  23. * detecting pulse while this
  24. * MUST be a space!
  25. */
  26. - sense = sense ? 0 : 1;
  27. + if (auto_sense) {
  28. + sense = sense ? 0 : 1;
  29. + }
  30. }
  31. } else {
  32. data = (int) (deltv*1000000 +
  33. @@ -417,6 +420,7 @@ static int init_port(void)
  34. printk(KERN_INFO LIRC_DRIVER_NAME
  35. ": manually using active %s receiver on GPIO pin %d\n",
  36. sense ? "low" : "high", gpio_in_pin);
  37. + auto_sense = 0;
  38. }
  39. return 0;