Re: [PATCH v8 1/2] usb: serial: add support for CH348

From: Johan Hovold
Date: Fri Jul 25 2025 - 06:17:48 EST


On Wed, Jul 16, 2025 at 11:31:49AM +0200, Martin Blumenstingl wrote:
> On Wed, Jul 16, 2025 at 10:57 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> > And are you trying to only have one set of urbs out for any port being
> > opened (i.e. you only have one control, one read, and one write urb for
> > the whole device, and the port info are multiplexed over these urbs? Or
> > do you have one endpoint per port?)

> CH348 provides up to 8 serial ports using these four endpoints, so
> multiplexing is going on:
> - one bulk out for TX (see struct ch348_txbuf)
> - one bulk in for RX (see struct ch348_rxbuf)
> - one bulk out for CONFIG handling (see struct ch348_config_buf)
> - one bulk in for STATUS handling (see struct ch348_status_entry)
>
> > If you are sharing endpoints, try looking at one of the other usb-serial
> > drivers that do this today, like io_edgeport.c, that has had shared
> > endpoints for 25 years, it's not a new thing :)

> My understanding is that io_edgeport is submits the URBs that are
> shared across ports outside of .open/.close.
> So this will be a question for Johan: am I still good with the
> original approach - or can you convince Greg that a different approach
> is better?

It's definitely better not to waste power when the device is plugged in
but not in use. :)

Take a look at f81534 for an example of how this can be implemented.

Johan