Skip to content

Commit

Permalink
usb: cdc-acm: add PPS support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Drown authored and Greg Kroah-Hartman committed Aug 8, 2023
1 parent d9216d3 commit 3b563b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3b563b9

Please sign in to comment.