Skip to content

Commit

Permalink
usb: xhci-exynos: Enable autosuspend on docking
Browse files Browse the repository at this point in the history
Enable "autosuspend" for an accessory of specific VID/PID which does not
set "remote wakeup" in its descriptor. Also disable the rewa and the
conn irq for it to avoid unnecessary disconnection events.

Bug: 218459337
Signed-off-by: Kyle Tso <[email protected]>
Change-Id: I85f2f8c3b1d5b39e4ab9ab55280ab428a4b39d93
  • Loading branch information
kyletsoadl authored and TreeHugger Robot committed Mar 17, 2022
1 parent 3c084b0 commit 0e2b5dc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions drivers/usb/host/xhci-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,18 @@ int xhci_exynos_bus_suspend(struct usb_hcd *hcd)

if (hcd == xhci->main_hcd &&
xhci_exynos->port_state == PORT_USB2) {
ret_phy = exynos_usbdrd_phy_vendor_set(xhci_exynos->phy_usb2, 1, 0);
struct usb_device *child_udev;
bool enable_rewa_irq = true;
/* We only need to find the first child for now. */
child_udev = usb_hub_find_child(udev, 1);
/* TODO: maintain a list of udev to disable conn and rewa irq */
if (child_udev && (child_udev->descriptor.idVendor == 0x18d1 &&
child_udev->descriptor.idProduct == 0x9480)) {
dev_dbg(xhci_exynos->dev, "%s: disable conn and rewa irq\n", __func__);
enable_rewa_irq = false;
}

ret_phy = exynos_usbdrd_phy_vendor_set(xhci_exynos->phy_usb2, enable_rewa_irq, 0);
if (ret_phy)
dev_info(xhci_exynos->dev, "phy vendor set fail\n");

Expand Down Expand Up @@ -322,7 +333,10 @@ static int xhci_exynos_check_port(struct xhci_hcd_exynos *exynos, struct usb_dev
}

/* do_remote_wakeup may be also set in drivers/usb/core/driver.c */
if (udev->do_remote_wakeup == 1 && audio_detected) {
if ((udev->do_remote_wakeup == 1 && audio_detected) ||
/* TODO: maintain a list of udev to force auto suspend */
(udev->descriptor.idVendor == 0x18d1 &&
udev->descriptor.idProduct == 0x9480)) {
device_init_wakeup(ddev, 1);
usb_enable_autosuspend(dev);
trace_android_vh_sound_usb_support_cpu_suspend(udev, 0,
Expand Down

0 comments on commit 0e2b5dc

Please sign in to comment.