1. 29 10月, 2010 1 次提交
  2. 23 10月, 2010 1 次提交
  3. 20 10月, 2010 1 次提交
  4. 17 10月, 2010 15 次提交
    • N
      PM: Introduce library for device-specific OPPs (v7) · e1f60b29
      Nishanth Menon 提交于
      SoCs have a standard set of tuples consisting of frequency and
      voltage pairs that the device will support per voltage domain. These
      are called Operating Performance Points or OPPs. The actual
      definitions of OPP varies over silicon versions. For a specific domain,
      we can have a set of {frequency, voltage} pairs. As the kernel boots
      and more information is available, a default set of these are activated
      based on the precise nature of device. Further on operation, based on
      conditions prevailing in the system (such as temperature), some OPP
      availability may be temporarily controlled by the SoC frameworks.
      
      To implement an OPP, some sort of power management support is necessary
      hence this library depends on CONFIG_PM.
      
      Contributions include:
      Sanjeev Premi for the initial concept:
      	http://patchwork.kernel.org/patch/50998/
      Kevin Hilman for converting original design to device-based.
      Kevin Hilman and Paul Walmsey for cleaning up many of the function
      abstractions, improvements and data structure handling.
      Romit Dasgupta for using enums instead of opp pointers.
      Thara Gopinath, Eduardo Valentin and Vishwanath BS for fixes and
      cleanups.
      Linus Walleij for recommending this layer be made generic for usage
      in other architectures beyond OMAP and ARM.
      Mark Brown, Andrew Morton, Rafael J. Wysocki, Paul E. McKenney for
      valuable improvements.
      
      Discussions and comments from:
      http://marc.info/?l=linux-omap&m=126033945313269&w=2
      http://marc.info/?l=linux-omap&m=125482970102327&w=2
      http://marc.info/?t=125809247500002&r=1&w=2
      http://marc.info/?l=linux-omap&m=126025973426007&w=2
      http://marc.info/?t=128152609200064&r=1&w=2
      http://marc.info/?t=128468723000002&r=1&w=2
      incorporated.
      
      v1: http://marc.info/?t=128468723000002&r=1&w=2Signed-off-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e1f60b29
    • J
      PM: Add sysfs attr for rechecking dev hash from PM trace · d33ac60b
      James Hogan 提交于
      If the device which fails to resume is part of a loadable kernel module
      it won't be checked at startup against the magic number stored in the
      RTC.
      
      Add a read-only sysfs attribute /sys/power/pm_trace_dev_match which
      contains a list of newline separated devices (usually just the one)
      which currently match the last magic number. This allows the device
      which is failing to resume to be found after the modules are loaded
      again.
      Signed-off-by: NJames Hogan <james@albanarts.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      d33ac60b
    • J
      PM: Lock PM device list mutex in show_dev_hash() · 2ac21c6b
      James Hogan 提交于
      Lock the PM device list mutex using device_pm_lock() and
      device_pm_unlock() around the list iteration in show_dev_hash().
      
      show_dev_hash() was reverse iterating dpm_list without first locking the
      mutex that the functions in drivers/base/power/main.c lock. I assume
      this was unintentional since there is no comment suggesting why the lock
      might not be necessary.
      Signed-off-by: NJames Hogan <james@albanarts.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      2ac21c6b
    • 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
    • A
      PM / Runtime: Merge synchronous and async runtime routines · 1bfee5bc
      Alan Stern 提交于
      This patch (as1423) merges the asynchronous routines
      __pm_request_idle(), __pm_request_suspend(), and __pm_request_resume()
      with their synchronous counterparts.  The RPM_ASYNC bitflag argument
      serves to indicate what sort of operation to perform.
      
      In the course of performing this merger, it became apparent that the
      various functions don't all behave consistenly with regard to error
      reporting and cancellation of outstanding requests.  A new routine,
      rpm_check_suspend_allowed(), was written to centralize much of the
      testing, and the other functions were revised to follow a simple
      algorithm:
      
      	If the operation is disallowed because of the device's
      	settings or current state, return an error.
      
      	Cancel pending or scheduled requests of lower priority.
      
      	Schedule, queue, or perform the desired operation.
      
      A few special cases and exceptions are noted in comments.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      1bfee5bc
    • A
      PM / Runtime: Replace boolean arguments with bitflags · 3f9af051
      Alan Stern 提交于
      The "from_wq" argument in __pm_runtime_suspend() and
      __pm_runtime_resume() supposedly indicates whether or not the function
      was called by the PM workqueue thread, but in fact it isn't always
      used this way.  It really indicates whether or not the function should
      return early if the requested operation is already in progress.
      
      Along with this badly-named boolean argument, later patches in this
      series will add several other boolean arguments to these functions and
      others.  Therefore this patch (as1422) begins the conversion process
      by replacing from_wq with a bitflag argument.  The same bitflags are
      also used in __pm_runtime_get() and __pm_runtime_put(), where they
      indicate whether or not the operation should be asynchronous.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3f9af051
    • A
      PM / Runtime: Move code in drivers/base/power/runtime.c · 4769373c
      Alan Stern 提交于
      This patch (as1421) moves the PM runtime accounting subroutines up to
      the beginning of runtime.c, taking them out of the middle of the
      functions that do the actual work.  No operational changes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4769373c
    • R
      PM: Fix potential issue with failing asynchronous suspend · 098dff73
      Rafael J. Wysocki 提交于
      There is a potential issue with the asynchronous suspend code that
      a device driver suspending asynchronously may not notice that it
      should back off.  There are two failing scenarions, (1) when the
      driver is waiting for a driver suspending synchronously to complete
      and that second driver returns error code, in which case async_error
      won't be set and the waiting driver will continue suspending and (2)
      after the driver has called device_pm_wait_for_dev() and the waited
      for driver returns error code, in which case the caller of
      device_pm_wait_for_dev() will not know that there was an error and
      will continue suspending.
      
      To fix this issue make __device_suspend() set async_error, so
      async_suspend() doesn't need to set it any more, and make
      device_pm_wait_for_dev() return async_error, so that its callers
      can check whether or not they should continue suspending.
      
      No more changes are necessary, since device_pm_wait_for_dev() is
      not used by any drivers' suspend routines.
      Reported-by: NColin Cross <ccross@android.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      098dff73
    • R
      PM / Wakeup: Introduce wakeup source objects and event statistics (v3) · 074037ec
      Rafael J. Wysocki 提交于
      Introduce struct wakeup_source for representing system wakeup sources
      within the kernel and for collecting statistics related to them.
      Make the recently introduced helper functions pm_wakeup_event(),
      pm_stay_awake() and pm_relax() use struct wakeup_source objects
      internally, so that wakeup statistics associated with wakeup devices
      can be collected and reported in a consistent way (the definition of
      pm_relax() is changed, which is harmless, because this function is
      not called directly by anyone yet).  Introduce new wakeup-related
      sysfs device attributes in /sys/devices/.../power for reporting the
      device wakeup statistics.
      
      Change the global wakeup events counters event_count and
      events_in_progress into atomic variables, so that it is not necessary
      to acquire a global spinlock in pm_wakeup_event(), pm_stay_awake()
      and pm_relax(), which should allow us to avoid lock contention in
      these functions on SMP systems with many wakeup devices.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      074037ec
    • K
      PM: Fix signed/unsigned warning in dpm_show_time() · 0702d9ee
      Kevin Cernekee 提交于
      Seen on MIPS32, gcc 4.4.3, 2.6.36-rc4:
      
      drivers/base/power/main.c: In function 'dpm_show_time':
      drivers/base/power/main.c:415: warning: comparison of distinct pointer types lacks a cast
      
      do_div() takes unsigned parameters:
      
      uint32_t do_div(uint64_t *n, uint32_t base);
      
      Using an unsigned variable for usecs64 should not cause any problems,
      because calltime >= starttime .
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0702d9ee
    • O
      PM / Runtime: Lenient generic runtime pm callbacks · 05aa55dd
      Ohad Ben-Cohen 提交于
      Allow drivers, that belong to subsystems which use the generic
      runtime pm callbacks, not to define runtime pm suspend/resume handlers,
      by implicitly assuming success in such cases.
      
      This is needed to eliminate nop handlers that would otherwise be
      necessary by drivers which enable runtime pm, but don't need
      to do anything when their devices are runtime-suspended/resumed.
      Signed-off-by: NOhad Ben-Cohen <ohad@wizery.com>
      Acked-by: NKevin Hilman <khilman@deeprootsystems.com>
      Acked-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      05aa55dd
  5. 09 9月, 2010 1 次提交
    • C
      PM: Prevent waiting forever on asynchronous resume after failing suspend · 152e1d59
      Colin Cross 提交于
      During suspend, the power.completion is expected to be set when a
      device has not yet started suspending.  Set it on init to fix a
      corner case where a device is resumed when its parent has never
      suspended.
      
      Consider three drivers, A, B, and C.  The parent of A is C, and C
      has async_suspend set.  On boot, C->power.completion is initialized
      to 0.
      
      During the first suspend:
      suspend_devices_and_enter(...)
       dpm_resume(...)
        device_suspend(A)
        device_suspend(B) returns error, aborts suspend
       dpm_resume_end(...)
         dpm_resume(...)
          device_resume(A)
           dpm_wait(A->parent == C)
            wait_for_completion(C->power.completion)
      
      The wait_for_completion will never complete, because
      complete_all(C->power.completion) will only be called from
      device_suspend(C) or device_resume(C), neither of which is called
      if suspend is aborted before C.
      
      After a successful suspend->resume cycle, where B doesn't abort
      suspend, C->power.completion is left in the completed state by the
      call to device_resume(C), and the same call path will work if B
      aborts suspend.
      Signed-off-by: NColin Cross <ccross@android.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      152e1d59
  6. 19 7月, 2010 4 次提交
    • A
      PM / Runtime: Add runtime PM statistics (v3) · 8d4b9d1b
      Arjan van de Ven 提交于
      In order for PowerTOP to be able to report how well the new runtime PM is
      working for the various drivers, the kernel needs to export some basic
      statistics in sysfs.
      
      This patch adds two sysfs files in the runtime PM domain that expose the
      total time a device has been active, and the time a device has been
      suspended.
      
      With this PowerTOP can compute the activity percentage
      
      Active %age = 100 * (delta active) / (delta active + delta suspended)
      
      and present the information to the user.
      
      I've written the PowerTOP code (slated for version 1.12) already, and the
      output looks like this:
      
      Runtime Device Power Management statistics
      Active  Device name
       10.0%	06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller
      
      [version 2: fix stat update bugs noticed by Alan Stern]
      [version 3: rebase to -next and move the sysfs declaration]
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8d4b9d1b
    • A
      PM / Runtime: Make runtime_status attribute not debug-only (v. 2) · 0fcb4eef
      Alan Stern 提交于
      This patch (as1404b) makes the runtime_status sysfs attribute available
      even in the absence of CONFIG_PM_ADVANCED_DEBUG, and it changes the
      routine to display "unsupported" when runtime PM is disabled for a
      device.  Although not strictly 100% accurate, this will almost always
      be correct.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0fcb4eef
    • R
      PM: Do not use dynamically allocated objects in pm_wakeup_event() · 4eb241e5
      Rafael J. Wysocki 提交于
      Originally, pm_wakeup_event() uses struct delayed_work objects,
      allocated with GFP_ATOMIC, to schedule the execution of pm_relax()
      in future.  However, as noted by Alan Stern, it is not necessary to
      do that, because all pm_wakeup_event() calls can use one static timer
      that will always be set to expire at the latest time passed to
      pm_wakeup_event().
      
      The modifications are based on the example code posted by Alan.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4eb241e5
    • R
      PM: Make it possible to avoid races between wakeup and system sleep · c125e96f
      Rafael J. Wysocki 提交于
      One of the arguments during the suspend blockers discussion was that
      the mainline kernel didn't contain any mechanisms making it possible
      to avoid races between wakeup and system suspend.
      
      Generally, there are two problems in that area.  First, if a wakeup
      event occurs exactly when /sys/power/state is being written to, it
      may be delivered to user space right before the freezer kicks in, so
      the user space consumer of the event may not be able to process it
      before the system is suspended.  Second, if a wakeup event occurs
      after user space has been frozen, it is not generally guaranteed that
      the ongoing transition of the system into a sleep state will be
      aborted.
      
      To address these issues introduce a new global sysfs attribute,
      /sys/power/wakeup_count, associated with a running counter of wakeup
      events and three helper functions, pm_stay_awake(), pm_relax(), and
      pm_wakeup_event(), that may be used by kernel subsystems to control
      the behavior of this attribute and to request the PM core to abort
      system transitions into a sleep state already in progress.
      
      The /sys/power/wakeup_count file may be read from or written to by
      user space.  Reads will always succeed (unless interrupted by a
      signal) and return the current value of the wakeup events counter.
      Writes, however, will only succeed if the written number is equal to
      the current value of the wakeup events counter.  If a write is
      successful, it will cause the kernel to save the current value of the
      wakeup events counter and to abort the subsequent system transition
      into a sleep state if any wakeup events are reported after the write
      has returned.
      
      [The assumption is that before writing to /sys/power/state user space
      will first read from /sys/power/wakeup_count.  Next, user space
      consumers of wakeup events will have a chance to acknowledge or
      veto the upcoming system transition to a sleep state.  Finally, if
      the transition is allowed to proceed, /sys/power/wakeup_count will
      be written to and if that succeeds, /sys/power/state will be written
      to as well.  Still, if any wakeup events are reported to the PM core
      by kernel subsystems after that point, the transition will be
      aborted.]
      
      Additionally, put a wakeup events counter into struct dev_pm_info and
      make these per-device wakeup event counters available via sysfs,
      so that it's possible to check the activity of various wakeup event
      sources within the kernel.
      
      To illustrate how subsystems can use pm_wakeup_event(), make the
      low-level PCI runtime PM wakeup-handling code use it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Acked-by: Nmarkgross <markgross@thegnar.org>
      Reviewed-by: NAlan Stern <stern@rowland.harvard.edu>
      c125e96f
  7. 11 5月, 2010 2 次提交
    • D
      PM / Runtime: Add sysfs debug files · c92445fa
      Dominik Brodowski 提交于
      Add a few sysfs files relating to runtime power management for
      advanced debug purposes:
      
      runtime_enabled: is runtime PM enabled for this device? States
      	are "enabled", "disabled", "forbidden" or a combination
      	of the latter two.
      
      runtime_status:	what state is the device in currently? E.g., it
      	reports "suspended" for runtime-suspended devices, and
              "active" for active devices. NOTE: if runtime_enabled
      	returns "disabled", the value of this file may not
      	reflect its physical state.
      
      runtime_usage: the runtime PM usage count of a device
      
      runtime_active_kids: the runtime PM children usage count of a device, or
      	0 if the ignore_children flag is set.
      
      Also, CONFIG_PM_SLEEP_ADVANCED_DEBUG is not defined in any Kconfig
      file, so replace it with CONFIG_PM_ADVANCED_DEBUG.
      Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c92445fa
    • A
      PM: Allow runtime_suspend methods to call pm_schedule_suspend() · 240c7337
      Alan Stern 提交于
      This patch (as1361) changes the runtime PM interface slightly; it
      allows suspend requests to be scheduled while the runtime_suspend
      method is running.  If the method succeeds then the scheduled request
      is cancelled, whereas if the method fails then an idle notification is
      sent only if no request was scheduled.
      
      Being able to schedule suspend requests from within a runtime_suspend
      method is useful for drivers that need to test for idleness and
      suspend the device all while holding a single spinlock, or for drivers
      that want to check for idleness by polling.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      240c7337
  8. 24 3月, 2010 1 次提交
  9. 08 3月, 2010 1 次提交
    • G
      Driver core: create lock/unlock functions for struct device · 8e9394ce
      Greg Kroah-Hartman 提交于
      In the future, we are going to be changing the lock type for struct
      device (once we get the lockdep infrastructure properly worked out)  To
      make that changeover easier, and to possibly burry the lock in a
      different part of struct device, let's create some functions to lock and
      unlock a device so that no out-of-core code needs to be changed in the
      future.
      
      This patch creates the device_lock/unlock/trylock() functions, and
      converts all in-tree users to them.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Dave Young <hidave.darkstar@gmail.com>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Magnus Damm <damm@igel.co.jp>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Alex Chiang <achiang@hp.com>
      Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrew Patterson <andrew.patterson@hp.com>
      Cc: Yu Zhao <yu.zhao@intel.com>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Wolfram Sang <w.sang@pengutronix.de>
      Cc: CHENG Renquan <rqcheng@smu.edu.sg>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Frans Pop <elendil@planet.nl>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      8e9394ce
  10. 07 3月, 2010 1 次提交
    • R
      PM: Provide generic subsystem-level callbacks · d690b2cd
      Rafael J. Wysocki 提交于
      There are subsystems whose power management callbacks only need to
      invoke the callbacks provided by device drivers.  Still, their system
      sleep PM callbacks should play well with the runtime PM callbacks,
      so that devices suspended at run time can be left in that state for
      a system sleep transition.
      
      Provide a set of generic PM callbacks for such subsystems and
      define convenience macros for populating dev_pm_ops structures.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      d690b2cd
  11. 27 2月, 2010 7 次提交
    • R
      PM: Allow device drivers to use dpm_wait() · f8824cee
      Rafael J. Wysocki 提交于
      There are some dependencies between devices (in particular, between
      EHCI USB controllers and their OHCI/UHCI siblings) which are not
      reflected by the structure of the device tree.  With synchronous
      suspend and resume these dependencies are taken into accout
      automatically, because the devices in question are always registered
      in the right order, but to meet these constraints with asynchronous
      suspend and resume the drivers of these devices will need to use
      dpm_wait() in their suspend/resume routines, so introduce a helper
      function allowing them to do that.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      f8824cee
    • R
      PM: Start asynchronous resume threads upfront · 97df8c12
      Rafael J. Wysocki 提交于
      It has been shown by testing that total device resume time can be
      reduced significantly (by as much as 50% or more) if the async
      threads executing some devices' resume routines are all started
      before the main resume thread starts to handle the "synchronous"
      devices.
      
      This is a consequence of the fact that the slowest devices tend to be
      located at the end of dpm_list, so their resume routines are started
      very late.  Consequently, they have to wait for all the preceding
      "synchronous" devices before their resume routines can be started
      by the main resume thread, even if they are "asynchronous".  By
      starting their async threads upfront we effectively move those
      devices towards the beginning of dpm_list, without breaking their
      ordering with respect to their parents and children.  As a result,
      their resume routines are started much earlier and we are able to
      save much more device resume time this way.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      97df8c12
    • R
      PM: Add facility for advanced testing of async suspend/resume · 5a2eb858
      Rafael J. Wysocki 提交于
      Add configuration switch CONFIG_PM_ADVANCED_DEBUG for compiling in
      extra PM debugging/testing code allowing one to access some
      PM-related attributes of devices from the user space via sysfs.
      
      If CONFIG_PM_ADVANCED_DEBUG is set, add sysfs attribute power/async
      for every device allowing the user space to access the device's
      power.async_suspend flag and modify it, if desired.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5a2eb858
    • R
      PM: Add a switch for disabling/enabling asynchronous suspend/resume · 0e06b4a8
      Rafael J. Wysocki 提交于
      Add sysfs attribute /sys/power/pm_async allowing the user space to
      disable/enable asynchronous suspend/resume of devices.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0e06b4a8
    • R
      PM: Asynchronous suspend and resume of devices · 5af84b82
      Rafael J. Wysocki 提交于
      Theoretically, the total time of system sleep transitions (suspend
      to RAM, hibernation) can be reduced by running suspend and resume
      callbacks of device drivers in parallel with each other.  However,
      there are dependencies between devices such that we're not allowed
      to suspend the parent of a device before suspending the device
      itself.  Analogously, we're not allowed to resume a device before
      resuming its parent.
      
      The most straightforward way to take these dependencies into accout
      is to start the async threads used for suspending and resuming
      devices at the core level, so that async_schedule() is called for
      each suspend and resume callback supposed to be executed
      asynchronously.
      
      For this purpose, introduce a new device flag, power.async_suspend,
      used to mark the devices whose suspend and resume callbacks are to be
      executed asynchronously (ie. in parallel with the main suspend/resume
      thread and possibly in parallel with each other) and helper function
      device_enable_async_suspend() allowing one to set power.async_suspend
      for given device (power.async_suspend is unset by default for all
      devices).  For each device with the power.async_suspend flag set the
      PM core will use async_schedule() to execute its suspend and resume
      callbacks.
      
      The async threads started for different devices as a result of
      calling async_schedule() are synchronized with each other and with
      the main suspend/resume thread with the help of completions, in the
      following way:
      (1) There is a completion, power.completion, for each device object.
      (2) Each device's completion is reset before calling async_schedule()
          for the device or, in the case of devices with the
          power.async_suspend flags unset, before executing the device's
          suspend and resume callbacks.
      (3) During suspend, right before running the bus type, device type
          and device class suspend callbacks for the device, the PM core
          waits for the completions of all the device's children to be
          completed.
      (4) During resume, right before running the bus type, device type and
          device class resume callbacks for the device, the PM core waits
          for the completion of the device's parent to be completed.
      (5) The PM core completes power.completion for each device right
          after the bus type, device type and device class suspend (or
          resume) callbacks executed for the device have returned.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5af84b82
    • R
      PM: Add parent information to timing messages · 8cc6b39f
      Rafael J. Wysocki 提交于
      Add parent information to the messages printed by the suspend/resume
      core when initcall_debug is set.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8cc6b39f
    • R
      PM / Runtime: Add sysfs switch for disabling device run-time PM · 53823639
      Rafael J. Wysocki 提交于
      Add new device sysfs attribute, power/control, allowing the user
      space to block the run-time power management of the devices.  If this
      attribute is set to "on", the driver of the device won't be able to power
      manage it at run time (without breaking the rules) and the device will
      always be in the full power state (except when the entire system goes
      into a sleep state).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      53823639
  12. 12 1月, 2010 1 次提交
  13. 23 12月, 2009 1 次提交
    • R
      PM / Runtime: Use device type and device class callbacks · a6ab7aa9
      Rafael J. Wysocki 提交于
      The power management of some devices is handled through device types
      and device classes rather than through bus types.  Since these
      devices may also benefit from using the run-time power management
      core, extend it so that the device type and device class run-time PM
      callbacks can be taken into consideration by it if the bus type
      callback is not defined.
      
      Update the run-time PM core documentation to reflect this change.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      a6ab7aa9
  14. 21 12月, 2009 1 次提交
    • A
      PM: Use pm_runtime_put_sync in system resume · aa0baaef
      Alan Stern 提交于
      This patch (as1317) fixes a bug in the PM core.  When a device is
      resumed following a system sleep, the core decrements the device's
      runtime PM usage counter but doesn't issue an idle notification if the
      counter reaches 0.  This could prevent an otherwise unused device from
      being runtime-suspended again after the system sleep.
      
      The fix is to call pm_runtime_put_sync() instead of
      pm_runtime_put_noidle().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      aa0baaef
  15. 18 12月, 2009 2 次提交
    • R
      PM: Measure device suspend and resume times · ecf762b2
      Rafael J. Wysocki 提交于
      Measure and print the time of suspending and resuming all devices.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ecf762b2
    • R
      PM: Make the initcall_debug style timing for suspend/resume complete · 875ab0b7
      Rafael J. Wysocki 提交于
      Commit f2511774
      (PM: Add initcall_debug style timing for suspend/resume) introduced
      basic timing instrumentation, needed for a scritps/bootgraph.pl
      equivalent or humans, but it missed the fact that bus types and
      device classes which haven't been switched to using struct dev_pm_ops
      objects yet need special handling.  As a result, the suspend/resume
      timing information is only available for devices whose bus types or
      device classes use struct dev_pm_ops objects, so the majority of
      devices is not covered.
      
      Fix this by adding basic suspend/resume timing instrumentation for
      devices whose bus types and device classes still don't use struct
      dev_pm_ops objects for power management.  To reduce code duplication
      move the timing code to helper functions.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      875ab0b7