Commit fd47ff55 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more USB updates from Greg KH:
 "Here are some straggler USB-serial changes for 5.15-rc1.

  These were not included in the first pull request as they came in
  "late" from Johan and I had missed them in my pull request earlier
  this week.

  Nothing big in here, just some USB to serial driver updates and fixes.
  All of these were in linux-next before I pulled them into my tree, and
  have been in linux-next all this week from my tree with no reported
  problems"

* tag 'usb-5.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: serial: pl2303: fix GL type detection
  USB: serial: replace symbolic permissions by octal permissions
  USB: serial: cp210x: determine fw version for CP2105 and CP2108
  USB: serial: cp210x: clean up type detection
  USB: serial: cp210x: clean up set-chars request
  USB: serial: cp210x: clean up control-request timeout
  USB: serial: cp210x: fix flow-control error handling
  USB: serial: cp210x: fix control-characters error handling
  USB: serial: io_edgeport: drop unused descriptor helper
parents 6b6dc4f4 1b4f3dfb
Loading
Loading
Loading
Loading
+32 −45
Original line number Diff line number Diff line
@@ -400,6 +400,7 @@ struct cp210x_special_chars {
};

/* CP210X_VENDOR_SPECIFIC values */
#define CP210X_GET_FW_VER	0x000E
#define CP210X_READ_2NCONFIG	0x000E
#define CP210X_GET_FW_VER_2N	0x0010
#define CP210X_READ_LATCH	0x00C2
@@ -638,7 +639,7 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req,
	result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
			req, REQTYPE_INTERFACE_TO_HOST, 0,
			port_priv->bInterfaceNumber, dmabuf, bufsize,
			USB_CTRL_SET_TIMEOUT);
			USB_CTRL_GET_TIMEOUT);
	if (result == bufsize) {
		memcpy(buf, dmabuf, bufsize);
		result = 0;
@@ -1145,33 +1146,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port)
	port_priv->event_mode = false;
}

static int cp210x_set_chars(struct usb_serial_port *port,
		struct cp210x_special_chars *chars)
{
	struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
	struct usb_serial *serial = port->serial;
	void *dmabuf;
	int result;

	dmabuf = kmemdup(chars, sizeof(*chars), GFP_KERNEL);
	if (!dmabuf)
		return -ENOMEM;

	result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
				CP210X_SET_CHARS, REQTYPE_HOST_TO_INTERFACE, 0,
				port_priv->bInterfaceNumber,
				dmabuf, sizeof(*chars), USB_CTRL_SET_TIMEOUT);

	kfree(dmabuf);

	if (result < 0) {
		dev_err(&port->dev, "failed to set special chars: %d\n", result);
		return result;
	}

	return 0;
}

