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

Commit 4147200d authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman
Browse files

USB: add do_wakeup parameter for PCI HCD suspend



This patch (as1385) adds a "do_wakeup" parameter to the pci_suspend
method used by PCI-based host controller drivers.  ehci-hcd in
particular needs to know whether or not to enable wakeup when
suspending a controller.  Although that information is currently
available through device_may_wakeup(), when support is added for
runtime suspend this will no longer be true.

Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 057c58bf
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -386,7 +386,9 @@ static int hcd_pci_suspend(struct device *dev)
		return retval;
		return retval;


	if (hcd->driver->pci_suspend) {
	if (hcd->driver->pci_suspend) {
		retval = hcd->driver->pci_suspend(hcd);
		bool	do_wakeup = device_may_wakeup(dev);

		retval = hcd->driver->pci_suspend(hcd, do_wakeup);
		suspend_report_result(hcd->driver->pci_suspend, retval);
		suspend_report_result(hcd->driver->pci_suspend, retval);
		if (retval)
		if (retval)
			return retval;
			return retval;
+1 −1
Original line number Original line Diff line number Diff line
@@ -228,7 +228,7 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
	 * the root hub is either suspended or stopped.
	 * the root hub is either suspended or stopped.
	 */
	 */
	spin_lock_irqsave(&ehci->lock, flags);
	spin_lock_irqsave(&ehci->lock, flags);
	ehci_prepare_ports_for_controller_suspend(ehci);
	ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev));
	ehci_writel(ehci, 0, &ehci->regs->intr_enable);
	ehci_writel(ehci, 0, &ehci->regs->intr_enable);
	(void)ehci_readl(ehci, &ehci->regs->intr_enable);
	(void)ehci_readl(ehci, &ehci->regs->intr_enable);


+2 −1
Original line number Original line Diff line number Diff line
@@ -313,7 +313,8 @@ static int ehci_fsl_drv_suspend(struct device *dev)
	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
	void __iomem *non_ehci = hcd->regs;
	void __iomem *non_ehci = hcd->regs;


	ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd));
	ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
			device_may_wakeup(dev));
	if (!fsl_deep_sleep())
	if (!fsl_deep_sleep())
		return 0;
		return 0;


+2 −3
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
}
}


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 suspending, bool do_wakeup)
{
{
	int		port;
	int		port;
	u32		temp;
	u32		temp;
@@ -117,8 +117,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
	 * when the controller is suspended or resumed.  In all other
	 * when the controller is suspended or resumed.  In all other
	 * cases they don't need to be changed.
	 * cases they don't need to be changed.
	 */
	 */
	if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup ||
	if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
			device_may_wakeup(ehci_to_hcd(ehci)->self.controller))
		return;
		return;


	/* clear phy low-power mode before changing wakeup flags */
	/* clear phy low-power mode before changing wakeup flags */
+2 −2
Original line number Original line Diff line number Diff line
@@ -277,7 +277,7 @@ done:
 * Also they depend on separate root hub suspend/resume.
 * Also they depend on separate root hub suspend/resume.
 */
 */


static int ehci_pci_suspend(struct usb_hcd *hcd)
static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
{
{
	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
	unsigned long		flags;
	unsigned long		flags;
@@ -291,7 +291,7 @@ static int ehci_pci_suspend(struct usb_hcd *hcd)
	 * the root hub is either suspended or stopped.
	 * the root hub is either suspended or stopped.
	 */
	 */
	spin_lock_irqsave (&ehci->lock, flags);
	spin_lock_irqsave (&ehci->lock, flags);
	ehci_prepare_ports_for_controller_suspend(ehci);
	ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup);
	ehci_writel(ehci, 0, &ehci->regs->intr_enable);
	ehci_writel(ehci, 0, &ehci->regs->intr_enable);
	(void)ehci_readl(ehci, &ehci->regs->intr_enable);
	(void)ehci_readl(ehci, &ehci->regs->intr_enable);


Loading