diff mbox

[5/7] staging: media/lirc: switch to use gpiolib

Message ID 1378816283-8164-1-git-send-email-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Linus Walleij Sept. 10, 2013, 12:31 p.m. UTC
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 <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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(-)

Comments

Greg Kroah-Hartman Sept. 12, 2013, 10:18 p.m. UTC | #1
On Tue, Sep 10, 2013 at 02:31:23PM +0200, Linus Walleij wrote:
> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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
Linus Walleij Sept. 13, 2013, 7:14 a.m. UTC | #2
Hi Mauro,

On Tue, Sep 10, 2013 at 2:31 PM, Linus Walleij <linus.walleij@linaro.org> wrote:

> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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
Krzysztof Halasa Sept. 13, 2013, 12:15 p.m. UTC | #3
Linus Walleij <linus.walleij@linaro.org> writes:

> +++ b/drivers/staging/media/lirc/lirc_serial.c
> @@ -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:

Acked-by: Krzysztof Halasa <khc@pm.waw.pl>
Linus Walleij Sept. 20, 2013, 7:24 p.m. UTC | #4
On Fri, Sep 13, 2013 at 9:14 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> Hi Mauro,
>
> On Tue, Sep 10, 2013 at 2:31 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>
>> 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 <kaloz@openwrt.org>
>> Cc: Krzysztof Halasa <khc@pm.waw.pl>
>> Cc: Alexandre Courbot <acourbot@nvidia.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> ---
>> 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?

Mauro, ping on this.

Yours,
Linus Walleij
Linus Walleij Sept. 20, 2013, 7:28 p.m. UTC | #5
On Fri, Sep 13, 2013 at 2:15 PM, Krzysztof Halasa <khc@pm.waw.pl> wrote:

> Linus Walleij <linus.walleij@linaro.org> writes:
>
>> +++ b/drivers/staging/media/lirc/lirc_serial.c
>> @@ -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?

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
diff mbox

Patch

diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index af08e67..f6bc4c9 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -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);