ANDROID: GKI: usb: core: Add helper function to return controller id

Function provides controller id used by a remote entity
to identify which usb controller to program to initiate
data transfer.

Test: build
Bug: 151977651
Change-Id: Ied396f34496104c139a7910ee86844c124e6803f
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit f906c280ee)
[hridya: EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
Hemant Kumar
2017-08-17 17:01:00 -07:00
committed by Hridya Valsaraju
parent 7147144b61
commit 7ff8c34945
4 changed files with 26 additions and 0 deletions

View File

@ -2235,6 +2235,16 @@ int usb_hcd_get_frame_number (struct usb_device *udev)
/*-------------------------------------------------------------------------*/
int usb_hcd_get_controller_id(struct usb_device *udev)
{
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (!HCD_RH_RUNNING(hcd))
return -EINVAL;
return hcd->driver->get_core_id(hcd);
}
#ifdef CONFIG_PM
int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)

View File

@ -825,6 +825,19 @@ int usb_get_current_frame_number(struct usb_device *dev)
}
EXPORT_SYMBOL_GPL(usb_get_current_frame_number);
/**
* usb_get_controller_id - returns the host controller id.
* @dev: the device whose host controller id is being queried.
*/
int usb_get_controller_id(struct usb_device *dev)
{
if (dev->state == USB_STATE_NOTATTACHED)
return -EINVAL;
return usb_hcd_get_controller_id(dev);
}
EXPORT_SYMBOL_GPL(usb_get_controller_id);
/*-------------------------------------------------------------------*/
/*
* __usb_get_extra_descriptor() finds a descriptor of specific type in the

View File

@ -824,6 +824,7 @@ static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
/* for drivers using iso endpoints */
extern int usb_get_current_frame_number(struct usb_device *usb_dev);
extern int usb_get_controller_id(struct usb_device *dev);
/* Sets up a group of bulk endpoints to support multiple stream IDs. */
extern int usb_alloc_streams(struct usb_interface *interface,

View File

@ -406,6 +406,7 @@ struct hc_driver {
int (*find_raw_port_number)(struct usb_hcd *, int);
/* Call for power on/off the port if necessary */
int (*port_power)(struct usb_hcd *hcd, int portnum, bool enable);
int (*get_core_id)(struct usb_hcd *hcd);
};
@ -445,6 +446,7 @@ extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
struct usb_host_interface *old_alt,
struct usb_host_interface *new_alt);
extern int usb_hcd_get_frame_number(struct usb_device *udev);
extern int usb_hcd_get_controller_id(struct usb_device *udev);
struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
struct device *sysdev, struct device *dev, const char *bus_name,