Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a32ff686 authored by Guang Jian Zeng's avatar Guang Jian Zeng
Browse files

usb: mdm_data_bridge: Add support for qdss trace bridge



Modify the code to support qdss trace bridge since only
one bulk in enpoint is used on qdss trace bridge.
Support qdss trace bridge on two PIDs: 0x908E and 0x909E.

Change-Id: Ib9c29b59bd277701c52a0f213eb65cb9f28df5e8
Signed-off-by: default avatarGuang Jian Zeng <gzeng@codeaurora.org>
parent 9bc618e8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -491,6 +491,8 @@ int ctrl_bridge_suspend(unsigned int id)
	dev = __dev[id];
	if (!dev)
		return -ENODEV;
	if (!dev->int_pipe)
		return 0;

	spin_lock_irqsave(&dev->lock, flags);
	if (!usb_anchor_empty(&dev->tx_submitted) || dev->rx_state == RX_BUSY) {
@@ -530,7 +532,8 @@ int ctrl_bridge_resume(unsigned int id)
	dev = __dev[id];
	if (!dev)
		return -ENODEV;

	if (!dev->int_pipe)
		return 0;
	if (!test_bit(SUSPENDED, &dev->flags))
		return 0;

@@ -678,7 +681,8 @@ ctrl_bridge_probe(struct usb_interface *ifc, struct usb_host_endpoint *int_in,
		pr_err("%s:device not found\n", __func__);
		return -ENODEV;
	}

	if (!int_in)
		return 0;
	dev->name = name;

	dev->pdev = platform_device_alloc(name, -1);
@@ -791,6 +795,8 @@ void ctrl_bridge_disconnect(unsigned int id)
{
	struct ctrl_bridge	*dev = __dev[id];

	if (!dev->int_pipe)
		return;
	dev_dbg(&dev->intf->dev, "%s:\n", __func__);

	/*set device name to none to get correct channel id
+23 −7
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ static const char * const rmnet_hsic_bridge_names[] = {
	"rmnet_hsic_ctrl",
};

static const char * const qdss_hsic_bridge_names[] = {
	"qdss_hsic_data",
};

/*for xport : HSUSB*/
static const char * const serial_hsusb_bridge_names[] = {
	"serial_hsusb_data",
@@ -712,6 +716,7 @@ static int data_bridge_probe(struct usb_interface *iface,
			bulk_in->desc.bEndpointAddress &
			USB_ENDPOINT_NUMBER_MASK);

	if (bulk_out)
		dev->bulk_out = usb_sndbulkpipe(dev->udev,
		bulk_out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);

@@ -1002,8 +1007,9 @@ bridge_probe(struct usb_interface *iface, const struct usb_device_id *id)
				int_in = endpoint;
		}
	}

	if ((!bulk_in && !data_int_in) || !bulk_out || !int_in) {
	if (((numends == 3)
	&& ((!bulk_in && !data_int_in) || !bulk_out || !int_in))
	|| ((numends == 1) && !bulk_in)) {
		dev_err(&iface->dev, "%s: invalid endpoints\n", __func__);
		status = -EINVAL;
		goto out;
@@ -1028,13 +1034,15 @@ bridge_probe(struct usb_interface *iface, const struct usb_device_id *id)
		goto out;
	}

	status = ctrl_bridge_probe(iface, int_in, bname[BRIDGE_CTRL_IDX],
	status = ctrl_bridge_probe(iface,
				int_in,
				bname[BRIDGE_CTRL_IDX],
				ch_id);
	if (status < 0) {
		dev_err(&iface->dev, "ctrl_bridge_probe failed %d\n", status);
		dev_err(&iface->dev, "ctrl_bridge_probe failed %d\n",
			status);
		goto error;
	}

	return 0;

error:
@@ -1116,6 +1124,10 @@ static const struct usb_device_id bridge_ids[] = {
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x908A, 5),
	.driver_info = (unsigned long)rmnet_hsic_bridge_names,
	},
	/* this PID supports QDSS-MDM trace*/
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x908E, 4),
	.driver_info = (unsigned long)qdss_hsic_bridge_names,
	},
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x908E, 5),
	.driver_info = (unsigned long)serial_hsic_bridge_names,
	},
@@ -1131,6 +1143,10 @@ static const struct usb_device_id bridge_ids[] = {
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x909E, 5),
	.driver_info = (unsigned long)serial_hsic_bridge_names,
	},
	/* this PID supports QDSS-MDM trace*/
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x909E, 4),
	.driver_info = (unsigned long)qdss_hsic_bridge_names,
	},
	{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x90A0, 3),
	.driver_info = (unsigned long)serial_hsic_bridge_names,
	},