12 Feb, 2011

1 commit

  • Commit 9630bdd (ACPI: Use GPE reference counting to support shared
    GPEs) introduced a suspend regression where boxes resume immediately
    after being suspended due to the lid or sleep button wakeup status
    not being cleared properly. This happens if the GPEs corresponding
    to those devices are not enabled all the time, which apparently is
    expected by some BIOSes.

    To fix this problem, enable button and lid GPEs unconditionally
    during initialization and keep them enabled all the time, regardless
    of whether or not the ACPI button driver is used.

    References: https://bugzilla.kernel.org/show_bug.cgi?id=27372
    Reported-and-tested-by: Ferenc Wágner
    Cc: stable@kernel.org
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

12 Jan, 2011

2 commits


07 Jan, 2011

1 commit

  • There are ACPI devices (buttons and the laptop lid) that can wake up
    the system from sleep states and have no "physical" companion
    devices. The ACPI subsystem uses two flags, wakeup.state.enabled and
    wakeup.flags.always_enabled, for handling those devices, but they
    are not accessible through the standard device wakeup infrastructure.
    User space can only control them via the /proc/acpi/wakeup interface
    that is not really convenient (e.g. the way in which devices are
    enabled to wake up the system is not portable between different
    systems, because it requires one to know the devices' "names" used in
    the system's ACPI tables).

    To address this problem, use standard device wakeup flags instead of
    the special ACPI flags for handling those devices. In particular,
    use device_set_wakeup_capable() to mark the ACPI wakeup devices
    during initialization and use device_set_wakeup_enable() to allow
    or disallow them to wake up the system from sleep states. Rework
    the /proc/acpi/wakeup interface to take these changes into account.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

15 Aug, 2010

1 commit


07 Jul, 2010

2 commits

  • ACPICA uses reference counters to avoid disabling GPEs too early in
    case they have been enabled for many times. This is done separately
    for runtime and for wakeup, but the wakeup GPE reference counter is
    not really necessary, because GPEs are only enabled to wake up the
    system at the hardware level by acpi_enter_sleep_state(). Thus it
    only is necessary to set the corresponding bits in the wakeup enable
    masks of these GPEs' registers right before the system enters a sleep
    state. Moreover, the GPE wakeup enable bits can only be set when the
    target sleep state of the system is known and they need to be cleared
    immediately after wakeup regardless of how many wakeup devices are
    associated with a given GPE.

    On the basis of the above observations, introduce function
    acpi_gpe_wakeup() to be used for setting or clearing the enable bit
    corresponding to a given GPE in its enable register's enable_for_wake
    mask. Modify the ACPI suspend and wakeup code the use
    acpi_gpe_wakeup() instead of acpi_{enable|disable}_gpe() to set
    and clear GPE enable bits in their registers' enable_for_wake masks
    during system transitions to a sleep state and back to the working
    state, respectively. [This will allow us to drop the third
    argument of acpi_{enable|disable}_gpe() and simplify the GPE
    handling code.]

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown
    Signed-off-by: Bob Moore
    Signed-off-by: Lin Ming
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • To simplify the enabling of wakeup devices during system suspend and
    hibernation, merge acpi_enable_wakeup_device_prep() with
    acpi_disable_wakeup_device() and remove unnecessary (and no longer
    valid) comments from the latter. Rename acpi_enable_wakeup_device()
    to acpi_enable_wakeup_devices() and acpi_disable_wakeup_device()
    to acpi_disable_wakeup_devices(), because these functions usually
    operate on multiple device objects.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

18 Jun, 2010

1 commit

  • After commit 9630bdd9b15d2f489c646d8bc04b60e53eb5ec78
    (ACPI: Use GPE reference counting to support shared GPEs) the wakeup
    enable mask bits of GPEs are set as soon as the GPEs are enabled to
    wake up the system. Unfortunately, this leads to a regression
    reported by Michal Hocko, where a system is woken up from ACPI S5 by
    a device that is not supposed to do that, because the wakeup enable
    mask bit of this device's GPE is always set when
    acpi_enter_sleep_state() calls acpi_hw_enable_all_wakeup_gpes(),
    although it should only be set if the device is supposed to wake up
    the system from the target state.

    To work around this issue, rework the ACPI power management code so
    that GPEs are not enabled to wake up the system upfront, but only
    during a system state transition when the target state of the system
    is known. [Of course, this means that the reference counting of
    "wakeup" GPEs doesn't really make sense and it is sufficient to
    set/unset the wakeup mask bits for them during system sleep
    transitions. This will allow us to simplify the GPE handling code
    quite a bit, but that change is too intrusive for 2.6.35.]

    Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15951

    Signed-off-by: Rafael J. Wysocki
    Reported-and-tested-by: Michal Hocko
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

23 Feb, 2010

2 commits

  • Use the run_wake flag to mark all devices for which run-time wake-up
    events may be generated by the platform. Introduce a new wake-up
    flag, always_enabled, for marking devices that should be permanently
    enabled to generate run-time events. Also, introduce a reference
    counter for run-wake devices and a function that will initialize all
    of the run-time wake-up fields for given device.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Len Brown
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • ACPI GPEs may map to multiple devices. The current GPE interface
    only provides a mechanism for enabling and disabling GPEs, making
    it difficult to change the state of GPEs at runtime without extensive
    cooperation between devices.

    Add an API to allow devices to indicate whether or not they want
    their device's GPE to be enabled for both runtime and wakeup events.

    Remove the old GPE type handling entirely, which gets rid of various
    quirks, like the implicit disabling with GPE type setting. This
    requires a small amount of rework in order to ensure that non-wake
    GPEs are enabled by default to preserve existing behaviour.

    Based on patches from Matthew Garrett .

    Signed-off-by: Matthew Garrett
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

10 Sep, 2009

1 commit

  • The wakeup.prepared flag is used for marking devices that have the
    wake-up power already enabled, so that the wake-up power is not
    enabled twice in a row for the same device. This assumes, however,
    that device wake-up power will only be enabled once, while the device
    is being prepared for a system-wide sleep transition, and the second
    attempt is made by acpi_enable_wakeup_device_prep().

    With the upcoming PCI wake-up rework this assumption will not hold
    any more for PCI bridges and the root bridge whose wake-up power
    may be enabled as a result of wake-up enable propagation from other
    devices (eg. add-on devices that are not associated with any GPEs).
    Thus, there may be many attempts to enable wake-up power on a PCI
    bridge or the root bridge during a system power state transition
    and it's better to replace wakeup.prepared with a reference counter.

    Reviewed-by: Matthew Garrett
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

07 Apr, 2009

1 commit


28 Mar, 2009

1 commit

  • This patch makes acpi_init() call acpi_wakeup_device_init() directly.
    Previously, acpi_wakeup_device_init() was a late_initcall (sequence 7).

    acpi_wakeup_device_init() depends on acpi_wakeup_device_list, which
    is populated when ACPI devices are enumerated by acpi_init() ->
    acpi_scan_init(). Using late_initcall is certainly enough to make
    sure acpi_wakeup_device_list is populated, but it is more than
    necessary. We can just as easily call acpi_wakeup_device_init()
    directly from acpi_init(), which avoids the initcall magic.

    Signed-off-by: Bjorn Helgaas
    CC: Li Shaohua
    Signed-off-by: Len Brown

    Bjorn Helgaas
     

17 Mar, 2009

1 commit

  • A number of things that shouldn't be exposed outside the ACPI core
    were declared in include/acpi/acpi_drivers.h, where anybody can
    see them. This patch moves those declarations to a new "internal.h"
    inside drivers/acpi.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     

09 Jan, 2009

1 commit