Lines Matching full:serial

3  * Prolific PL2303 USB to serial adaptor driver
10 * See Documentation/usb/usb-serial.rst for more information on using this
20 #include <linux/serial.h>
26 #include <linux/usb/serial.h>
243 static int pl2303_vendor_read(struct usb_serial *serial, u16 value, in pl2303_vendor_read() argument
246 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_vendor_read()
247 struct device *dev = &serial->interface->dev; in pl2303_vendor_read()
256 res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), in pl2303_vendor_read()
273 static int pl2303_vendor_write(struct usb_serial *serial, u16 value, u16 index) in pl2303_vendor_write() argument
275 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_vendor_write()
276 struct device *dev = &serial->interface->dev; in pl2303_vendor_write()
287 res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in pl2303_vendor_write()
299 static int pl2303_update_reg(struct usb_serial *serial, u8 reg, u8 mask, u8 val) in pl2303_update_reg() argument
301 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_update_reg()
310 ret = pl2303_vendor_read(serial, reg, buf); in pl2303_update_reg()
312 ret = pl2303_vendor_read(serial, reg | 0x80, buf); in pl2303_update_reg()
320 ret = pl2303_vendor_write(serial, reg, *buf); in pl2303_update_reg()
327 static int pl2303_probe(struct usb_serial *serial, in pl2303_probe() argument
330 usb_set_serial_data(serial, (void *)id->driver_info); in pl2303_probe()
340 static int pl2303_endpoint_hack(struct usb_serial *serial, in pl2303_endpoint_hack() argument
343 struct usb_interface *interface = serial->interface; in pl2303_endpoint_hack()
344 struct usb_device *dev = serial->dev; in pl2303_endpoint_hack()
370 static int pl2303_calc_num_ports(struct usb_serial *serial, in pl2303_calc_num_ports() argument
373 unsigned long quirks = (unsigned long)usb_get_serial_data(serial); in pl2303_calc_num_ports()
374 struct device *dev = &serial->interface->dev; in pl2303_calc_num_ports()
378 ret = pl2303_endpoint_hack(serial, epds); in pl2303_calc_num_ports()
391 static bool pl2303_supports_hx_status(struct usb_serial *serial) in pl2303_supports_hx_status() argument
396 ret = usb_control_msg_recv(serial->dev, 0, VENDOR_READ_REQUEST, in pl2303_supports_hx_status()
403 static int pl2303_detect_type(struct usb_serial *serial) in pl2303_detect_type() argument
405 struct usb_device_descriptor *desc = &serial->dev->descriptor; in pl2303_detect_type()
444 if (pl2303_supports_hx_status(serial)) in pl2303_detect_type()
452 if (pl2303_supports_hx_status(serial)) in pl2303_detect_type()
465 dev_err(&serial->interface->dev, in pl2303_detect_type()
470 static int pl2303_startup(struct usb_serial *serial) in pl2303_startup() argument
477 ret = pl2303_detect_type(serial); in pl2303_startup()
482 dev_dbg(&serial->interface->dev, "device type: %s\n", pl2303_type_data[type].name); in pl2303_startup()
489 spriv->quirks = (unsigned long)usb_get_serial_data(serial); in pl2303_startup()
492 usb_set_serial_data(serial, spriv); in pl2303_startup()
501 pl2303_vendor_read(serial, 0x8484, buf); in pl2303_startup()
502 pl2303_vendor_write(serial, 0x0404, 0); in pl2303_startup()
503 pl2303_vendor_read(serial, 0x8484, buf); in pl2303_startup()
504 pl2303_vendor_read(serial, 0x8383, buf); in pl2303_startup()
505 pl2303_vendor_read(serial, 0x8484, buf); in pl2303_startup()
506 pl2303_vendor_write(serial, 0x0404, 1); in pl2303_startup()
507 pl2303_vendor_read(serial, 0x8484, buf); in pl2303_startup()
508 pl2303_vendor_read(serial, 0x8383, buf); in pl2303_startup()
509 pl2303_vendor_write(serial, 0, 1); in pl2303_startup()
510 pl2303_vendor_write(serial, 1, 0); in pl2303_startup()
512 pl2303_vendor_write(serial, 2, 0x24); in pl2303_startup()
514 pl2303_vendor_write(serial, 2, 0x44); in pl2303_startup()
522 static void pl2303_release(struct usb_serial *serial) in pl2303_release() argument
524 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_release()
555 struct usb_device *dev = port->serial->dev; in pl2303_set_control_lines()
692 struct usb_serial *serial = port->serial; in pl2303_encode_baud_rate() local
693 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_encode_baud_rate()
728 struct usb_device *udev = port->serial->dev; in pl2303_get_line_request()
751 struct usb_device *udev = port->serial->dev; in pl2303_set_line_request()
796 struct usb_serial *serial = port->serial; in pl2303_set_termios() local
797 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_set_termios()
872 * Some PL2303 are known to lose bytes if you change serial settings in pl2303_set_termios()
906 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0x40); in pl2303_set_termios()
908 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG, in pl2303_set_termios()
912 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0x60); in pl2303_set_termios()
916 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG, in pl2303_set_termios()
920 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0xc0); in pl2303_set_termios()
924 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG, in pl2303_set_termios()
928 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0); in pl2303_set_termios()
961 struct usb_serial *serial = port->serial; in pl2303_open() local
962 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_open()
966 usb_clear_halt(serial->dev, port->write_urb->pipe); in pl2303_open()
967 usb_clear_halt(serial->dev, port->read_urb->pipe); in pl2303_open()
971 pl2303_vendor_write(serial, PL2303_HXN_RESET_REG, in pl2303_open()
975 pl2303_vendor_write(serial, 8, 0); in pl2303_open()
976 pl2303_vendor_write(serial, 9, 0); in pl2303_open()
1066 struct usb_serial *serial = port->serial; in pl2303_set_break() local
1078 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), in pl2303_set_break()
1100 struct usb_serial *serial = port->serial; in pl2303_update_line_status() local
1101 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); in pl2303_update_line_status()
1271 MODULE_DESCRIPTION("Prolific PL2303 USB to serial adaptor driver");