summaryrefslogtreecommitdiff
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorDan Drown <dan-netdev@drown.org>2023-08-05 21:26:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-08 10:36:05 +0200
commit3b563b901eefb47ce27a9897dea2739abe70ee5a (patch)
tree2942064adfb19e67a26866df0001ec2adf044444 /drivers/usb/class
parentd9216d3ef538c32a7e413f3401cd6b606b81a708 (diff)
downloadlwn-3b563b901eefb47ce27a9897dea2739abe70ee5a.tar.gz
lwn-3b563b901eefb47ce27a9897dea2739abe70ee5a.zip
usb: cdc-acm: add PPS support
This patch adds support for PPS to CDC devices. Changes to the DCD pin are monitored and passed to the ldisc system, which is used by pps-ldisc. Signed-off-by: Dan Drown <dan-netdev@drown.org> Link: https://lore.kernel.org/r/ZM8ExV6bAvJtIA1d@vps3.drown.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/cdc-acm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 11da5fb284d0..9b34199474c4 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -28,6 +28,7 @@
#include <linux/serial.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
+#include <linux/tty_ldisc.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
@@ -324,8 +325,17 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf)
if (difference & USB_CDC_SERIAL_STATE_DSR)
acm->iocount.dsr++;
- if (difference & USB_CDC_SERIAL_STATE_DCD)
+ if (difference & USB_CDC_SERIAL_STATE_DCD) {
+ if (acm->port.tty) {
+ struct tty_ldisc *ld = tty_ldisc_ref(acm->port.tty);
+ if (ld) {
+ if (ld->ops->dcd_change)
+ ld->ops->dcd_change(acm->port.tty, newctrl & USB_CDC_SERIAL_STATE_DCD);
+ tty_ldisc_deref(ld);
+ }
+ }
acm->iocount.dcd++;
+ }
if (newctrl & USB_CDC_SERIAL_STATE_BREAK) {
acm->iocount.brk++;
tty_insert_flip_char(&acm->port, 0, TTY_BREAK);