linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FT232H user space GPIO device
@ 2020-03-22 19:40 Ryan Lovelett
  2020-03-23  6:52 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Ryan Lovelett @ 2020-03-22 19:40 UTC (permalink / raw)
  To: linux-serial

I have been trying to find a way to get my Adafruit FT232H breakout
board [1] to appear as a user space GPIO device so I can use it with
libgpiod. As far as I can tell from reading table 3.5 from the
datasheet [2] ACBUS5, ACBUS6, ACBUS8 and ACBUS9 should all be usable
for this.

I found a patch that was submitted by Karoly Pados in 2018 [3] that
seemes to add support for that (though maybe only for a specific chip).

Through a little bit of ftrace and printk I realized that the switch
statement in ftdi_gpio_init was falling through to the default case for
the FT232H [4].

I'd like to see if an expert on these mailing lists can help me to
understand if what I'm trying to achieve is possible. If so, to learn
how I might go about getting it working. My current guess is that I
need to implement a new ftdi_gpio_init_ft232h method and possibly the
modify the ftdi_read_eeprom method. But I'm not really sure.

Regards,
Ryan Lovelett

[1] https://www.adafruit.com/product/2264

[2] 
https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf

[3] https://patchwork.kernel.org/patch/10614055/

[4] 
https://github.com/torvalds/linux/blob/v5.3/drivers/usb/serial/ftdi_sio.c#L2100-L2109


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FT232H user space GPIO device
  2020-03-22 19:40 FT232H user space GPIO device Ryan Lovelett
@ 2020-03-23  6:52 ` Greg KH
  2020-03-23 13:00   ` Ryan Lovelett
  2020-03-24  9:28   ` Johan Hovold
  0 siblings, 2 replies; 5+ messages in thread
From: Greg KH @ 2020-03-23  6:52 UTC (permalink / raw)
  To: Ryan Lovelett; +Cc: linux-serial

On Sun, Mar 22, 2020 at 03:40:33PM -0400, Ryan Lovelett wrote:
> I have been trying to find a way to get my Adafruit FT232H breakout
> board [1] to appear as a user space GPIO device so I can use it with
> libgpiod. As far as I can tell from reading table 3.5 from the
> datasheet [2] ACBUS5, ACBUS6, ACBUS8 and ACBUS9 should all be usable
> for this.
> 
> I found a patch that was submitted by Karoly Pados in 2018 [3] that
> seemes to add support for that (though maybe only for a specific chip).
> 
> Through a little bit of ftrace and printk I realized that the switch
> statement in ftdi_gpio_init was falling through to the default case for
> the FT232H [4].

So it sounds like you have the wrong device type.  Can you make sure you
use the latest kernel release (5.5) and if you have problems with this,
email the linux-usb mailing list as the driver maintainers for that
driver are there.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FT232H user space GPIO device
  2020-03-23  6:52 ` Greg KH
@ 2020-03-23 13:00   ` Ryan Lovelett
  2020-03-24  9:28   ` Johan Hovold
  1 sibling, 0 replies; 5+ messages in thread
From: Ryan Lovelett @ 2020-03-23 13:00 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial

On Mon, 2020-03-23 at 07:52 +0100, Greg KH wrote:
> So it sounds like you have the wrong device type.

What makes it sound that way to you? The priv->chip_type is returning 8
which according to the ftdi_chip_type enum in ftdi_sio.h is the case
for FT232H. My layperson understanding of that would say that the
chip_type is being detected correctly.

I want to be clear, I do not think your wrong. Clearly I am wrong and
drawing the wrong conclusion. I am just trying to understand how you
know I am getting the wrong device type because it is not obvious to
me.

> Can you make sure you use the latest kernel release (5.5) and if you
> have problems with this, email the linux-usb mailing list as the
> driver maintainers for that driver are there.

I am cloning the kernel source now and am going to start compiling it
shortly.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FT232H user space GPIO device
  2020-03-23  6:52 ` Greg KH
  2020-03-23 13:00   ` Ryan Lovelett
@ 2020-03-24  9:28   ` Johan Hovold
  2020-03-24 12:38     ` Ryan Lovelett
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2020-03-24  9:28 UTC (permalink / raw)
  To: Greg KH; +Cc: Ryan Lovelett, linux-serial

On Mon, Mar 23, 2020 at 07:52:11AM +0100, Greg Kroah-Hartman wrote:
> On Sun, Mar 22, 2020 at 03:40:33PM -0400, Ryan Lovelett wrote:
> > I have been trying to find a way to get my Adafruit FT232H breakout
> > board [1] to appear as a user space GPIO device so I can use it with
> > libgpiod. As far as I can tell from reading table 3.5 from the
> > datasheet [2] ACBUS5, ACBUS6, ACBUS8 and ACBUS9 should all be usable
> > for this.
> > 
> > I found a patch that was submitted by Karoly Pados in 2018 [3] that
> > seemes to add support for that (though maybe only for a specific chip).
> > 
> > Through a little bit of ftrace and printk I realized that the switch
> > statement in ftdi_gpio_init was falling through to the default case for
> > the FT232H [4].
> 
> So it sounds like you have the wrong device type.  Can you make sure you
> use the latest kernel release (5.5) and if you have problems with this,
> email the linux-usb mailing list as the driver maintainers for that
> driver are there.

As Greg suggested you need to update your kernel as GPIO support for
FT232H went into 5.4.

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FT232H user space GPIO device
  2020-03-24  9:28   ` Johan Hovold
@ 2020-03-24 12:38     ` Ryan Lovelett
  0 siblings, 0 replies; 5+ messages in thread
From: Ryan Lovelett @ 2020-03-24 12:38 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Greg KH, linux-serial

On Tue, 2020-03-24 at 10:28 +0100, Johan Hovold wrote:
> As Greg suggested you need to update your kernel as GPIO support for
> FT232H went into 5.4.

I did as Greg suggested and went to 5.5 and everything was working. But
with this hint I was able to find the actual commit that added support
[1].

Thank you all.

[1] 
https://github.com/torvalds/linux/commit/7a786b84790789eff5bad49e3f6c15f75b7bf691


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-24 12:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 19:40 FT232H user space GPIO device Ryan Lovelett
2020-03-23  6:52 ` Greg KH
2020-03-23 13:00   ` Ryan Lovelett
2020-03-24  9:28   ` Johan Hovold
2020-03-24 12:38     ` Ryan Lovelett

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).