From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Wang YanQing <udknight@gmail.com>
Cc: gregkh@linuxfoundation.org, linus.walleij@linaro.org,
jhovold@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb:serial:pl2303: add GPIOs interface on PL2303
Date: Wed, 23 Jul 2014 17:03:14 +0100 [thread overview]
Message-ID: <20140723170314.23864779@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <20140720063841.GA28059@udknight>
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -28,6 +28,9 @@
> #include <linux/usb.h>
> #include <linux/usb/serial.h>
> #include <asm/unaligned.h>
> +#ifdef CONFIG_USB_SERIAL_PL2303_GPIO
> +#include <linux/gpio.h>
> +#endif
> #include "pl2303.h"
Just include the file anyway it does no harm
>
>
> @@ -143,9 +146,27 @@ struct pl2303_type_data {
> unsigned long quirks;
> };
>
> +#ifdef CONFIG_USB_SERIAL_PL2303_GPIO
> +struct pl2303_gpio {
> + /*
> + * 0..3: unknown (zero)
> + * 4: gp0 output enable (1: gp0 pin is output, 0: gp0 pin is input)
> + * 5: gp1 output enable (1: gp1 pin is output, 0: gp1 pin is input)
> + * 6: gp0 pin value
> + * 7: gp1 pin value
> + */
> + u8 index;
> + struct usb_serial *serial;
> + struct gpio_chip gpio_chip;
> +};
> +#endif
Declaring the struct anyway does no harm
> struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
>
> +#ifdef CONFIG_USB_SERIAL_PL2303_GPIO
> + if (spriv && spriv->gpio) {
Can spriv ever be NULL - how would that occur?
> + if (gpiochip_remove(&spriv->gpio->gpio_chip))
> + dev_err(&serial->interface->dev, "unable to remove gpio_chip?\n");
> + kfree(spriv->gpio);
> + }
> +#endif
> kfree(spriv);
Only other question I have - if I have multiple PL2303HX adapters how
will I work out which GPIO lines belong to which /dev/ttyUSB* interface ?
Do we need a way to actually ask the serial port for its GPIO range ?
next prev parent reply other threads:[~2014-07-23 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-20 6:38 Wang YanQing
2014-07-20 9:19 ` Daniele Forsi
2014-07-23 16:03 ` One Thousand Gnomes [this message]
2014-07-23 16:21 ` Greg KH
2014-07-24 9:34 ` One Thousand Gnomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140723170314.23864779@alan.etchedpixels.co.uk \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jhovold@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=udknight@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®