1. 01 11月, 2011 1 次提交
  2. 22 10月, 2011 2 次提交
    • J
      PM / Clocks: Remove redundant NULL checks before kfree() · 0ab1e79b
      Jonghwan Choi 提交于
      Since kfree() checks it its argument is not NULL, it is not necessary
      to duplicate this check in __pm_clk_remove().
      
      [rjw: Added the changelog.]
      Signed-off-by: NJonghwan Choi <jhbird.choi@samsung.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0ab1e79b
    • R
      PM / Sleep: Mark devices involved in wakeup signaling during suspend · 4ca46ff3
      Rafael J. Wysocki 提交于
      The generic PM domains code in drivers/base/power/domain.c has
      to avoid powering off domains that provide power to wakeup devices
      during system suspend.  Currently, however, this only works for
      wakeup devices directly belonging to the given domain and not for
      their children (or the children of their children and so on).
      Thus, if there's a wakeup device whose parent belongs to a power
      domain handled by the generic PM domains code, the domain will be
      powered off during system suspend preventing the device from
      signaling wakeup.
      
      To address this problem introduce a device flag, power.wakeup_path,
      that will be set during system suspend for all wakeup devices,
      their parents, the parents of their parents and so on.  This way,
      all wakeup paths in the device hierarchy will be marked and the
      generic PM domains code will only need to avoid powering off
      domains containing devices whose power.wakeup_path is set.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4ca46ff3
  3. 17 10月, 2011 4 次提交
    • A
      PM: Update the policy on default wakeup settings · 8f88893c
      Alan Stern 提交于
      This patch (as1485) documents a change to the kernel's default wakeup
      policy.  Devices that forward wakeup requests between buses should be
      enabled for wakeup by default.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8f88893c
    • S
      PM / Suspend: Add statistics debugfs file for suspend to RAM · 2a77c46d
      ShuoX Liu 提交于
      Record S3 failure time about each reason and the latest two failed
      devices' names in S3 progress.
      We can check it through 'suspend_stats' entry in debugfs.
      
      The motivation of the patch:
      
      We are enabling power features on Medfield. Comparing with PC/notebook,
      a mobile enters/exits suspend-2-ram (we call it s3 on Medfield) far
      more frequently. If it can't enter suspend-2-ram in time, the power
      might be used up soon.
      
      We often find sometimes, a device suspend fails. Then, system retries
      s3 over and over again. As display is off, testers and developers
      don't know what happens.
      
      Some testers and developers complain they don't know if system
      tries suspend-2-ram, and what device fails to suspend. They need
      such info for a quick check. The patch adds suspend_stats under
      debugfs for users to check suspend to RAM statistics quickly.
      
      If not using this patch, we have other methods to get info about
      what device fails. One is to turn on  CONFIG_PM_DEBUG, but users
      would get too much info and testers need recompile the system.
      
      In addition, dynamic debug is another good tool to dump debug info.
      But it still doesn't match our utilization scenario closely.
      1) user need write a user space parser to process the syslog output;
      2) Our testing scenario is we leave the mobile for at least hours.
         Then, check its status. No serial console available during the
         testing. One is because console would be suspended, and the other
         is serial console connecting with spi or HSU devices would consume
         power. These devices are powered off at suspend-2-ram.
      Signed-off-by: NShuoX Liu <shuox.liu@intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      2a77c46d
    • 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
  4. 05 10月, 2011 1 次提交
    • R
      PM / QoS: Add function dev_pm_qos_read_value() (v3) · 1a9a9152
      Rafael J. Wysocki 提交于
      To read the current PM QoS value for a given device we need to
      make sure that the device's power.constraints object won't be
      removed while we're doing that.  For this reason, put the
      operation under dev->power.lock and acquire the lock
      around the initialization and removal of power.constraints.
      
      Moreover, since we're using the value of power.constraints to
      determine whether or not the object is present, the
      power.constraints_state field isn't necessary any more and may be
      removed.  However, dev_pm_qos_add_request() needs to check if the
      device is being removed from the system before allocating a new
      PM QoS constraints object for it, so make it use the
      power.power_state field of struct device for this purpose.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      1a9a9152
  5. 01 10月, 2011 1 次提交
  6. 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
  7. 27 9月, 2011 2 次提交
    • R
      PM / Domains: Split device PM domain data into base and need_restore · cd0ea672
      Rafael J. Wysocki 提交于
      The struct pm_domain_data data type is defined in such a way that
      adding new fields specific to the generic PM domains code will
      require include/linux/pm.h to be modified.  As a result, data types
      used only by the generic PM domains code will be defined in two
      headers, although they all should be defined in pm_domain.h and
      pm.h will need to include more headers, which won't be very nice.
      
      For this reason change the definition of struct pm_subsys_data
      so that its domain_data member is a pointer, which will allow
      struct pm_domain_data to be subclassed by various PM domains
      implementations.  Remove the need_restore member from
      struct pm_domain_data and make the generic PM domains code
      subclass it by adding the need_restore member to the new data type.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      cd0ea672
    • R
      PM / Clocks: Do not acquire a mutex under a spinlock · e8b364b8
      Rafael J. Wysocki 提交于
      Commit b7ab83ed (PM: Use spinlock instead of mutex in clock
      management functions) introduced a regression causing clocks_mutex
      to be acquired under a spinlock.  This happens because
      pm_clk_suspend() and pm_clk_resume() call pm_clk_acquire() under
      pcd->lock, but pm_clk_acquire() executes clk_get() which causes
      clocks_mutex to be acquired.  Similarly, __pm_clk_remove(),
      executed under pcd->lock, calls clk_put(), which also causes
      clocks_mutex to be acquired.
      
      To fix those problems make pm_clk_add() call pm_clk_acquire(), so
      that pm_clk_suspend() and pm_clk_resume() don't have to do that.
      Change pm_clk_remove() and pm_clk_destroy() to separate
      modifications of the pcd->clock_list list from the actual removal of
      PM clock entry objects done by __pm_clk_remove().
      Reported-and-tested-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      e8b364b8
  8. 25 8月, 2011 15 次提交
    • R
      PM / Domains: Preliminary support for devices with power.irq_safe set · 0aa2a221
      Rafael J. Wysocki 提交于
      The generic PM domains framework currently doesn't work with devices
      whose power.irq_safe flag is set, because runtime PM callbacks for
      such devices are run with interrupts disabled and the callbacks
      provided by the generic PM domains framework use domain mutexes
      and may sleep.  However, such devices very well may belong to
      power domains on some systems, so the generic PM domains framework
      should take them into account.
      
      For this reason, modify the generic PM domains framework so that the
      domain .power_off() and .power_on() callbacks are never executed for
      a domain containing devices with power.irq_safe set, although the
      .stop_device() and .start_device() callbacks are still run for them.
      
      Additionally, introduce a flag allowing the creator of a
      struct generic_pm_domain object to indicate that its .stop_device()
      and .start_device() callbacks may be run in interrupt context
      (might_sleep_if() triggers if that flag is not set and one of those
      callbacks is run in interrupt context).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0aa2a221
    • J
      PM QoS: Add global notification mechanism for device constraints · b66213cd
      Jean Pihet 提交于
      Add a global notification chain that gets called upon changes to the
      aggregated constraint value for any device.
      The notification callbacks are passing the full constraint request data
      in order for the callees to have access to it. The current use is for the
      platform low-level code to access the target device of the constraint.
      Signed-off-by: NJean Pihet <j-pihet@ti.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b66213cd
    • J
      PM QoS: Implement per-device PM QoS constraints · 91ff4cb8
      Jean Pihet 提交于
      Implement the per-device PM QoS constraints by creating a device
      PM QoS API, which calls the PM QoS constraints management core code.
      
      The per-device latency constraints data strctures are stored
      in the device dev_pm_info struct.
      
      The device PM code calls the init and destroy of the per-device constraints
      data struct in order to support the dynamic insertion and removal of the
      devices in the system.
      
      To minimize the data usage by the per-device constraints, the data struct
      is only allocated at the first call to dev_pm_qos_add_request.
      The data is later free'd when the device is removed from the system.
      A global mutex protects the constraints users from the data being
      allocated and free'd.
      Signed-off-by: NJean Pihet <j-pihet@ti.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      91ff4cb8
    • R
      PM: Move clock-related definitions and headers to separate file · b5e8d269
      Rafael J. Wysocki 提交于
      Since the PM clock management code in drivers/base/power/clock_ops.c
      is used for both runtime PM and system suspend/hibernation, the
      definitions of data structures and headers related to it should not
      be located in include/linux/pm_rumtime.h.  Move them to a separate
      header file.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b5e8d269
    • R
      PM / Domains: Use power.sybsys_data to reduce overhead · 4605ab65
      Rafael J. Wysocki 提交于
      Currently pm_genpd_runtime_resume() has to walk the list of devices
      from the device's PM domain to find the corresponding device list
      object containing the need_restore field to check if the driver's
      .runtime_resume() callback should be executed for the device.
      This is suboptimal and can be simplified by using power.sybsys_data
      to store device information used by the generic PM domains code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4605ab65
    • R
      PM: Reference counting of power.subsys_data · ef27bed1
      Rafael J. Wysocki 提交于
      Since the power.subsys_data device field will be used by multiple
      filesystems, introduce a reference counting mechanism for it to avoid
      freeing it prematurely or changing its value at a wrong time.
      
      Make the PM clocks management code that currently is the only user of
      power.subsys_data use the new reference counting.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ef27bed1
    • R
      PM: Introduce struct pm_subsys_data · 5c095a0e
      Rafael J. Wysocki 提交于
      Introduce struct pm_subsys_data that may be subclassed by subsystems
      to store subsystem-specific information related to the device.  Move
      the clock management fields accessed through the power.subsys_data
      pointer in struct device to the new strucutre.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5c095a0e
    • R
      PM / Domains: Rename argument of pm_genpd_add_subdomain() · bc0403ff
      Rafael J. Wysocki 提交于
      Change the name of the second argument of pm_genpd_add_subdomain()
      so that it is (a) shorter and (b) in agreement with the name of
      the second argument of pm_genpd_add_subdomain().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      bc0403ff
    • R
      PM / Domains: Rename GPD_STATE_WAIT_PARENT to GPD_STATE_WAIT_MASTER · 17877eb5
      Rafael J. Wysocki 提交于
      Since it is now possible for a PM domain to have multiple masters
      instead of one parent, rename the "wait for parent" status to reflect
      the new situation.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      17877eb5
    • R
      PM / Domains: Allow generic PM domains to have multiple masters · 5063ce15
      Rafael J. Wysocki 提交于
      Currently, for a given generic PM domain there may be only one parent
      domain (i.e. a PM domain it depends on).  However, there is at least
      one real-life case in which there should be two parents (masters) for
      one PM domain (the A3RV domain on SH7372 turns out to depend on the
      A4LC domain and it depends on the A4R domain and the same time). For
      this reason, allow a PM domain to have multiple parents (masters) by
      introducing objects representing links between PM domains.
      
      The (logical) links between PM domains represent relationships in
      which one domain is a master (i.e. it is depended on) and another
      domain is a slave (i.e. it depends on the master) with the rule that
      the slave cannot be powered on if the master is not powered on and
      the master cannot be powered off if the slave is not powered off.
      Each struct generic_pm_domain object representing a PM domain has
      two lists of links, a list of links in which it is a master and
      a list of links in which it is a slave.  The first of these lists
      replaces the list of subdomains and the second one is used in place
      of the parent pointer.
      
      Each link is represented by struct gpd_link object containing
      pointers to the master and the slave and two struct list_head
      members allowing it to hook into two lists (the master's list
      of "master" links and the slave's list of "slave" links).  This
      allows the code to get to the link from each side (either from
      the master or from the slave) and follow it in each direction.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5063ce15
    • R
      PM / Domains: Add "wait for parent" status for generic PM domains · 3f241775
      Rafael J. Wysocki 提交于
      The next patch will make it possible for a generic PM domain to have
      multiple parents (i.e. multiple PM domains it depends on).  To
      prepare for that change it is necessary to change pm_genpd_poweron()
      so that it doesn't jump to the start label after running itself
      recursively for the parent domain.  For this purpose, introduce a new
      PM domain status value GPD_STATE_WAIT_PARENT that will be set by
      pm_genpd_poweron() before calling itself recursively for the parent
      domain and modify the code in drivers/base/power/domain.c so that
      the GPD_STATE_WAIT_PARENT status is guaranteed to be preserved during
      the execution of pm_genpd_poweron() for the parent.
      
      This change also causes pm_genpd_add_subdomain() and
      pm_genpd_remove_subdomain() to wait for started pm_genpd_poweron() to
      complete and allows pm_genpd_runtime_resume() to avoid dropping the
      lock after powering on the PM domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3f241775
    • R
      PM / Domains: Make pm_genpd_poweron() always survive parent removal · 9e08cf42
      Rafael J. Wysocki 提交于
      If pm_genpd_remove_subdomain() is called to remove a PM domain's
      subdomain and pm_genpd_poweron() is called for that subdomain at
      the same time, and the pm_genpd_poweron() called by it recursively
      for the parent returns an error, the first pm_genpd_poweron()'s
      error code path will attempt to decrement the subdomain counter of
      a PM domain that it's not a subdomain of any more.
      
      Rearrange the code in pm_genpd_poweron() to prevent this from
      happening.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      9e08cf42
    • R
      PM / Domains: Do not take parent locks to modify subdomain counters · 3c07cbc4
      Rafael J. Wysocki 提交于
      After the subdomain counter in struct generic_pm_domain has been
      changed into an atomic_t field, it is possible to modify
      pm_genpd_poweron() and pm_genpd_poweroff() so that they don't take
      the parents locks.  This requires pm_genpd_poweron() to increment
      the parent's subdomain counter before calling itself recursively
      for the parent and to decrement it if an error is to be returned.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3c07cbc4
    • R
      PM / Domains: Implement subdomain counters as atomic fields · c4bb3160
      Rafael J. Wysocki 提交于
      Currently, pm_genpd_poweron() and pm_genpd_poweroff() need to take
      the parent PM domain's lock in order to modify the parent's counter
      of active subdomains in a nonracy way.  This causes the locking to be
      considerably complex and in fact is not necessary, because the
      subdomain counters may be implemented as atomic fields and they
      won't have to be modified under a lock.
      
      Replace the unsigned in sd_count field in struct generic_pm_domain
      by an atomic_t one and modify the code in drivers/base/power/domain.c
      to take this change into account.
      
      This patch doesn't change the locking yet, that is going to be done
      in a separate subsequent patch.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c4bb3160
    • R
      PM: Use spinlock instead of mutex in clock management functions · b7ab83ed
      Rafael J. Wysocki 提交于
      The lock member of struct pm_clk_data is of type struct mutex,
      which is a problem, because the suspend and resume routines
      defined in drivers/base/power/clock_ops.c cannot be executed
      with interrupts disabled for this reason.  Modify
      struct pm_clk_data so that its lock member is a spinlock.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      b7ab83ed
  9. 14 8月, 2011 2 次提交
    • 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
    • R
      PM / Domains: Fix build for CONFIG_PM_RUNTIME unset · 17f2ae7f
      Rafael J. Wysocki 提交于
      Function genpd_queue_power_off_work() is not defined for
      CONFIG_PM_RUNTIME, so pm_genpd_poweroff_unused() causes a build
      error to happen in that case.  Fix the problem by making
      pm_genpd_poweroff_unused() depend on CONFIG_PM_RUNTIME too.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      17f2ae7f
  10. 06 8月, 2011 2 次提交
    • 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
    • R
      PM / Domains: Fix pm_genpd_poweron() · fe202fde
      Rafael J. Wysocki 提交于
      The local variable ret is defined twice in pm_genpd_poweron(), which
      causes this function to always return 0, even if the PM domain's
      .power_on() callback fails, in which case an error code should be
      returned.
      
      Remove the wrong second definition of ret and additionally remove an
      unnecessary definition of wait from pm_genpd_poweron().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      fe202fde
  11. 27 7月, 2011 2 次提交
  12. 16 7月, 2011 2 次提交
  13. 15 7月, 2011 2 次提交
  14. 13 7月, 2011 1 次提交
  15. 12 7月, 2011 1 次提交