27 Jun, 2019

1 commit

  • If there are shared power resources between otherwise unrelated devices
    turning them on causes the other devices sharing them to be powered up
    as well. In case of PCI devices go into D0uninitialized state meaning
    that if they were configured to trigger wake that configuration is lost
    at this point.

    For this reason introduce a concept of "_PR0 dependent device" that can
    be added to any ACPI device that has power resources. The dependent
    device will be included in a list of dependent devices for all power
    resources returned by the ACPI device's _PR0 (assuming it has one).
    Whenever a power resource having dependent devices is turned physically
    on (its _ON method is called) we runtime resume all of them to allow
    their driver or in case of PCI the PCI core to re-initialize the device
    and its wake configuration.

    This adds two functions that can be used to add and remove these
    dependent devices. Note the dependent device does not necessary need
    share power resources so this functionality can be used to add "software
    dependencies" as well if needed.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki

    Mika Westerberg
     

31 May, 2019

1 commit

  • 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: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

27 Mar, 2019

1 commit


02 Jan, 2019

1 commit

  • Some ACPI tables contain duplicate power resource references like this:

    Name (_PR0, Package (0x04) // _PR0: Power Resources for D0
    {
    P28P,
    P18P,
    P18P,
    CLK4
    })

    This causes a WARN_ON in sysfs_add_link_to_group() because we end up
    adding a link to the same acpi_device twice:

    sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/808622C1:00/OVTI2680:00/power_resources_D0/LNXPOWER:0a'
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.12-301.fc29.x86_64 #1
    Hardware name: Insyde CherryTrail/Type2 - Board Product Name, BIOS jumperx.T87.KFBNEEA02 04/13/2016
    Call Trace:
    dump_stack+0x5c/0x80
    sysfs_warn_dup.cold.3+0x17/0x2a
    sysfs_do_create_link_sd.isra.2+0xa9/0xb0
    sysfs_add_link_to_group+0x30/0x50
    acpi_power_expose_list+0x74/0xa0
    acpi_power_add_remove_device+0x50/0xa0
    acpi_add_single_object+0x26b/0x5f0
    acpi_bus_check_add+0xc4/0x250
    ...

    To address this issue, make acpi_extract_power_resources() check for
    duplicates and simply skip them when found.

    Cc: All applicable
    Signed-off-by: Hans de Goede
    [ rjw: Subject & changelog, comments ]
    Signed-off-by: Rafael J. Wysocki

    Hans de Goede
     

05 Jul, 2017

1 commit

  • attribute_groups are not supposed to change at runtime. All functions
    working with attribute_groups provided by work with const
    attribute_group. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    4622 304 8 4934 1346 drivers/acpi/power.o

    File size After adding 'const':
    text data bss dec hex filename
    4846 80 8 4934 1346 drivers/acpi/power.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: Rafael J. Wysocki

    Arvind Yadav
     

02 May, 2017

1 commit

  • Commit 660b1113e0f3 (ACPI / PM: Fix consistency check for power resources
    during resume) introduced a check for ACPI power resources which have
    been turned on by the BIOS during suspend and turns these back off again.

    This is causing problems on a Dell Venue Pro 11 7130 (i5-4300Y) it causes
    the following messages to show up in dmesg:

    [ 131.014605] ACPI: Waking up from system sleep state S3
    [ 131.150271] acpi LNXPOWER:07: Turning OFF
    [ 131.150323] acpi LNXPOWER:06: Turning OFF
    [ 131.150911] acpi LNXPOWER:00: Turning OFF
    [ 131.169014] ACPI : EC: interrupt unblocked
    [ 131.181811] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
    [ 133.535728] pci_raw_set_power_state: 76 callbacks suppressed
    [ 133.535735] iwlwifi 0000:01:00.0: Refused to change power state,
    currently in D3
    [ 133.597672] PM: noirq resume of devices complete after 2428.891 msecs

    Followed by a bunch of iwlwifi errors later on and the pcie device
    dropping from the bus (acpiphp thinks it has been unplugged).

    Disabling the turning off of unused power resources fixes this. Instead
    of adding a quirk for this system, this commit fixes this by moving the
    disabling of unused power resources to later in the resume sequence
    when the iwlwifi card has been moved out of D3 so the ref_count for
    its power resource no longer is 0.

    This new behavior seems to match the intend of the original commit which
    commit-msg says: "(... which means that no devices are going to need them
    any time soon) and we should turn them off".

    This also avoids power resources which we need when bringing devices out
    of D3 from getting bounced off and then back on again.

    Signed-off-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki

    Hans de Goede
     

