Lines Matching +full:break +full:- +full:control
1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2010-2013 Johan Hovold (jhovold@gmail.com)
10 * Greg Kroah-Hartman (greg@kroah.com)
155 const struct usb_device_id *id = usb_get_serial_data(port->serial); in spcp8x5_port_probe()
160 return -ENOMEM; in spcp8x5_port_probe()
162 spin_lock_init(&priv->lock); in spcp8x5_port_probe()
163 priv->quirks = id->driver_info; in spcp8x5_port_probe()
167 port->port.drain_delay = 256; in spcp8x5_port_probe()
183 struct usb_device *dev = port->serial->dev; in spcp8x5_set_ctrl_line()
186 if (priv->quirks & SPCP825_QUIRK_NO_UART_STATUS) in spcp8x5_set_ctrl_line()
187 return -EPERM; in spcp8x5_set_ctrl_line()
193 dev_err(&port->dev, "failed to set control lines: %d\n", in spcp8x5_set_ctrl_line()
202 struct usb_device *dev = port->serial->dev; in spcp8x5_get_msr()
206 if (priv->quirks & SPCP825_QUIRK_NO_UART_STATUS) in spcp8x5_get_msr()
207 return -EPERM; in spcp8x5_get_msr()
211 return -ENOMEM; in spcp8x5_get_msr()
217 dev_err(&port->dev, "failed to get modem status: %d\n", ret); in spcp8x5_get_msr()
219 ret = -EIO; in spcp8x5_get_msr()
223 dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x\n", ret, *buf); in spcp8x5_get_msr()
236 struct usb_device *dev = port->serial->dev; in spcp8x5_set_work_mode()
239 if (priv->quirks & SPCP825_QUIRK_NO_WORK_MODE) in spcp8x5_set_work_mode()
245 dev_dbg(&port->dev, "value = %#x , index = %#x\n", value, index); in spcp8x5_set_work_mode()
247 dev_err(&port->dev, "failed to set work mode: %d\n", ret); in spcp8x5_set_work_mode()
266 u8 control; in spcp8x5_dtr_rts() local
268 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_dtr_rts()
270 priv->line_control = MCR_CONTROL_LINE_DTR in spcp8x5_dtr_rts()
273 priv->line_control &= ~ (MCR_CONTROL_LINE_DTR in spcp8x5_dtr_rts()
275 control = priv->line_control; in spcp8x5_dtr_rts()
276 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_dtr_rts()
277 spcp8x5_set_ctrl_line(port, control); in spcp8x5_dtr_rts()
289 struct usb_serial *serial = port->serial; in spcp8x5_set_termios()
292 unsigned int cflag = tty->termios.c_cflag; in spcp8x5_set_termios()
297 u8 control; in spcp8x5_set_termios() local
300 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) in spcp8x5_set_termios()
304 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_set_termios()
305 control = priv->line_control; in spcp8x5_set_termios()
306 if (old_termios && (old_termios->c_cflag & CBAUD) == B0) { in spcp8x5_set_termios()
307 priv->line_control |= MCR_DTR; in spcp8x5_set_termios()
308 if (!(old_termios->c_cflag & CRTSCTS)) in spcp8x5_set_termios()
309 priv->line_control |= MCR_RTS; in spcp8x5_set_termios()
311 if (control != priv->line_control) { in spcp8x5_set_termios()
312 control = priv->line_control; in spcp8x5_set_termios()
313 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_set_termios()
314 spcp8x5_set_ctrl_line(port, control); in spcp8x5_set_termios()
316 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_set_termios()
322 case 300: buf[0] = 0x00; break; in spcp8x5_set_termios()
323 case 600: buf[0] = 0x01; break; in spcp8x5_set_termios()
324 case 1200: buf[0] = 0x02; break; in spcp8x5_set_termios()
325 case 2400: buf[0] = 0x03; break; in spcp8x5_set_termios()
326 case 4800: buf[0] = 0x04; break; in spcp8x5_set_termios()
327 case 9600: buf[0] = 0x05; break; in spcp8x5_set_termios()
328 case 19200: buf[0] = 0x07; break; in spcp8x5_set_termios()
329 case 38400: buf[0] = 0x09; break; in spcp8x5_set_termios()
330 case 57600: buf[0] = 0x0a; break; in spcp8x5_set_termios()
331 case 115200: buf[0] = 0x0b; break; in spcp8x5_set_termios()
332 case 230400: buf[0] = 0x0c; break; in spcp8x5_set_termios()
333 case 460800: buf[0] = 0x0d; break; in spcp8x5_set_termios()
334 case 921600: buf[0] = 0x0e; break; in spcp8x5_set_termios()
335 /* case 1200000: buf[0] = 0x0f; break; */ in spcp8x5_set_termios()
336 /* case 2400000: buf[0] = 0x10; break; */ in spcp8x5_set_termios()
337 case 3000000: buf[0] = 0x11; break; in spcp8x5_set_termios()
338 /* case 6000000: buf[0] = 0x12; break; */ in spcp8x5_set_termios()
341 buf[0] = 0x0b; break; in spcp8x5_set_termios()
343 dev_err(&port->dev, "unsupported baudrate, using 9600\n"); in spcp8x5_set_termios()
350 break; in spcp8x5_set_termios()
353 break; in spcp8x5_set_termios()
356 break; in spcp8x5_set_termios()
360 break; in spcp8x5_set_termios()
367 /* Set Parity bit3-4 01:Odd 11:Even */ in spcp8x5_set_termios()
376 i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in spcp8x5_set_termios()
380 dev_err(&port->dev, "Set UART format %#x failed (error = %d)\n", in spcp8x5_set_termios()
382 dev_dbg(&port->dev, "0x21:0x40:0:0 %d\n", i); in spcp8x5_set_termios()
385 /* enable hardware flow control */ in spcp8x5_set_termios()
392 struct usb_serial *serial = port->serial; in spcp8x5_open()
396 usb_clear_halt(serial->dev, port->write_urb->pipe); in spcp8x5_open()
397 usb_clear_halt(serial->dev, port->read_urb->pipe); in spcp8x5_open()
399 ret = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in spcp8x5_open()
405 spcp8x5_set_ctrl_line(port, priv->line_control); in spcp8x5_open()
416 struct usb_serial_port *port = tty->driver_data; in spcp8x5_tiocmset()
419 u8 control; in spcp8x5_tiocmset() local
421 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_tiocmset()
423 priv->line_control |= MCR_RTS; in spcp8x5_tiocmset()
425 priv->line_control |= MCR_DTR; in spcp8x5_tiocmset()
427 priv->line_control &= ~MCR_RTS; in spcp8x5_tiocmset()
429 priv->line_control &= ~MCR_DTR; in spcp8x5_tiocmset()
430 control = priv->line_control; in spcp8x5_tiocmset()
431 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_tiocmset()
433 return spcp8x5_set_ctrl_line(port, control); in spcp8x5_tiocmset()
438 struct usb_serial_port *port = tty->driver_data; in spcp8x5_tiocmget()
449 spin_lock_irqsave(&priv->lock, flags); in spcp8x5_tiocmget()
450 mcr = priv->line_control; in spcp8x5_tiocmget()
451 spin_unlock_irqrestore(&priv->lock, flags); in spcp8x5_tiocmget()