1. 17 12月, 2014 1 次提交
  2. 04 12月, 2014 1 次提交
    • U
      PM / Domains: Initial PM clock support for genpd · c11f6f5b
      Ulf Hansson 提交于
      It's quite common for PM domains to use PM clocks. Typically from SOC
      specific code, the per device PM clock list is created and
      pm_clk_suspend|resume() are invoked to handle clock gating/ungating.
      
      A step towards consolidation is to integrate PM clock support into
      genpd, which is what this patch does.
      
      In this initial step, the calls to the pm_clk_suspend|resume() are
      handled within genpd, but the per device PM clock list still needs to
      be created from SOC specific code. It seems reasonable to have gendp to
      handle that as well, but that left to future patches to address.
      
      It's not every users of genpd that are keen on using PM clocks, thus we
      need to provide this a configuration option for genpd. Therefore let's
      add flag field in the genpd struct to keep this information and define
      a new GENDP_FLAG_PM_CLK bit for it.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Acked-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c11f6f5b
  3. 21 11月, 2014 1 次提交
    • U
      PM / Domains: Power on the PM domain right after attach completes · 2ed12769
      Ulf Hansson 提交于
      Vast amount of platform drivers which enables runtime PM, don't invoke
      a pm_runtime_get_sync() while probing their devices.
      
      Instead, once they have turned on their PM resourses during ->probe()
      and are ready to handle I/O, these invokes pm_runtime_set_active() to
      synchronize its state towards the runtime PM core.
      
      From the runtime PM point of view this behavior is perfectly acceptable,
      but we encounter probe failures if their corresponding devices resides
      in the generic PM domain. The issues are observed for those devices,
      which requires its PM domain to stay powered during ->probe() since
      that's not being controlled.
      
      While using the generic OF-based PM domain look-up, a device's PM
      domain will be attached during the probe sequence. For this path, let's
      fix the probe failures, by simply power on the PM domain right after
      when it's been attached to the device.
      
      The generic PM domain stays powered until all of its devices becomes
      runtime PM enabled and runtime PM suspended.
      
      The old SOCs which makes use of the generic PM domain but don't use the
      generic OF-based PM domain look-up, will not be affected from this
      change.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2ed12769
  4. 14 11月, 2014 2 次提交
  5. 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
  6. 08 11月, 2014 1 次提交
  7. 03 10月, 2014 1 次提交
  8. 26 9月, 2014 2 次提交
  9. 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
  10. 22 9月, 2014 2 次提交
  11. 09 9月, 2014 8 次提交
  12. 18 4月, 2014 1 次提交
  13. 07 4月, 2014 1 次提交
  14. 01 3月, 2014 1 次提交
  15. 15 2月, 2014 1 次提交
  16. 04 6月, 2013 1 次提交
  17. 12 4月, 2013 2 次提交
  18. 26 1月, 2013 1 次提交
  19. 24 10月, 2012 1 次提交
  20. 23 10月, 2012 1 次提交
  21. 07 9月, 2012 1 次提交
  22. 04 9月, 2012 8 次提交
    • 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