1. 09 1月, 2012 2 次提交
    • L
      [SCSI] runtime resume parent for child's system-resume · 28fd00d4
      Lin Ming 提交于
      [Patch description from Alan Stern]
      
      If a child device was runtime-suspended when a system suspend began,
      then there will be nothing to prevent its parent from
      runtime-suspending as soon as it is woken up during the system resume.
      Then when the time comes to resume the child, the resume will fail
      because the parent is already back at low power.
      
      On the other hand, there are some devices which should remain at low
      power across an entire suspend-resume cycle.  The details depend on the
      device and the platform.
      
      This suggests that the PM core is not the right place to solve the
      problem. One possible solution is for the subsystem or device driver
      to call pm_runtime_get_sync(dev->parent) at the start of the
      system-resume procedure and pm_runtime_put_sync(dev->parent) at the
      end.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      28fd00d4
    • L
      [SCSI] check runtime PM status in system PM · 28640516
      Lin Ming 提交于
      The only high-level SCSI driver that currently implements runtime PM is
      sd, and sd treats runtime suspend exactly the same as the SUSPEND and
      HIBERNATE stages of system sleep, but not the same as the FREEZE stage.
      
      Therefore, when entering the SUSPEND or HIBERNATE stages of system
      sleep, we can skip the callback to the driver if the device is already
      in runtime suspend.  When entering the FREEZE stage, however, we should
      first issue a runtime resume.  The overhead of doing this is
      negligible, because a suspended drive would be spun up during the THAW
      stage of hibernation anyway.
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      28640516
  2. 01 11月, 2011 1 次提交
  3. 02 7月, 2011 1 次提交
    • R
      PM / Runtime: Return special error code if runtime PM is disabled · 632e270e
      Rafael J. Wysocki 提交于
      Some callers of pm_runtime_get_sync() and other runtime PM helper
      functions, scsi_autopm_get_host() and scsi_autopm_get_device() in
      particular, need to distinguish error codes returned when runtime PM
      is disabled (i.e. power.disable_depth is nonzero for the given
      device) from error codes returned in other situations.  For this
      reason, make the runtime PM helper functions return -EACCES when
      power.disable_depth is nonzero and ensure that this error code
      won't be returned by them in any other circumstances.  Modify
      scsi_autopm_get_host() and scsi_autopm_get_device() to check the
      error code returned by pm_runtime_get_sync() and ignore -EACCES.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      632e270e
  4. 28 7月, 2010 2 次提交
    • A
      [SCSI] implement runtime Power Management · bc4f2401
      Alan Stern 提交于
      This patch (as1398b) adds runtime PM support to the SCSI layer.  Only
      the machanism is provided; use of it is up to the various high-level
      drivers, and the patch doesn't change any of them.  Except for sg --
      the patch expicitly prevents a device from being runtime-suspended
      while its sg device file is open.
      
      The implementation is simplistic.  In general, hosts and targets are
      automatically suspended when all their children are asleep, but for
      them the runtime-suspend code doesn't actually do anything.  (A host's
      runtime PM status is propagated up the device tree, though, so a
      runtime-PM-aware lower-level driver could power down the host adapter
      hardware at the appropriate times.)  There are comments indicating
      where a transport class might be notified or some other hooks added.
      
      LUNs are runtime-suspended by calling the drivers' existing suspend
      handlers (and likewise for runtime-resume).  Somewhat arbitrarily, the
      implementation delays for 100 ms before suspending an eligible LUN.
      This is because there typically are occasions during bootup when the
      same device file is opened and closed several times in quick
      succession.
      
      The way this all works is that the SCSI core increments a device's
      PM-usage count when it is registered.  If a high-level driver does
      nothing then the device will not be eligible for runtime-suspend
      because of the elevated usage count.  If a high-level driver wants to
      use runtime PM then it can call scsi_autopm_put_device() in its probe
      routine to decrement the usage count and scsi_autopm_get_device() in
      its remove routine to restore the original count.
      
      Hosts, targets, and LUNs are not suspended while they are being probed
      or removed, or while the error handler is running.  In fact, a fairly
      large part of the patch consists of code to make sure that things
      aren't suspended at such times.
      
      [jejb: fix up compile issues in PM config variations]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      bc4f2401
    • A
      [SCSI] convert to the new PM framework · db5bd1e0
      Alan Stern 提交于
      This patch (as1397b) converts the SCSI midlayer to use the new PM
      callbacks (struct dev_pm_ops).  A new source file, scsi_pm.c, is
      created to hold the new callback routines, and the existing
      suspend/resume code is moved there.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      db5bd1e0