From: Johan Hovold <johan@kernel.org>
To: Karoly Pados <pados@pados.hu>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Loic Poulain <loic.poulain@linaro.org>
Subject: [v4] USB: serial: ftdi_sio: implement GPIO support for FT-X devices
Date: Tue, 18 Sep 2018 11:45:15 +0200 [thread overview]
Message-ID: <20180918094515.GD3943@localhost> (raw)
On Tue, Sep 18, 2018 at 09:35:35AM +0000, Karoly Pados wrote:
> >> + goto out_free;
> >> +
> >> + /* Chip-type guessing logic based on libftdi. */
> >> + priv->gc.ngpio = 4; /* FT230X, FT231X */
> >> + if (le16_to_cpu(serial->dev->descriptor.bcdDevice) != 0x1000)
> >> + priv->gc.ngpio = 1; /* FT234XD */
> >
> > As I mentioned in my last mail: I've asked FTDI about this, but I fear
> > that FTX234XD has bcdDevice 0x1000 and we may need to just always
> > register all four pins after all.
> >
>
> To avoid missing 4.20, what is the latest time I should wait for FTDI's answer?
> Or should I just submit v5 as it is now and you'll incorporate FTDI's feedback
> when you receive it?
We'll get this into 4.20 either way, there's plenty of time. But I guess
we could play it safe and always register four pins, and if/when we get
more info about FT234XD we can implement registering just one pin in a
follow up patch.
Sounds good? If so I'll just merge your v5 (registering four pins) next
week.
> >> +static void ftdi_gpio_remove(struct usb_serial_port *port)
> >> +{
> >> + struct ftdi_private *priv = usb_get_serial_port_data(port);
> >> +
> >> + if (priv->gpio_used) {
> >> + /* Remark: Exiting CBUS-mode does not reset pin states too */
> >> + ftdi_exit_cbus_mode(port);
> >> + priv->gpio_used = false;
> >> + }
> >
> > This should go after deregistration or we have a tiny race window here.
>
> Can you elaborate on that to make sure I get it right?
> By "deregistration" do you mean deregistering the GPIO chip below in the same method?
Yes.
> Does that mean something can call into our module while this method is running?
> If not, I'm clueless about the possible race here.
Correct, you can get gpio callbacks until the gpio chip has been
deregistered (anything coming in after that would be a gpiolib bug).
Thanks,
Johan
next reply other threads:[~2018-09-18 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 9:45 Johan Hovold [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-09-18 11:19 [v4] USB: serial: ftdi_sio: implement GPIO support for FT-X devices Johan Hovold
2018-09-18 10:27 Karoly Pados
2018-09-18 9:35 Karoly Pados
2018-09-18 9:16 Johan Hovold
2018-09-16 17:58 Karoly Pados
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=20180918094515.GD3943@localhost \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=pados@pados.hu \
/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;
as well as URLs for NNTP newsgroup(s).