1. 08 12月, 2016 2 次提交
  2. 07 12月, 2016 2 次提交
    • T
      PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend · bed57030
      Tony Lindgren 提交于
      I noticed some wakeirq flakeyness with consumer drivers not using
      autosuspend. For drivers not using autosuspend, the wakeirq may never
      get unmasked in rpm_suspend() because of irq desc->depth.
      
      We are configuring dedicated wakeirqs to start with IRQ_NOAUTOEN as we
      naturally don't want them running until rpm_suspend() is called.
      
      However, when a consumer driver initially calls pm_runtime_get(), we
      now wrongly start with disable_irq_nosync() call on the dedicated
      wakeirq that is disabled to start with.
      
      This causes desc->depth to toggle between 1 and 2 instead of the usual
      0 and 1. This can prevent enable_irq() from unmasking the wakeirq as
      that only happens at desc->depth 1.
      
      This does not necessarily show up with drivers using autosuspend as
      there is time for disable_irq_nosync() before rpm_suspend() gets called
      after the autosuspend timeout.
      
      Let's fix the issue by adding wirq->status that lazily gets set on
      the first rpm_suspend(). We also need PM runtime core private functions
      for dev_pm_enable_wake_irq_check() and dev_pm_disable_wake_irq_check()
      so we can enable the dedicated wakeirq on the first rpm_suspend().
      
      While at it, let's also fix the comments for dev_pm_enable_wake_irq()
      and dev_pm_disable_wake_irq(). Those can still be used by the consumer
      drivers as needed because the IRQ core manages the interrupt usecount
      for us.
      
      Fixes: 4990d4fe (PM / Wakeirq: Add automated device wake IRQ handling)
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bed57030
    • L
      PM / Domains: Fix compatible for domain idle state · 598da548
      Lina Iyer 提交于
      Re-using idle state definition provided by arm,idle-state for domain
      idle states creates a lot of confusion and limits further evolution of
      the domain idle definition. To keep things clear and simple, define a
      idle states for domain using a new compatible "domain-idle-state".
      
      Fix existing PM domains code to look for the newly defined compatible.
      Signed-off-by: NLina Iyer <lina.iyer@linaro.org>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      598da548
  3. 06 12月, 2016 7 次提交
  4. 01 12月, 2016 5 次提交
  5. 30 11月, 2016 1 次提交
    • C
      timekeeping: Ignore the bogus sleep time if pm_trace is enabled · ba58d102
      Chen Yu 提交于
      Power management suspend/resume tracing (ab)uses the RTC to store
      suspend/resume information persistently. As a consequence the RTC value is
      clobbered when timekeeping is resumed and tries to inject the sleep time.
      
      Commit a4f8f666 ("timekeeping: Cap array access in timekeeping_debug")
      plugged a out of bounds array access in the timekeeping debug code which
      was caused by the clobbered RTC value, but we still use the clobbered RTC
      value for sleep time injection into kernel timekeeping, which will result
      in random adjustments depending on the stored "hash" value.
      
      To prevent this keep track of the RTC clobbering and ignore the invalid RTC
      timestamp at resume. If the system resumed successfully clear the flag,
      which marks the RTC as unusable, warn the user about the RTC clobber and
      recommend to adjust the RTC with 'ntpdate' or 'rdate'.
      
      [jstultz: Fixed up pr_warn formating, and implemented suggestions from Ingo]
      [ tglx: Rewrote changelog ]
      
      Originally-from: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NChen Yu <yu.c.chen@intel.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Xunlei Pang <xlpang@redhat.com>
      Cc: Len Brown <lenb@kernel.org>
      Link: http://lkml.kernel.org/r/1480372524-15181-3-git-send-email-john.stultz@linaro.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      ba58d102
  6. 19 11月, 2016 1 次提交
  7. 11 11月, 2016 2 次提交
  8. 09 11月, 2016 1 次提交
  9. 01 11月, 2016 4 次提交
    • R
      PM / runtime: Optimize the use of device links · baa8809f
      Rafael J. Wysocki 提交于
      If the device has no links to suppliers that should be used for
      runtime PM (links with DEVICE_LINK_PM_RUNTIME set), there is no
      reason to walk the list of suppliers for that device during
      runtime suspend and resume.
      
      Add a simple mechanism to detect that case and possibly avoid the
      extra unnecessary overhead.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      baa8809f
    • R
      PM / runtime: Use device links · 21d5c57b
      Rafael J. Wysocki 提交于
      Modify the runtime PM framework to use device links to ensure that
      supplier devices will not be suspended if any of their consumer
      devices are active.
      
      The idea is to reference count suppliers on the consumer's resume
      and drop references to them on its suspend.  The information on
      whether or not the supplier has been reference counted by the
      consumer's (runtime) resume is stored in a new field (rpm_active)
      in the link object for each link.
      
      It may be necessary to clean up those references when the
      supplier is unbinding and that's why the links whose status is
      DEVICE_LINK_SUPPLIER_UNBIND are skipped by the runtime suspend
      and resume code.
      
      The above means that if the consumer device is probed in the
      runtime-active state, the supplier has to be resumed and reference
      counted by device_link_add() so the code works as expected on its
      (runtime) suspend.  There is a new flag, DEVICE_LINK_RPM_ACTIVE,
      to tell device_link_add() about that (in which case the caller
      is responsible for making sure that the consumer really will
      be runtime-active when runtime PM is enabled for it).
      
      The other new link flag, DEVICE_LINK_PM_RUNTIME, tells the core
      whether or not the link should be used for runtime PM at all.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21d5c57b
    • R
      PM / sleep: Make async suspend/resume of devices use device links · 8c73b428
      Rafael J. Wysocki 提交于
      Make the device suspend/resume part of the core system
      suspend/resume code use device links to ensure that supplier
      and consumer devices will be suspended and resumed in the right
      order in case of async suspend/resume.
      
      The idea, roughly, is to use dpm_wait() to wait for all consumers
      before a supplier device suspend and to wait for all suppliers
      before a consumer device resume.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c73b428
    • R
      driver core: Functional dependencies tracking support · 9ed98953
      Rafael J. Wysocki 提交于
      Currently, there is a problem with taking functional dependencies
      between devices into account.
      
      What I mean by a "functional dependency" is when the driver of device
      B needs device A to be functional and (generally) its driver to be
      present in order to work properly.  This has certain consequences
      for power management (suspend/resume and runtime PM ordering) and
      shutdown ordering of these devices.  In general, it also implies that
      the driver of A needs to be working for B to be probed successfully
      and it cannot be unbound from the device before the B's driver.
      
      Support for representing those functional dependencies between
      devices is added here to allow the driver core to track them and act
      on them in certain cases where applicable.
      
      The argument for doing that in the driver core is that there are
      quite a few distinct use cases involving device dependencies, they
      are relatively hard to get right in a driver (if one wants to
      address all of them properly) and it only gets worse if multiplied
      by the number of drivers potentially needing to do it.  Morever, at
      least one case (asynchronous system suspend/resume) cannot be handled
      in a single driver at all, because it requires the driver of A to
      wait for B to suspend (during system suspend) and the driver of B to
      wait for A to resume (during system resume).
      
      For this reason, represent dependencies between devices as "links",
      with the help of struct device_link objects each containing pointers
      to the "linked" devices, a list node for each of them, status
      information, flags, and an RCU head for synchronization.
      
      Also add two new list heads, representing the lists of links to the
      devices that depend on the given one (consumers) and to the devices
      depended on by it (suppliers), and a "driver presence status" field
      (needed for figuring out initial states of device links) to struct
      device.
      
      The entire data structure consisting of all of the lists of link
      objects for all devices is protected by a mutex (for link object
      addition/removal and for list walks during device driver probing
      and removal) and by SRCU (for list walking in other case that will
      be introduced by subsequent change sets).  If CONFIG_SRCU is not
      selected, however, an rwsem is used for protecting the entire data
      structure.
      
      In addition, each link object has an internal status field whose
      value reflects whether or not drivers are bound to the devices
      pointed to by the link or probing/removal of their drivers is in
      progress etc.  That field is only modified under the device links
      mutex, but it may be read outside of it in some cases (introduced by
      subsequent change sets), so modifications of it are annotated with
      WRITE_ONCE().
      
      New links are added by calling device_link_add() which takes three
      arguments: pointers to the devices in question and flags.  In
      particular, if DL_FLAG_STATELESS is set in the flags, the link status
      is not to be taken into account for this link and the driver core
      will not manage it.  In turn, if DL_FLAG_AUTOREMOVE is set in the
      flags, the driver core will remove the link automatically when the
      consumer device driver unbinds from it.
      
      One of the actions carried out by device_link_add() is to reorder
      the lists used for device shutdown and system suspend/resume to
      put the consumer device along with all of its children and all of
      its consumers (and so on, recursively) to the ends of those lists
      in order to ensure the right ordering between all of the supplier
      and consumer devices.
      
      For this reason, it is not possible to create a link between two
      devices if the would-be supplier device already depends on the
      would-be consumer device as either a direct descendant of it or a
      consumer of one of its direct descendants or one of its consumers
      and so on.
      
      There are two types of link objects, persistent and non-persistent.
      The persistent ones stay around until one of the target devices is
      deleted, while the non-persistent ones are removed automatically when
      the consumer driver unbinds from its device (ie. they are assumed to
      be valid only as long as the consumer device has a driver bound to
      it).  Persistent links are created by default and non-persistent
      links are created when the DL_FLAG_AUTOREMOVE flag is passed
      to device_link_add().
      
      Both persistent and non-persistent device links can be deleted
      with an explicit call to device_link_del().
      
      Links created without the DL_FLAG_STATELESS flag set are managed
      by the driver core using a simple state machine.  There are 5 states
      each link can be in: DORMANT (unused), AVAILABLE (the supplier driver
      is present and functional), CONSUMER_PROBE (the consumer driver is
      probing), ACTIVE (both supplier and consumer drivers are present and
      functional), and SUPPLIER_UNBIND (the supplier driver is unbinding).
      The driver core updates the link state automatically depending on
      what happens to the linked devices and for each link state specific
      actions are taken in addition to that.
      
      For example, if the supplier driver unbinds from its device, the
      driver core will also unbind the drivers of all of its consumers
      automatically under the assumption that they cannot function
      properly without the supplier.  Analogously, the driver core will
      only allow the consumer driver to bind to its device if the
      supplier driver is present and functional (ie. the link is in
      the AVAILABLE state).  If that's not the case, it will rely on
      the existing deferred probing mechanism to wait for the supplier
      driver to become available.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ed98953
  10. 27 10月, 2016 1 次提交
  11. 22 10月, 2016 5 次提交
  12. 21 10月, 2016 4 次提交
  13. 26 9月, 2016 1 次提交
    • D
      PM / OPP: Don't support OPP if it provides supported-hw but platform does not · a4ee4545
      Dave Gerlach 提交于
      The OPP framework allows each OPP to set a opp-supported-hw property
      which provides values that are matched against supported_hw values
      provided by the platform to limit support for certain OPPs on specific
      hardware. Currently, if the platform does not set supported_hw values,
      all OPPs are interpreted as supported, even if they have provided their
      own opp-supported-hw values.
      
      If an OPP has provided opp-supported-hw, it is indicating that there is
      some specific hardware configuration it is supported by. These constraints
      should be honored, and if no supported_hw has been provided by the
      platform, there is no way to determine if that OPP is actually supported,
      so it should be marked as not supported.
      Signed-off-by: NDave Gerlach <d-gerlach@ti.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a4ee4545
  14. 24 9月, 2016 4 次提交