Skip to content

Commit 3b563b9

Browse files
Dan Drowngregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d9216d3 commit 3b563b9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/usb/class/cdc-acm.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/serial.h>
2929
#include <linux/tty_driver.h>
3030
#include <linux/tty_flip.h>
31+
#include <linux/tty_ldisc.h>
3132
#include <linux/module.h>
3233
#include <linux/mutex.h>
3334
#include <linux/uaccess.h>
@@ -324,8 +325,17 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf)
324325

325326
if (difference & USB_CDC_SERIAL_STATE_DSR)
326327
acm->iocount.dsr++;
327-
if (difference & USB_CDC_SERIAL_STATE_DCD)
328+
if (difference & USB_CDC_SERIAL_STATE_DCD) {
329+
if (acm->port.tty) {
330+
struct tty_ldisc *ld = tty_ldisc_ref(acm->port.tty);
331+
if (ld) {
332+
if (ld->ops->dcd_change)
333+
ld->ops->dcd_change(acm->port.tty, newctrl & USB_CDC_SERIAL_STATE_DCD);
334+
tty_ldisc_deref(ld);
335+
}
336+
}
328337
acm->iocount.dcd++;
338+
}
329339
if (newctrl & USB_CDC_SERIAL_STATE_BREAK) {
330340
acm->iocount.brk++;
331341
tty_insert_flip_char(&acm->port, 0, TTY_BREAK);

0 commit comments

Comments
 (0)