aboutsummaryrefslogtreecommitdiff
path: root/include/linux/usb/android_composite.h
blob: e3877154986338938c7df8d4517545f6f6184861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 * Platform data for Android USB
 *
 * Copyright (C) 2008 Google, Inc.
 * Author: Mike Lockwood <lockwood@android.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef	__LINUX_USB_ANDROID_H
#define	__LINUX_USB_ANDROID_H

#include <linux/usb/composite.h>
#include <linux/if_ether.h>

#if 0
struct android_usb_function {
	struct list_head list;
	char *name;
	int (*bind_config) (struct usb_configuration * c);
};
#endif

struct android_usb_product {
	/* Vendor ID for this set of functions.
	 * Default vendor_id in platform data will be used if this is zero.
	 */
	__u16 vendor_id;

	/* Default product ID. */
	__u16 product_id;

	/* List of function names associated with this product.
	 * This is used to compute the USB product ID dynamically
	 * based on which functions are enabled.
	 */
	int num_functions;
	char **functions;
};

struct android_usb_platform_data {
	/* USB device descriptor fields */
	__u16 vendor_id;

	/* Default product ID. */
	__u16 product_id;

	__u16 version;

	char *product_name;
	char *manufacturer_name;
	char *serial_number;

	/* List of available USB products.
	 * This is used to compute the USB product ID dynamically
	 * based on which functions are enabled.
	 * if num_products is zero or no match can be found,
	 * we use the default product ID
	 */
	int num_products;
	struct android_usb_product *products;

	/* List of all supported USB functions.
	 * This list is used to define the order in which
	 * the functions appear in the configuration's list of USB interfaces.
	 * This is necessary to avoid depending upon the order in which
	 * the individual function drivers are initialized.
	 */
	int num_functions;
	char **functions;

	void (*enable_fast_charge) (bool enable);
	bool RndisDisableMPDecision;

	/* To indicate the GPIO num for USB id
	 */
	int usb_id_pin_gpio;

	/* For QCT diag
	 */
	int (*update_pid_and_serial_num) (uint32_t, const char *);

	/* For multiple serial function support
	 * Ex: "tty:serial[,sdio:modem_mdm][,smd:modem]"
	 */
	char *fserial_init_string;

	/* the ctrl/data interface name for rmnet interface.
	 * format(per port):"ctrl0,data0,ctrl1,data1..."
	 * Ex: "smd,bam" or  "hsic,hsic"
	 */
	char *usb_rmnet_interface;
	char *usb_diag_interface;

	/* The gadget driver need to initial at beginning
	 */
	unsigned char diag_init:1;
	unsigned char modem_init:1;
	unsigned char rmnet_init:1;
	unsigned char reserved:5;

	/* ums initial parameters */

	/* number of LUNS */
	int nluns;
	/* bitmap of lun to indicate cdrom disk.
	 * NOTE: Only support one cdrom disk
	 * and it must be located in last lun */
	int cdrom_lun;
	int cdrom_cttype;

	/* Re-match the product ID.
	 * In some devices, the product id is specified by vendor request.
	 *
	 * @param product_id: the common product id
	 * @param intrsharing: 1 for internet sharing, 0 for internet pass through
	 */
	int (*match) (int product_id, int intrsharing);
	/* in some cpu architecture, the sfab freq is not fixed.
	 * it will impact USB perforamnce,
	 * add callback function to lock sfab manaully.
	 */
	void (*sfab_lock) (int lock);
	u32 swfi_latency;

	bool support_modem;
	/* hold a performance lock while adb_read a maximum data to keep
	 * adb throughput level
	 */
	int mtp_perf_lock_on;
};

/* Platform data for "usb_mass_storage" driver. */
struct usb_mass_storage_platform_data {
	/* Contains values for the SC_INQUIRY SCSI command. */
	char *vendor;
	char *product;
	int release;

	char can_stall;
	/* number of LUNS */
	int nluns;
};

/* Platform data for USB ethernet driver. */
struct usb_ether_platform_data {
	u8 ethaddr[ETH_ALEN];
	u32 vendorID;
	const char *vendorDescr;
};

#if defined(CONFIG_MACH_HOLIDAY)
extern u8 in_usb_tethering;
#endif
int htc_usb_enable_function(char *name, int ebl);

#if 0
extern void android_register_function(struct android_usb_function *f);
extern int android_enable_function(struct usb_function *f, int enable);
#endif

#endif /* __LINUX_USB_ANDROID_H */