Skip to content

Commit f58752e

Browse files
carvsdrivergregkh
authored andcommitted
USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10 INGENIC touchscreen
The Lenovo Yoga Book 9 14IAH10 (83KJ) has a composite USB device (17EF:6161) that controls both touchscreens via a CDC ACM interface. Interface 0 is a standard CDC ACM control interface, but interface 1 (the data interface) incorrectly declares vendor-specific class (0xFF) instead of USB_CLASS_CDC_DATA. cdc-acm rejects the device at probe with -EINVAL, leaving interface 0 unbound and EP 0x82 never polled. With no consumer polling EP 0x82, the firmware's watchdog fires every ~20 seconds and resets the USB bus, producing a continuous disconnect/ reconnect loop that prevents the touchscreens from ever initialising. Add two new quirk flags: VENDOR_CLASS_DATA_IFACE: Bypasses the bInterfaceClass check in acm_probe() that would otherwise reject the vendor-class data interface with -EINVAL. ALWAYS_POLL_CTRL: Submits the notification URB at probe() rather than waiting for a TTY open. This keeps EP 0x82 polled at all times, permanently suppressing the firmware watchdog. The URB is resubmitted after port_shutdown() and on system resume. SET_CONTROL_LINE_STATE (DTR|RTS) is sent at probe and after port_shutdown() to complete firmware handshake. Note: the firmware performs exactly 4 USB connect/disconnect cycles (~19 s each) on every cold boot before stabilising. This is a fixed firmware property; touch is available ~75-80 s after power-on. Signed-off-by: Dave Carey <carvsdriver@gmail.com> Cc: stable <stable@kernel.org> Tested-by: Dave Carey <carvsdriver@gmail.com> Acked-by: Oliver Neukum <oneukum@suse.com> Link: https://patch.msgid.link/20260402182950.389016-1-carvsdriver@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 609865a commit f58752e

1 file changed

Lines changed: 46 additions & 7 deletions

File tree

drivers/usb/class/cdc-acm.c

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value,
114114
int retval;
115115

116116
retval = usb_autopm_get_interface(acm->control);
117+
#define VENDOR_CLASS_DATA_IFACE BIT(9) /* data interface uses vendor-specific class */
118+
#define ALWAYS_POLL_CTRL BIT(10) /* keep ctrl URB active even without an open TTY */
117119
if (retval)
118120
return retval;
119121

@@ -710,12 +712,14 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty)
710712
set_bit(TTY_NO_WRITE_SPLIT, &tty->flags);
711713
acm->control->needs_remote_wakeup = 1;
712714

713-
acm->ctrlurb->dev = acm->dev;
714-
retval = usb_submit_urb(acm->ctrlurb, GFP_KERNEL);
715-
if (retval) {
716-
dev_err(&acm->control->dev,
717-
"%s - usb_submit_urb(ctrl irq) failed\n", __func__);
718-
goto error_submit_urb;
715+
if (!(acm->quirks & ALWAYS_POLL_CTRL)) {
716+
acm->ctrlurb->dev = acm->dev;
717+
retval = usb_submit_urb(acm->ctrlurb, GFP_KERNEL);
718+
if (retval) {
719+
dev_err(&acm->control->dev,
720+
"%s - usb_submit_urb(ctrl irq) failed\n", __func__);
721+
goto error_submit_urb;
722+
}
719723
}
720724

721725
acm_tty_set_termios(tty, NULL);
@@ -788,6 +792,14 @@ static void acm_port_shutdown(struct tty_port *port)
788792

789793
acm_unpoison_urbs(acm);
790794

795+
if (acm->quirks & ALWAYS_POLL_CTRL) {
796+
acm->ctrlurb->dev = acm->dev;
797+
if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL))
798+
dev_dbg(&acm->control->dev,
799+
"ctrl polling restart failed after port close\n");
800+
/* port_shutdown() cleared DTR/RTS; restore them */
801+
acm_set_control(acm, USB_CDC_CTRL_DTR | USB_CDC_CTRL_RTS);
802+
}
791803
}
792804

793805
static void acm_tty_cleanup(struct tty_struct *tty)
@@ -1328,6 +1340,9 @@ static int acm_probe(struct usb_interface *intf,
13281340
dev_dbg(&intf->dev,
13291341
"Your device has switched interfaces.\n");
13301342
swap(control_interface, data_interface);
1343+
} else if (quirks & VENDOR_CLASS_DATA_IFACE) {
1344+
dev_dbg(&intf->dev,
1345+
"Vendor-specific data interface class, continuing.\n");
13311346
} else {
13321347
return -EINVAL;
13331348
}
@@ -1522,6 +1537,9 @@ static int acm_probe(struct usb_interface *intf,
15221537
acm->line.bDataBits = 8;
15231538
acm_set_line(acm, &acm->line);
15241539

1540+
if (quirks & ALWAYS_POLL_CTRL)
1541+
acm_set_control(acm, USB_CDC_CTRL_DTR | USB_CDC_CTRL_RTS);
1542+
15251543
if (!acm->combined_interfaces) {
15261544
rv = usb_driver_claim_interface(&acm_driver, data_interface, acm);
15271545
if (rv)
@@ -1543,6 +1561,13 @@ static int acm_probe(struct usb_interface *intf,
15431561

15441562
dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor);
15451563

1564+
if (acm->quirks & ALWAYS_POLL_CTRL) {
1565+
acm->ctrlurb->dev = acm->dev;
1566+
if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL))
1567+
dev_warn(&intf->dev,
1568+
"failed to start persistent ctrl polling\n");
1569+
}
1570+
15461571
return 0;
15471572

15481573
err_release_data_interface:
@@ -1669,7 +1694,7 @@ static int acm_resume(struct usb_interface *intf)
16691694

16701695
acm_unpoison_urbs(acm);
16711696

1672-
if (tty_port_initialized(&acm->port)) {
1697+
if (tty_port_initialized(&acm->port) || (acm->quirks & ALWAYS_POLL_CTRL)) {
16731698
rv = usb_submit_urb(acm->ctrlurb, GFP_ATOMIC);
16741699

16751700
for (;;) {
@@ -2016,6 +2041,20 @@ static const struct usb_device_id acm_ids[] = {
20162041
/* CH343 supports CAP_BRK, but doesn't advertise it */
20172042
{ USB_DEVICE(0x1a86, 0x55d3), .driver_info = MISSING_CAP_BRK, },
20182043

2044+
/*
2045+
* Lenovo Yoga Book 9 14IAH10 (83KJ) — INGENIC 17EF:6161 touchscreen
2046+
* composite device. The CDC ACM control interface (0) uses a standard
2047+
* Union descriptor, but the data interface (1) is declared as vendor-
2048+
* specific class (0xff) with no CDC data descriptors, so cdc-acm would
2049+
* normally reject it. The firmware also requires continuous polling of
2050+
* the notification endpoint (EP 0x82) to suppress a 20-second watchdog
2051+
* reset; ALWAYS_POLL_CTRL keeps the ctrlurb active even when no TTY is
2052+
* open. Match only the control interface by class to avoid probing the
2053+
* vendor-specific data interface.
2054+
*/
2055+
{ USB_DEVICE_INTERFACE_CLASS(0x17ef, 0x6161, USB_CLASS_COMM),
2056+
.driver_info = VENDOR_CLASS_DATA_IFACE | ALWAYS_POLL_CTRL },
2057+
20192058
/* control interfaces without any protocol set */
20202059
{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
20212060
USB_CDC_PROTO_NONE) },

0 commit comments

Comments
 (0)