Add a hub_control() callback to the xhci_driver_overrides structure to
allow host drivers to override the default hub_control function. This
is required for Tegra which requires device specific actions for power
management to be executed during USB state transitions.
Signed-off-by: Jim Lin <jilin@nvidia.com>
---
v5: new change
v6: adjust parameter alignment (xhci.h hub_control)
v7: change commit message
drivers/usb/host/xhci.c | 2 ++
drivers/usb/host/xhci.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 902f410874e8..3c7bf0a0e0b4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -5461,6 +5461,8 @@ void xhci_init_driver(struct hc_driver *drv,
drv->check_bandwidth = over->check_bandwidth;
if (over->reset_bandwidth)
drv->reset_bandwidth = over->reset_bandwidth;
+ if (over->hub_control)
+ drv->hub_control = over->hub_control;
}
}
EXPORT_SYMBOL_GPL(xhci_init_driver);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 5a75fe563123..f51b674fc10c 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1943,6 +1943,8 @@ struct xhci_driver_overrides {
struct usb_host_endpoint *ep);
int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
+ int (*hub_control)(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
+ u16 wIndex, char *buf, u16 wLength);
};
#define XHCI_CFC_DELAY 10
--
2.17.1
On Fri, Nov 11, 2022 at 06:18:11PM +0800, Jim Lin wrote: > Add a hub_control() callback to the xhci_driver_overrides structure to > allow host drivers to override the default hub_control function. This > is required for Tegra which requires device specific actions for power > management to be executed during USB state transitions. > > Signed-off-by: Jim Lin <jilin@nvidia.com> > > --- > v5: new change > v6: adjust parameter alignment (xhci.h hub_control) > v7: change commit message > > drivers/usb/host/xhci.c | 2 ++ > drivers/usb/host/xhci.h | 2 ++ > 2 files changed, 4 insertions(+) Acked-by: Thierry Reding <treding@nvidia.com>
On 11/11/2022 10:18, Jim Lin wrote:
> Add a hub_control() callback to the xhci_driver_overrides structure to
> allow host drivers to override the default hub_control function. This
> is required for Tegra which requires device specific actions for power
> management to be executed during USB state transitions.
>
> Signed-off-by: Jim Lin <jilin@nvidia.com>
>
> ---
> v5: new change
> v6: adjust parameter alignment (xhci.h hub_control)
> v7: change commit message
>
> drivers/usb/host/xhci.c | 2 ++
> drivers/usb/host/xhci.h | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 902f410874e8..3c7bf0a0e0b4 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -5461,6 +5461,8 @@ void xhci_init_driver(struct hc_driver *drv,
> drv->check_bandwidth = over->check_bandwidth;
> if (over->reset_bandwidth)
> drv->reset_bandwidth = over->reset_bandwidth;
> + if (over->hub_control)
> + drv->hub_control = over->hub_control;
> }
> }
> EXPORT_SYMBOL_GPL(xhci_init_driver);
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 5a75fe563123..f51b674fc10c 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1943,6 +1943,8 @@ struct xhci_driver_overrides {
> struct usb_host_endpoint *ep);
> int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
> void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
> + int (*hub_control)(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> + u16 wIndex, char *buf, u16 wLength);
> };
>
> #define XHCI_CFC_DELAY 10
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Thanks
Jon
--
nvpublic
© 2016 - 2026 Red Hat, Inc.