brcm2708: update against latest rpi-3.10.y branch
[openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0051-Added-inverted-transmitter-support.patch
1 From f1f13a6b3798161ccc3852320bd2184b85c9209b Mon Sep 17 00:00:00 2001
2 From: pjennings <pjennings-git@pjennings.net>
3 Date: Wed, 20 Feb 2013 17:51:43 -0600
4 Subject: [PATCH 051/174] Added inverted transmitter support
5
6 ---
7  drivers/staging/media/lirc/lirc_rpi.c | 17 +++++++++++------
8  1 file changed, 11 insertions(+), 6 deletions(-)
9
10 --- a/drivers/staging/media/lirc/lirc_rpi.c
11 +++ b/drivers/staging/media/lirc/lirc_rpi.c
12 @@ -68,6 +68,8 @@ static int debug;
13  static int sense = -1;
14  /* use softcarrier by default */
15  static int softcarrier = 1;
16 +/* 0 = do not invert output, 1 = invert output */
17 +static int invert = 0;
18  
19  struct gpio_chip *gpiochip;
20  struct irq_chip *irqchip;
21 @@ -135,10 +137,10 @@ static long send_pulse_softcarrier(unsig
22         actual = 0; target = 0; flag = 0;
23         while (actual < length) {
24                 if (flag) {
25 -                       gpiochip->set(gpiochip, gpio_out_pin, 0);
26 +                       gpiochip->set(gpiochip, gpio_out_pin, invert);
27                         target += space_width;
28                 } else {
29 -                       gpiochip->set(gpiochip, gpio_out_pin, 1);
30 +                       gpiochip->set(gpiochip, gpio_out_pin, !invert);
31                         target += pulse_width;
32                 }
33                 d = (target - actual -
34 @@ -162,7 +164,7 @@ static long send_pulse(unsigned long len
35         if (softcarrier) {
36                 return send_pulse_softcarrier(length);
37         } else {
38 -               gpiochip->set(gpiochip, gpio_out_pin, 1);
39 +               gpiochip->set(gpiochip, gpio_out_pin, !invert);
40                 safe_udelay(length);
41                 return 0;
42         }
43 @@ -170,7 +172,7 @@ static long send_pulse(unsigned long len
44  
45  static void send_space(long length)
46  {
47 -       gpiochip->set(gpiochip, gpio_out_pin, 0);
48 +       gpiochip->set(gpiochip, gpio_out_pin, invert);
49         if (length <= 0)
50                 return;
51         safe_udelay(length);
52 @@ -318,7 +320,7 @@ static int init_port(void)
53  
54         gpiochip->direction_input(gpiochip, gpio_in_pin);
55         gpiochip->direction_output(gpiochip, gpio_out_pin, 1);
56 -       gpiochip->set(gpiochip, gpio_out_pin, 0);
57 +       gpiochip->set(gpiochip, gpio_out_pin, invert);
58  
59         irq = gpiochip->to_irq(gpiochip, gpio_in_pin);
60         dprintk("to_irq %d\n", irq);
61 @@ -457,7 +459,7 @@ static ssize_t lirc_write(struct file *f
62                 else
63                         delta = send_pulse(wbuf[i]);
64         }
65 -       gpiochip->set(gpiochip, gpio_out_pin, 0);
66 +       gpiochip->set(gpiochip, gpio_out_pin, invert);
67  
68         spin_unlock_irqrestore(&lock, flags);
69         kfree(wbuf);
70 @@ -683,5 +685,8 @@ MODULE_PARM_DESC(sense, "Override autode
71  module_param(softcarrier, bool, S_IRUGO);
72  MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)");
73  
74 +module_param(invert, bool, S_IRUGO);
75 +MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off");
76 +
77  module_param(debug, bool, S_IRUGO | S_IWUSR);
78  MODULE_PARM_DESC(debug, "Enable debugging messages");