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

Commit 294d95f2 authored by Matthew Garrett's avatar Matthew Garrett Committed by Greg Kroah-Hartman
Browse files

ehci: Check individual port status registers on resume



If a device plug/unplug is detected on an ATI SB700 USB controller in D3,
it appears to set the port status register but not the controller status
register. As a result we'll fail to detect the plug event. Check the port
status register on resume as well in order to catch this case.

Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Cc: stable <stable@kernel.org> [after .39-rc1 is out]
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0fd857ae
Loading
Loading
Loading
Loading
+22 −1
Original line number Original line Diff line number Diff line
@@ -106,6 +106,27 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
	ehci->owned_ports = 0;
	ehci->owned_ports = 0;
}
}


static int ehci_port_change(struct ehci_hcd *ehci)
{
	int i = HCS_N_PORTS(ehci->hcs_params);

	/* First check if the controller indicates a change event */

	if (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)
		return 1;

	/*
	 * Not all controllers appear to update this while going from D3 to D0,
	 * so check the individual port status registers as well
	 */

	while (i--)
		if (ehci_readl(ehci, &ehci->regs->port_status[i]) & PORT_CSC)
			return 1;

	return 0;
}

static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
		bool suspending, bool do_wakeup)
		bool suspending, bool do_wakeup)
{
{
@@ -173,7 +194,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
	}
	}


	/* Does the root hub have a port wakeup pending? */
	/* Does the root hub have a port wakeup pending? */
	if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD))
	if (!suspending && ehci_port_change(ehci))
		usb_hcd_resume_root_hub(ehci_to_hcd(ehci));
		usb_hcd_resume_root_hub(ehci_to_hcd(ehci));


	spin_unlock_irqrestore(&ehci->lock, flags);
	spin_unlock_irqrestore(&ehci->lock, flags);