1. 04 6月, 2013 1 次提交
  2. 12 4月, 2013 1 次提交
  3. 24 2月, 2013 2 次提交
    • M
      pm / runtime: force memory allocation with no I/O during Runtime PM callbcack · db88175f
      Ming Lei 提交于
      Apply the introduced memalloc_noio_save() and memalloc_noio_restore() to
      force memory allocation with no I/O during runtime_resume/runtime_suspend
      callback on device with the flag of 'memalloc_noio' set.
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: Jiri Kosina <jiri.kosina@suse.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      db88175f
    • M
      pm / runtime: introduce pm_runtime_set_memalloc_noio() · e823407f
      Ming Lei 提交于
      Introduce the flag memalloc_noio in 'struct dev_pm_info' to help PM core
      to teach mm not allocating memory with GFP_KERNEL flag for avoiding
      probable deadlock.
      
      As explained in the comment, any GFP_KERNEL allocation inside
      runtime_resume() or runtime_suspend() on any one of device in the path
      from one block or network device to the root device in the device tree
      may cause deadlock, the introduced pm_runtime_set_memalloc_noio() sets
      or clears the flag on device in the path recursively.
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: Jiri Kosina <jiri.kosina@suse.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e823407f
  4. 23 9月, 2012 1 次提交
    • K
      PM / Runtime: let rpm_resume() succeed if RPM_ACTIVE, even when disabled, v2 · 6f3c77b0
      Kevin Hilman 提交于
      There are several drivers where the return value of
      pm_runtime_get_sync() is used to decide whether or not it is safe to
      access hardware and that don't provide .suspend() callbacks for system
      suspend (but may use late/noirq callbacks.)  If such a driver happens
      to call pm_runtime_get_sync() during system suspend, after the core
      has disabled runtime PM, it will get the error code and will decide
      that the hardware should not be accessed, although this may be a wrong
      conclusion, depending on the state of the device when runtime PM was
      disabled.
      
      Drivers might work around this problem by using a test like:
      
         ret = pm_runtime_get_sync(dev);
         if (!ret || (ret == -EACCES && driver_private_data(dev)->suspended)) {
            /* access hardware */
         }
      
      where driver_private_data(dev)->suspended is a flag set by the
      driver's .suspend() method (that would have to be added for this
      purpose).  However, that potentially would need to be done by multiple
      drivers which means quite a lot of duplicated code and bloat.
      
      To avoid that we can use the observation that the core sets
      dev->power.is_suspended before disabling runtime PM and use that
      instead of the driver's private flag.  Still, potentially many drivers
      would need to repeat that same check in quite a few places, so it's
      better to let the core do it.
      
      Then we can be a bit smarter and check whether or not runtime PM was
      disabled by the core only (disable_depth == 1) or by someone else in
      addition to the core (disable_depth > 1).  In the former case
      rpm_resume() can return 1 if the runtime PM status is RPM_ACTIVE,
      because it means the device was active when the core disabled runtime
      PM.  In the latter case it should still return -EACCES, because it
      isn't clear why runtime PM has been disabled.
      
      Tested on AM3730/Beagle-xM where a wakeup IRQ firing during the late
      suspend phase triggers runtime PM activity in the I2C driver since the
      wakeup IRQ is on an I2C-connected PMIC.
      
      [rjw: Modified whitespace to follow the file's convention.]
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6f3c77b0
  5. 04 9月, 2012 2 次提交
    • R
      PM: Do not use the syscore flag for runtime PM · feb70af0
      Rafael J. Wysocki 提交于
      The syscore device PM flag used to mark the devices (belonging to
      PM domains) that should never be turned off, except for the system
      core (syscore) suspend/hibernation and resume stages, need not be
      accessed by the runtime PM core functions, because all of the devices
      it is set for need to be marked as "irq safe" anyway and are
      protected from being turned off by runtime PM by ensuring that their
      usage counters are always set.
      
      For this reason, make the syscore flag system-wide PM-specific
      and simplify the code used for manipulating it, because it need not
      acquire the device's power.lock any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      feb70af0
    • R
      PM / Domains: Move syscore flag from subsys data to struct device · dbf37414
      Rafael J. Wysocki 提交于
      The syscore device PM flag is used to mark the devices (belonging to
      a PM domain) that should never be turned off, except for the system
      core (syscore) suspend/hibernation and resume stages.  That flag is
      stored in the device's struct pm_subsys_data object whose address is
      available from struct device.  However, in some situations it may be
      convenient to set that flag before the device is added to a PM
      domain, so it is better to move it directly to the "power" member of
      struct device.  Then, it can be checked by the routines in
      drivers/base/power/runtime.c and drivers/base/power/main.c, which is
      more straightforward.
      
      This also reduces the number of dev_gpd_data() invocations in the
      generic PM domains framework, so the overhead related to the syscore
      flag is slightly smaller.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      dbf37414
  6. 18 8月, 2012 3 次提交
    • R
      PM / Runtime: Check device PM QoS setting before "no callbacks" check · 55d7ec45
      Rafael J. Wysocki 提交于
      If __dev_pm_qos_read_value(dev) returns a negative value,
      rpm_suspend() should return -EPERM for dev even if its
      power.no_callbacks flag is set.  For this to happen, the device's
      power.no_callbacks flag has to be checked after the PM QoS check,
      so move the PM QoS check to rpm_check_suspend_allowed() (this will
      make it cover idle notifications as well as runtime suspend too).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      55d7ec45
    • R
      PM / Runtime: Clear power.deferred_resume on success in rpm_suspend() · 58a34de7
      Rafael J. Wysocki 提交于
      The power.deferred_resume can only be set if the runtime PM status
      of device is RPM_SUSPENDING and it should be cleared after its
      status has been changed, regardless of whether or not the runtime
      suspend has been successful.  However, it only is cleared on
      suspend failure, while it may remain set on successful suspend and
      is happily leaked to rpm_resume() executed in that case.
      
      That shouldn't happen, so if power.deferred_resume is set in
      rpm_suspend() after the status has been changed to RPM_SUSPENDED,
      clear it before calling rpm_resume().  Then, it doesn't need to be
      cleared before changing the status to RPM_SUSPENDING any more,
      because it's always cleared after the status has been changed to
      either RPM_SUSPENDED (on success) or RPM_ACTIVE (on failure).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      58a34de7
    • R
      PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set · 7f321c26
      Rafael J. Wysocki 提交于
      For devices whose power.no_callbacks flag is set, rpm_resume()
      should return 1 if the device's parent is already active, so that
      the callers of pm_runtime_get() don't think that they have to wait
      for the device to resume (asynchronously) in that case (the core
      won't queue up an asynchronous resume in that case, so there's
      nothing to wait for anyway).
      
      Modify the code accordingly (and make sure that an idle notification
      will be queued up on success, even if 1 is to be returned).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      7f321c26
  7. 02 5月, 2012 1 次提交
  8. 27 3月, 2012 1 次提交
    • A
      PM / Runtime: don't forget to wake up waitqueue on failure · f2791d73
      Alan Stern 提交于
      This patch (as1535) fixes a bug in the runtime PM core.  When a
      runtime suspend attempt completes, whether successfully or not, the
      device's power.wait_queue is supposed to be signalled.  But this
      doesn't happen in the failure pathway of rpm_suspend() when another
      autosuspend attempt is rescheduled.  As a result, a task can get stuck
      indefinitely on the wait queue (I have seen this happen in testing).
      
      The patch fixes the problem by moving the wake_up_all() call up near
      the start of the failure code.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      f2791d73
  9. 22 12月, 2011 1 次提交
    • R
      PM: Run the driver callback directly if the subsystem one is not there · 35cd133c
      Rafael J. Wysocki 提交于
      Make the PM core execute driver PM callbacks directly if the
      corresponding subsystem callbacks are not present.
      
      There are three reasons for doing that.  First, it reflects the
      behavior of drivers/base/dd.c:really_probe() that runs the driver's
      .probe() callback directly if the bus type's one is not defined, so
      this change will remove one arbitrary difference between the PM core
      and the remaining parts of the driver core.  Second, it will allow
      some subsystems, whose PM callbacks don't do anything except for
      executing driver callbacks, to be simplified quite a bit by removing
      those "forward-only" callbacks.  Finally, it will allow us to remove
      one level of indirection in the system suspend and resume code paths
      where it is not necessary, which is going to lead to less debug noise
      with initcall_debug passed in the kernel command line (messages won't
      be printed for driverless devices whose subsystems don't provide
      PM callbacks among other things).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      35cd133c
  10. 02 12月, 2011 1 次提交
    • R
      PM / Runtime: Use device PM QoS constraints (v2) · 00dc9ad1
      Rafael J. Wysocki 提交于
      Make the runtime PM core use device PM QoS constraints to check if
      it is allowed to suspend a given device, so that an error code is
      returned if the device's own PM QoS constraint is negative or one of
      its children has already been suspended for too long.  If this is
      not the case, the maximum estimated time the device is allowed to be
      suspended, computed as the minimum of the device's PM QoS constraint
      and the PM QoS constraints of its children (reduced by the difference
      between the current time and their suspend times) is stored in a new
      device's PM field power.max_time_suspended_ns that can be used by
      the device's subsystem or PM domain to decide whether or not to put
      the device into lower-power (and presumably higher-latency) states
      later (if the constraint is 0, which means "no constraint", the
      power.max_time_suspended_ns is set to -1).
      
      Additionally, the time of execution of the subsystem-level
      .runtime_suspend() callback for the device is recorded in the new
      power.suspend_time field for later use by the device's subsystem or
      PM domain along with power.max_time_suspended_ns (it also is used
      by the core code when the device's parent is suspended).
      
      Introduce a new helper function,
      pm_runtime_update_max_time_suspended(), allowing subsystems and PM
      domains (or device drivers) to update the power.max_time_suspended_ns
      field, for example after changing the power state of a suspended
      device.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      00dc9ad1
  11. 05 11月, 2011 2 次提交
  12. 01 11月, 2011 1 次提交
  13. 17 10月, 2011 2 次提交
    • M
      PM / Runtime: Handle .runtime_suspend() failure correctly · 857b36c7
      Ming Lei 提交于
      If .runtime_suspend() returns -EAGAIN or -EBUSY, the device should
      still be in ACTIVE state, so it is not necessary to send an idle
      notification to its parent.  If .runtime_suspend() returns other
      fatal failure, it doesn't make sense to send idle notification to
      its parent.
      
      Skip parent idle notification when failure is returned from
      .runtime_suspend() and update comments in rpm_suspend() to reflect
      that change.
      
      [rjw: Modified the subject and changelog slightly.]
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      857b36c7
    • M
      PM / Runtime: Fix kerneldoc comment for rpm_suspend() · 47d8f0ba
      Ming Lei 提交于
      This patch fix kerneldoc comments for rpm_suspend():
      
       - 'Cancel a pending idle notification' should be put before, also
         should be changed to 'Cancel a pending idle notification,
         autosuspend or suspend'.
      
       - idle notification for the device after succeeding suspend has
         been removed, so update the comment accordingly.
      
      [rjw: Modified the subject and changelog slightly.]
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      47d8f0ba
  14. 28 9月, 2011 2 次提交
    • M
      PM / Runtime: Replace dev_dbg() with trace_rpm_*() · c3dc2f14
      Ming Lei 提交于
      This patch replaces dev_dbg with trace_rpm_* inside
      the three important functions:
      
      	rpm_idle
      	rpm_suspend
      	rpm_resume
      
      Trace points have the below advantages compared with dev_dbg:
      
      	- trace points include much runtime information(such as
      	running cpu, current task, ...)
      
      	- most of linux distributions may disable "verbose debug"
      	driver debug compile switch, so it is very difficult to
      	report/debug runtime pm related problems from distribution
      	users without this kind of debug information.
      
      	- for upstream kernel users, enableing the debug switch will
      	produce many useless "rpm_resume" output, and it is very noise.
      
      	- dev_dbg inside rpm_suspend/rpm_resume may have some effects
      	on runtime pm behaviour of console devicer
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c3dc2f14
    • R
      PM / Runtime: Don't run callbacks under lock for power.irq_safe set · ad3c36a5
      Rafael J. Wysocki 提交于
      The rpm_suspend() and rpm_resume() routines execute subsystem or PM
      domain callbacks under power.lock if power.irq_safe is set for the
      given device.  This is inconsistent with that rpm_idle() does after
      commit 02b26774 (PM / Runtime: Allow _put_sync() from
      interrupts-disabled context) and is problematic for subsystems and PM
      domains wanting to use power.lock for synchronization in their
      runtime PM callbacks.
      
      This change requires the code checking if the device's runtime PM
      status is RPM_SUSPENDING or RPM_RESUMING to be modified too, to take
      the power.irq_safe set case into account (that code wasn't reachable
      before with power.irq_safe set, because it's executed with the
      device's power.lock held).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NMing Lei <tom.leiming@gmail.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      ad3c36a5
  15. 14 8月, 2011 1 次提交
    • C
      PM / Runtime: Add might_sleep() to runtime PM functions · 311aab73
      Colin Cross 提交于
      Some of the entry points to pm runtime are not safe to
      call in atomic context unless pm_runtime_irq_safe() has
      been called.  Inspecting the code, it is not immediately
      obvious that the functions sleep at all, as they run
      inside a spin_lock_irqsave, but under some conditions
      they can drop the lock and turn on irqs.
      
      If a driver incorrectly calls the pm_runtime apis, it can
      cause sleeping and irq processing when it expects to stay
      in atomic context.
      
      Add might_sleep_if to the majority of the __pm_runtime_* entry points
      to enforce correct usage.
      
      Add pm_runtime_put_sync_autosuspend to the list of
      functions that can be called in atomic context.
      Signed-off-by: NColin Cross <ccross@android.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      311aab73
  16. 06 8月, 2011 1 次提交
    • K
      PM / Runtime: Allow _put_sync() from interrupts-disabled context · 02b26774
      Kevin Hilman 提交于
      Currently the use of pm_runtime_put_sync() is not safe from
      interrupts-disabled context because rpm_idle() will release the
      spinlock and enable interrupts for the idle callbacks.  This enables
      interrupts during a time where interrupts were expected to be
      disabled, and can have strange side effects on drivers that expected
      interrupts to be disabled.
      
      This is not a bug since the documentation clearly states that only
      _put_sync_suspend() is safe in IRQ-safe mode.
      
      However, pm_runtime_put_sync() could be made safe when in IRQ-safe
      mode by releasing the spinlock but not re-enabling interrupts, which
      is what this patch aims to do.
      
      Problem was found when using some buggy drivers that set
      pm_runtime_irq_safe() and used _put_sync() in interrupts-disabled
      context.
      Reported-by: NColin Cross <ccross@google.com>
      Tested-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      02b26774
  17. 09 7月, 2011 1 次提交
  18. 06 7月, 2011 1 次提交
  19. 02 7月, 2011 2 次提交
    • 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
    • R
      PM / Domains: Rename struct dev_power_domain to struct dev_pm_domain · 564b905a
      Rafael J. Wysocki 提交于
      The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
      (PM: Add support for device power domains), which introduced the
      struct dev_power_domain type for representing device power domains,
      evidently confuses some developers who tend to think that objects
      of this type must correspond to "power domains" as defined by
      hardware, which is not the case.  Namely, at the kernel level, a
      struct dev_power_domain object can represent arbitrary set of devices
      that are mutually dependent power management-wise and need not belong
      to one hardware power domain.  To avoid that confusion, rename struct
      dev_power_domain to struct dev_pm_domain and rename the related
      pointers in struct device and struct pm_clk_notifier_block from
      pwr_domain to pm_domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      564b905a
  20. 29 4月, 2011 1 次提交
    • R
      PM: Make power domain callbacks take precedence over subsystem ones · 4d27e9dc
      Rafael J. Wysocki 提交于
      Change the PM core's behavior related to power domains in such a way
      that, if a power domain is defined for a given device, its callbacks
      will be executed instead of and not in addition to the device
      subsystem's PM callbacks.
      
      The idea behind the initial implementation of power domains handling
      by the PM core was that power domain callbacks would be executed in
      addition to subsystem callbacks, so that it would be possible to
      extend the subsystem callbacks by using power domains.  It turns out,
      however, that this wouldn't be really convenient in some important
      situations.
      
      For example, there are systems in which power can only be removed
      from entire power domains.  On those systems it is not desirable to
      execute device drivers' PM callbacks until it is known that power is
      going to be removed from the devices in question, which means that
      they should be executed by power domain callbacks rather then by
      subsystem (e.g. bus type) PM callbacks, because subsystems generally
      have no information about what devices belong to which power domain.
      Thus, for instance, if the bus type in question is the platform bus
      type, its PM callbacks generally should not be called in addition to
      power domain callbacks, because they run device drivers' callbacks
      unconditionally if defined.
      
      While in principle the default subsystem PM callbacks, or a subset of
      them, may be replaced with different functions, it doesn't seem
      correct to do so, because that would change the subsystem's behavior
      with respect to all devices in the system, regardless of whether or
      not they belong to any power domains.  Thus, the only remaining
      option is to make power domain callbacks take precedence over
      subsystem callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Acked-by: NKevin Hilman <khilman@ti.com>
      4d27e9dc
  21. 31 3月, 2011 1 次提交
  22. 15 3月, 2011 2 次提交
    • R
      PM: Make system-wide PM and runtime PM treat subsystems consistently · 9659cc06
      Rafael J. Wysocki 提交于
      The code handling system-wide power transitions (eg. suspend-to-RAM)
      can in theory execute callbacks provided by the device's bus type,
      device type and class in each phase of the power transition.  In
      turn, the runtime PM core code only calls one of those callbacks at
      a time, preferring bus type callbacks to device type or class
      callbacks and device type callbacks to class callbacks.
      
      It seems reasonable to make them both behave in the same way in that
      respect.  Moreover, even though a device may belong to two subsystems
      (eg. bus type and device class) simultaneously, in practice power
      management callbacks for system-wide power transitions are always
      provided by only one of them (ie. if the bus type callbacks are
      defined, the device class ones are not and vice versa).  Thus it is
      possible to modify the code handling system-wide power transitions
      so that it follows the core runtime PM code (ie. treats the
      subsystem callbacks as mutually exclusive).
      
      On the other hand, the core runtime PM code will choose to execute,
      for example, a runtime suspend callback provided by the device type
      even if the bus type's struct dev_pm_ops object exists, but the
      runtime_suspend pointer in it happens to be NULL.  This is confusing,
      because it may lead to the execution of callbacks from different
      subsystems during different operations (eg. the bus type suspend
      callback may be executed during runtime suspend of the device, while
      the device type callback will be executed during system suspend).
      
      Make all of the power management code treat subsystem callbacks in
      a consistent way, such that:
      (1) If the device's type is defined (eg. dev->type is not NULL)
          and its pm pointer is not NULL, the callbacks from dev->type->pm
          will be used.
      (2) If dev->type is NULL or dev->type->pm is NULL, but the device's
          class is defined (eg. dev->class is not NULL) and its pm pointer
          is not NULL, the callbacks from dev->class->pm will be used.
      (3) If dev->type is NULL or dev->type->pm is NULL and dev->class is
          NULL or dev->class->pm is NULL, the callbacks from dev->bus->pm
          will be used provided that both dev->bus and dev->bus->pm are
          not NULL.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      Reasoning-sounds-sane-to: Grant Likely <grant.likely@secretlab.ca>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9659cc06
    • R
      PM: Add support for device power domains · 7538e3db
      Rafael J. Wysocki 提交于
      The platform bus type is often used to handle Systems-on-a-Chip (SoC)
      where all devices are represented by objects of type struct
      platform_device.  In those cases the same "platform" device driver
      may be used with multiple different system configurations, but the
      actions needed to put the devices it handles into a low-power state
      and back into the full-power state may depend on the design of the
      given SoC.  The driver, however, cannot possibly include all the
      information necessary for the power management of its device on all
      the systems it is used with.  Moreover, the device hierarchy in its
      current form also is not suitable for representing this kind of
      information.
      
      The patch below attempts to address this problem by introducing
      objects of type struct dev_power_domain that can be used for
      representing power domains within a SoC.  Every struct
      dev_power_domain object provides a sets of device power
      management callbacks that can be used to perform what's needed for
      device power management in addition to the operations carried out by
      the device's driver and subsystem.
      
      Namely, if a struct dev_power_domain object is pointed to by the
      pwr_domain field in a struct device, the callbacks provided by its
      ops member will be executed in addition to the corresponding
      callbacks provided by the device's subsystem and driver during all
      power transitions.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-and-acked-by: NKevin Hilman <khilman@ti.com>
      7538e3db
  23. 26 1月, 2011 1 次提交
  24. 24 12月, 2010 1 次提交
    • A
      PM / Runtime: Add synchronous runtime interface for interrupt handlers (v3) · c7b61de5
      Alan Stern 提交于
      This patch (as1431c) makes the synchronous runtime-PM interface
      suitable for use in interrupt handlers.  Subsystems can call the new
      pm_runtime_irq_safe() function to tell the PM core that a device's
      runtime_suspend and runtime_resume callbacks should be invoked with
      interrupts disabled and the spinlock held.  This permits the
      pm_runtime_get_sync() and the new pm_runtime_put_sync_suspend()
      routines to be called from within interrupt handlers.
      
      When a device is declared irq-safe in this way, the PM core increments
      the parent's usage count, so the parent will never be runtime
      suspended.  This prevents difficult situations in which an irq-safe
      device can't resume because it is forced to wait for its non-irq-safe
      parent.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c7b61de5
  25. 29 10月, 2010 1 次提交
  26. 23 10月, 2010 1 次提交
  27. 17 10月, 2010 5 次提交
    • R
      PM / Runtime: Remove idle notification after failing suspend · f71648d7
      Rafael J. Wysocki 提交于
      If runtime suspend of a device fails returning -EAGAIN or -EBUSY,
      which means that it's safe to try to suspend it again, the PM core
      runs the runtime idle helper function for it.  Unfortunately this may
      lead to problems, for example for PCI devices whose drivers don't
      implement the ->runtime_idle() callback, because in that case the
      PCI bus type's ->runtime_idle() always calls pm_runtime_suspend()
      for the given device.  Then, if there's an automatic idle
      notification after the driver's ->runtime_suspend() returning -EAGAIN
      or -EBUSY, it will make the suspend happen again possibly causing a
      busy loop to appear.  To avoid that, remove the idle notification
      after failing runtime suspend of a device altogether and let the
      callers of pm_runtime_suspend() repeat the operation if need be.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      f71648d7
    • R
      PM / Runtime: Reduce code duplication in core helper functions · 71c63122
      Rafael J. Wysocki 提交于
      Reduce code duplication in rpm_idle(), rpm_suspend() and rpm_resume()
      by using local pointers to store callback addresses and moving some
      duplicated code into a separate function.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NAlan Stern <stern@rowland.harvard.edu>
      71c63122
    • A
      PM / Runtime: Implement autosuspend support · 15bcb91d
      Alan Stern 提交于
      This patch (as1427) implements the "autosuspend" facility for runtime
      PM.  A few new fields are added to the dev_pm_info structure and
      several new PM helper functions are defined, for telling the PM core
      whether or not a device uses autosuspend, for setting the autosuspend
      delay, and for marking periods of device activity.
      
      Drivers that do not want to use autosuspend can continue using the
      same helper functions as before; their behavior will not change.  In
      addition, drivers supporting autosuspend can also call the old helper
      functions to get the old behavior.
      
      The details are all explained in Documentation/power/runtime_pm.txt
      and Documentation/ABI/testing/sysfs-devices-power.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      15bcb91d
    • A
      PM / Runtime: Add no_callbacks flag · 7490e442
      Alan Stern 提交于
      Some devices, such as USB interfaces, cannot be power-managed
      independently of their parents, i.e., they cannot be put in low power
      while the parent remains at full power.  This patch (as1425) creates a
      new "no_callbacks" flag, which tells the PM core not to invoke the
      runtime-PM callback routines for the such devices but instead to
      assume that the callbacks always succeed.  In addition, the
      non-debugging runtime-PM sysfs attributes for the devices are removed,
      since they are pretty much meaningless.
      
      The advantage of this scheme comes not so much from avoiding the
      callbacks themselves, but rather from the fact that without the need
      for a process context in which to run the callbacks, more work can be
      done in interrupt context.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      7490e442
    • A
      PM / Runtime: Combine runtime PM entry points · 140a6c94
      Alan Stern 提交于
      This patch (as1424) combines the various public entry points for the
      runtime PM routines into three simple functions: one for idle, one for
      suspend, and one for resume.  A new bitflag specifies whether or not
      to increment or decrement the usage_count field.
      
      The new entry points are named __pm_runtime_idle,
      __pm_runtime_suspend, and __pm_runtime_resume, to reflect that they
      are trampolines.  Simultaneously, the corresponding internal routines
      are renamed to rpm_idle, rpm_suspend, and rpm_resume.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      140a6c94