Lines Matching +full:cable +full:- +full:modem

1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 2010-2021 Johan Hovold (johan@kernel.org)
10 * control thanks to Munir Nassar nassarmu@real-time.com
55 { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */
56 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
57 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
58 { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
61 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
63 { USB_DEVICE(0x0908, 0x0070) }, /* Siemens SCALANCE LPE-9000 USB Serial Console */
67 { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
72 { USB_DEVICE(0x0FDE, 0xCA05) }, /* OWL Wireless Electricity Monitor CM-160 */
74 { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */
75 { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */
76 { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */
80 { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */
81 { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */
83 { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */
87 { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
88 { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */
100 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
101 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
111 { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
112 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
113 { USB_DEVICE(0x10C4, 0x81D7) }, /* IAI Corp. RCB-CV-USB USB to RS485 Adaptor */
114 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
118 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
119 { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */
123 { USB_DEVICE(0x10C4, 0x82AA) }, /* Silicon Labs IFS-USB-DATACABLE used with Quint UPS */
129 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
132 { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */
135 { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */
136 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
144 { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
145 { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
147 { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
148 { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
149 { USB_DEVICE(0x10C4, 0x87ED) }, /* IMST USB-Stick for Smart Meter */
150 { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */
163 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
169 { USB_DEVICE(0x10C4, 0xEA63) }, /* Silicon Labs Windows Update (CP2101-4/CP2102N) */
171 { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
178 { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */
179 { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
183 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
185 { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
186 { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */
187 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
188 { USB_DEVICE(0x166A, 0x0304) }, /* Clipsal 5000CT2 C-Bus Black and White Touchscreen */
189 { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */
190 { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */
191 { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */
195 { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
196 …{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Powe…
197 { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */
198 …{ USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Lo…
199 { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
200 { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
203 { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */
204 { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */
206 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
207 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
218 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */
220 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
223 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
225 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
246 { USB_DEVICE(0x2184, 0x0030) }, /* GW Instek GDM-834x Digital Multimeter */
248 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
249 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
250 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
448 * CP210X_PURGE - 16 bits passed in wValue of USB request.
575 …* See https://www.silabs.com/documents/public/application-notes/an978-cp210x-usb-to-uart-api-speci…
630 cur_altsetting = serial->interface->cur_altsetting; in cp210x_interface_num()
632 return cur_altsetting->desc.bInterfaceNumber; in cp210x_interface_num()
636 * Reads a variable-sized block of CP210X_ registers, identified by req.
642 struct usb_serial *serial = port->serial; in cp210x_read_reg_block()
647 result = usb_control_msg_recv(serial->dev, 0, req, in cp210x_read_reg_block()
649 port_priv->bInterfaceNumber, buf, bufsize, in cp210x_read_reg_block()
652 dev_err(&port->dev, "failed get req 0x%x size %d status: %d\n", in cp210x_read_reg_block()
661 * Reads any 8-bit CP210X_ register identified by req.
669 * Reads a variable-sized vendor block of CP210X_ registers, identified by val.
677 result = usb_control_msg_recv(serial->dev, 0, CP210X_VENDOR_SPECIFIC, in cp210x_read_vendor_block()
681 dev_err(&serial->interface->dev, in cp210x_read_vendor_block()
691 * Writes any 16-bit CP210X_ register (req) whose value is passed
696 struct usb_serial *serial = port->serial; in cp210x_write_u16_reg()
700 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in cp210x_write_u16_reg()
702 port_priv->bInterfaceNumber, NULL, 0, in cp210x_write_u16_reg()
705 dev_err(&port->dev, "failed set request 0x%x status: %d\n", in cp210x_write_u16_reg()
713 * Writes a variable-sized block of CP210X_ registers, identified by req.
719 struct usb_serial *serial = port->serial; in cp210x_write_reg_block()
723 result = usb_control_msg_send(serial->dev, 0, req, in cp210x_write_reg_block()
725 port_priv->bInterfaceNumber, buf, bufsize, in cp210x_write_reg_block()
728 dev_err(&port->dev, "failed set req 0x%x size %d status: %d\n", in cp210x_write_reg_block()
737 * Writes any 32-bit CP210X_ register identified by req.
750 * Writes a variable-sized vendor block of CP210X_ registers, identified by val.
758 result = usb_control_msg_send(serial->dev, 0, CP210X_VENDOR_SPECIFIC, in cp210x_write_vendor_block()
762 dev_err(&serial->interface->dev, in cp210x_write_vendor_block()
779 dev_err(&port->dev, "%s - Unable to enable UART\n", __func__); in cp210x_open()
794 port_priv->event_mode = false; in cp210x_open()
810 /* Disabling the interface disables event-insertion mode. */ in cp210x_close()
811 port_priv->event_mode = false; in cp210x_close()
817 port->icount.brk++; in cp210x_process_lsr()
820 port->icount.parity++; in cp210x_process_lsr()
823 port->icount.frame++; in cp210x_process_lsr()
828 port->icount.overrun++; in cp210x_process_lsr()
829 tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); in cp210x_process_lsr()
837 switch (port_priv->event_state) { in cp210x_process_char()
840 port_priv->event_state = ES_ESCAPE; in cp210x_process_char()
847 dev_dbg(&port->dev, "%s - escape char\n", __func__); in cp210x_process_char()
849 port_priv->event_state = ES_DATA; in cp210x_process_char()
852 port_priv->event_state = ES_LSR_DATA_0; in cp210x_process_char()
855 port_priv->event_state = ES_LSR; in cp210x_process_char()
858 port_priv->event_state = ES_MSR; in cp210x_process_char()
861 dev_err(&port->dev, "malformed event 0x%02x\n", *ch); in cp210x_process_char()
862 port_priv->event_state = ES_DATA; in cp210x_process_char()
867 port_priv->lsr = *ch; in cp210x_process_char()
868 port_priv->event_state = ES_LSR_DATA_1; in cp210x_process_char()
871 dev_dbg(&port->dev, "%s - lsr = 0x%02x, data = 0x%02x\n", in cp210x_process_char()
872 __func__, port_priv->lsr, *ch); in cp210x_process_char()
873 cp210x_process_lsr(port, port_priv->lsr, flag); in cp210x_process_char()
874 port_priv->event_state = ES_DATA; in cp210x_process_char()
877 dev_dbg(&port->dev, "%s - lsr = 0x%02x\n", __func__, *ch); in cp210x_process_char()
878 port_priv->lsr = *ch; in cp210x_process_char()
879 cp210x_process_lsr(port, port_priv->lsr, flag); in cp210x_process_char()
880 port_priv->event_state = ES_DATA; in cp210x_process_char()
883 dev_dbg(&port->dev, "%s - msr = 0x%02x\n", __func__, *ch); in cp210x_process_char()
885 port_priv->event_state = ES_DATA; in cp210x_process_char()
894 struct usb_serial_port *port = urb->context; in cp210x_process_read_urb()
896 unsigned char *ch = urb->transfer_buffer; in cp210x_process_read_urb()
900 if (!urb->actual_length) in cp210x_process_read_urb()
903 if (port_priv->event_mode) { in cp210x_process_read_urb()
904 for (i = 0; i < urb->actual_length; i++, ch++) { in cp210x_process_read_urb()
910 tty_insert_flip_char(&port->port, *ch, flag); in cp210x_process_read_urb()
913 tty_insert_flip_string(&port->port, ch, urb->actual_length); in cp210x_process_read_urb()
915 tty_flip_buffer_push(&port->port); in cp210x_process_read_urb()
924 struct usb_serial *serial = port->serial; in cp210x_get_tx_queue_byte_count()
929 result = usb_control_msg_recv(serial->dev, 0, CP210X_GET_COMM_STATUS, in cp210x_get_tx_queue_byte_count()
931 port_priv->bInterfaceNumber, &sts, sizeof(sts), in cp210x_get_tx_queue_byte_count()
934 dev_err(&port->dev, "failed to get comm status: %d\n", result); in cp210x_get_tx_queue_byte_count()
1051 struct usb_serial *serial = port->serial; in cp210x_change_speed()
1055 if (tty->termios.c_ospeed == 0) in cp210x_change_speed()
1062 baud = clamp(tty->termios.c_ospeed, priv->min_speed, priv->max_speed); in cp210x_change_speed()
1064 if (priv->use_actual_rate) in cp210x_change_speed()
1069 dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud); in cp210x_change_speed()
1071 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud); in cp210x_change_speed()
1073 baud = old_termios->c_ospeed; in cp210x_change_speed()
1083 struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); in cp210x_enable_event_mode()
1087 if (port_priv->event_mode) in cp210x_enable_event_mode()
1090 if (priv->no_event_mode) in cp210x_enable_event_mode()
1093 port_priv->event_state = ES_DATA; in cp210x_enable_event_mode()
1094 port_priv->event_mode = true; in cp210x_enable_event_mode()
1098 dev_err(&port->dev, "failed to enable events: %d\n", ret); in cp210x_enable_event_mode()
1099 port_priv->event_mode = false; in cp210x_enable_event_mode()
1108 if (!port_priv->event_mode) in cp210x_disable_event_mode()
1113 dev_err(&port->dev, "failed to disable events: %d\n", ret); in cp210x_disable_event_mode()
1117 port_priv->event_mode = false; in cp210x_disable_event_mode()
1124 iflag_change = ((a->c_iflag ^ b->c_iflag) & (INPCK | IXON | IXOFF)); in cp210x_termios_change()
1125 cc_change = a->c_cc[VSTART] != b->c_cc[VSTART] || in cp210x_termios_change()
1126 a->c_cc[VSTOP] != b->c_cc[VSTOP]; in cp210x_termios_change()
1135 struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); in cp210x_set_flow_control()
1148 if (priv->no_flow_control) { in cp210x_set_flow_control()
1149 tty->termios.c_cflag &= ~CRTSCTS; in cp210x_set_flow_control()
1150 tty->termios.c_iflag &= ~(IXON | IXOFF); in cp210x_set_flow_control()
1153 if (tty->termios.c_ospeed != 0 && in cp210x_set_flow_control()
1154 old_termios && old_termios->c_ospeed != 0 && in cp210x_set_flow_control()
1155 C_CRTSCTS(tty) == (old_termios->c_cflag & CRTSCTS) && in cp210x_set_flow_control()
1156 I_IXON(tty) == (old_termios->c_iflag & IXON) && in cp210x_set_flow_control()
1157 I_IXOFF(tty) == (old_termios->c_iflag & IXOFF) && in cp210x_set_flow_control()
1158 START_CHAR(tty) == old_termios->c_cc[VSTART] && in cp210x_set_flow_control()
1159 STOP_CHAR(tty) == old_termios->c_cc[VSTOP]) { in cp210x_set_flow_control()
1172 dev_err(&port->dev, "failed to set special chars: %d\n", in cp210x_set_flow_control()
1177 mutex_lock(&port_priv->mutex); in cp210x_set_flow_control()
1179 if (tty->termios.c_ospeed == 0) { in cp210x_set_flow_control()
1180 port_priv->dtr = false; in cp210x_set_flow_control()
1181 port_priv->rts = false; in cp210x_set_flow_control()
1182 } else if (old_termios && old_termios->c_ospeed == 0) { in cp210x_set_flow_control()
1183 port_priv->dtr = true; in cp210x_set_flow_control()
1184 port_priv->rts = true; in cp210x_set_flow_control()
1199 if (port_priv->dtr) in cp210x_set_flow_control()
1207 if (port_priv->rts) in cp210x_set_flow_control()
1214 if (port_priv->rts) in cp210x_set_flow_control()
1235 dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", __func__, in cp210x_set_flow_control()
1246 port_priv->crtscts = crtscts; in cp210x_set_flow_control()
1248 mutex_unlock(&port_priv->mutex); in cp210x_set_flow_control()
1255 struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); in cp210x_set_termios()
1259 if (old_termios && !cp210x_termios_change(&tty->termios, old_termios) && in cp210x_set_termios()
1260 tty->termios.c_ospeed != 0) in cp210x_set_termios()
1263 if (!old_termios || tty->termios.c_ospeed != old_termios->c_ospeed) in cp210x_set_termios()
1266 /* CP2101 only supports CS8, 1 stop bit and non-stick parity. */ in cp210x_set_termios()
1267 if (priv->partnum == CP210X_PARTNUM_CP2101) { in cp210x_set_termios()
1268 tty->termios.c_cflag &= ~(CSIZE | CSTOPB | CMSPAR); in cp210x_set_termios()
1269 tty->termios.c_cflag |= CS8; in cp210x_set_termios()
1311 dev_err(&port->dev, "failed to set line control: %d\n", ret); in cp210x_set_termios()
1316 * Enable event-insertion mode only if input parity checking is in cp210x_set_termios()
1328 struct usb_serial_port *port = tty->driver_data; in cp210x_tiocmset()
1341 mutex_lock(&port_priv->mutex); in cp210x_tiocmset_port()
1344 port_priv->rts = true; in cp210x_tiocmset_port()
1349 port_priv->dtr = true; in cp210x_tiocmset_port()
1354 port_priv->rts = false; in cp210x_tiocmset_port()
1359 port_priv->dtr = false; in cp210x_tiocmset_port()
1365 * Use SET_FLOW to set DTR and enable/disable auto-RTS when hardware in cp210x_tiocmset_port()
1368 if (port_priv->crtscts && control & CONTROL_WRITE_RTS) { in cp210x_tiocmset_port()
1378 if (port_priv->dtr) in cp210x_tiocmset_port()
1384 if (port_priv->rts) in cp210x_tiocmset_port()
1392 dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", in cp210x_tiocmset_port()
1398 dev_dbg(&port->dev, "%s - control = 0x%04x\n", __func__, control); in cp210x_tiocmset_port()
1403 mutex_unlock(&port_priv->mutex); in cp210x_tiocmset_port()
1418 struct usb_serial_port *port = tty->driver_data; in cp210x_tiocmget()
1433 dev_dbg(&port->dev, "%s - control = 0x%02x\n", __func__, control); in cp210x_tiocmget()
1440 struct usb_serial_port *port = tty->driver_data; in cp210x_break_ctl()
1441 struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); in cp210x_break_ctl()
1444 if (priv->partnum == CP210X_PARTNUM_CP2105) { in cp210x_break_ctl()
1445 if (cp210x_interface_num(port->serial) == 1) in cp210x_break_ctl()
1446 return -ENOTTY; in cp210x_break_ctl()
1454 dev_dbg(&port->dev, "%s - turning break %s\n", __func__, in cp210x_break_ctl()
1470 result = usb_autopm_get_interface(serial->interface); in cp210x_gpio_get()
1474 switch (priv->partnum) { in cp210x_gpio_get()
1493 usb_autopm_put_interface(serial->interface); in cp210x_gpio_get()
1520 result = usb_autopm_get_interface(serial->interface); in cp210x_gpio_set()
1524 switch (priv->partnum) { in cp210x_gpio_set()
1543 result = usb_control_msg(serial->dev, in cp210x_gpio_set()
1544 usb_sndctrlpipe(serial->dev, 0), in cp210x_gpio_set()
1553 usb_autopm_put_interface(serial->interface); in cp210x_gpio_set()
1556 dev_err(&serial->interface->dev, "failed to set GPIO value: %d\n", in cp210x_gpio_set()
1566 return priv->gpio_input & BIT(gpio); in cp210x_gpio_direction_get()
1574 if (priv->partnum == CP210X_PARTNUM_CP2105) { in cp210x_gpio_direction_input()
1576 return -ENOTSUPP; in cp210x_gpio_direction_input()
1579 /* push-pull pins cannot be changed to be inputs */ in cp210x_gpio_direction_input()
1580 if (priv->gpio_pushpull & BIT(gpio)) in cp210x_gpio_direction_input()
1581 return -EINVAL; in cp210x_gpio_direction_input()
1586 priv->gpio_input |= BIT(gpio); in cp210x_gpio_direction_input()
1597 priv->gpio_input &= ~BIT(gpio); in cp210x_gpio_direction_output()
1612 (priv->gpio_pushpull & BIT(gpio))) in cp210x_gpio_set_config()
1616 !(priv->gpio_pushpull & BIT(gpio))) in cp210x_gpio_set_config()
1619 return -ENOTSUPP; in cp210x_gpio_set_config()
1627 struct device *dev = &serial->interface->dev; in cp210x_gpio_init_valid_mask()
1628 unsigned long altfunc_mask = priv->gpio_altfunc; in cp210x_gpio_init_valid_mask()
1668 /* 2 banks of GPIO - One for the pins taken from each serial port */ in cp2105_gpioconf_init()
1670 priv->gc.ngpio = 2; in cp2105_gpioconf_init()
1674 priv->gpio_altfunc = 0xff; in cp2105_gpioconf_init()
1679 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & in cp2105_gpioconf_init()
1683 priv->gc.ngpio = 3; in cp2105_gpioconf_init()
1687 priv->gpio_altfunc = 0xff; in cp2105_gpioconf_init()
1692 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & in cp2105_gpioconf_init()
1696 return -ENODEV; in cp2105_gpioconf_init()
1701 priv->gpio_altfunc |= BIT(0); in cp2105_gpioconf_init()
1704 priv->gpio_altfunc |= BIT(1); in cp2105_gpioconf_init()
1707 priv->gpio_input = 0; in cp2105_gpioconf_init()
1727 priv->gc.ngpio = 4; in cp2104_gpioconf_init()
1730 priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & in cp2104_gpioconf_init()
1739 priv->gpio_altfunc |= BIT(0); in cp2104_gpioconf_init()
1741 priv->gpio_altfunc |= BIT(1); in cp2104_gpioconf_init()
1743 priv->gpio_altfunc |= BIT(2); in cp2104_gpioconf_init()
1750 for (i = 0; i < priv->gc.ngpio; ++i) { in cp2104_gpioconf_init()
1752 * Set direction to "input" iff pin is open-drain and reset in cp2104_gpioconf_init()
1755 if (!(priv->gpio_pushpull & BIT(i)) && (gpio_latch & BIT(i))) in cp2104_gpioconf_init()
1756 priv->gpio_input |= BIT(i); in cp2104_gpioconf_init()
1776 priv->gc.ngpio = 16; in cp2108_gpio_init()
1777 priv->gpio_pushpull = le16_to_cpu(config.reset_state.gpio_mode_pb1); in cp2108_gpio_init()
1784 * https://www.silabs.com/documents/public/data-sheets/cp2108-datasheet.pdf in cp2108_gpio_init()
1792 priv->gpio_altfunc |= BIT(i * 4); in cp2108_gpio_init()
1794 priv->gpio_altfunc |= BIT((i * 4) + 1); in cp2108_gpio_init()
1796 priv->gpio_altfunc |= BIT((i * 4) + 2); in cp2108_gpio_init()
1798 priv->gpio_altfunc |= BIT((i * 4) + 3); in cp2108_gpio_init()
1805 for (i = 0; i < priv->gc.ngpio; ++i) { in cp2108_gpio_init()
1807 * Set direction to "input" iff pin is open-drain and reset in cp2108_gpio_init()
1810 if (!(priv->gpio_pushpull & BIT(i)) && (gpio_latch & BIT(i))) in cp2108_gpio_init()
1811 priv->gpio_input |= BIT(i); in cp2108_gpio_init()
1835 … https://www.silabs.com/community/interface/knowledge-base.entry.html/2017/03/31/cp2102n_setconfig in cp2102n_gpioconf_init()
1839 return -ENOMEM; in cp2102n_gpioconf_init()
1860 return -ENOTSUPP; in cp2102n_gpioconf_init()
1862 priv->gc.ngpio = 4; in cp2102n_gpioconf_init()
1866 * the direction of an open-drain pin. in cp2102n_gpioconf_init()
1870 /* 0 indicates open-drain mode, 1 is push-pull */ in cp2102n_gpioconf_init()
1871 priv->gpio_pushpull = (gpio_pushpull >> 3) & 0x0f; in cp2102n_gpioconf_init()
1874 if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN20) { in cp2102n_gpioconf_init()
1877 priv->gpio_altfunc |= BIT(0); in cp2102n_gpioconf_init()
1879 priv->gpio_altfunc |= BIT(1); in cp2102n_gpioconf_init()
1881 priv->gpio_altfunc |= BIT(2); in cp2102n_gpioconf_init()
1883 priv->gpio_altfunc |= BIT(3); in cp2102n_gpioconf_init()
1885 priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; in cp2102n_gpioconf_init()
1888 if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) { in cp2102n_gpioconf_init()
1890 * For the QFN28 package, GPIO4-6 are controlled by in cp2102n_gpioconf_init()
1896 priv->gc.ngpio = 7; in cp2102n_gpioconf_init()
1898 priv->gpio_pushpull |= (gpio_pushpull & 7) << 4; in cp2102n_gpioconf_init()
1903 * it only knows open-drain and push-pull modes which is set at in cp2102n_gpioconf_init()
1904 * factory. An open-drain pin can function both as an in cp2102n_gpioconf_init()
1905 * input or an output. We emulate input mode for open-drain pins in cp2102n_gpioconf_init()
1907 * push-pull pins to be set as an input. in cp2102n_gpioconf_init()
1909 for (i = 0; i < priv->gc.ngpio; ++i) { in cp2102n_gpioconf_init()
1911 * Set direction to "input" iff pin is open-drain and reset in cp2102n_gpioconf_init()
1914 if (!(priv->gpio_pushpull & BIT(i)) && (gpio_latch & BIT(i))) in cp2102n_gpioconf_init()
1915 priv->gpio_input |= BIT(i); in cp2102n_gpioconf_init()
1926 switch (priv->partnum) { in cp210x_gpio_init()
1954 priv->gc.label = "cp210x"; in cp210x_gpio_init()
1955 priv->gc.get_direction = cp210x_gpio_direction_get; in cp210x_gpio_init()
1956 priv->gc.direction_input = cp210x_gpio_direction_input; in cp210x_gpio_init()
1957 priv->gc.direction_output = cp210x_gpio_direction_output; in cp210x_gpio_init()
1958 priv->gc.get = cp210x_gpio_get; in cp210x_gpio_init()
1959 priv->gc.set = cp210x_gpio_set; in cp210x_gpio_init()
1960 priv->gc.set_config = cp210x_gpio_set_config; in cp210x_gpio_init()
1961 priv->gc.init_valid_mask = cp210x_gpio_init_valid_mask; in cp210x_gpio_init()
1962 priv->gc.owner = THIS_MODULE; in cp210x_gpio_init()
1963 priv->gc.parent = &serial->interface->dev; in cp210x_gpio_init()
1964 priv->gc.base = -1; in cp210x_gpio_init()
1965 priv->gc.can_sleep = true; in cp210x_gpio_init()
1967 result = gpiochip_add_data(&priv->gc, serial); in cp210x_gpio_init()
1969 priv->gpio_registered = true; in cp210x_gpio_init()
1978 if (priv->gpio_registered) { in cp210x_gpio_remove()
1979 gpiochip_remove(&priv->gc); in cp210x_gpio_remove()
1980 priv->gpio_registered = false; in cp210x_gpio_remove()
2000 struct usb_serial *serial = port->serial; in cp210x_port_probe()
2005 return -ENOMEM; in cp210x_port_probe()
2007 port_priv->bInterfaceNumber = cp210x_interface_num(serial); in cp210x_port_probe()
2008 mutex_init(&port_priv->mutex); in cp210x_port_probe()
2030 switch (priv->partnum) { in cp210x_init_max_speed()
2065 priv->min_speed = min; in cp210x_init_max_speed()
2066 priv->max_speed = max; in cp210x_init_max_speed()
2067 priv->use_actual_rate = use_actual_rate; in cp210x_init_max_speed()
2080 * Some (possibly counterfeit) CP2102 do not support event-insertion in cp2102_determine_quirks()
2083 * two-byte part-number request. in cp2102_determine_quirks()
2085 ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), in cp2102_determine_quirks()
2089 dev_dbg(&serial->interface->dev, in cp2102_determine_quirks()
2090 "device does not support event-insertion mode\n"); in cp2102_determine_quirks()
2091 priv->no_event_mode = true; in cp2102_determine_quirks()
2108 dev_dbg(&serial->interface->dev, "%s - %d.%d.%d\n", __func__, in cp210x_get_fw_version()
2111 priv->fw_version = ver[0] << 16 | ver[1] << 8 | ver[2]; in cp210x_get_fw_version()
2122 CP210X_GET_PARTNUM, &priv->partnum, in cp210x_determine_type()
2123 sizeof(priv->partnum)); in cp210x_determine_type()
2125 dev_warn(&serial->interface->dev, in cp210x_determine_type()
2127 priv->partnum = CP210X_PARTNUM_UNKNOWN; in cp210x_determine_type()
2131 dev_dbg(&serial->interface->dev, "partnum = 0x%02x\n", priv->partnum); in cp210x_determine_type()
2133 switch (priv->partnum) { in cp210x_determine_type()
2147 if (priv->fw_version <= 0x10004) in cp210x_determine_type()
2148 priv->no_flow_control = true; in cp210x_determine_type()
2162 return -ENOMEM; in cp210x_attach()
2171 dev_err(&serial->interface->dev, "GPIO initialisation failed: %d\n", in cp210x_attach()