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: [v5] USB: serial: ftdi_sio: implement GPIO support for FT-X devices
Date: Mon, 24 Sep 2018 10:47:56 +0200 [thread overview]
Message-ID: <20180924084756.GD5101@localhost> (raw)
On Sun, Sep 23, 2018 at 06:03:30PM +0200, Karoly Pados wrote:
> This patch allows using the CBUS pins of FT-X devices as GPIO in CBUS
> bitbanging mode. There is no conflict between the GPIO and VCP
> functionality in this mode. Tested on FT230X and FT231X.
>
> As there is no way to request the current CBUS register configuration
> from the device, all CBUS pins are set to a known state when the first
> GPIO is requested. This allows using libftdi to set the GPIO pins
> before loading this module for UART functionality, a behavior that
> existing applications might be relying upon (though no specific case
> is known to the authors of this patch).
>
> Signed-off-by: Karoly Pados <pados@pados.hu>
> ---
> Changelog:
> - v2: Fix compile error when CONFIG_GPIOLIB is not defined.
> - v3: Incorporate review feedback.
> - v4: Include linux/gpio/driver.h unconditionally.
> Replace and invert gpio_input with gpio_output.
> Make ftdi_gpio_direction_get return 0/1.
> Change dev_err msg in ftdi_set_bitmode_req.
> Change formatting of error checking in ftdi_gpio_get.
> Drop dev_err in ftdi_gpio_set.
> Remove some line breaks and empty lines.
> Change error handling in ftdi_read_eeprom (and adjust caller).
> Replace SIO->FTX in FTDI_SIO_CBUS_MUX_GPIO macro name.
> - v5: Read only 4 bytes from eeprom in ftx_gpioconf_init.
> Compare ftdi_read_eeprom result with 0 instead of eq. cehck.
> Reserve 4 GPIOs even for FT234X.
> Release CBUS after gpiochip deregister to avoid possible race.
> Adjust comment on FTDI_SIO_SET_BITMODE macro.
> Protect GPIO value/dir setting with mutex.
This patch doesn't add any locking so I'm assuming you posted the wrong
version of the patch.
> Add support for gpiochip.get_multiple and set_multiple.
> Add names to GPIO lines.
I'll wait for v6.
Thanks,
Johan
WARNING: multiple messages have this Message-ID (diff)
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: Re: [PATCH v5] USB: serial: ftdi_sio: implement GPIO support for FT-X devices
Date: Mon, 24 Sep 2018 10:47:56 +0200 [thread overview]
Message-ID: <20180924084756.GD5101@localhost> (raw)
In-Reply-To: <20180923160330.2184-1-pados@pados.hu>
On Sun, Sep 23, 2018 at 06:03:30PM +0200, Karoly Pados wrote:
> This patch allows using the CBUS pins of FT-X devices as GPIO in CBUS
> bitbanging mode. There is no conflict between the GPIO and VCP
> functionality in this mode. Tested on FT230X and FT231X.
>
> As there is no way to request the current CBUS register configuration
> from the device, all CBUS pins are set to a known state when the first
> GPIO is requested. This allows using libftdi to set the GPIO pins
> before loading this module for UART functionality, a behavior that
> existing applications might be relying upon (though no specific case
> is known to the authors of this patch).
>
> Signed-off-by: Karoly Pados <pados@pados.hu>
> ---
> Changelog:
> - v2: Fix compile error when CONFIG_GPIOLIB is not defined.
> - v3: Incorporate review feedback.
> - v4: Include linux/gpio/driver.h unconditionally.
> Replace and invert gpio_input with gpio_output.
> Make ftdi_gpio_direction_get return 0/1.
> Change dev_err msg in ftdi_set_bitmode_req.
> Change formatting of error checking in ftdi_gpio_get.
> Drop dev_err in ftdi_gpio_set.
> Remove some line breaks and empty lines.
> Change error handling in ftdi_read_eeprom (and adjust caller).
> Replace SIO->FTX in FTDI_SIO_CBUS_MUX_GPIO macro name.
> - v5: Read only 4 bytes from eeprom in ftx_gpioconf_init.
> Compare ftdi_read_eeprom result with 0 instead of eq. cehck.
> Reserve 4 GPIOs even for FT234X.
> Release CBUS after gpiochip deregister to avoid possible race.
> Adjust comment on FTDI_SIO_SET_BITMODE macro.
> Protect GPIO value/dir setting with mutex.
This patch doesn't add any locking so I'm assuming you posted the wrong
version of the patch.
> Add support for gpiochip.get_multiple and set_multiple.
> Add names to GPIO lines.
I'll wait for v6.
Thanks,
Johan
next reply other threads:[~2018-09-24 8:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 8:47 Johan Hovold [this message]
2018-09-24 8:47 ` [PATCH v5] USB: serial: ftdi_sio: implement GPIO support for FT-X devices Johan Hovold
-- strict thread matches above, loose matches on Subject: below --
2018-09-24 12:37 [v5] " Johan Hovold
2018-09-24 12:37 ` [PATCH v5] " Johan Hovold
2018-09-24 11:52 [v5] " Karoly Pados
2018-09-24 11:52 ` [PATCH v5] " Karoly Pados
2018-09-23 16:03 [v5] " Karoly Pados
2018-09-23 16:03 ` [PATCH v5] " 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=20180924084756.GD5101@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.