From 4e07805158d1f71bd67990147d5a0fb78470c126 Mon Sep 17 00:00:00 2001 From: Praneeth Bajjuri Date: Mon, 26 Sep 2011 22:18:47 -0700 Subject: usb: gadget: android: Update android gadget driver * Functions and the device descriptor are configured from user space: echo 0 > /sys/class/android_usb/android0/enable echo adb,acm > /sys/class/android_usb/android0/functions echo 2 > /sys/class/android_usb/android0/f_acm/instances echo 1 > /sys/class/android_usb/android0/enable * Driver does not require platform data anymore * Moved function initialization to android.c instead of each function file * Replaced switches by uevents Signed-off-by: Benoit Goby Signed-off-by: Mike Lockwood Resolve merge conflicts Change-Id: I3ce527b8286da1cfa949305b9283c4fadbff73e6 Signed-off-by: Praneeth Bajjuri --- include/linux/usb/android_composite.h | 106 ---------------------------------- include/linux/usb/composite.h | 21 ------- 2 files changed, 127 deletions(-) delete mode 100644 include/linux/usb/android_composite.h (limited to 'include') diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h deleted file mode 100644 index 7f9000711f4..00000000000 --- a/include/linux/usb/android_composite.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Platform data for Android USB - * - * Copyright (C) 2008 Google, Inc. - * Author: Mike Lockwood - * - * 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 -#include - -struct android_usb_function { - struct list_head list; - char *name; - int (*bind_config)(struct usb_configuration *c); -}; - -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; - - /* Product ID for this set of functions. */ - __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; -}; - -/* 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; - - /* 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; -}; - -/* Platform data for ACM driver. */ -struct acm_platform_data { - u8 num_inst; -}; - -extern void android_register_function(struct android_usb_function *f); - -extern void android_enable_function(struct usb_function *f, int enable); - - -#endif /* __LINUX_USB_ANDROID_H */ diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index cb65fa2c016..6938a8608cf 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -36,7 +36,6 @@ #include #include -#include /* * USB function drivers should return USB_GADGET_DELAYED_STATUS if they @@ -47,7 +46,6 @@ */ #define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ -struct usb_composite_dev; struct usb_configuration; /** @@ -119,7 +117,6 @@ struct usb_function { struct usb_descriptor_header **ss_descriptors; struct usb_configuration *config; - int disabled; /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if @@ -152,7 +149,6 @@ struct usb_function { /* internals */ struct list_head list; DECLARE_BITMAP(endpoints, 32); - struct device *dev; }; int usb_add_function(struct usb_configuration *, struct usb_function *); @@ -167,9 +163,6 @@ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ -void usb_function_set_enabled(struct usb_function *, int); -void usb_composite_force_reset(struct usb_composite_dev *); - /** * struct usb_configuration - represents one gadget configuration * @label: For diagnostics, describes the configuration. @@ -295,9 +288,6 @@ struct usb_composite_driver { enum usb_device_speed max_speed; unsigned needs_serial:1; - struct class *class; - atomic_t function_count; - int (*unbind)(struct usb_composite_dev *); void (*disconnect)(struct usb_composite_dev *); @@ -305,8 +295,6 @@ struct usb_composite_driver { /* global suspend hooks */ void (*suspend)(struct usb_composite_dev *); void (*resume)(struct usb_composite_dev *); - - void (*enable_function)(struct usb_function *f, int enable); }; extern int usb_composite_probe(struct usb_composite_driver *driver, @@ -377,15 +365,6 @@ struct usb_composite_dev { /* protects deactivations and delayed_status counts*/ spinlock_t lock; - - /* switch indicating connected/disconnected state */ - struct switch_dev sw_connected; - /* switch indicating current configuration */ - struct switch_dev sw_config; - /* current connected state for sw_connected */ - bool connected; - - struct work_struct switch_work; }; extern int usb_string_id(struct usb_composite_dev *c); -- cgit v1.2.3