“9706d85fe950c947f7e5d36881e6189ef04b4016”上不存在“...linux-f21-mustang/cpu/cpu0/power/runtime_suspended_time”
  1. 04 1月, 2022 1 次提交
    • H
      ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper · 57a18322
      Hans de Goede 提交于
      Some x86 ACPI boards have broken AC and battery ACPI devices in their ACPI
      tables. This is often tied to these devices using certain PMICs where the
      factory OS image seems to be using native charger and fuel-gauge drivers
      instead.
      
      So far both the AC and battery drivers have almost identical checks for
      these PMICs including both of them having a DMI based mechanism to force
      usage of the ACPI AC and battery drivers on some boards even though one
      of these PMICs is present, with the same 2 boards listed in both driver's
      DMI tables for this.
      
      The only difference is that the AC driver checks for 2 PMICs and the
      battery driver only for one. This has grown this way because the other
      (Whiskey Cove) PMIC is only used on a few boards (3 known boards) and
      although some of these do have non working ACPI battery devices, their
      _STA method always returns 0, but that really should not be relied on.
      
      This patch factors out the shared checks into a new
      acpi_quirk_skip_acpi_ac_and_battery() helper and moves the AC and
      battery drivers over to this new helper.
      
      Note the DMI table is shared with acpi_quirk_skip_i2c_client_enumeration()
      and acpi_quirk_skip_serdev_enumeration(), because boards needing DMI quirks
      for either of these typically also have broken AC and battery ACPI devices.
      
      The ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY quirk is not set yet on boards
      already in this DMI table, to avoid introducing any functional changes
      in this refactoring patch.
      
      Besided sharing the code between the AC and battery drivers this
      refactoring also moves this quirk handling to under #ifdef CONFIG_X86,
      removing this x86 specific code from non x86 ACPI builds.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      57a18322
  2. 14 10月, 2021 1 次提交
  3. 08 4月, 2021 1 次提交
  4. 05 2月, 2021 1 次提交
    • R
      ACPI: battery: Clean up printing messages · bd8c5d1e
      Rafael J. Wysocki 提交于
      Replace the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
      in battery.c with acpi_handle_debug() and acpi_handle_info() calls,
      respectively, which among other things causes the excessive log
      level of the messages previously printed via ACPI_EXCEPTION() to
      be increased.
      
      Drop the _COMPONENT and ACPI_MODULE_NAME() definitions that are not
      used any more, drop the no longer needed ACPI_BATTERY_COMPONENT
      definition from the headers and update the documentation accordingly.
      
      While at it, update the pr_fmt() definition and drop the unneeded
      PREFIX sybmbol definition from battery.c.  Also adapt the existing
      pr_info() calls to the new pr_fmt() definition.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Reviewed-by: NHans de Goede <hdegoede@redhat.com>
      bd8c5d1e
  5. 10 11月, 2020 1 次提交
  6. 22 6月, 2020 1 次提交
  7. 04 3月, 2020 1 次提交
  8. 04 2月, 2020 1 次提交
  9. 16 12月, 2019 3 次提交
    • H
      ACPI / battery: Deal better with neither design nor full capacity not being reported · ff3154d1
      Hans de Goede 提交于
      Commit b41901a2 ("ACPI / battery: Do not export energy_full[_design] on
      devices without full_charge_capacity") added support for some (broken)
      devices which always report 0 for both design_capacity and
      full_charge_capacity.
      
      Since the device that commit was written as a fix for is not reporting any
      form of "full" capacity we cannot calculate the value for the
      POWER_SUPPLY_PROP_CAPACITY, this is worked around by using an alternative
      array of available properties which does not contain this property.
      
      This is necessary because userspace (upower) treats us returning -ENODEV
      as 0 and then typically will trigger an emergency shutdown because of that.
      Userspace does not do this if the capacity sysfs attribute is not present
      at all.
      
      There are two potential problems with that commit:
       1) It assumes that both full_charge- and design-capacity are broken at the
          same time and only checks if full_charge- is broken.
       2) It assumes that this only ever happens for devices which report energy
          units rather then charge units.
      
      This commit fixes both issues by only using the alternative
      array of available properties if both full_charge- and design-capacity are
      broken and by also adding an alternative array of available properties for
      devices using mA units.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ff3154d1
    • H
      ACPI / battery: Use design-cap for capacity calculations if full-cap is not available · 5b74d1d1
      Hans de Goede 提交于
      The ThunderSoft TS178 tablet's _BIX implementation reports design_capacity
      but not full_charge_capacity.
      
      Before this commit this would cause us to return -ENODEV for the capacity
      attribute, which userspace does not like. Specifically upower does this:
      
              if (sysfs_file_exists (native_path, "capacity")) {
                      percentage = sysfs_get_double (native_path, "capacity");
      
      Where the sysfs_get_double() helper returns 0 when we return -ENODEV,
      so the battery always reads 0% if we return -ENODEV.
      
      This commit fixes this by using the design-capacity instead of the
      full-charge-capacity when the full-charge-capacity is not available.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5b74d1d1
    • H
      ACPI / battery: Deal with design or full capacity being reported as -1 · cc99f0ad
      Hans de Goede 提交于
      Commit b41901a2 ("ACPI / battery: Do not export energy_full[_design]
      on devices without full_charge_capacity") added support for some (broken)
      devices which always report 0 for both design- and full_charge-capacity.
      
      This assumes that if the capacity is not being reported it is 0. The
      ThunderSoft TS178 tablet's _BIX implementation falsifies this assumption.
      It reports ACPI_BATTERY_VALUE_UNKNOWN (-1) as full_charge_capacity, which
      we treat as a valid value which causes several problems.
      
      This commit fixes this by adding a new ACPI_BATTERY_CAPACITY_VALID() helper
      which checks that the value is not 0 and not -1; and using this whenever we
      need to test if either design_capacity or full_charge_capacity is valid.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cc99f0ad
  10. 18 10月, 2019 1 次提交
  11. 31 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner 提交于
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Reviewed-by: NRichard Fontana <rfontana@redhat.com>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  12. 09 8月, 2018 1 次提交
  13. 25 7月, 2018 4 次提交
  14. 24 7月, 2018 1 次提交
  15. 04 7月, 2018 1 次提交
  16. 16 5月, 2018 1 次提交
  17. 10 5月, 2018 1 次提交
    • C
      ACPI / battery: Add quirk to avoid checking for PMIC with native driver · ec625a37
      Carlo Caione 提交于
      With commit dccfae6d (ACPI / battery: Add a blacklist with PMIC ACPI
      HIDs with a native battery driver) a blacklist was introduced to avoid
      using the ACPI drivers for the battery when a native PMIC driver was
      already present. While this is in general a good idea (because of broken
      DSDT or proprietary and undocumented ACPI opregions for the ACPI battery
      devices) there are some Cherry Trail devices which use a separate FG
      controller despite the AXP288 having a builtin FG.
      
      The net effect of blacklisting the ACPI drivers is that on these devices
      the battery reporting is broken since the AXP288 PMIC FG bits are not
      actually used on this hardware.
      
      This commit adds a battery_do_not_check_pmic quirk for this and sets
      this on the 2 devices currently known to use a separate FG controller,
      the ECS EF20EA and the Lenovo Ideapad Miix 320.
      
      [hdegoede@redhat.com: Merge the quirk handling and the adding of the DMI
       table entry into 1 commit, add a second DMI entry for the Miix 320.]
      Signed-off-by: NCarlo Caione <carlo@endlessm.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ec625a37
  18. 02 5月, 2018 3 次提交
    • H
      ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken · 1b799c5c
      Hans de Goede 提交于
      On some devices the "AC" interface ACPI AML code uses the exact same broken
      logic which is causing the battery code to wrongly report discharging to
      determine the "AC" state. Specifically the ACPI AML code is checking the
      charging status bits of the charger-IC rather then the vbus present or
      power-good status bits.
      
      This makes our workaround for devices which wrongly report discharging when
      plugged into AC while the charge is above the start charging threshold not
      work on these devices.
      
      This commit adds a battery_ac_is_broken flag and when that is set it skips
      the power_supply_is_system_supplied() check in the workaround fixing this.
      
      This flag gets set by a DMI quirk selected by systems where we know the AC
      AML code is broken in this way *and* the rate_now value can be trusted.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1b799c5c
    • H
      ACPI / battery: Add handling for devices which wrongly report discharging state · 19fffc84
      Hans de Goede 提交于
      On quite a few devices the battery code in the ACPI tables is buggy and
      first checks the charging status bits of the charger-IC, and if those
      report not charging it will report discharging, without looking at the
      presence of AC power or at the battery dis(charge) current from the
      fuel-gauge.
      
      This causes the wrong status to be reported for the battery in the
      following quite common scenario:
      
      1) Plug in charger while battery is say half full, battery starts
      charging, charging state bits indicate: pre-charge or fast-charge,
      ACPI reported battery status is ok
      
      2) When fully charged charging state bits indicate: end-of-charge,
      ACPI reported battery status is ok
      
      3) unplug the charger, wait 1 minute, replug. Now the battery voltage is
      still above the start-charging threshold, so the charger will not start
      charging to avoid wrecking the battery by repeatedly recharging the last 1%
      capacity. The charger IC charging state bits now are all 0 (not-charging)
      and the broken ACPI code wrongly translate this to "discharging" and ends
      up setting the ACPI_BATTERY_STATE_DISCHARGING bit in its state field.
      
      Reporting this "not charging" state as discharging is confusing for users,
      making the user think his adapter/power-brick is broken or not properly
      plugged in.
      
      This commit adds a helper for handling the ACPI_BATTERY_STATE_DISCHARGING
      state. This helper checks if we're an AC and the current going out of the
      battery is 0 and in that case reports a status of "not charging" to
      userspace rather then "discharging".
      
      This replaces commit c68f0676 ("ACPI / battery: Add quirk for Asus
      GL502VSK and UX305LA"), a previous fix for this which was reverted.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NDaniel Drake <drake@endlessm.com>
      Reviewed-by: NSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      19fffc84
    • H
      ACPI / battery: Remove initializer for unused ident dmi_system_id · 91afa076
      Hans de Goede 提交于
      The battery code does not use the dmi_system_id ident member, so there is
      no need to initialize it. This saves us storing the unused strings as
      as const data.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      91afa076
  19. 19 3月, 2018 1 次提交
    • D
      Revert "ACPI / battery: Add quirk for Asus GL502VSK and UX305LA" · 82bf43b2
      Daniel Drake 提交于
      Revert commit c68f0676 ("ACPI / battery: Add quirk for Asus
      GL502VSK and UX305LA") and commit 4446823e ("ACPI / battery: Add
      quirk for Asus UX360UA and UX410UAK").
      
      On many many Asus products, the battery is sometimes reported as
      charging or discharging even when it is full and you are on AC power.
      This change quirked the kernel to avoid advertising the discharging
      state when this happens on 4 laptop models, under the belief that
      this was incorrect information.  I presume it originates from user
      reports who are confused that their battery status icon says that it
      is discharging.
      
      However, the reported information is indeed correct, and the quirk
      approach taken is inadequate and more thought is needed first.
      Specifically:
      
       1. It only quirks discharging state, not charging
      
       2. There are so many different Asus products and DMI naming variants
          within those product families that behave this way; Linux could
          grow to quirk hundreds of products and still not even be close at
          "winning" this battle.
      
       3. Asus previously clarified that this behaviour is intentional. The
          platform will periodically do a partial discharge/charge cycle
          when the battery is full, because this is one way to extend the
          lifetime of the battery (leaving a battery at 100% charge and
          unused will decrease its usable capacity over time).
      
          My understanding is that any decent consumer product will have
          this behaviour, but it appears that Asus is different in that
          they expose this info through ACPI.
      
          However, the behaviour seems correct. The ACPI spec does not
          suggest in that the platform should hide the truth.  It lets you
          report that the battery is full of charge, and discharging, and
          with external power connected; and Asus does this.
      
       4. In terms of not confusing the user, this seems like something that
          could/should be handled by userspace, which can also detect these
          same (accurate) conditions in the general case.
      
      Revert this quirk before it gets included in a release, while we look
      for better approaches.
      Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Acked-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      82bf43b2
  20. 13 3月, 2018 1 次提交
  21. 28 2月, 2018 2 次提交
  22. 22 2月, 2018 2 次提交
    • O
      ACPI: battery: Add the ThinkPad "Not Charging" quirk · 91eea70e
      Ognjen Galic 提交于
      The EC/ACPI firmware on Lenovo ThinkPads used to report a status
      of "Unknown" when the battery is between the charge start and
      charge stop thresholds. On Windows, it reports "Not Charging"
      so the quirk has been added to also report correctly.
      
      Now the "status" attribute returns "Not Charging" when the
      battery on ThinkPads is not physicaly charging.
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NOgnjen Galic <smclt30p@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      91eea70e
    • O
      battery: Add the battery hooking API · fa93854f
      Ognjen Galic 提交于
      This is a patch that implements a generic hooking API for the
      generic ACPI battery driver.
      
      With this new generic API, drivers can expose platform specific
      behaviour via sysfs attributes in /sys/class/power_supply/BATn/
      in a generic way.
      
      A perfect example of the need for this API are Lenovo ThinkPads.
      
      Lenovo ThinkPads have a ACPI extension that allows the setting of
      start and stop charge thresholds in the EC and battery firmware
      via ACPI. The thinkpad_acpi module can use this API to expose
      sysfs attributes that it controls inside the ACPI battery driver
      sysfs tree, under /sys/class/power_supply/BATN/.
      
      The file drivers/acpi/battery.h has been moved to
      include/acpi/battery.h and the includes inside ac.c, sbs.c, and
      battery.c have been adjusted to reflect that.
      
      When drivers hooks into the API, the API calls add_battery() for
      each battery in the system that passes it a acpi_battery
      struct. Then, the drivers can use device_create_file() to create
      new sysfs attributes with that struct and identify the batteries
      for per-battery attributes.
      Signed-off-by: NOgnjen Galic <smclt30p@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fa93854f
  23. 04 2月, 2018 1 次提交
  24. 18 12月, 2017 1 次提交
  25. 13 12月, 2017 1 次提交
  26. 24 8月, 2017 1 次提交
  27. 15 6月, 2017 1 次提交
    • R
      ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle · 33e4f80e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled.  However, to preserve the existing
      behavior with respect to suspend-to-RAM, this only is done in
      the suspend-to-idle case and only if an SCI has occurred while
      suspended.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33e4f80e
  28. 07 6月, 2017 1 次提交
  29. 06 5月, 2017 1 次提交
    • R
      ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle · eed4d47e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled (that also helps to catch device-induced
      wakeup events occurring during suspend transitions in progress).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eed4d47e
  30. 20 4月, 2017 2 次提交