Lines Matching +full:clip +full:- +full:x +full:- +full:low

1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 2000-2001 Greg Kroah-Hartman (greg@kroah.com)
9 * This program is largely derived from work by the linux-usb group
13 * See Documentation/usb/usb-serial.rst for more information on using this
17 * -- Add true modem control line query capability. Currently we track the
19 * -- Add support for flush commands
108 #define BSA_USB_CMD(c, v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \
114 struct usb_device *dev = port->serial->dev; in belkin_sa_port_probe()
119 return -ENOMEM; in belkin_sa_port_probe()
121 spin_lock_init(&priv->lock); in belkin_sa_port_probe()
122 priv->control_state = 0; in belkin_sa_port_probe()
123 priv->last_lsr = 0; in belkin_sa_port_probe()
124 priv->last_msr = 0; in belkin_sa_port_probe()
126 priv->bad_flow_control = in belkin_sa_port_probe()
127 (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0; in belkin_sa_port_probe()
128 dev_info(&dev->dev, "bcdDevice: %04x, bfc: %d\n", in belkin_sa_port_probe()
129 le16_to_cpu(dev->descriptor.bcdDevice), in belkin_sa_port_probe()
130 priv->bad_flow_control); in belkin_sa_port_probe()
150 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); in belkin_sa_open()
152 dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); in belkin_sa_open()
158 usb_kill_urb(port->interrupt_in_urb); in belkin_sa_open()
166 usb_kill_urb(port->interrupt_in_urb); in belkin_sa_close()
171 struct usb_serial_port *port = urb->context; in belkin_sa_read_int_callback()
173 unsigned char *data = urb->transfer_buffer; in belkin_sa_read_int_callback()
175 int status = urb->status; in belkin_sa_read_int_callback()
182 case -ECONNRESET: in belkin_sa_read_int_callback()
183 case -ENOENT: in belkin_sa_read_int_callback()
184 case -ESHUTDOWN: in belkin_sa_read_int_callback()
186 dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n", in belkin_sa_read_int_callback()
190 dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n", in belkin_sa_read_int_callback()
195 usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data); in belkin_sa_read_int_callback()
201 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_read_int_callback()
202 priv->last_msr = data[BELKIN_SA_MSR_INDEX]; in belkin_sa_read_int_callback()
205 if (priv->last_msr & BELKIN_SA_MSR_DSR) in belkin_sa_read_int_callback()
206 priv->control_state |= TIOCM_DSR; in belkin_sa_read_int_callback()
208 priv->control_state &= ~TIOCM_DSR; in belkin_sa_read_int_callback()
210 if (priv->last_msr & BELKIN_SA_MSR_CTS) in belkin_sa_read_int_callback()
211 priv->control_state |= TIOCM_CTS; in belkin_sa_read_int_callback()
213 priv->control_state &= ~TIOCM_CTS; in belkin_sa_read_int_callback()
215 if (priv->last_msr & BELKIN_SA_MSR_RI) in belkin_sa_read_int_callback()
216 priv->control_state |= TIOCM_RI; in belkin_sa_read_int_callback()
218 priv->control_state &= ~TIOCM_RI; in belkin_sa_read_int_callback()
220 if (priv->last_msr & BELKIN_SA_MSR_CD) in belkin_sa_read_int_callback()
221 priv->control_state |= TIOCM_CD; in belkin_sa_read_int_callback()
223 priv->control_state &= ~TIOCM_CD; in belkin_sa_read_int_callback()
225 priv->last_lsr = data[BELKIN_SA_LSR_INDEX]; in belkin_sa_read_int_callback()
226 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_read_int_callback()
230 dev_err(&port->dev, "%s - usb_submit_urb failed with " in belkin_sa_read_int_callback()
236 struct usb_serial_port *port = urb->context; in belkin_sa_process_read_urb()
238 unsigned char *data = urb->transfer_buffer; in belkin_sa_process_read_urb()
246 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_process_read_urb()
247 status = priv->last_lsr; in belkin_sa_process_read_urb()
248 priv->last_lsr &= ~BELKIN_SA_LSR_ERR; in belkin_sa_process_read_urb()
249 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_process_read_urb()
251 if (!urb->actual_length) in belkin_sa_process_read_urb()
263 dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); in belkin_sa_process_read_urb()
267 tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); in belkin_sa_process_read_urb()
270 tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, in belkin_sa_process_read_urb()
271 urb->actual_length); in belkin_sa_process_read_urb()
272 tty_flip_buffer_push(&port->port); in belkin_sa_process_read_urb()
279 struct usb_serial *serial = port->serial; in belkin_sa_set_termios()
290 struct ktermios *termios = &tty->termios; in belkin_sa_set_termios()
292 iflag = termios->c_iflag; in belkin_sa_set_termios()
293 cflag = termios->c_cflag; in belkin_sa_set_termios()
295 termios->c_cflag &= ~CMSPAR; in belkin_sa_set_termios()
298 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_set_termios()
299 control_state = priv->control_state; in belkin_sa_set_termios()
300 bad_flow_control = priv->bad_flow_control; in belkin_sa_set_termios()
301 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_set_termios()
303 old_iflag = old_termios->c_iflag; in belkin_sa_set_termios()
304 old_cflag = old_termios->c_cflag; in belkin_sa_set_termios()
312 dev_err(&port->dev, "Set DTR error\n"); in belkin_sa_set_termios()
317 dev_err(&port->dev, "Set RTS error\n"); in belkin_sa_set_termios()
324 /* Clip to maximum speed */ in belkin_sa_set_termios()
333 dev_err(&port->dev, "Set baudrate error\n"); in belkin_sa_set_termios()
338 dev_err(&port->dev, "Disable flowcontrol error\n"); in belkin_sa_set_termios()
342 dev_err(&port->dev, "DTR LOW error\n"); in belkin_sa_set_termios()
344 dev_err(&port->dev, "RTS LOW error\n"); in belkin_sa_set_termios()
355 dev_err(&port->dev, "Set parity error\n"); in belkin_sa_set_termios()
362 dev_err(&port->dev, "Set data bits error\n"); in belkin_sa_set_termios()
371 dev_err(&port->dev, "Set stop bits error\n"); in belkin_sa_set_termios()
392 dev_err(&port->dev, "Set flow control error\n"); in belkin_sa_set_termios()
396 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_set_termios()
397 priv->control_state = control_state; in belkin_sa_set_termios()
398 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_set_termios()
403 struct usb_serial_port *port = tty->driver_data; in belkin_sa_break_ctl()
404 struct usb_serial *serial = port->serial; in belkin_sa_break_ctl()
409 dev_err(&port->dev, "Set break_ctl %d\n", break_state); in belkin_sa_break_ctl()
418 struct usb_serial_port *port = tty->driver_data; in belkin_sa_tiocmget()
423 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_tiocmget()
424 control_state = priv->control_state; in belkin_sa_tiocmget()
425 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_tiocmget()
433 struct usb_serial_port *port = tty->driver_data; in belkin_sa_tiocmset()
434 struct usb_serial *serial = port->serial; in belkin_sa_tiocmset()
442 spin_lock_irqsave(&priv->lock, flags); in belkin_sa_tiocmset()
443 control_state = priv->control_state; in belkin_sa_tiocmset()
462 priv->control_state = control_state; in belkin_sa_tiocmset()
463 spin_unlock_irqrestore(&priv->lock, flags); in belkin_sa_tiocmset()
467 dev_err(&port->dev, "Set RTS error %d\n", retval); in belkin_sa_tiocmset()
473 dev_err(&port->dev, "Set DTR error %d\n", retval); in belkin_sa_tiocmset()