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
7 drivers/staging/media/lirc/lirc_rpi.c | 17 +++++++++++------
8 1 file changed, 11 insertions(+), 6 deletions(-)
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;
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) {
25 - gpiochip->set(gpiochip, gpio_out_pin, 0);
26 + gpiochip->set(gpiochip, gpio_out_pin, invert);
27 target += space_width;
29 - gpiochip->set(gpiochip, gpio_out_pin, 1);
30 + gpiochip->set(gpiochip, gpio_out_pin, !invert);
31 target += pulse_width;
33 d = (target - actual -
34 @@ -162,7 +164,7 @@ static long send_pulse(unsigned long len
36 return send_pulse_softcarrier(length);
38 - gpiochip->set(gpiochip, gpio_out_pin, 1);
39 + gpiochip->set(gpiochip, gpio_out_pin, !invert);
43 @@ -170,7 +172,7 @@ static long send_pulse(unsigned long len
45 static void send_space(long length)
47 - gpiochip->set(gpiochip, gpio_out_pin, 0);
48 + gpiochip->set(gpiochip, gpio_out_pin, invert);
52 @@ -318,7 +320,7 @@ static int init_port(void)
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);
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
63 delta = send_pulse(wbuf[i]);
65 - gpiochip->set(gpiochip, gpio_out_pin, 0);
66 + gpiochip->set(gpiochip, gpio_out_pin, invert);
68 spin_unlock_irqrestore(&lock, flags);
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)");
74 +module_param(invert, bool, S_IRUGO);
75 +MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off");
77 module_param(debug, bool, S_IRUGO | S_IWUSR);
78 MODULE_PARM_DESC(debug, "Enable debugging messages");