20 Apr, 2017

1 commit

  • gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state()
    is enterered at least once, so it assumes that cur_state might not get
    initialized:

    drivers/acpi/power.c: In function 'acpi_power_get_inferred_state':
    drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    This sets the variable to zero at the start of the loop, to ensure that
    there is well-defined behavior even for an empty list. This gets rid of
    the warning.

    The warning first showed up when the -Os flag got removed in a bug fix
    patch in linux-4.11-rc5.

    I would suggest merging this addon patch on top of that bug fix to avoid
    introducing a new warning in the stable kernels.

    Fixes: 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing)
    Cc: All applicable
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Rafael J. Wysocki

    Arnd Bergmann
     

01 Sep, 2015

1 commit

  • * acpi-pm:
    ACPI / bus: Move duplicate code to a separate new function
    mfd: Add support for Intel Sunrisepoint LPSS devices
    dmaengine: add a driver for Intel integrated DMA 64-bit
    mfd: make mfd_remove_devices() iterate in reverse order
    driver core: implement device_for_each_child_reverse()
    klist: implement klist_prev()
    Driver core: wakeup the parent device before trying probe
    ACPI / PM: Attach ACPI power domain only once
    PM / QoS: Make it possible to expose device latency tolerance to userspace
    ACPI / PM: Update the copyright notice and description of power.c

    Rafael J. Wysocki
     

16 Jul, 2015

1 commit


08 Jul, 2015

1 commit


26 May, 2015

1 commit

  • According to Section 7.2 of ACPI 6.0, power resources should
    always be enabled and disabled in order given by the "resourceorder"
    field of the corresponding Power Resource objects: "Power Resource
    levels are enabled from low values to high values and are disabled
    from high values to low values."

    However, this is not what happens during system resume, because
    in that case the enabling/disabling is carried out in the power
    resource registration order which may not reflect the ordering
    required by the platform.

    For this reason, make the ordering of the global list of all
    power resources in the system (used by the system resume code)
    reflect the one given by the "resourceorder" attributes of the
    Power Resource objects in the ACPI namespace and modify
    acpi_resume_power_resources() to walk the list in the reverse
    order when turning off the power resources that had been off
    before the system was suspended.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

16 May, 2015

1 commit

  • The ACPI 6 specification has made some changes in the device power
    management area. In particular:

    * The D3hot power state is now supposed to be always available
    (instead of D3cold) and D3cold is only regarded as valid if the
    _PR3 object is present for the given device.

    * The required ordering of transitions into power states deeper than
    D0 is now such that for a transition into state Dx the _PSx method
    is supposed to be executed first, if present, and the states of
    the power resources the device depends on are supposed to be
    changed after that.

    * It is now explicitly forbidden to transition devices from
    lower-power (deeper) into higher-power (shallower) power states
    other than D0.

    Those changes have been made so the specification reflects the
    Windows' device power management code that the vast majority of
    systems using ACPI is validated against.

    To avoid artificial differences in ACPI device power management
    between Windows and Linux, modify the ACPI device power management
    code to follow the new specification. Add comments explaining the
    code flow in some unclear places.

    This only may affect some real corner cases in which the OS behavior
    expected by the firmware is different from the Windows one, but that's
    quite unlikely. The transition ordering change affects transitions
    to D1 and D2 which are rarely used (if at all) and into D3hot and
    D3cold for devices actually having _PR3, but those are likely to
    be validated against Windows anyway. The other changes may affect
    code calling acpi_device_get_power() or acpi_device_update_power()
    where ACPI_STATE_D3_HOT may be returned instead of ACPI_STATE_D3_COLD
    (that's why the ACPI fan driver needs to be updated too) and since
    transitions into ACPI_STATE_D3_HOT may remove power now, it is better
    to avoid this one in acpi_pm_device_sleep_state() if the "no power
    off" PM QoS flag is set.

    The only existing user of acpi_device_can_poweroff() really cares
    about the case when _PR3 is present, so the change in that function
    should not cause any problems to happen too.

    A plus is that PCI_D3hot can be mapped to ACPI_STATE_D3_HOT
    now and the compatibility with older systems should be covered
    automatically.

    In any case, if any real problems result from this, it still will
    be better to follow the Windows' behavior (which now is reflected
    by the specification too) in general and handle the cases when it
    doesn't work via quirks.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

