Lines Matching refs: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>
242 static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
245 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
246 struct device *dev = &serial->interface->dev;
255 res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
272 static int pl2303_vendor_write(struct usb_serial *serial, u16 value, u16 index)
274 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
275 struct device *dev = &serial->interface->dev;
286 res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
298 static int pl2303_update_reg(struct usb_serial *serial, u8 reg, u8 mask, u8 val)
300 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
309 ret = pl2303_vendor_read(serial, reg, buf);
311 ret = pl2303_vendor_read(serial, reg | 0x80, buf);
319 ret = pl2303_vendor_write(serial, reg, *buf);
326 static int pl2303_probe(struct usb_serial *serial,
329 usb_set_serial_data(serial, (void *)id->driver_info);
339 static int pl2303_endpoint_hack(struct usb_serial *serial,
342 struct usb_interface *interface = serial->interface;
343 struct usb_device *dev = serial->dev;
369 static int pl2303_calc_num_ports(struct usb_serial *serial,
372 unsigned long quirks = (unsigned long)usb_get_serial_data(serial);
373 struct device *dev = &serial->interface->dev;
377 ret = pl2303_endpoint_hack(serial, epds);
390 static bool pl2303_supports_hx_status(struct usb_serial *serial)
395 ret = usb_control_msg_recv(serial->dev, 0, VENDOR_READ_REQUEST,
402 static int pl2303_detect_type(struct usb_serial *serial)
404 struct usb_device_descriptor *desc = &serial->dev->descriptor;
443 if (pl2303_supports_hx_status(serial))
451 if (pl2303_supports_hx_status(serial))
464 dev_err(&serial->interface->dev,
469 static int pl2303_startup(struct usb_serial *serial)
476 ret = pl2303_detect_type(serial);
481 dev_dbg(&serial->interface->dev, "device type: %s\n", pl2303_type_data[type].name);
488 spriv->quirks = (unsigned long)usb_get_serial_data(serial);
491 usb_set_serial_data(serial, spriv);
500 pl2303_vendor_read(serial, 0x8484, buf);
501 pl2303_vendor_write(serial, 0x0404, 0);
502 pl2303_vendor_read(serial, 0x8484, buf);
503 pl2303_vendor_read(serial, 0x8383, buf);
504 pl2303_vendor_read(serial, 0x8484, buf);
505 pl2303_vendor_write(serial, 0x0404, 1);
506 pl2303_vendor_read(serial, 0x8484, buf);
507 pl2303_vendor_read(serial, 0x8383, buf);
508 pl2303_vendor_write(serial, 0, 1);
509 pl2303_vendor_write(serial, 1, 0);
511 pl2303_vendor_write(serial, 2, 0x24);
513 pl2303_vendor_write(serial, 2, 0x44);
521 static void pl2303_release(struct usb_serial *serial)
523 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
554 struct usb_device *dev = port->serial->dev;
691 struct usb_serial *serial = port->serial;
692 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
727 struct usb_device *udev = port->serial->dev;
750 struct usb_device *udev = port->serial->dev;
795 struct usb_serial *serial = port->serial;
796 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
871 * Some PL2303 are known to lose bytes if you change serial settings
905 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0x40);
907 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG,
911 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0x60);
915 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG,
919 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0xc0);
923 pl2303_update_reg(serial, PL2303_HXN_FLOWCTRL_REG,
927 pl2303_update_reg(serial, 0, PL2303_FLOWCTRL_MASK, 0);
960 struct usb_serial *serial = port->serial;
961 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
965 usb_clear_halt(serial->dev, port->write_urb->pipe);
966 usb_clear_halt(serial->dev, port->read_urb->pipe);
970 pl2303_vendor_write(serial, PL2303_HXN_RESET_REG,
974 pl2303_vendor_write(serial, 8, 0);
975 pl2303_vendor_write(serial, 9, 0);
1065 struct usb_serial *serial = port->serial;
1077 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1099 struct usb_serial *serial = port->serial;
1100 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
1271 MODULE_DESCRIPTION("Prolific PL2303 USB to serial adaptor driver");