Skip to contentSkip to conversation

staging: media/lirc: switch to use gpiolib

PATCH In review Linus Walleij 3 participants 6 messages Sep 10, 2013 – Sep 20, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

The lirc serial module has special hooks to work with NSLU2, switch these over to use gpiolib, as that is available on the ixp4 platform.

Not even compile tested as there is no way to select this driver from menuconfig on the ixp4 platform.

Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
Hi Greg: I'm seeking an ACK on this patch to take it through the GPIO tree as part of a clean-up attempt to remove custom GPIO APIs.

---
 drivers/staging/media/lirc/lirc_serial.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_serial.c +13 -3
index af08e67..f6bc4c9 100644
@@ -67,7 +67,7 @@
 #include <linux/delay.h>
 #include <linux/poll.h>
 #include <linux/platform_device.h>
-
+#include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/fcntl.h>
@@ -321,7 +321,7 @@ static void on(void)
 	 * status LED and ground
 	 */
 	if (type == LIRC_NSLU2) {
-		gpio_line_set(NSLU2_LED_GRN, IXP4XX_GPIO_LOW);
+		gpio_set_value(NSLU2_LED_GRN, 0);
 		return;
 	}
 #endif
@@ -335,7 +335,7 @@ static void off(void)
 {
 #ifdef CONFIG_LIRC_SERIAL_NSLU2
 	if (type == LIRC_NSLU2) {
-		gpio_line_set(NSLU2_LED_GRN, IXP4XX_GPIO_HIGH);
+		gpio_set_value(NSLU2_LED_GRN, 1);
 		return;
 	}
 #endif
@@ -839,6 +839,16 @@ static int lirc_serial_probe(struct platform_device *dev)
 {
 	int i, nlow, nhigh, result;
 
+#ifdef CONFIG_LIRC_SERIAL_NSLU2
+	/* This GPIO is used for a LED on the NSLU2 */
+	result = devm_gpio_request(dev, NSLU2_LED_GRN, "lirc-serial");
+	if (result)
+		return result;
+	result = gpio_direction_output(NSLU2_LED_GRN, 0);
+	if (result)
+		return result;
+#endif
+
 	result = request_irq(irq, irq_handler,
 			     (share_irq ? IRQF_SHARED : 0),
 			     LIRC_DRIVER_NAME, (void *)&hardware);
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

Quoted 12 lines · Linus Walleij

The lirc serial module has special hooks to work with NSLU2, switch these over to use gpiolib, as that is available on the ixp4 platform.

Not even compile tested as there is no way to select this driver from menuconfig on the ixp4 platform.

Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines

---
Hi Greg: I'm seeking an ACK on this patch to take it through the GPIO tree as part of a clean-up attempt to remove custom GPIO APIs.

I'm not the one responsible for drivers/staging/media/ sorry, that's Mauro.

greg k-h

#2 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

In reply to Linus Walleij

Hi Mauro,

Quoted 12 lines · Linus Walleij

The lirc serial module has special hooks to work with NSLU2, switch these over to use gpiolib, as that is available on the ixp4 platform.

Not even compile tested as there is no way to select this driver from menuconfig on the ixp4 platform.

Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines

---
Hi Greg: I'm seeking an ACK on this patch to take it through the GPIO tree as part of a clean-up attempt to remove custom GPIO APIs.

Could you ACK this patch if it looks OK to you?

Yours,
Linus Walleij

#3 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

Quoted 21 lines · Linus Walleij

Hi Mauro,

Quoted 12 lines · Linus Walleij

The lirc serial module has special hooks to work with NSLU2, switch these over to use gpiolib, as that is available on the ixp4 platform.

Not even compile tested as there is no way to select this driver from menuconfig on the ixp4 platform.

Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines

---
Hi Greg: I'm seeking an ACK on this patch to take it through the GPIO tree as part of a clean-up attempt to remove custom GPIO APIs.

Quoted 1 line

Could you ACK this patch if it looks OK to you?

Mauro, ping on this.

Yours,
Linus Walleij

#4 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

In reply to Linus Walleij

drivers/staging/media/lirc/lirc_serial.c static int lirc_serial_probe(struct platform_device *dev) · line 844

Quoted 8 lines · Linus Walleij

+++ b/drivers/staging/media/lirc/lirc_serial.c

drivers/staging/media/lirc/lirc_serial.c +3 -0
@@ -839,6 +839,16 @@ static int lirc_serial_probe(struct platform_device *dev)
 {
 	int i, nlow, nhigh, result;
 
+#ifdef CONFIG_LIRC_SERIAL_NSLU2
+	/* This GPIO is used for a LED on the NSLU2 */
+	result = devm_gpio_request(dev, NSLU2_LED_GRN, "lirc-serial");

Will this succeed with the LED driver already loaded? Should the user unload it first?

Otherwise, while I don't have any of the hw in question, I can't see other obvious problems, so for the whole patchset:

Signature · 1 line
Krzysztof Halasa
#5 lore raw

PATCH 5/7 staging: media/lirc: switch to use gpiolib

Quoted 7 lines · Krzysztof Halasa
Quoted 5 lines · Linus Walleij

+++ b/drivers/staging/media/lirc/lirc_serial.c

drivers/staging/media/lirc/lirc_serial.c +0 -0
@@ -839,6 +839,16 @@ static int lirc_serial_probe(struct platform_device *dev)
 {
      int i, nlow, nhigh, result;
 
Quoted 6 lines

drivers/staging/media/lirc/lirc_serial.c static int lirc_serial_probe(struct platform_device *dev) · line 844

Quoted 3 lines
drivers/staging/media/lirc/lirc_serial.c +3 -0
+#ifdef CONFIG_LIRC_SERIAL_NSLU2
+     /* This GPIO is used for a LED on the NSLU2 */
+     result = devm_gpio_request(dev, NSLU2_LED_GRN, "lirc-serial");

Will this succeed with the LED driver already loaded? Should the user unload it first?

Hm if this driver should use this as a LED it needs to register a trigger for that GPIO LED instead. A GPIO can not be used by two consumers at the same time...

Yours,
Linus Walleij