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. 28 10月, 2014 1 次提交
    • I
      PM / Sleep: fix async suspend_late/freeze_late error handling · 246ef766
      Imre Deak 提交于
      If an asynchronous suspend_late or freeze_late callback fails
      during the SUSPEND, FREEZE or QUIESCE phases, we don't propagate the
      corresponding error correctly, in effect ignoring the error and
      continuing the suspend-to-ram/hibernation. During suspend-to-ram this
      could leave some devices without a valid saved context, leading to a
      failure to reinitialize them during resume. During hibernation this
      could leave some devices active interfeering with the creation /
      restoration of the hibernation image. Also this could leave the
      corresponding devices without a valid saved context and failure to
      reinitialize them during resume.
      
      Fixes: de377b39 (PM / sleep: Asynchronous threads for suspend_late)
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      246ef766
  8. 03 10月, 2014 2 次提交
  9. 01 10月, 2014 1 次提交
  10. 26 9月, 2014 2 次提交
  11. 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
  12. 22 9月, 2014 3 次提交
  13. 09 9月, 2014 9 次提交
  14. 08 9月, 2014 1 次提交
  15. 01 9月, 2014 1 次提交
  16. 29 7月, 2014 1 次提交
  17. 11 6月, 2014 1 次提交
    • T
      PM / sleep: trace events for device PM callbacks · e8bca479
      Todd E Brandt 提交于
      Adds two trace events which supply the same info that initcall_debug
      provides, but via ftrace instead of dmesg. The existing initcall_debug
      calls require the pm_print_times_enabled var to be set (either via
      sysfs or via the kernel cmd line). The new trace events provide all the
      same info as the initcall_debug prints but with less overhead, and also
      with coverage of device prepare and complete device callbacks.
      
      These events replace the device_pm_report_time event (which has been
      removed). device_pm_callback_start is called first and provides the device
      and callback info. device_pm_callback_end is called after with the
      device name and error info. The time and pid are gathered from the trace
      data headers.
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e8bca479
  18. 07 6月, 2014 1 次提交
    • T
      PM / sleep: trace events for suspend/resume · bb3632c6
      Todd E Brandt 提交于
      Adds trace events that give finer resolution into suspend/resume. These
      events are graphed in the timelines generated by the analyze_suspend.py
      script. They represent large areas of time consumed that are typical to
      suspend and resume.
      
      The event is triggered by calling the function "trace_suspend_resume"
      with three arguments: a string (the name of the event to be displayed
      in the timeline), an integer (case specific number, such as the power
      state or cpu number), and a boolean (where true is used to denote the start
      of the timeline event, and false to denote the end).
      
      The suspend_resume trace event reproduces the data that the machine_suspend
      trace event did, so the latter has been removed.
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bb3632c6
  19. 30 5月, 2014 1 次提交
  20. 27 5月, 2014 1 次提交
  21. 20 5月, 2014 1 次提交
  22. 17 5月, 2014 1 次提交
    • R
      PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily · aae4518b
      Rafael J. Wysocki 提交于
      Currently, some subsystems (e.g. PCI and the ACPI PM domain) have to
      resume all runtime-suspended devices during system suspend, mostly
      because those devices may need to be reprogrammed due to different
      wakeup settings for system sleep and for runtime PM.
      
      For some devices, though, it's OK to remain in runtime suspend
      throughout a complete system suspend/resume cycle (if the device was in
      runtime suspend at the start of the cycle).  We would like to do this
      whenever possible, to avoid the overhead of extra power-up and power-down
      events.
      
      However, problems may arise because the device's descendants may require
      it to be at full power at various points during the cycle.  Therefore the
      most straightforward way to do this safely is if the device and all its
      descendants can remain runtime suspended until the complete stage of
      system resume.
      
      To this end, introduce a new device PM flag, power.direct_complete
      and modify the PM core to use that flag as follows.
      
      If the ->prepare() callback of a device returns a positive number,
      the PM core will regard that as an indication that it may leave the
      device runtime-suspended.  It will then check if the system power
      transition in progress is a suspend (and not hibernation in particular)
      and if the device is, indeed, runtime-suspended.  In that case, the PM
      core will set the device's power.direct_complete flag.  Otherwise it
      will clear power.direct_complete for the device and it also will later
      clear it for the device's parent (if there's one).
      
      Next, the PM core will not invoke the ->suspend() ->suspend_late(),
      ->suspend_irq(), ->resume_irq(), ->resume_early(), or ->resume()
      callbacks for all devices having power.direct_complete set.  It
      will invoke their ->complete() callbacks, however, and those
      callbacks are then responsible for resuming the devices as
      appropriate, if necessary.  For example, in some cases they may
      need to queue up runtime resume requests for the devices using
      pm_request_resume().
      
      Changelog partly based on an Alan Stern's description of the idea
      (http://marc.info/?l=linux-pm&m=139940466625569&w=2).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      aae4518b
  23. 07 5月, 2014 2 次提交
    • N
      PM / OPP: Move cpufreq specific OPP functions out of generic OPP library · a0dd7b79
      Nishanth Menon 提交于
      CPUFreq specific helper functions for OPP (Operating Performance Points)
      now use generic OPP functions that allow CPUFreq to be be moved back
      into CPUFreq framework. This allows for independent modifications
      or future enhancements as needed isolated to just CPUFreq framework
      alone.
      
      Here, we just move relevant code and documentation to make this part of
      CPUFreq infrastructure.
      
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a0dd7b79
    • N
      PM / OPP: Remove cpufreq wrapper dependency on internal data organization · 0f5c890e
      Nishanth Menon 提交于
      CPUFREQ custom functions for OPP (Operating Performance Points)
      currently exist inside the OPP library. These custom functions currently
      depend on internal data structures to pick up OPP information to create
      the cpufreq table.  For example, the cpufreq table is created precisely
      in the same order of how OPP entries are stored inside the list implementation.
      
      This kind of tight interdependency is purely artificial since the same
      functionality can be achieved using the generic OPP functions
      meant to do the same. This interdependency also limits the independent
      modification of cpufreq and OPP library.
      
      So use the generic dev_pm_opp_find_freq_ceil function that achieves the
      table organization as we currently use.
      
      As a result of this, we dont need to use the internal device_opp
      structure anymore, and we hence we can switch over to rcu lock instead
      of the mutex holding the internal list lock.
      
      This breaking of dependency on internal data structure imposes no change
      to usage of these.
      
      NOTE: This change is a precursor to moving this cpufreq specific logic
      out of the generic library into cpufreq.
      
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0f5c890e
  24. 18 4月, 2014 1 次提交
  25. 07 4月, 2014 1 次提交
  26. 26 3月, 2014 1 次提交