09 May, 2015

1 commit


19 Mar, 2014

1 commit


07 Dec, 2013

1 commit

  • Replace direct inclusions of , and
    , which are incorrect, with
    inclusions and remove some inclusions of those files that aren't
    necessary.

    First of all, , and
    should not be included directly from any files that are built for
    CONFIG_ACPI unset, because that generally leads to build warnings about
    undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set,
    includes those files and for CONFIG_ACPI unset it
    provides stub ACPI symbols to be used in that case.

    Second, there are ordering dependencies between those files that always
    have to be met. Namely, it is required that be included
    prior to so that the acpi_pci_root declarations the
    latter depends on are always there. And which provides
    basic ACPICA type declarations should always be included prior to any other
    ACPI headers in CONFIG_ACPI builds. That also is taken care of including
    as appropriate.

    Signed-off-by: Lv Zheng
    Cc: Greg Kroah-Hartman
    Cc: Matthew Garrett
    Cc: Tony Luck
    Cc: "H. Peter Anvin"
    Acked-by: Bjorn Helgaas (drivers/pci stuff)
    Acked-by: Konrad Rzeszutek Wilk (Xen stuff)
    Signed-off-by: Rafael J. Wysocki

    Lv Zheng
     

17 Oct, 2013

1 commit

  • The mechanism causing devices depending on a given power resource
    (that is, devices that can be in D0 only if that power resource is
    on) to be resumed automatically when the power resource is turned
    on (and their "inferred" power state becomes D0 as a result) is
    inherently racy and in fact unnecessary.

    It is racy, because if the power resource is turned on and then
    immediately off, the device resume triggered by the first transition
    to "on" may still happen, causing the power resource to be turned
    on again. That again will trigger the "resume of dependent devices"
    mechanism, but if the devices in question are not in use, they will
    be suspended in the meantime causing the power resource to be turned
    off. However, the "resume of dependent devices" will next resume
    them again and so on. In some cases (USB port PM in particular) that
    leads to an endless busy loop of flipping the resource on and off
    continuously.

    It is needless, because whoever turns a power resource on will most
    likely turn it off at some point and the devices that go into "D0"
    as a result of turning it on will then go back into D3cold
    (generally, the state they were in before).

    Moreover, turning on all power resources a device needs to go into
    D0 is not sufficient for a full transition into D0 in general.
    Namely, _PS0 may need to be executed in addition to that in some
    cases. This means that the whole rationale of the "resume of
    dependent devices" mechanism was incorrect to begin with and it's
    best to remove it entirely.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

16 Oct, 2013

1 commit


27 Aug, 2013

1 commit

  • * acpi-pm:
    ACPI / PM: Add state information to error message in acpi_device_set_power()
    ACPI / PM: Remove redundant power manageable check from acpi_bus_set_power()
    ACPI / PM: Use ACPI_STATE_D3_COLD instead of ACPI_STATE_D3 everywhere
    ACPI / PM: Make messages in acpi_device_set_power() print device names
    ACPI / PM: Only set power states of devices that are power manageable

    Rafael J. Wysocki
     

30 Jul, 2013

1 commit


15 Jul, 2013

1 commit


05 Jul, 2013

1 commit


20 Jun, 2013

1 commit

  • Commit 781d737 (ACPI: Drop power resources driver) introduced a
    bug in the power resources initialization error code path causing
    a NULL pointer to be referenced in acpi_release_power_resource()
    if there's an error triggering a jump to the 'err' label in
    acpi_add_power_resource(). This happens because the list_node
    field of struct acpi_power_resource has not been initialized yet
    at this point and doing a list_del() on it is a bad idea.

    To prevent this problem from occuring, initialize the list_node
    field of struct acpi_power_resource upfront.

    Reported-by: Mika Westerberg
    Tested-by: Lan Tianyu
    Signed-off-by: Rafael J. Wysocki
    Cc: 3.9+
    Acked-by: Yasuaki Ishimatsu
    Reviewed-by: Mika Westerberg

    Rafael J. Wysocki
     

28 Apr, 2013

1 commit


12 Apr, 2013

1 commit

  • Commit 18a3870 (ACPI / PM: Expose lists of device power resources
    to user space) exposed the lists of ACPI power resources associated
    with power states of ACPI devices, but it didn't expose the lists
    of ACPI wakeup power resources, which also is necessary to get the
    full picture of dependencies between ACPI devices and power
    resources.

    For this reason, for every ACPI device node having a list of ACPI
    wakeup power resources associated with it, expose that list to user
    space in analogy with commit 18a3870.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

