diff options
author | Benoit Goby <benoit@android.com> | 2011-10-01 14:44:00 +0100 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-10-02 09:39:31 +0100 |
commit | 4c20c675334e3fb0780552f8d485d8cf81f8b047 (patch) | |
tree | 448dabef1c121cd27f406116950cd028279eb40b /include | |
parent | 43fb00842be8b691497bccc515be086b0da9949c (diff) |
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 <benoit@android.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
Change-Id: If5ad9267c111ad0a442f0d87a0d31082dc5381b6
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/android_composite.h | 106 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 23 |
2 files changed, 0 insertions, 129 deletions
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 <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> - -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 c70fe154877..6938a8608cf 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -36,7 +36,6 @@ #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> -#include <linux/switch.h> /* * 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; /** @@ -120,9 +118,6 @@ struct usb_function { struct usb_configuration *config; - /* disabled is zero if the function is enabled */ - int disabled; - /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if * we can't restructure things to avoid mismatching. @@ -154,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 *); @@ -169,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. @@ -297,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 *); @@ -307,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, @@ -379,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); |