public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Stan Bertrand <stanislasbertrand@gmail.com>
To: Stan Bertrand <stanislasbertrand@gmail.com>,
	Johan Hovold <johan@kernel.org>
Cc: linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: serial: ftdi_sio: add ftdi serial to gpiochip label
Date: Mon, 01 Jan 2024 18:00:22 -0800	[thread overview]
Message-ID: <4193075.XuvPJYOev2@dl3541lx> (raw)
In-Reply-To: <ZXwmBxvQlxca8aNv@hovoldconsulting.com>

On Friday, December 15, 2023 2:10:15 AM PST Johan Hovold wrote:
> On Mon, Oct 02, 2023 at 05:11:35PM -0700, Stan Bertrand wrote:
> > From: Stanislas Bertrand <stanislasbertrand@gmail.com>
> > 
> > Use ftdi serial number on gpiochip label.
> > Allows to interface with gpiod utils using the serial number:
> > 
> > $ gpiodetect
> > gpiochip5 [ftdi-cbus-FTRelay2] (4 lines)
> > gpiochip6 [ftdi-cbus] (4 lines)
> > gpiochip7 [ftdi-cbus-A106TPEC] (4 lines)
> > 
> > $ gpioget ftdi-cbus-FTRelay2 2
> > 0
> 
> I don't think this is a good idea, for example, as not all devices have
> a unique serial string.

The goal is to identify the gpiochip corresponding to a known FTDI device.
If serials are not unique, it can still differentiate others.
A device serial can be set (FT Prog, Python lib, ...) for direct of access.

> Looks like the naming of gpiochips are all over the place, and ideally
> this should not have been something that was left up to individual
> driver to decide.
> 
> I see several drivers using the name of the corresponding platform
> device as label, which works in most cases, but not always either. The
> only unique and always available identifier is the gpiochip's place in
> the device tree itself.
> 
> For USB, we already encode the bus topology in the USB device names
> (e.g. 1-11.5.1) and we could possibly consider using that. But we
> already have USB serial devices with multiple GPIO chips so also that
> would require some further thought (e.g. using the interface name
> instead).

The aim is identification while being platform agnostic, device tree or x86.
The FTDI serial allows device identification regardless of the system topology.

> Johan

Thanks,
Stan



  reply	other threads:[~2024-01-02  2:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03  0:11 [PATCH] USB: serial: ftdi_sio: add ftdi serial to gpiochip label Stan Bertrand
2023-12-15 10:10 ` Johan Hovold
2024-01-02  2:00   ` Stan Bertrand [this message]
2024-01-02  8:50     ` Johan Hovold

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=4193075.XuvPJYOev2@dl3541lx \
    --to=stanislasbertrand@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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