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

Commit dca661a9 authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

usb: gadget: Fix interface descriptor fields for QTI functions



Currently many QTI function drivers are exposing incorrect
interface descriptor fields. Fix the same.

Change-Id: I06bd30c0374d57f7e0fe407e74f89b6e7eaf2db8
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 497e1f66
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011, 2013-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011, 2013-2020, The Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2 license terms,
 * and distributes only under these terms.
 *
@@ -147,6 +147,7 @@ struct f_cdev_opts {
	struct f_cdev *port;
	char *func_name;
	u8 port_num;
	u8 proto;
};

static int major, minors;
@@ -169,8 +170,8 @@ static struct usb_interface_descriptor cser_interface_desc = {
	/* .bInterfaceNumber = DYNAMIC */
	.bNumEndpoints =	3,
	.bInterfaceClass =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	0,
	.bInterfaceProtocol =	0,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	/* .bInterfaceProtocol = DYNAMIC */
	/* .iInterface = DYNAMIC */
};

@@ -786,6 +787,8 @@ static int usb_cser_bind(struct usb_configuration *c, struct usb_function *f)
	struct f_cdev *port = func_to_port(f);
	int status;
	struct usb_ep *ep;
	struct f_cdev_opts *opts =
			container_of(f->fi, struct f_cdev_opts, func_inst);

	if (cser_string_defs[0].id == 0) {
		status = usb_string_id(c->cdev);
@@ -799,6 +802,7 @@ static int usb_cser_bind(struct usb_configuration *c, struct usb_function *f)
		goto fail;
	port->port_usb.data_id = status;
	cser_interface_desc.bInterfaceNumber = status;
	cser_interface_desc.bInterfaceProtocol = opts->proto;

	status = -ENODEV;
	ep = usb_ep_autoconfig(cdev->gadget, &cser_fs_in_desc);
@@ -2010,6 +2014,9 @@ static int cser_set_inst_name(struct usb_function_instance *f, const char *name)
		port->port_usb.send_modem_ctrl_bits = dun_cser_send_ctrl_bits;
		port->port_usb.disconnect = dun_cser_disconnect;
		port->port_usb.send_break = dun_cser_send_break;
		opts->proto = 0x40;
	} else {
		opts->proto = 0x60;
	}

	return 0;
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * Diag Function Device - Route ARM9 and ARM11 DIAG messages
 * between HOST and DEVICE.
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2018, 2020, The Linux Foundation. All rights reserved.
 * Author: Brian Swetland <swetland@google.com>
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -68,8 +68,8 @@ static struct usb_interface_descriptor intf_desc = {
	.bLength            =	sizeof(intf_desc),
	.bDescriptorType    =	USB_DT_INTERFACE,
	.bNumEndpoints      =	2,
	.bInterfaceClass    =	0xFF,
	.bInterfaceSubClass =	0xFF,
	.bInterfaceClass    =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	.bInterfaceProtocol =	0x30,
};

+5 −5
Original line number Diff line number Diff line
@@ -371,8 +371,8 @@ static struct usb_interface_descriptor rmnet_gsi_interface_desc = {
	.bDescriptorType =	USB_DT_INTERFACE,
	.bNumEndpoints =	3,
	.bInterfaceClass =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceProtocol =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	.bInterfaceProtocol =	0x50,
	/* .iInterface = DYNAMIC */
};

@@ -1339,9 +1339,9 @@ static struct usb_interface_descriptor qdss_gsi_data_intf_desc = {
	.bDescriptorType    =	USB_DT_INTERFACE,
	.bAlternateSetting  =   0,
	.bNumEndpoints      =	1,
	.bInterfaceClass    =	0xff,
	.bInterfaceSubClass =	0xff,
	.bInterfaceProtocol =	0xff,
	.bInterfaceClass    =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	.bInterfaceProtocol =	0x80,
};

static struct usb_endpoint_descriptor qdss_gsi_fs_data_desc = {
+4 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -45,9 +45,9 @@ static struct usb_interface_descriptor intf_desc = {
	.bLength            =	sizeof(intf_desc),
	.bDescriptorType    =	USB_DT_INTERFACE,
	.bNumEndpoints      =	2,
	.bInterfaceClass    =	0xFF,
	.bInterfaceSubClass =	0xFF,
	.bInterfaceProtocol =	0x30,
	.bInterfaceClass    =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	.bInterfaceProtocol =	0x90,
};

static struct usb_endpoint_descriptor hs_bulk_in_desc = {
+16 −7
Original line number Diff line number Diff line
/* Copyright (c) 2011-2014, 2019, Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2019-2020, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -68,18 +68,18 @@ static struct usb_interface_descriptor intf_in_only_desc = {
	.bLength            =	sizeof(intf_in_only_desc),
	.bDescriptorType    =	USB_DT_INTERFACE,
	.bNumEndpoints      =	1,
	.bInterfaceClass    =	0xFF,
	.bInterfaceSubClass =	0xFF,
	.bInterfaceProtocol =	0x30,
	.bInterfaceClass    =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	/* .bInterfaceProtocol = DYNAMIC */
};

static struct usb_interface_descriptor intf_desc = {
	.bLength            =	sizeof(intf_desc),
	.bDescriptorType    =	USB_DT_INTERFACE,
	.bNumEndpoints      =	2,
	.bInterfaceClass    =	0xFF,
	.bInterfaceSubClass =	0xFF,
	.bInterfaceProtocol =	0x30,
	.bInterfaceClass    =	USB_CLASS_VENDOR_SPEC,
	.bInterfaceSubClass =	USB_SUBCLASS_VENDOR_SPEC,
	/* .bInterfaceProtocol = DYNAMIC */
};

static struct usb_endpoint_descriptor hs_bulk_in_desc = {
@@ -1142,6 +1142,15 @@ static int mdm_data_bind(struct usb_configuration *c, struct usb_function *f)
	}

	data_desc->bInterfaceNumber = usb_interface_id(c, f);

	status = bridge_id_to_protocol(id);
	if (status < 0) {
		pr_err("%s: Invalid port\n", __func__);
		return status;
	}

	data_desc->bInterfaceProtocol = status;

	status = usb_string_id(cdev);
	if (status < 0)
		return status;
Loading