1. 12 11月, 2014 1 次提交
    • U
      PM / Domains: Fix initial default state of the need_restore flag · 67732cd3
      Ulf Hansson 提交于
      The initial state of the device's need_restore flag should'nt depend on
      the current state of the PM domain. For example it should be perfectly
      valid to attach an inactive device to a powered PM domain.
      
      The pm_genpd_dev_need_restore() API allow us to update the need_restore
      flag to somewhat cope with such scenarios. Typically that should have
      been done from drivers/buses ->probe() since it's those that put the
      requirements on the value of the need_restore flag.
      
      Until recently, the Exynos SOCs were the only user of the
      pm_genpd_dev_need_restore() API, though invoking it from a centralized
      location while adding devices to their PM domains.
      
      Due to that Exynos now have swithed to the generic OF-based PM domain
      look-up, it's no longer possible to invoke the API from a centralized
      location. The reason is because devices are now added to their PM
      domains during the probe sequence.
      
      Commit "ARM: exynos: Move to generic PM domain DT bindings"
      did the switch for Exynos to the generic OF-based PM domain look-up,
      but it also removed the call to pm_genpd_dev_need_restore(). This
      caused a regression for some of the Exynos drivers.
      
      To handle things more properly in the generic PM domain, let's change
      the default initial value of the need_restore flag to reflect that the
      state is unknown. As soon as some of the runtime PM callbacks gets
      invoked, update the initial value accordingly.
      
      Moreover, since the generic PM domain is verifying that all devices
      are both runtime PM enabled and suspended, using pm_runtime_suspended()
      while pm_genpd_poweroff() is invoked from the scheduled work, we can be
      sure of that the PM domain won't be powering off while having active
      devices.
      
      Do note that, the generic PM domain can still only know about active
      devices which has been activated through invoking its runtime PM resume
      callback. In other words, buses/drivers using pm_runtime_set_active()
      during ->probe() will still suffer from a race condition, potentially
      probing a device without having its PM domain being powered. That issue
      will have to be solved using a different approach.
      
      This a log from the boot regression for Exynos5, which is being fixed in
      this patch.
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 308 at ../drivers/clk/clk.c:851 clk_disable+0x24/0x30()
      Modules linked in:
      CPU: 0 PID: 308 Comm: kworker/0:1 Not tainted 3.18.0-rc3-00569-gbd9449f-dirty #10
      Workqueue: pm pm_runtime_work
      [<c0013c64>] (unwind_backtrace) from [<c0010dec>] (show_stack+0x10/0x14)
      [<c0010dec>] (show_stack) from [<c03ee4cc>] (dump_stack+0x70/0xbc)
      [<c03ee4cc>] (dump_stack) from [<c0020d34>] (warn_slowpath_common+0x64/0x88)
      [<c0020d34>] (warn_slowpath_common) from [<c0020d74>] (warn_slowpath_null+0x1c/0x24)
      [<c0020d74>] (warn_slowpath_null) from [<c03107b0>] (clk_disable+0x24/0x30)
      [<c03107b0>] (clk_disable) from [<c02cc834>] (gsc_runtime_suspend+0x128/0x160)
      [<c02cc834>] (gsc_runtime_suspend) from [<c0249024>] (pm_generic_runtime_suspend+0x2c/0x38)
      [<c0249024>] (pm_generic_runtime_suspend) from [<c024f44c>] (pm_genpd_default_save_state+0x2c/0x8c)
      [<c024f44c>] (pm_genpd_default_save_state) from [<c024ff2c>] (pm_genpd_poweroff+0x224/0x3ec)
      [<c024ff2c>] (pm_genpd_poweroff) from [<c02501b4>] (pm_genpd_runtime_suspend+0x9c/0xcc)
      [<c02501b4>] (pm_genpd_runtime_suspend) from [<c024a4f8>] (__rpm_callback+0x2c/0x60)
      [<c024a4f8>] (__rpm_callback) from [<c024a54c>] (rpm_callback+0x20/0x74)
      [<c024a54c>] (rpm_callback) from [<c024a930>] (rpm_suspend+0xd4/0x43c)
      [<c024a930>] (rpm_suspend) from [<c024bbcc>] (pm_runtime_work+0x80/0x90)
      [<c024bbcc>] (pm_runtime_work) from [<c0032a9c>] (process_one_work+0x12c/0x314)
      [<c0032a9c>] (process_one_work) from [<c0032cf4>] (worker_thread+0x3c/0x4b0)
      [<c0032cf4>] (worker_thread) from [<c003747c>] (kthread+0xcc/0xe8)
      [<c003747c>] (kthread) from [<c000e738>] (ret_from_fork+0x14/0x3c)
      ---[ end trace 40cd58bcd6988f12 ]---
      
      Fixes: a4a8c2c4 (ARM: exynos: Move to generic PM domain DT bindings)
      Reported-and-tested0by: Sylwester Nawrocki <s.nawrocki@samsung.com>
      Reviewed-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Reviewed-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      67732cd3
  2. 08 11月, 2014 1 次提交
  3. 03 10月, 2014 1 次提交
  4. 26 9月, 2014 2 次提交
  5. 24 9月, 2014 1 次提交
    • M
      PM / Domains: add debugfs listing of struct generic_pm_domain-s · 2bd5306a
      Maciej Matraszek 提交于
      Add /sys/kernel/debug/pm_genpd/pm_genpd_summary file, which
      lists power domains in the system, their statuses and attached devices,
      resembling /sys/kernel/debug/clk/clk_summary.
      
      Currently it is impossible to inspect (from userland) whether
      a power domain is on or off. And, if it is on, which device blocks it
      from powering down. This change allows developers working on
      embedded devices power efficiency to list all necessary information
      about generic power domains in one place.
      
      The content of pm_genpd/pm_genpd_summary file is generated by iterating
      over all generic power domain in the system, and, for each,
      over registered devices and over the subdomains, if present.
      
      Example output:
      $ cat  /sys/kernel/debug/pm_genpd/pm_genpd_summary
          domain                      status         slaves
                 /device                                      runtime status
      ----------------------------------------------------------------------
      a4su                            off
      a3sg                            off
      a3sm                            on
      a3sp                            on
          /devices/e6600000.pwm                               suspended
          /devices/e6c50000.serial                            active
          /devices/e6850000.sd                                suspended
          /devices/e6bd0000.mmc                               active
      a4s                             on               a3sp, a3sm, a3sg
          /devices/e6900000.irqpin                            unsupported
          /devices/e6900004.irqpin                            unsupported
          /devices/e6900008.irqpin                            unsupported
          /devices/e690000c.irqpin                            unsupported
          /devices/e9a00000.ethernet                          active
      a3rv                            off
      a4r                             off              a3rv
          /devices/fff20000.i2c                               suspended
      a4lc                            off
      c5                              on               a4lc, a4r, a4s, a4su
          /devices/e6050000.pfc                               unsupported
          /devices/e6138000.timer                             active
      
      To enable this feature, compile the kernel with debugfs
      and CONFIG_PM_ADVANCED_DEBUG enabled.
      Signed-off-by: NMaciej Matraszek <m.matraszek@samsung.com>
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2bd5306a
  6. 22 9月, 2014 2 次提交
  7. 09 9月, 2014 8 次提交
  8. 18 4月, 2014 1 次提交
  9. 07 4月, 2014 1 次提交
  10. 01 3月, 2014 1 次提交
  11. 15 2月, 2014 1 次提交
  12. 04 6月, 2013 1 次提交
  13. 12 4月, 2013 2 次提交
  14. 26 1月, 2013 1 次提交
  15. 24 10月, 2012 1 次提交
  16. 23 10月, 2012 1 次提交
  17. 07 9月, 2012 1 次提交
  18. 04 9月, 2012 11 次提交
    • R
      PM / Domains: Operations related to cpuidle using domain names · 74a2799a
      Rafael J. Wysocki 提交于
      Make it possible to use domain names in operations connecting cpuidle
      to and disconnecting it from a PM domain.  This is useful on
      platforms where PM domain objects are organized in such a way that
      the names of the domains are easier to use than the addresses of
      those objects.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      74a2799a
    • R
      PM / Domains: Document cpuidle-related functions and change their names · 40114447
      Rafael J. Wysocki 提交于
      The names of the cpuidle-related functions in
      drivers/base/power/domain.c are inconsistent with the names of the
      other exported functions in that file (the "pm_" prefix is missing
      from them) and they are missing kerneldoc comments.
      
      Fix that by adding the missing "pm_" prefix to the names of those
      functions and add kerneldoc comments documenting them.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      40114447
    • R
      PM / Domains: Add power-on function using names to identify domains · 8bc0251d
      Rafael J. Wysocki 提交于
      It sometimes is necessary to turn on a given PM domain when only
      the name of it is known and the domain pointer is not readily
      available.  For this reason, add a new helper function,
      pm_genpd_name_poweron(), allowing the caller to turn on a PM domain
      using its name for identification.  To avoid code duplication,
      move the domain lookup code to a separate function.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8bc0251d
    • R
      PM / Domains: Make it possible to use names when adding subdomains · fb7268be
      Rafael J. Wysocki 提交于
      Add a new helper function, pm_genpd_add_subdomain_names(), allowing
      the caller to add a subdomain to a generic PM domain using names for
      domain identification (both domains have to be initialized before).
      
      This function is useful for adding subdomains to PM domains whose
      representations are stored in tables, when the caller doesn't know
      the indices of the domain to add the subdomain to and of the
      subdomain itself, but it knows the domains' names.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      fb7268be
    • R
      PM / Domains: Make it possible to use domain names when adding devices · b5abb085
      Rafael J. Wysocki 提交于
      Add a new helper function __pm_genpd_name_add_device() allowing
      a device to be added to a (registered) generic PM domain identified
      by name.  Add a wrapper around it, pm_genpd_name_add_device(),
      passing NULL as the last argument and reorganize pm_domains.h for the
      new functions to be defined consistently with the existing ones.
      
      These functions are useful for adding devices to PM domains whose
      representations are stored in tables, when the caller doesn't know
      the index of the domain to add the device to, but it knows the
      domain's name.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b5abb085
    • 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: Do not measure start time for "irq safe" devices · e2e3e4e5
      Rafael J. Wysocki 提交于
      The genpd_start_dev() routine used by pm_genpd_runtime_resume()
      to put "irq safe" devices into the full power state measures the
      time necessary to "start" the device and updates its PM QoS timing
      data if necessary.  This may lead to a deadlock if the given device
      is a clock source and genpd_start_dev() is invoked from within the
      clock source's .enable() routine, which will happen if that routine
      uses pm_runtime_get_sync(), for example, to ensure that the device
      is operational.
      
      For this reason, introduce a special routine analogous to
      genpd_start_dev(), called genpd_start_dev_no_timing(), that doesn't
      carry out the time measurement, and make pm_genpd_runtime_resume()
      use it instead of genpd_start_dev() to power up "irq safe" devices.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e2e3e4e5
    • 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
    • R
      PM / Domains: Rename the always_on device flag to syscore · 6fb28bad
      Rafael J. Wysocki 提交于
      The always_on device 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.  Change name
      of that flag to "syscore" to better reflect its purpose.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      6fb28bad
    • R
      PM / Domains: Add power off/on function for system core suspend stage · 77f827de
      Rafael J. Wysocki 提交于
      Introduce function pm_genpd_syscore_switch() and two wrappers around
      it, pm_genpd_syscore_poweroff() and pm_genpd_syscore_poweron(),
      allowing the callers to let the generic PM domains framework know
      that the given device is not necessary any more and its PM domain
      can be turned off (the former) or that the given device will be
      required immediately, so its PM domain has to be turned on (the
      latter) during the system core (syscore) stage of system suspend
      (or hibernation) and resume.
      
      These functions will be used for handling devices registered as
      clock sources and clock event devices that belong to PM domains.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      77f827de
    • R
      PM / Domains: Introduce simplified power on routine for system resume · 802d8b49
      Rafael J. Wysocki 提交于
      Introduce function pm_genpd_sync_poweron() for restoring domain power
      during resume from system suspend and hibernation.  It can be much
      simpler than pm_genpd_poweron(), because it doesn't have to care
      about locking and it can skip many checks done by the latter.
      
      Modify pm_genpd_resume_noirq() and pm_genpd_restore_noirq() to use
      the new function.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      802d8b49
  19. 13 7月, 2012 1 次提交
  20. 11 7月, 2012 1 次提交