1. 17 3月, 2016 1 次提交
    • J
      PM / clk: Add support for obtaining clocks from device-tree · 02113ba9
      Jon Hunter 提交于
      The PM clocks framework requires clients to pass either a con-id or a
      valid clk pointer in order to add a clock to a device. Add a new
      function of_pm_clk_add_clks() to allows device clocks to be retrieved
      from device-tree and populated for a given device. Note that it is
      not necessary to make the compilation of this new function dependent
      upon CONFIG_OF because there are stubs functions for the device-tree
      APIs used.
      
      In order to handle errors encountered when adding clocks from
      device-tree, add a function pm_clk_remove_clk() to remove any clocks
      (using a pointer to the clk structure) that have been added
      successfully before the error occurred.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      02113ba9
  2. 08 1月, 2016 2 次提交
  3. 28 10月, 2015 1 次提交
    • G
      PM / clk: Fix broken build due to non-matching code and header #ifdefs · a6175616
      Geert Uytterhoeven 提交于
      If an architecture's main Kconfig file doesn't include
      kernel/power/Kconfig, but CONFIG_PM=y and HAVE_CLK=y (e.g. m68knommu
      allmodconfig):
      
          drivers/base/power/clock_ops.c: In function ‘__pm_clk_add’:
          drivers/base/power/clock_ops.c:106: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:120: error: redefinition of ‘pm_clk_add’
          include/linux/pm_clock.h:64: error: previous definition of ‘pm_clk_add’ was here
          drivers/base/power/clock_ops.c:135: error: redefinition of ‘pm_clk_add_clk’
          include/linux/pm_clock.h:69: error: previous definition of ‘pm_clk_add_clk’ was here
          drivers/base/power/clock_ops.c:171: error: redefinition of ‘pm_clk_remove’
          include/linux/pm_clock.h:73: error: previous definition of ‘pm_clk_remove’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_remove’:
          drivers/base/power/clock_ops.c:180: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c:180: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:207: error: redefinition of ‘pm_clk_init’
          include/linux/pm_clock.h:54: error: previous definition of ‘pm_clk_init’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_init’:
          drivers/base/power/clock_ops.c:210: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:221: error: redefinition of ‘pm_clk_create’
          include/linux/pm_clock.h:57: error: previous definition of ‘pm_clk_create’ was here
          drivers/base/power/clock_ops.c:234: error: redefinition of ‘pm_clk_destroy’
          include/linux/pm_clock.h:61: error: previous definition of ‘pm_clk_destroy’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_destroy’:
          drivers/base/power/clock_ops.c:246: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c:246: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:263: error: expected identifier or ‘(’ before ‘void’
          drivers/base/power/clock_ops.c:263: error: expected ‘)’ before numeric constant
          drivers/base/power/clock_ops.c:293: error: expected identifier or ‘(’ before ‘void’
          drivers/base/power/clock_ops.c:293: error: expected ‘)’ before numeric constant
          drivers/base/power/clock_ops.c: In function ‘pm_clk_runtime_suspend’:
          drivers/base/power/clock_ops.c:384: error: called object ‘0u’ is not a function
          drivers/base/power/clock_ops.c: In function ‘pm_clk_runtime_resume’:
          drivers/base/power/clock_ops.c:400: error: called object ‘0u’ is not a function
      
      This happens because:
        - drivers/base/power/clock_ops.c depends on CONFIG_HAVE_CLK,
        - the failing code inside clock_ops.c additionally depends on
          CONFIG_PM,
        - the forward declarations and other definitions in <linux/pm_clock.h>
          depend on CONFIG_PM_CLK,
        - CONFIG_PM_CLK is defined as PM && HAVE_CLK in kernel/power/Kconfig,
          but it is not included on all architectures.
      
      Fix this by protecting the failing code inside clock_ops.c by
      CONFIG_PM_CLK instead of CONFIG_PM, so it matches <linux/pm_clock.h>.
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a6175616
  4. 06 10月, 2015 1 次提交
    • S
      PM / clk: Do not __clk_get passed in clock-references · 772b0508
      Stephen Boyd 提交于
      Clock references are on a per-user basis now, so they are not supposed
      to be refcounted by itself anymore. Therefore multiple cascaded get and
      put calls will fail.
      
      When a clock reference gets passed into pm_clk_add_clk we can assume
      that the pm clock handling will take control of the clock reference,
      so after this functions returns the caller should've given up control
      of that handle.
      
      So remove the additional call to __clk_get() in __pm_clk_add().
      
      The only current user of pm_clk_add_clk is drivers/clk/shmobile/clk-mstp.c
      which already follows this paradigm by only getting the clock but not
      puting it after passing the reference into pm_clk_add_clk.
      
      In the error case the caller is expected to clean up the clock, as it
      may very well try to do something different if pm_clk_add_clk() fails.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      [add commit-message]
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      772b0508
  5. 18 7月, 2015 1 次提交
    • C
      PM / clk: don't return int on __pm_clk_enable() · f4745a92
      Colin Ian King 提交于
      Static analysis by cppcheck found an issue that was recently introduced by
      commit 471f7707 ("PM / clock_ops: make __pm_clk_enable more generic")
      where a return status in ret was not being initialised and garbage
      being returned when ce->status >= PCE_STATUS_ERROR.
      
      The fact that ret is not being checked by the caller and that
      ret is only used internally __pm_clk_enable() to check if clk_enable()
      was OK means we can ignore returning it instead turn
      __pm_clk_enable() into function with a void return.
      
      Fixes: 471f7707 ("PM / clock_ops: make __pm_clk_enable more generic")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f4745a92
  6. 16 6月, 2015 1 次提交
  7. 19 5月, 2015 1 次提交
  8. 13 5月, 2015 1 次提交
  9. 12 2月, 2015 1 次提交
  10. 04 12月, 2014 1 次提交
  11. 07 11月, 2014 2 次提交
  12. 03 10月, 2014 1 次提交
    • G
      PM / clk: Fix crash in clocks management code if !CONFIG_PM_RUNTIME · a968bed7
      Geert Uytterhoeven 提交于
      Unlike the clocks management code for runtime PM, the code used for
      system suspend does not check the pm_clock_entry.status field.
      If pm_clk_acquire() failed, ce->status will be PCE_STATUS_ERROR, and
      ce->clk will be a negative error code (e.g. 0xfffffffe = -2 = -ENOENT).
      
      Depending on the clock implementation, suspend or resume may crash with:
      
          Unable to handle kernel NULL pointer dereference at virtual address 00000026
      
      (CCF clk_disable() has an IS_ERR_OR_NULL() check, while CCF clk_enable()
       only has a NULL check; pre-CCF implementations may behave differently)
      
      While just checking for PCE_STATUS_ERROR would be sufficient, it doesn't
      hurt to use the same state machine as is done for runtime PM, as this
      makes the two versions more similar, and eligible for a future
      consolidation.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a968bed7
  13. 15 2月, 2014 1 次提交
  14. 15 1月, 2014 3 次提交
  15. 15 11月, 2012 1 次提交
  16. 09 8月, 2012 1 次提交
  17. 12 3月, 2012 1 次提交
    • P
      device.h: cleanup users outside of linux/include (C files) · 51990e82
      Paul Gortmaker 提交于
      For files that are actively using linux/device.h, make sure
      that they call it out.  This will allow us to clean up some
      of the implicit uses of linux/device.h within include/*
      without introducing build regressions.
      
      Yes, this was created by "cheating" -- i.e. the headers were
      cleaned up, and then the fallout was found and fixed, and then
      the two commits were reordered.  This ensures we don't introduce
      build regressions into the git history.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      51990e82
  18. 10 11月, 2011 1 次提交
    • M
      PM / Clocks: Only disable enabled clocks in pm_clk_suspend() · 24050956
      Magnus Damm 提交于
      Refrain from running clk_disable() on clocks that
      have not been enabled. A typical case when this can
      happen is during Suspend-to-RAM for devices that have
      no driver associated with them. In such case the clock
      may be in default ACQUIRED state.
      
      Without this patch the sh7372 Mackerel board crashes
      in __clk_disable() during Suspend-to-RAM with:
      "Trying to disable clock 0xdeadbeef with 0 usecount"
      This happens for the CEU device which is added during
      boot. The test case has no CEU driver included in the
      kernel configuration. Needed for v3.2-rc1.
      Signed-off-by: NMagnus Damm <damm@opensource.se>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      24050956
  19. 22 10月, 2011 1 次提交
  20. 27 9月, 2011 1 次提交
    • 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
  21. 25 8月, 2011 4 次提交
  22. 02 7月, 2011 3 次提交
    • R
      PM: Rename clock management functions · 3d5c3036
      Rafael J. Wysocki 提交于
      The common PM clock management functions may be used for system
      suspend/resume as well as for runtime PM, so rename them
      accordingly.  Modify kerneldoc comments describing these functions
      and kernel messages printed by them, so that they refer to power
      management in general rather that to runtime PM.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      3d5c3036
    • R
      PM: Allow the clocks management code to be used during system suspend · b7b95920
      Rafael J. Wysocki 提交于
      The common clocks management code in drivers/base/power/clock_ops.c
      is going to be used during system-wide power transitions as well as
      for runtime PM, so it shouldn't depend on CONFIG_PM_RUNTIME.
      However, the suspend/resume functions provided by it for
      CONFIG_PM_RUNTIME unset, to be used during system-wide power
      transitions, should not behave in the same way as their counterparts
      defined for CONFIG_PM_RUNTIME set, because in that case the clocks
      are managed differently at run time.
      
      The names of the functions still contain the word "runtime" after
      this change, but that is going to be modified by a separate patch
      later.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      b7b95920
    • R
      PM / Domains: Rename struct dev_power_domain to struct dev_pm_domain · 564b905a
      Rafael J. Wysocki 提交于
      The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
      (PM: Add support for device power domains), which introduced the
      struct dev_power_domain type for representing device power domains,
      evidently confuses some developers who tend to think that objects
      of this type must correspond to "power domains" as defined by
      hardware, which is not the case.  Namely, at the kernel level, a
      struct dev_power_domain object can represent arbitrary set of devices
      that are mutually dependent power management-wise and need not belong
      to one hardware power domain.  To avoid that confusion, rename struct
      dev_power_domain to struct dev_pm_domain and rename the related
      pointers in struct device and struct pm_clk_notifier_block from
      pwr_domain to pm_domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      564b905a
  23. 22 6月, 2011 1 次提交
    • R
      PM / Runtime: Handle clocks correctly if CONFIG_PM_RUNTIME is unset · 4d1518f5
      Rafael J. Wysocki 提交于
      Commit 85eb8c8d (PM / Runtime:
      Generic clock manipulation rountines for runtime PM (v6)) converted
      the shmobile platform to using generic code for runtime PM clock
      management, but it changed the behavior for CONFIG_PM_RUNTIME unset
      incorrectly.
      
      Specifically, for CONFIG_PM_RUNTIME unset pm_runtime_clk_notify()
      should enable clocks for action equal to BUS_NOTIFY_BIND_DRIVER and
      it should disable them for action equal to BUS_NOTIFY_UNBOUND_DRIVER
      (instead of BUS_NOTIFY_ADD_DEVICE and BUS_NOTIFY_DEL_DEVICE,
      respectively).  Make this function behave as appropriate.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      4d1518f5
  24. 08 6月, 2011 1 次提交
  25. 17 5月, 2011 1 次提交
  26. 30 4月, 2011 1 次提交