On Thu, Jan 24, 2013 at 01:44:09PM +0800, Ming Lei wrote: > On Thu, Jan 24, 2013 at 10:45 AM, Chen Peter-B29397 > <B29397@xxxxxxxxxxxxx> wrote: > > > > I also agree with no auto suspend occur during the resume signal is active. > > Yes, I agree too. > > > > > But one think I still can't understand that you add > > usb_autopm_get_interface_no_resume( > > to_usb_interface(hub->intfdev)); > > the purpose should be avoid hub's auto-suspend. > > > > But why the hub's suspend still occurs after calling it, see below log? > > Please see below comment in the hub_events(), :-) > > /* Balance the usb_autopm_get_interface_no_resume() in > * kick_khubd() and allow autosuspend. > */ Sorry, I may not understand runtime pm internal well. As my understanding, the idle/suspend is allowed when dev->power.usage_count is 0. So, usb_autopm_get_interface_no_resume at kick_khubd will inc hub's dev->power.usage_count. After that, the hub's idle/suspend should be blocked (like the comment at kick_khubd, I also debug it, it is 1 at the time), at hub_events, it dec hub's dev->power.usage_count, and allow autosuspend (like the comment said). My puzzle is after calling usb_autopm_get_interface_no_resume() at kick_khubd the dev->power.usage_count is 1, when the hub's suspend will be called? --------------------------------------------LOG---------------------------------- ci_hdrc ci_hdrc.0: port 1 remote wakeup imx_usb 2184000.usb: at the end of imx_controller_resume, ret = 0 usb usb1: usb wakeup-resume usb usb1: usb auto-resume ci_hdrc ci_hdrc.0: resume root hub hub 1-0:1.0: hub_resume usb usb1: wait for ports resuming over hub 1-0:1.0: port 1: status 0107 change 0000 process 1 hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000 hub 1-0:1.0: hub_suspend usb usb1: bus auto-suspend, wakeup 1 ci_hdrc ci_hdrc.0: suspend root hub ci_hdrc ci_hdrc.0: suspend failed because a port is resuming usb usb1: bus suspend fail, err -16 hub 1-0:1.0: hub_resume usb usb1: wait for ports resuming over ci_hdrc ci_hdrc.0: GetStatus port:1 status 10001805 8 ACK POWER sig=j PE CONNECT hub 1-0:1.0: port 1: status 0103 change 0004 process 1 > > Alan mentioned that we may add one pm_runtime_get_noresume() > to avoid root-hub auto-suspend when it is sending ports resuming > signal from remote-wakeup. > > Thanks, > -- > Ming Lei > -- Best Regards, Peter Chen -- 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