1. 26 12月, 2016 1 次提交
    • L
      avoid spurious "may be used uninitialized" warning · d33d5a6c
      Linus Torvalds 提交于
      The timer type simplifications caused a new gcc warning:
      
        drivers/base/power/domain.c: In function ‘genpd_runtime_suspend’:
        drivers/base/power/domain.c:562:14: warning: ‘time_start’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
      
      despite the actual use of "time_start" not having changed in any way.
      It appears that simply changing the type of ktime_t from a union to a
      plain scalar type made gcc check the use.
      
      The variable wasn't actually used uninitialized, but gcc apparently
      failed to notice that the conditional around the use was exactly the
      same as the conditional around the initialization of that variable.
      
      Add an unnecessary initialization just to shut up the compiler.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d33d5a6c
  2. 07 12月, 2016 1 次提交
  3. 01 12月, 2016 1 次提交
  4. 11 11月, 2016 1 次提交
  5. 27 10月, 2016 1 次提交
  6. 22 10月, 2016 5 次提交
  7. 24 9月, 2016 4 次提交
  8. 17 9月, 2016 1 次提交
  9. 13 9月, 2016 8 次提交
    • J
      PM / Domains: Add support for removing nested PM domains by provider · 17926551
      Jon Hunter 提交于
      If a device supports PM domains that are subdomains of another PM
      domain, then the PM domains should be removed in reverse order to
      ensure that the subdomains are removed first. Furthermore, if there is
      more than one provider, then there needs to be a way to remove the
      domains in reverse order for a specific provider.
      
      Add the function of_genpd_remove_last() to remove the last PM domain
      added by a given PM domain provider and return the generic_pm_domain
      structure for the PM domain that was removed.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      17926551
    • J
      PM / Domains: Add support for removing PM domains · 3fe57710
      Jon Hunter 提交于
      The genpd framework allows users to add PM domains via the pm_genpd_init()
      function, however, there is no corresponding function to remove a PM
      domain. For most devices this may be fine as the PM domains are never
      removed, however, for devices that wish to populate the PM domains from
      within a driver, having the ability to remove a PM domain if the probing
      of the device fails or the driver is unloaded is necessary.
      
      Add the function pm_genpd_remove() to remove a PM domain by referencing
      it's generic_pm_domain structure. Note that the bulk of the code that
      removes the PM domain is placed in a separate local function
      genpd_remove() (which is called by pm_genpd_remove()). The code is
      structured in this way to prepare for adding another function to remove
      a PM domain by provider that will also call genpd_remove(). Note that
      users of genpd_remove() must call this function with the mutex,
      gpd_list_lock, held.
      
      PM domains can only be removed if the associated provider has been
      removed, they are not a parent domain to another PM domain and have no
      devices associated with them.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3fe57710
    • J
      PM / Domains: Store the provider in the PM domain structure · de0aa06d
      Jon Hunter 提交于
      It is possible that a device has more than one provider of PM domains
      and to support the removal of a PM domain by provider, it is necessary
      to store a reference to the provider in the PM domain structure.
      Therefore, store a reference to the firmware node handle in the PM
      domain structure and populate it when providers (only device-tree based
      providers are currently supported by PM domains) are registered.
      
      Please note that when removing PM domains, it is necessary to verify
      that the PM domain provider has been removed from the list of providers
      before the PM domain can be removed. To do this add another member to
      the PM domain structure that indicates if the provider is present and
      set this member accordingly when providers are added and removed.
      
      Initialise the 'provider' and 'has_provider' members of the
      generic_pm_domain structure when a PM domains is added by calling
      pm_genpd_init().
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      de0aa06d
    • J
      PM / Domains: Prepare for adding support to remove PM domains · 19efa5ff
      Jon Hunter 提交于
      In order to remove PM domains safely from the list of PM domains,
      it is necessary to adding locking for the PM domain list around any
      places where devices or subdomains are added to a PM domain.
      
      There are places where a reference to a PM domain is obtained via
      calling of_genpd_get_from_provider() before adding the device or the
      subdomain. In these cases a lock for the PM domain list needs to be
      held around the call to of_genpd_get_from_provider() and the call to
      add the device/subdomain. To avoid deadlocks by multiple attempts to
      obtain the PM domain list lock, add functions genpd_add_device() and
      genpd_add_subdomain() which require the user to hold the PM domain
      list lock when calling.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      19efa5ff
    • J
      PM / Domains: Verify the PM domain is present when adding a provider · 0159ec67
      Jon Hunter 提交于
      When a PM domain provider is added, there is currently no way to tell if
      any PM domains associated with the provider are present. Naturally, the
      PM domain provider should not be registered if the PM domains have not
      been added. Nonetheless, verify that the PM domain(s) associated with a
      provider are present when registering the PM domain provider.
      
      This change adds a dependency on the function pm_genpd_present() when
      CONFIG_PM_GENERIC_DOMAINS_OF is enabled and so ensure this function is
      available when CONFIG_PM_GENERIC_DOMAINS_OF selected.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0159ec67
    • J
      PM / Domains: Don't expose xlate and provider helper functions · 892ebdcc
      Jon Hunter 提交于
      Functions __of_genpd_xlate_simple(), __of_genpd_xlate_onecell() and
      __of_genpd_add_provider() are not used outside of the core generic PM
      domain code. Therefore, reduce the number of APIs exposed by making
      these static. At the same time don't expose the typedef for
      genpd_xlate_t either and make this a local definition as well.
      
      The functions are renamed to follow the naming conventions for static
      functions in the generic PM domain core.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      892ebdcc
    • J
      PM / Domains: Don't expose generic_pm_domain structure to clients · f58d4e5a
      Jon Hunter 提交于
      There should be no need to expose the generic_pm_domain structure to
      clients and this eliminates the need to implement reference counting for
      any external reference to a PM domain. Therefore, make the functions
      pm_genpd_lookup_dev() and of_genpd_get_from_provider() private to the
      PM domain core. The functions are renamed in accordance with the naming
      conventions for genpd static functions.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f58d4e5a
    • J
      PM / Domains: Add new helper functions for device-tree · ec69572b
      Jon Hunter 提交于
      Ideally, if we are returning a reference to a PM domain via a call to
      of_genpd_get_from_provider(), then we should keep track of such
      references via a reference count. The reference count could then be used
      to determine if a PM domain can be safely removed. Alternatively, it is
      possible to avoid such external references by providing APIs to access
      the PM domain and hence, eliminate any calls to
      of_genpd_get_from_provider().
      
      Add new helper functions for adding a device and a subdomain to a PM
      domain when using device-tree, so that external calls to
      of_genpd_get_from_provider() can be removed.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ec69572b
  10. 12 8月, 2016 1 次提交
  11. 29 6月, 2016 1 次提交
  12. 16 6月, 2016 5 次提交
    • U
      PM / Domains: Stop/start devices during system PM suspend/resume in genpd · 122a2237
      Ulf Hansson 提交于
      Not all subsystems/drivers that manages devices attached to a genpd
      makes use of the pm_runtime_force_suspend|resume() helper functions
      to deal with system PM suspend/resume.
      
      In cases like these and when genpd's ->stop|start() callbacks are
      used for the device, invoke the pm_runtime_force_suspend|resume()
      helper functions from genpd's "noirq" system PM callbacks. In this
      way we make sure to "stop" the device on suspend and to "start" it
      on resume.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      122a2237
    • U
      PM / Domains: Allow runtime PM during system PM phases · 4d23a5e8
      Ulf Hansson 提交于
      In cases when a PM domain isn't powered off when genpd's ->prepare()
      callback is invoked, genpd runtime resumes and disables runtime PM for the
      device. This behaviour was needed when genpd managed intermediate states
      during the power off sequence, as to maintain proper low power states of
      devices during system PM suspend/resume.
      
      Commit ba2bbfbf (PM / Domains: Remove intermediate states from the
      power off sequence), enables genpd to improve its behaviour in that
      respect.
      
      The PM core disables runtime PM at __device_suspend_late() before it calls
      a system PM "late" callback for a device. When resuming a device, after a
      corresponding "early" callback has been invoked, the PM core re-enables
      runtime PM.
      
      By changing genpd to allow runtime PM according to the same system PM
      phases as the PM core, devices can be runtime resumed by their
      corresponding subsystem/driver when really needed.
      
      In this way, genpd no longer need to runtime resume the device from its
      ->prepare() callback. In most cases that avoids unnecessary and energy-
      wasting operations of runtime resuming devices that have nothing to do,
      only to runtime suspend them shortly after.
      
      Although, because of changing this behaviour in genpd and due to that
      genpd powers on the PM domain unconditionally in the system PM resume
      "noirq" phase, it could potentially cause a PM domain to stay powered
      on even if it's unused after the system has resumed. To avoid this,
      schedule a power off work when genpd's system PM ->complete() callback
      has been invoked for the last device in the PM domain.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4d23a5e8
    • U
      PM / Domains: Remove redundant pm_request_idle() call in genpd · 9b002b8f
      Ulf Hansson 提交于
      The PM core increases the runtime PM usage count at the system PM prepare
      phase. Later when the system resumes, it does a pm_runtime_put() in the
      complete phase, which in addition to decrementing the usage count, does
      the equivalent of a pm_request_idle().
      
      Therefore the call to pm_request_idle() from within genpd's ->complete()
      callback is redundant, so remove it.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9b002b8f
    • U
      PM / Domains: Remove redundant wrapper functions for system PM · 80018853
      Ulf Hansson 提交于
      Due to the previous changes in genpd, which removed the suspend_power_off
      flag, several of the system PM callbacks no longer do any additional
      checks but only invoke corresponding pm_generic_* helper functions.
      
      To clean up the code, drop these wrapper functions as they have
      become redundant. Instead, assign the system PM callbacks directly
      to the pm_generic_*() helper functions.
      
      While changing this, it has bocame clear that some of the current
      system PM callbacks in genpd invoke wrong driver callbacks. For
      example, the genpd's ->restore() callback invokes pm_generic_resume(),
      while that should be pm_generic_restore(). Fix that as well.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      80018853
    • U
      PM / Domains: Allow genpd to power on during system PM phases · 39dd0f23
      Ulf Hansson 提交于
      If a PM domain is powered off when the first device starts its system PM
      prepare phase, genpd prevents any further attempts to power on the PM
      domain during the following system PM phases. Not until the system PM
      complete phase is finalized for all devices in the PM domain, genpd again
      allows it to be powered on.
      
      This behaviour needs to be changed, as a subsystem/driver for a device in
      the same PM domain may still need to be able to serve requests in some of
      the system PM phases. Accordingly, it may need to runtime resume its
      device and thus also request the corresponding PM domain to be powered on.
      
      To deal with these scenarios, let's make the device operational in the
      system PM prepare phase by runtime resuming it, no matter if the PM domain
      is powered on or off. Changing this also enables us to remove genpd's
      suspend_power_off flag, as it's being used to track this condition.
      Additionally, we must allow the PM domain to be powered on via runtime PM
      during the system PM phases.
      
      This change also requires a fix in the AMD ACP (Audio CoProcessor) drm
      driver. It registers a genpd to model the ACP as a PM domain, but
      unfortunately it's also abuses genpd's "internal" suspend_power_off flag
      to deal with a corner case at system PM resume.
      
      More precisely, the so called SMU block powers on the ACP at system PM
      resume, unconditionally if it's being used or not. This may lead to that
      genpd's internal status of the power state, may not correctly reflect the
      power state of the HW after a system PM resume.
      
      Because of changing the behaviour of genpd, by runtime resuming devices in
      the prepare phase, the AMD ACP drm driver no longer have to deal with this
      corner case. So let's just drop the related code in this driver.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Acked-by: NMaruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      39dd0f23
  13. 27 4月, 2016 2 次提交
  14. 22 4月, 2016 3 次提交
  15. 09 3月, 2016 5 次提交