1. 26 Oct, 2021 1 commit
  2. 19 Oct, 2021 5 commits
    • Rafael J. Wysocki's avatar
      ACPI: PM: Turn off wakeup power resources on _DSW/_PSW errors · a9a8f827
      Rafael J. Wysocki authored
      If acpi_device_sleep_wake() called by acpi_enable_wakeup_device_power()
      returns an error which means that the evaluation of either _DWS or
      _PSW has failed, turn off all of the device's wakeup power resources
      to be consistent with the clearing of dev->wakeup.prepare_count.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a9a8f827
    • Rafael J. Wysocki's avatar
      ACPI: PM: Fix sharing of wakeup power resources · a2d7b2e0
      Rafael J. Wysocki authored
      If an ACPI wakeup power resource is shared between multiple devices,
      it may not be managed correctly.
      
      Suppose, for example, that two devices, A and B, share a wakeup power
      resource P whose wakeup_enabled flag is 0 initially.  Next, suppose
      that wakeup power is enabled for A and B, in this order, and disabled
      for B.  When wakeup power is enabled for A, P will be turned on and
      its wakeup_enabled flag will be set.  Next, when wakeup power is
      enabled for B, P will not be touched, because its wakeup_enabled flag
      is set.  Now, when wakeup power is disabled for B, P will be turned
      off which is incorrect, because A will still need P in order to signal
      wakeup.
      
      Moreover, if wakeup power is enabled for A and then disabled for B,
      the latter will cause P to be turned off incorrectly (it will be still
      needed by A), because acpi_disable_wakeup_device_power() is allowed
      to manipulate power resources when the wakeup.prepare_count counter
      of the given device is 0.
      
      While the first issue could be addressed by changing the
      wakeup_enabled power resource flag into a counter, addressing the
      second one requires modifying acpi_disable_wakeup_device_power() to
      do nothing when the target device's wakeup.prepare_count reference
      counter is zero and that would cause the new counter to be redundant.
      Namely, if acpi_disable_wakeup_device_power() is modified as per the
      above, every change of the new counter following a wakeup.prepare_count
      change would be reflected by the analogous change of the main reference
      counter of the given power resource.
      
      Accordingly, modify acpi_disable_wakeup_device_power() to do nothing
      when the target device's wakeup.prepare_count reference counter is
      zero and drop the power resource wakeup_enabled flag altogether.
      
      While at it, ensure that all of the power resources that can be
      turned off will be turned off when disabling device wakeup due to
      a power resource manipulation error, to prevent energy from being
      wasted.
      
      Fixes: b5d667eb ("ACPI / PM: Take unusual configurations of power resources into account")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a2d7b2e0
    • Rafael J. Wysocki's avatar
      ACPI: PM: Turn off unused wakeup power resources · 7a63296d
      Rafael J. Wysocki authored
      If an ACPI power resource is found to be "on" during the
      initialization of the list of wakeup power resources of a device,
      it is reference counted and its wakeup_enabled flag is set, which is
      problematic if the deivce in question is the only user of the given
      power resource, it is never runtime-suspended and it is not allowed
      to wake up the system from sleep, because in that case the given
      power resource will stay "on" until the system reboots and energy
      will be wasted.
      
      It is better to simply turn off wakeup power resources that are "on"
      during the initialization unless their reference counters are not
      zero, because that may be the only opportunity to prevent them from
      staying in the "on" state all the time.
      
      Fixes: b5d667eb ("ACPI / PM: Take unusual configurations of power resources into account")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7a63296d
    • Rafael J. Wysocki's avatar
      ACPI: PM: Check states of power resources during initialization · a1224f34
      Rafael J. Wysocki authored
      To avoid situations in which the actual states of certain ACPI power
      resources are not known just because they have never been referenced
      by any device configuration objects, check the initial states of all
      power resources as soon as they are found in the ACPI namespace (and
      fall back to turning them on if the state check fails).
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: default avatarAndreas K. Huettel <andreas.huettel@ur.de>
      a1224f34
    • Rafael J. Wysocki's avatar
      ACPI: PM: Do not turn off power resources in unknown state · bc283685
      Rafael J. Wysocki authored
      Commit 6381195a ("ACPI: power: Rework turning off unused power
      resources") caused power resources in unknown state with reference
      counters equal to zero to be turned off too, but that caused issues
      to appear in the field, so modify the code to only turn off power
      resources that are known to be "on".
      
      Link: https://lore.kernel.org/linux-acpi/6faf4b92-78d5-47a4-63df-cc2bab7769d0@molgen.mpg.de/
      Fixes: 6381195a ("ACPI: power: Rework turning off unused power resources")
      Reported-by: default avatarAndreas K. Huettel <andreas.huettel@ur.de>
      Tested-by: default avatarAndreas K. Huettel <andreas.huettel@ur.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: 5.14+ <stable@vger.kernel.org> # 5.14+
      bc283685
  3. 18 Oct, 2021 17 commits
  4. 17 Oct, 2021 3 commits
  5. 16 Oct, 2021 14 commits