* [PATCH] USB: serial: Support attaching serdev devices
@ 2026-09-17 8:11 Alban Bedel
2026-09-17 8:27 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Alban Bedel @ 2026-09-17 8:11 UTC (permalink / raw)
To: linux-kernel, linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold, Alban Bedel
Use tty_port_register_device_serdev() to allow attaching serdev
devices to USB serial ports. Also set the ACPI companion device on the
USB serial device to let the serdev matching work on ACPI systems.
Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
---
drivers/usb/serial/bus.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 9e2a18c0b2183..0b0a5ea1ba5aa 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -6,6 +6,7 @@
*/
#include <linux/kernel.h>
+#include <linux/acpi.h>
#include <linux/errno.h>
#include <linux/tty.h>
#include <linux/slab.h>
@@ -49,9 +50,13 @@ static int usb_serial_device_probe(struct device *dev)
goto err_autopm_put;
}
+ ACPI_COMPANION_SET(dev, ACPI_COMPANION(&port->serial->dev->dev));
+
minor = port->minor;
- tty_dev = tty_port_register_device(&port->port, usb_serial_tty_driver,
- minor, dev);
+ tty_dev = tty_port_register_device_serdev(&port->port,
+ usb_serial_tty_driver,
+ minor, dev,
+ &port->serial->dev->dev);
if (IS_ERR(tty_dev)) {
retval = PTR_ERR(tty_dev);
goto err_port_remove;
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: serial: Support attaching serdev devices
2026-09-17 8:11 [PATCH] USB: serial: Support attaching serdev devices Alban Bedel
@ 2026-09-17 8:27 ` Greg Kroah-Hartman
2026-09-17 13:37 ` Alban Bedel
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2026-09-17 8:27 UTC (permalink / raw)
To: Alban Bedel; +Cc: linux-kernel, linux-usb, Johan Hovold
On Thu, Sep 17, 2026 at 10:11:03AM +0200, Alban Bedel wrote:
> Use tty_port_register_device_serdev() to allow attaching serdev
> devices to USB serial ports. Also set the ACPI companion device on the
> USB serial device to let the serdev matching work on ACPI systems.
"also" should be a separate patch, right?
And I didn't think that serdev could handle devices going away at any
point in time, when did that change? How was this all tested and what
ACPI device wants to use this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: serial: Support attaching serdev devices
2026-09-17 8:27 ` Greg Kroah-Hartman
@ 2026-09-17 13:37 ` Alban Bedel
2026-09-17 14:08 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Alban Bedel @ 2026-09-17 13:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb, Johan Hovold, Alban Bedel
On Thu, 17 Sep 2026 09:27:42 +0100
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Thu, Sep 17, 2026 at 10:11:03AM +0200, Alban Bedel wrote:
> > Use tty_port_register_device_serdev() to allow attaching serdev
> > devices to USB serial ports. Also set the ACPI companion device on the
> > USB serial device to let the serdev matching work on ACPI systems.
>
> "also" should be a separate patch, right?
Will do.
> And I didn't think that serdev could handle devices going away at any
> point in time, when did that change? How was this all tested and what
> ACPI device wants to use this?
The use case here is an x86 embedded platform with a soldered USB serial
adapter connecting to a MAX9265 GMSL serializer. As everything is on a
single PCB there is no question of anything getting disconnected at
runtime.
But I now see that I missed that the bus remove also need to be
adjusted to use tty_port_unregister_device() instead of
tty_unregister_device(). With that done the serdev device get properly
taken down when I manually disable the port. With a small fix to the
serdev core it also comes back up when the port is enabled again.
The ACPI part is a custom DSDT overlay that defines the chain
starting from the USB port. At this level there is no difference to
classic UART where serdev are already working.
Alban
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: serial: Support attaching serdev devices
2026-09-17 13:37 ` Alban Bedel
@ 2026-09-17 14:08 ` Greg Kroah-Hartman
2026-09-17 15:21 ` Alban Bedel
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2026-09-17 14:08 UTC (permalink / raw)
To: Alban Bedel; +Cc: linux-kernel, linux-usb, Johan Hovold
On Thu, Sep 17, 2026 at 03:37:36PM +0200, Alban Bedel wrote:
> On Thu, 17 Sep 2026 09:27:42 +0100
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> > On Thu, Sep 17, 2026 at 10:11:03AM +0200, Alban Bedel wrote:
> > > Use tty_port_register_device_serdev() to allow attaching serdev
> > > devices to USB serial ports. Also set the ACPI companion device on the
> > > USB serial device to let the serdev matching work on ACPI systems.
> >
> > "also" should be a separate patch, right?
>
> Will do.
>
> > And I didn't think that serdev could handle devices going away at any
> > point in time, when did that change? How was this all tested and what
> > ACPI device wants to use this?
>
> The use case here is an x86 embedded platform with a soldered USB serial
> adapter connecting to a MAX9265 GMSL serializer. As everything is on a
> single PCB there is no question of anything getting disconnected at
> runtime.
You hope :)
> But I now see that I missed that the bus remove also need to be
> adjusted to use tty_port_unregister_device() instead of
> tty_unregister_device(). With that done the serdev device get properly
> taken down when I manually disable the port. With a small fix to the
> serdev core it also comes back up when the port is enabled again.
Please read the archives for why we don't want to do this unless/until
serdev is "fixed" to properly handle dynamic device removals.
> The ACPI part is a custom DSDT overlay that defines the chain
> starting from the USB port. At this level there is no difference to
> classic UART where serdev are already working.
So acpi now defines USB to serial devices? Is that new?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: serial: Support attaching serdev devices
2026-09-17 14:08 ` Greg Kroah-Hartman
@ 2026-09-17 15:21 ` Alban Bedel
0 siblings, 0 replies; 5+ messages in thread
From: Alban Bedel @ 2026-09-17 15:21 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb, Johan Hovold, Alban Bedel
On Thu, 17 Sep 2026 15:08:11 +0100
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Thu, Sep 17, 2026 at 03:37:36PM +0200, Alban Bedel wrote:
> > On Thu, 17 Sep 2026 09:27:42 +0100
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >
> > > On Thu, Sep 17, 2026 at 10:11:03AM +0200, Alban Bedel wrote:
> > > > Use tty_port_register_device_serdev() to allow attaching serdev
> > > > devices to USB serial ports. Also set the ACPI companion device on the
> > > > USB serial device to let the serdev matching work on ACPI systems.
> > >
> > > "also" should be a separate patch, right?
> >
> > Will do.
> >
> > > And I didn't think that serdev could handle devices going away at any
> > > point in time, when did that change? How was this all tested and what
> > > ACPI device wants to use this?
> >
> > The use case here is an x86 embedded platform with a soldered USB serial
> > adapter connecting to a MAX9265 GMSL serializer. As everything is on a
> > single PCB there is no question of anything getting disconnected at
> > runtime.
>
> You hope :)
Obviously anything can fail, but I don't see why that should be treated
differently than an UART connected via PCI or LPC. The link could also
fail anytime.
> > But I now see that I missed that the bus remove also need to be
> > adjusted to use tty_port_unregister_device() instead of
> > tty_unregister_device(). With that done the serdev device get properly
> > taken down when I manually disable the port. With a small fix to the
> > serdev core it also comes back up when the port is enabled again.
>
> Please read the archives for why we don't want to do this unless/until
> serdev is "fixed" to properly handle dynamic device removals.
All I could find is the "USB-Serial serdev support" thread from last
year which sadly doesn't provides much details. Like Marco Felsch back
then I tested disabling/enabling the USB port and didn't have any
issue, the serdev device get removed and added back just fine. In my
case the serdev driver provides an I2C bus, all devices on it get
removed and added back again as well and work just fine.
I really fail to see an issue in pratice, would you care to explain
what I'm missing here?
> > The ACPI part is a custom DSDT overlay that defines the chain
> > starting from the USB port. At this level there is no difference to
> > classic UART where serdev are already working.
>
> So acpi now defines USB to serial devices? Is that new?
UARTSerialBusV2() is there to define devices using an UART, the
specification doesn't mention any limitation on the kind of UART it can
be pointed at. What is the issue here?
Alban
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-17 15:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 8:11 [PATCH] USB: serial: Support attaching serdev devices Alban Bedel
2026-09-17 8:27 ` Greg Kroah-Hartman
2026-09-17 13:37 ` Alban Bedel
2026-09-17 14:08 ` Greg Kroah-Hartman
2026-09-17 15:21 ` Alban Bedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®