Lines Matching +full:serial +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0+
3 * spcp8x5 USB to serial adaptor driver
5 * Copyright (C) 2010-2013 Johan Hovold (jhovold@gmail.com)
10 * Greg Kroah-Hartman (greg@kroah.com)
22 #include <linux/usb/serial.h>
24 #define DRIVER_DESC "SPCP8x5 USB to serial adaptor driver"
135 static int spcp8x5_probe(struct usb_serial *serial, in spcp8x5_probe() argument
136 const struct usb_device_id *id) in spcp8x5_probe() argument
138 usb_set_serial_data(serial, (void *)id); in spcp8x5_probe()
145 const struct usb_device_id *id = usb_get_serial_data(port->serial); in spcp8x5_port_probe() local
150 return -ENOMEM; in spcp8x5_port_probe()
152 spin_lock_init(&priv->lock); in spcp8x5_port_probe()
153 priv->quirks = id->driver_info; in spcp8x5_port_probe()
157 port->port.drain_delay = 256; in spcp8x5_port_probe()
173 struct usb_device *dev = port->serial->dev; in spcp8x5_set_ctrl_line()
176 if (priv->quirks & SPCP825_QUIRK_NO_UART_STATUS) in spcp8x5_set_ctrl_line()
177 return -EPERM; in spcp8x5_set_ctrl_line()
183 dev_err(&port->dev, "failed to set control lines: %d\n", in spcp8x5_set_ctrl_line()
192 struct usb_device *dev = port->serial->dev; in spcp8x5_get_msr()
196 if (priv->quirks & SPCP825_QUIRK_NO_UART_STATUS) in spcp8x5_get_msr()
197 return -EPERM; in spcp8x5_get_msr()
201 return -ENOMEM; in spcp8x5_get_msr()
207 dev_err(&port->dev, "failed to get modem status: %d\n", ret); in spcp8x5_get_msr()
209 ret = -EIO; in spcp8x5_get_msr()
213 dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x\n", ret, *buf); in spcp8x5_get_msr()
226 struct usb_device *dev = port->serial->dev; in spcp8x5_set_work_mode()
229 if (priv->quirks & SPCP825_QUIRK_NO_WORK_MODE) in spcp8x5_set_work_mode()
235 dev_dbg(&port->dev, "value = %#x , index = %#x\n", value, index); in spcp8x5_set_work_mode()
237 dev_err(&port->dev, "failed to set work mode: %d\n", ret); in spcp8x5_set_work_mode()
258 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_dtr_rts()
260 priv->line_control = MCR_CONTROL_LINE_DTR in spcp8x5_dtr_rts()
263 priv->line_control &= ~ (MCR_CONTROL_LINE_DTR in spcp8x5_dtr_rts()
265 control = priv->line_control; in spcp8x5_dtr_rts()
266 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_dtr_rts()
279 struct usb_serial *serial = port->serial; in spcp8x5_set_termios() local
282 unsigned int cflag = tty->termios.c_cflag; in spcp8x5_set_termios()
290 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) in spcp8x5_set_termios()
294 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_set_termios()
295 control = priv->line_control; in spcp8x5_set_termios()
296 if (old_termios && (old_termios->c_cflag & CBAUD) == B0) { in spcp8x5_set_termios()
297 priv->line_control |= MCR_DTR; in spcp8x5_set_termios()
298 if (!(old_termios->c_cflag & CRTSCTS)) in spcp8x5_set_termios()
299 priv->line_control |= MCR_RTS; in spcp8x5_set_termios()
301 if (control != priv->line_control) { in spcp8x5_set_termios()
302 control = priv->line_control; in spcp8x5_set_termios()
303 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_set_termios()
306 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_set_termios()
333 dev_err(&port->dev, "unsupported baudrate, using 9600\n"); in spcp8x5_set_termios()
357 /* Set Parity bit3-4 01:Odd 11:Even */ in spcp8x5_set_termios()
366 i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in spcp8x5_set_termios()
370 dev_err(&port->dev, "Set UART format %#x failed (error = %d)\n", in spcp8x5_set_termios()
372 dev_dbg(&port->dev, "0x21:0x40:0:0 %d\n", i); in spcp8x5_set_termios()
382 struct usb_serial *serial = port->serial; in spcp8x5_open() local
386 usb_clear_halt(serial->dev, port->write_urb->pipe); in spcp8x5_open()
387 usb_clear_halt(serial->dev, port->read_urb->pipe); in spcp8x5_open()
389 ret = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in spcp8x5_open()
395 spcp8x5_set_ctrl_line(port, priv->line_control); in spcp8x5_open()
406 struct usb_serial_port *port = tty->driver_data; in spcp8x5_tiocmset()
411 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_tiocmset()
413 priv->line_control |= MCR_RTS; in spcp8x5_tiocmset()
415 priv->line_control |= MCR_DTR; in spcp8x5_tiocmset()
417 priv->line_control &= ~MCR_RTS; in spcp8x5_tiocmset()
419 priv->line_control &= ~MCR_DTR; in spcp8x5_tiocmset()
420 control = priv->line_control; in spcp8x5_tiocmset()
421 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_tiocmset()
428 struct usb_serial_port *port = tty->driver_data; in spcp8x5_tiocmget()
439 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_tiocmget()
440 mcr = priv->line_control; in spcp8x5_tiocmget()
441 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_tiocmget()