Re: how to trigger function in usb_device_pm_ops

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

 



hi alan:

2013/10/7 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>:
> On Mon, 7 Oct 2013, yoma sophian wrote:
>
>> >> 1. When will platform register dev_pm_ops be called? Is it called
>> >> before or after usb_device_pm_ops ?
>> >
>> > The platform suspend routine is called after the USB suspend routine.
>> > The platform resume routine is called before the USB resume routine.
>> I found some driver register
>> a. platform_driver->suspend/resume
>> instead of
>> b. platform_driver->driver->pm->suspend/resume
>>
>> is there any difference between above a) and b)?
>
> platform_driver->suspend/resume is deprecated.  You should use
> driver->pm->suspend/resume for new code.
>
>> > However, xHCI is fundamentally different from EHCI.  A single xHCI
>> > controller manages two physically independent buses: a SuperSpeed bus
>> > and a full/low/high-speed bus.  An EHCI controller, on the other hand,
>> > manages only one bus.  Therefore the drivers need to be somewhat
>> > different.
>> Is that the reason why we register 2 HCDs in xhci driver?
>
> Yes, it is.
>
>> if so, how driver decide to use which hcd when Super/Non-Super speed
>> devices plug in?
>
> Simple: When a SuperSpeed device plugs in, the driver uses the
> SuperSpeed hcd.  When a non-SuperSpeed device plugs in, the driver uses
> the non-SuperSpeed hcd.  :-)
in handle_port_status, we use major_revision to choose correct hcd,
then find port_array.
then I cannot see any benefit to make 2 hcds.

    if ((major_revision == 0x03) != (hcd->speed == HCD_USB3))
        hcd = xhci->shared_hcd;
    bus_state = &xhci->bus_state[hcd_index(hcd)];
    if (hcd->speed == HCD_USB3)
        port_array = xhci->usb3_ports;
    else
        port_array = xhci->usb2_ports;

BTW, why in xhci we choose HCD with USB2 as major?


>
>> If we are doing hibernate for example, why we still need to put
>> bus/controller suspend?
>> it should be fine if we just reset it and re-initialize it when
>> hibernate happen.
>> After all, OS is power down in hibernate, right?
>
> Remember, it's possible that the hibernate transition might fail.  If
> it does fail, we want the controller to return to the same state it had
> before, not to be reset.
Yes, you are right.
if we just reset controller each time for hibernate transition, that
mean controller has no chance back to normal state when hibernate
transition is fail.

But why don't we just add error handling in xhci_suspend instead of
calling bus spend for hibernate transition?


Thanks for your kind help,
--
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