25 Mar, 2013

1 commit

  • This patch introduces acpi_set_pnp_ids() and acpi_free_pnp_ids(),
    which are updated from acpi_device_set_id() and acpi_free_ids(),
    to setup and free acpi_device_pnp for a given acpi_handle. They
    can be called without acpi_device.

    Signed-off-by: Toshi Kani
    Signed-off-by: Rafael J. Wysocki

    Toshi Kani
     

24 Feb, 2013

1 commit

  • Commit d2e5f0c (ACPI / PCI: Rework the setup and cleanup of device
    wakeup) moved the initial disabling of system wakeup for PCI devices
    into a place where it can actually work and that exposed a hidden old
    issue with crap^Wunusual system designs where the same power
    resources are used for both wakeup power and device power control at
    run time.

    Namely, say there is one power resource such that the ACPI power
    state D0 of a PCI device depends on that power resource (i.e. the
    device is in D0 when that power resource is "on") and it is used
    as a wakeup power resource for the same device. Then, calling
    acpi_pci_sleep_wake(pci_dev, false) for the device in question will
    cause the reference counter of that power resource to drop to 0,
    which in turn will cause it to be turned off. As a result, the
    device will go into D3cold at that point, although it should have
    stayed in D0.

    As it turns out, that happens to USB controllers on some laptops
    and USB becomes unusable on those machines as a result, which is
    a major regression from v3.8.

    To fix this problem, (1) increment the reference counters of wakup
    power resources during their initialization if they are "on"
    initially, (2) prevent acpi_disable_wakeup_device_power() from
    decrementing the reference counters of wakeup power resources that
    were not enabled for wakeup power previously, and (3) prevent
    acpi_enable_wakeup_device_power() from incrementing the reference
    counters of wakeup power resources that already are enabled for
    wakeup power.

    In addition to that, if it is impossible to determine the initial
    states of wakeup power resources, avoid enabling wakeup for devices
    whose wakeup power depends on those power resources.

    Reported-by: Dave Jones
    Reported-by: Fabio Baltieri
    Tested-by: Fabio Baltieri
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

26 Jan, 2013

2 commits

  • During system resume we check if there are power resources that have
    been turned off by the BIOS, but our reference counters for them
    are nonzero (they need to be turned on then). It turns out, however,
    that we also need to check the opposite, i.e. if there are power
    resources that have been turned on by the BIOS, but our reference
    counters for them are zero (which means that no devices are going
    to need them any time soon) and we should turn them off.

    Make the power resources resume code do the additional check and
    turn off the unused power resources as appropriate.

    This change has been tested on HP nx6325.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Since ACPI power resources are going to be used more extensively on
    new hardware platforms, it is necessary to allow user space (powertop
    in particular) to look at the lists of power resources corresponding
    to different power states of devices for diagnostics and control
    purposes.

    For this reason, for each power state of an ACPI device node using
    power resources create a special attribute group under the device
    node's directory in sysfs containing links to sysfs directories
    representing the power resources in that list. The names of the
    new attribute groups are "power_resources_", where
    is the state name i.e. "D0", "D1", "D2", or "D3hot".

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

24 Jan, 2013

2 commits

  • Since ACPI power resources are going to be used more extensively on
    new hardware platforms, it becomes necessary for user space (powertop
    in particular) to observe some properties of those resources for
    diagnostics purposes.

    For this reason, expose the current status of each ACPI power
    resource to user space via sysfs by adding a new resource_in_use
    attribute to the sysfs directory representing the given power
    resource.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • ACPI core adds sysfs device files after the given devices have been
    registered with device_register(), which is not appropriate, because
    it may lead to race conditions with user space tools using those
    files.

    Fix the problem by delaying the KOBJ_ADD uevent for ACPI devices
    until after all of the devices' sysfs files have been created.

    This also fixes a use-after-free in acpi_device_unregister().

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

22 Jan, 2013

1 commit

  • After the only user of acpi_power_on_resources(),
    acpi_bus_init_power(), has been changed to avoid calling it
    for state equal to ACPI_STATE_D3_COLD, it doesn't have to special
    case that state any more.

    For this reason, modify the checks in acpi_power_on_resources()
    so that it returns -EINVAL for ACPI_STATE_D3_COLD as it should.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

17 Jan, 2013

