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

Commit 7ff8c349 authored by Hemant Kumar's avatar Hemant Kumar Committed by Hridya Valsaraju
Browse files

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: default avatarHemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit f906c280)
[hridya: EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL]
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>
parent 7147144b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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)
+13 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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,
+2 −0
Original line number Diff line number Diff line
@@ -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,