static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b)
{
	bool iflag_change, cc_change;
@@ -1192,6 +1166,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
	struct cp210x_flow_ctl flow_ctl;
	u32 flow_repl;
	u32 ctl_hs;
	bool crtscts;
	int ret;

	/*
@@ -1218,9 +1193,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
		chars.bXonChar = START_CHAR(tty);
		chars.bXoffChar = STOP_CHAR(tty);

		ret = cp210x_set_chars(port, &chars);
		if (ret)
			return;
		ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars,
				sizeof(chars));
		if (ret) {
			dev_err(&port->dev, "failed to set special chars: %d\n",
					ret);
		}
	}

	mutex_lock(&port_priv->mutex);
@@ -1249,14 +1227,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
			flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL;
		else
			flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
		port_priv->crtscts = true;
		crtscts = true;
	} else {
		ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE;
		if (port_priv->rts)
			flow_repl |= CP210X_SERIAL_RTS_ACTIVE;
		else
			flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
		port_priv->crtscts = false;
		crtscts = false;
	}

	if (I_IXOFF(tty)) {
@@ -1279,8 +1257,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
	flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs);
	flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl);

	cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
	ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
			sizeof(flow_ctl));
	if (ret)
		goto out_unlock;

	port_priv->crtscts = crtscts;
out_unlock:
	mutex_unlock(&port_priv->mutex);
}
@@ -2111,12 +2093,26 @@ static int cp210x_get_fw_version(struct usb_serial *serial, u16 value)
	return 0;
}

static void cp210x_determine_quirks(struct usb_serial *serial)
static void cp210x_determine_type(struct usb_serial *serial)
{
	struct cp210x_serial_private *priv = usb_get_serial_data(serial);
	int ret;

	ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
			CP210X_GET_PARTNUM, &priv->partnum,
			sizeof(priv->partnum));
	if (ret < 0) {
		dev_warn(&serial->interface->dev,
				"querying part number failed\n");
		priv->partnum = CP210X_PARTNUM_UNKNOWN;
		return;
	}

	switch (priv->partnum) {
	case CP210X_PARTNUM_CP2105:
	case CP210X_PARTNUM_CP2108:
		cp210x_get_fw_version(serial, CP210X_GET_FW_VER);
		break;
	case CP210X_PARTNUM_CP2102N_QFN28:
	case CP210X_PARTNUM_CP2102N_QFN24:
	case CP210X_PARTNUM_CP2102N_QFN20:
@@ -2140,18 +2136,9 @@ static int cp210x_attach(struct usb_serial *serial)
	if (!priv)
		return -ENOMEM;

	result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
					  CP210X_GET_PARTNUM, &priv->partnum,
					  sizeof(priv->partnum));
	if (result < 0) {
		dev_warn(&serial->interface->dev,
			 "querying part number failed\n");
		priv->partnum = CP210X_PARTNUM_UNKNOWN;
	}

	usb_set_serial_data(serial, priv);

	cp210x_determine_quirks(serial);
	cp210x_determine_type(serial);
	cp210x_init_max_speed(serial);

	result = cp210x_gpio_init(serial);
+3 −3
Original line number Diff line number Diff line
@@ -1199,9 +1199,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

module_param(stats, bool, S_IRUGO | S_IWUSR);
module_param(stats, bool, 0644);
MODULE_PARM_DESC(stats, "Enable statistics or not");
module_param(interval, int, S_IRUGO | S_IWUSR);
module_param(interval, int, 0644);
MODULE_PARM_DESC(interval, "Overrides interrupt interval");
module_param(unstable_bauds, bool, S_IRUGO | S_IWUSR);
module_param(unstable_bauds, bool, 0644);
MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates");
+1 −1
Original line number Diff line number Diff line
@@ -2938,5 +2938,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR);
module_param(ndi_latency_timer, int, 0644);
MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");
+1 −1
Original line number Diff line number Diff line
@@ -1444,5 +1444,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

module_param(initial_mode, int, S_IRUGO);
module_param(initial_mode, int, 0444);
MODULE_PARM_DESC(initial_mode, "Initial mode");
+0 −33
Original line number Diff line number Diff line
@@ -389,39 +389,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial)
	release_firmware(fw);
}

#if 0
/************************************************************************
 *
 *  Get string descriptor from device
 *
 ************************************************************************/
static int get_string_desc(struct usb_device *dev, int Id,
				struct usb_string_descriptor **pRetDesc)
{
	struct usb_string_descriptor StringDesc;
	struct usb_string_descriptor *pStringDesc;

	dev_dbg(&dev->dev, "%s - USB String ID = %d\n", __func__, Id);

	if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc,
						sizeof(StringDesc)))
		return 0;

	pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL);
	if (!pStringDesc)
		return -1;

	if (!usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc,
							StringDesc.bLength)) {
		kfree(pStringDesc);
		return -1;
	}

	*pRetDesc = pStringDesc;
	return 0;
}
#endif

static void dump_product_info(struct edgeport_serial *edge_serial,
			      struct edgeport_product_info *product_info)
{
Loading