9 commits

  • The system level attribute of ACPI power resources is the lowest
    system sleep level (S0, S2 etc.) in which the given resource can be
    "on" (ACPI 5.0, Section 7.1). On the other hand, wakeup power
    resources have to be "on" for devices depending on them to be able to
    signal wakeup. Therefore devices cannot wake up the system from
    sleep states higher than the minimum of the system level attributes
    of their wakeup power resources.

    Use the wakeup power resources' system level values to get the
    deepest system sleep state (highest system sleep level) the given
    device can wake up the system from.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Some ACPI power resource initialization errors, like memory
    allocation errors, are not taken into account appropriately in some
    cases, which may lead to a device having an incomplete list of power
    resources that one of its power states depends on, for one example.

    Rework the power resource initialization and namespace scanning code
    so that power resource initialization errors are treated more
    seriously.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The lists of ACPI power resources are currently extracted in two
    different ways, one for wakeup power resources and one for power
    resources that device power states depend on. There is no reason
    why it should be done differently in those two cases, so introduce
    a common routine for extracting power resources lists from data
    returned by AML, acpi_extract_power_resources(), and make the
    namespace scanning code use it for both wakeup and device power
    states power resources.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • ACPI power resources have an order attribute that should be taken
    into account when turning them on and off, but it is not used now.

    Modify the power resources management code to preserve the
    spec-compliant ordering of wakeup power resources.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • ACPI power resources have an order attribute that should be taken
    into account when turning them on and off, but it is not used now.

    Modify the power resources management code to preserve the
    spec-compliant ordering of power resources that power states of
    devices depend on (analogous changes will be done separately for
    power resources used for wakeup).

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • ACPI power resource objects have struct acpi_device components, but
    they are only used for registering those resources in the device
    hierarchy. In particular, power state information stored in them is
    completely useless (amnong other things, because the power resources
    "devices" are not power manageable), so there is no reason for the
    power resources management code to keep it up to date.

    Remove the code updating device power states of power resources from
    drivers/acpi/power.c.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The ACPI power resources driver is not very useful, because the only
    thing it really does is to restore the state of the power resources
    that were "on" before system suspend or hibernation, but that may be
    achieved in a different way.

    Drop the ACPI power resources driver entirely and add
    acpi_resume_power_resources() that will walk the list of all
    registered power resources during system resume and turn on the ones
    that were "on" before the preceding system suspend or hibernation.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • ACPI power resources need to be treated in a special way by the
    namespace scanning code, because they need to be ready to use as
    soon as they have been discovered (even before registering ACPI
    device nodes using them for power management).

    For this reason, it doesn't make sense to separate the preparation
    of struct acpi_device objects representing them in the device
    hierarchy from the creation of struct acpi_power_resource objects
    actually used for power resource manipulation. Accordingly, it
    doesn't make sense to define non-empty .add() and .remove() callbacks
    in the power resources "driver" (in fact, it is questionable whether
    or not it is useful to register such a "driver" at all).

    Rearrange the code in scan.c and power.c so that power resources are
    initialized entirely by one routine, acpi_add_power_resource(), that
    also prepares their struct acpi_device objects and registers them
    with the driver core, telling it to use a special release routine,
    acpi_release_power_resource(), for removing objects that represent
    power resources from memory. Make the ACPI namespace scanning code
    in scan.c always use acpi_add_power_resource() for preparing and
    registering objects that represent power resources.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Commit 0090def6 (ACPI: Add interface to register/unregister device
    to/from power resources) made it possible to indicate to the ACPI
    core that if the given device depends on any power resources, then
    it should be resumed as soon as all of the power resources required
    by it to transition to the D0 power state have been turned on.

    Unfortunately, however, this was a mistake, because all devices
    depending on power resources should be treated this way (i.e. they
    should be resumed when all power resources required by their D0
    state have been turned on) and for the majority of those devices
    the ACPI core can figure out by itself which (physical) devices
    depend on what power resources.

    For this reason, replace the code added by commit 0090def6 with a
    new, much more straightforward, mechanism that will be used
    internally by the ACPI core and remove all references to that code
    from kernel subsystems using ACPI.

    For the cases when there are (physical) devices that should be
    resumed whenever a not directly related ACPI device node goes into
    D0 as a result of power resources configuration changes, like in
    the SATA case, add two new routines, acpi_dev_pm_add_dependent()
    and acpi_dev_pm_remove_dependent(), allowing subsystems to manage
    such dependencies. Convert the SATA subsystem to use the new
    functions accordingly.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki