Re: ehci pci runtime pm question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

2011/3/24 jacob pan <jacob.jun.pan@xxxxxxxxxxxxxxx>:
> Hi,
>
> I have a dumb question about enabling EHCI runtime PM with PCI
> subsystem. It seems core code in hci-pci.c provides the runtime call
> backs in usb_hcd_pci_pm_ops. But I don't see that being used in case of
> EHCI suspend/resume.
>
> I must have missed something, can someone explain how this should work?

A PCI device may implement multiple usb host controllers, for example,
one ehci and multiple uhci may be integrated into the same pci device. So
the pci device can't be put into sleep until all usb host controllers attached
into it are suspended.

In fact, from view of device model, the parent device of root hub(s) is
device of its pci device in your case, pm core will handle it if auto
suspend is enabled for the pci device.

> On our platform, we need to put EHCI in PCI D0i3 hot when we suspend
> root hub so that the block can be put into low power mode. I guess we
> also need platform specific functions to set the PCI Dx state during
> runtime suspend.
>
> It seems we can add the following to schedule PCI runtime PM calls by:

As explained above, the patch is not needed, and it is wrong.

> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -301,8 +301,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
>
>        if (ehci->has_otg && ehci->otg_suspend)
>                rc = ehci->otg_suspend(hcd);
> -
>        spin_unlock_irq (&ehci->lock);
> +       ehci_dbg(ehci, "rpm suspend\n");
> +       pm_runtime_put_sync(ehci_to_hcd(ehci)->self.controller);
> +       pm_schedule_suspend(ehci_to_hcd(ehci)->self.controller, 0);
>
>        /* ehci_work() may have re-enabled the watchdog timer, which we
> do not
>         * want, and so we must delete any pending watchdog timer
> events. @@ -322,6 +324,9 @@ static int ehci_bus_resume (struct usb_hcd
> *hcd) u8                      resume_needed = 0;
>        int                     rc = 0;
>
> +       ehci_dbg(ehci, "rpm resume bus\n");
> +       pm_runtime_get_sync(ehci_to_hcd(ehci)->self.controller);
> +
>        if (time_before (jiffies, ehci->next_statechange))
>                msleep(5);
>        spin_lock_irq (&ehci->lock);
>

thanks,
-- 
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux