28 Jun, 2017

1 commit

  • The run_wake flag in struct dev_pm_info is used to indicate whether
    or not the device is capable of generating remote wakeup signals at
    run time (or in the system working state), but the distinction
    between runtime remote wakeup and system wakeup signaling has always
    been rather artificial. The only practical reason for it to exist
    at the core level was that ACPI and PCI treated those two cases
    differently, but that's not the case any more after recent changes.

    For this reason, get rid of the run_wake flag and, when applicable,
    use device_set_wakeup_capable() and device_can_wakeup() instead of
    device_set_run_wake() and device_run_wake(), respectively.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Mika Westerberg
    Acked-by: Bjorn Helgaas

    Rafael J. Wysocki
     

14 Dec, 2016

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the new driver core patches for 4.10-rc1.

    Big thing here is the nice addition of "functional dependencies" to
    the driver core. The idea has been talked about for a very long time,
    great job to Rafael for stepping up and implementing it. It's been
    tested for longer than the 4.9-rc1 date, we held off on merging it
    earlier in order to feel more comfortable about it.

    Other than that, it's just a handful of small other patches, some good
    cleanups to the mess that is the firmware class code, and we have a
    test driver for the deferred probe logic.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'driver-core-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (30 commits)
    firmware: Correct handling of fw_state_wait() return value
    driver core: Silence device links sphinx warning
    firmware: remove warning at documentation generation time
    drivers: base: dma-mapping: Fix typo in dmam_alloc_non_coherent comments
    driver core: test_async: fix up typo found by 0-day
    firmware: move fw_state_is_done() into UHM section
    firmware: do not use fw_lock for fw_state protection
    firmware: drop bit ops in favor of simple state machine
    firmware: refactor loading status
    firmware: fix usermode helper fallback loading
    driver core: firmware_class: convert to use class_groups
    driver core: devcoredump: convert to use class_groups
    driver core: class: add class_groups support
    kernfs: Declare two local data structures static
    driver-core: fix platform_no_drv_owner.cocci warnings
    drivers/base/memory.c: Remove unused 'first_page' variable
    driver core: add CLASS_ATTR_WO()
    drivers: base: cacheinfo: support DT overrides for cache properties
    drivers: base: cacheinfo: add pr_fmt logging
    drivers: base: cacheinfo: fix boot error message when acpi is enabled
    ...

    Linus Torvalds
     

01 Nov, 2016

2 commits

  • 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: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    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: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

21 Oct, 2016

2 commits

  • Because pm_runtime_set_suspended() invokes __pm_runtime_set_status(), which
    can fail, pm_runtime_set_suspended() can also fail.

    Instead of hiding a potential error, let's propagate it by converting
    pm_runtime_set_suspended() from a void to return an int. In this way users
    are able to check the error code and act accordingly.

    Signed-off-by: Ulf Hansson
    Reviewed-by: Linus Walleij
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     
  • The exported function pm_children_suspended() has only one caller, which is
    the runtime PM internal function, rpm_check_suspend_allowed().

    Let's clean-up this code, by removing pm_children_suspended() altogether
    and instead do the one-liner check directly in rpm_check_suspend_allowed().

    Signed-off-by: Ulf Hansson
    Reviewed-by: Linus Walleij
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

22 Apr, 2016

1 commit

  • The ignore_children flag is used only when CONFIG_PM is set, so let's move
    it into that section within the struct dev_pm_info.

    Move also the corresponding pm_suspend_ignore_children() API out of
    device.h into pm_runtime.h, to be consistent with similar APIs.

    Unfortunate this causes the Toshiba PCI SD mmc host driver to fail to
    compile as it needs pm_runtime.h, so let's fix this here as well.

    Signed-off-by: Ulf Hansson
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

21 Dec, 2015

1 commit

  • Introduce a new runtime PM function, pm_runtime_get_if_in_use(),
    that will increment the device's runtime PM usage counter and
    return 1 if its status is RPM_ACTIVE and its usage counter
    is greater than 0 at the same time (0 will be returned otherwise).

    This is useful for things that should only be done if the device
    is active (from the runtime PM perspective) and used by somebody
    (as indicated by the usage counter) already and they are not worth
    bothering otherwise.

    Requested-by: Imre Deak
    Reviewed-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

22 Jul, 2015

1 commit

  • Don't unset the direct_complete flag on devices that have runtime PM
    disabled, if they are runtime suspended.

    This is needed because otherwise ancestor devices wouldn't be able to
    do direct_complete without adding runtime PM support to all its
    descendants.

    Also removes pm_runtime_suspended_if_enabled() because it's now unused.

    Signed-off-by: Tomeu Vizoso
    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     

13 Dec, 2014

1 commit

  • Pull ARM updates from Russell King:
    "The major updates included in this update are:

    - Clang compatible stack pointer accesses by Behan Webster.
    - SA11x0 updates from Dmitry Eremin-Solenikov.
    - kgdb handling of breakpoints with read-only text/modules
    - Support for Privileged-no-execute feature on ARMv7 to prevent
    userspace code execution by the kernel.
    - AMBA primecell bus handling of irq-safe runtime PM
    - Unwinding support for memset/memzero/memmove/memcpy functions
    - VFP fixes for Krait CPUs and improvements in detecting the VFP
    architecture
    - A number of code cleanups (using pr_*, removing or reducing the
    severity of a couple of kernel messages, splitting ftrace asm code
    out to a separate file, etc.)
    - Add machine name to stack dump output"

    * 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: (62 commits)
    ARM: 8247/2: pcmcia: sa1100: make use of device clock
    ARM: 8246/2: pcmcia: sa1111: provide device clock
    ARM: 8245/1: pcmcia: soc-common: enable/disable socket clocks
    ARM: 8244/1: fbdev: sa1100fb: make use of device clock
    ARM: 8243/1: sa1100: add a clock alias for sa1111 pcmcia device
    ARM: 8242/1: sa1100: add cpu clock
    ARM: 8221/1: PJ4: allow building in Thumb-2 mode
    ARM: 8234/1: sa1100: reorder IRQ handling code
    ARM: 8233/1: sa1100: switch to hwirq usage
    ARM: 8232/1: sa1100: merge GPIO multiplexer IRQ to "normal" irq domain
    ARM: 8231/1: sa1100: introduce irqdomains support
    ARM: 8230/1: sa1100: shift IRQs by one
    ARM: 8229/1: sa1100: replace irq numbers with names in irq driver
    ARM: 8228/1: sa1100: drop entry-macro.S
    ARM: 8227/1: sa1100: switch to MULTI_IRQ_HANDLER
    ARM: 8241/1: Update processor_modes for hyp and monitor mode
    ARM: 8240/1: MCPM: document mcpm_sync_init()
    ARM: 8239/1: Introduce {set,clear}_pte_bit
    ARM: 8238/1: mm: Refine set_memory_* functions
    ARM: 8237/1: fix flush_pfn_alias
    ...

    Linus Torvalds
     

04 Dec, 2014

1 commit

  • After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
    selected) PM_RUNTIME is always set if PM is set, so quite a few
    depend on CONFIG_PM or even may be dropped entirely in some cases.

    Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PM core code.

    Reviewed-by: Ulf Hansson
    Acked-by: Kevin Hilman
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

18 Nov, 2014

1 commit


23 Jul, 2014

1 commit


17 May, 2014

1 commit

  • Currently, some subsystems (e.g. PCI and the ACPI PM domain) have to
    resume all runtime-suspended devices during system suspend, mostly
    because those devices may need to be reprogrammed due to different
    wakeup settings for system sleep and for runtime PM.

    For some devices, though, it's OK to remain in runtime suspend
    throughout a complete system suspend/resume cycle (if the device was in
    runtime suspend at the start of the cycle). We would like to do this
    whenever possible, to avoid the overhead of extra power-up and power-down
    events.

    However, problems may arise because the device's descendants may require
    it to be at full power at various points during the cycle. Therefore the
    most straightforward way to do this safely is if the device and all its
    descendants can remain runtime suspended until the complete stage of
    system resume.

    To this end, introduce a new device PM flag, power.direct_complete
    and modify the PM core to use that flag as follows.

    If the ->prepare() callback of a device returns a positive number,
    the PM core will regard that as an indication that it may leave the
    device runtime-suspended. It will then check if the system power
    transition in progress is a suspend (and not hibernation in particular)
    and if the device is, indeed, runtime-suspended. In that case, the PM
    core will set the device's power.direct_complete flag. Otherwise it
    will clear power.direct_complete for the device and it also will later
    clear it for the device's parent (if there's one).

    Next, the PM core will not invoke the ->suspend() ->suspend_late(),
    ->suspend_irq(), ->resume_irq(), ->resume_early(), or ->resume()
    callbacks for all devices having power.direct_complete set. It
    will invoke their ->complete() callbacks, however, and those
    callbacks are then responsible for resuming the devices as
    appropriate, if necessary. For example, in some cases they may
    need to queue up runtime resume requests for the devices using
    pm_request_resume().

    Changelog partly based on an Alan Stern's description of the idea
    (http://marc.info/?l=linux-pm&m=139940466625569&w=2).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Alan Stern

    Rafael J. Wysocki
     

02 Mar, 2014

1 commit

  • This patch provides two new runtime PM helper functions which intend to
    be used from system suspend/resume callbacks, to make sure devices are
    put into low power state during system suspend and brought back to full
    power at system resume.

    The prerequisite is to have all levels of a device's runtime PM
    callbacks to be defined through the SET_PM_RUNTIME_PM_OPS macro, which
    means these are available for CONFIG_PM.

    By using the new runtime PM helper functions especially the two
    scenarios below will be addressed.

    1) The PM core prevents .runtime_suspend callbacks from being invoked
    during system suspend. That means even for a runtime PM centric
    subsystem and driver, the device needs to be put into low power state
    from a system suspend callback. Otherwise it may very well be left in
    full power state (runtime resumed) while the system is suspended. By
    using the new helper functions, we make sure to walk the hierarchy of
    a device's power domain, subsystem and driver.

    2) Subsystems and drivers need to cope with all the combinations of
    CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. The two new helper functions
    smothly addresses this.

    Signed-off-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

22 Dec, 2013

1 commit

  • The pm_generic_runtime_suspend|resume functions were implemented within
    CONFIG_PM_RUNTIME.

    As we also may use runtime PM callbacks during system suspend, to put
    devices into low power state, we need to move the implementation of
    pm_generic_runtime_suspend|resume to CONFIG_PM.

    This change gives a power domain provision to invoke a platform
    driver's runtime PM callback from a power domain's system PM callback.
    This were earlier prevented by the platform bus, since it uses the
    pm_generic_runtime_suspend|resume functions as runtime PM callbacks.

    Cc: Kevin Hilman
    Cc: Alan Stern
    Signed-off-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

04 Jun, 2013

1 commit

  • The "runtime idle" helper routine, rpm_idle(), currently ignores
    return values from .runtime_idle() callbacks executed by it.
    However, it turns out that many subsystems use
    pm_generic_runtime_idle() which checks the return value of the
    driver's callback and executes pm_runtime_suspend() for the device
    unless that value is not 0. If that logic is moved to rpm_idle()
    instead, pm_generic_runtime_idle() can be dropped and its users
    will not need any .runtime_idle() callbacks any more.

    Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
    routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
    ata_port_runtime_idle(), respectively, as well as a few drivers'
    ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
    been returned by the .runtime_idle() callback executed by it.

    To reduce overall code bloat, make the changes described above.

    Tested-by: Mika Westerberg
    Tested-by: Kevin Hilman
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Kevin Hilman
    Reviewed-by: Ulf Hansson
    Acked-by: Alan Stern

    Rafael J. Wysocki
     

24 Feb, 2013

1 commit

  • Introduce the flag memalloc_noio in 'struct dev_pm_info' to help PM core
    to teach mm not allocating memory with GFP_KERNEL flag for avoiding
    probable deadlock.

    As explained in the comment, any GFP_KERNEL allocation inside
    runtime_resume() or runtime_suspend() on any one of device in the path
    from one block or network device to the root device in the device tree
    may cause deadlock, the introduced pm_runtime_set_memalloc_noio() sets
    or clears the flag on device in the path recursively.

    Signed-off-by: Ming Lei
    Cc: Minchan Kim
    Cc: Alan Stern
    Cc: Oliver Neukum
    Cc: Jiri Kosina
    Cc: Mel Gorman
    Cc: KAMEZAWA Hiroyuki
    Cc: Michal Hocko
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: "Rafael J. Wysocki"
    Cc: Greg KH
    Cc: Jens Axboe
    Cc: "David S. Miller"
    Cc: Eric Dumazet
    Cc: David Decotigny
    Cc: Tom Herbert
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ming Lei
     

26 Jan, 2013

1 commit

  • This boolean function simply returns whether or not the runtime
    status of the device is 'active'. The typical scenario is driver
    calls pm_runtime_get firstly, then check pm_runtime_active in
    atomic environment.

    Also add entry to Documentation/power/runtime.txt

    Signed-off-by: Yanmin Zhang
    Signed-off-by: ShuoX Liu
    Signed-off-by: Rafael J. Wysocki

    ShuoX Liu
     

02 May, 2012

1 commit

  • After the previous changes in default_stop_ok() and
    default_power_down_ok() for PM domains, there are two fields in
    struct dev_pm_info that aren't necessary any more, suspend_time
    and max_time_suspended_ns.

    Remove those fields along with all of the code that accesses them,
    which simplifies the runtime PM framework quite a bit.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

02 Dec, 2011

1 commit

  • Make the runtime PM core use device PM QoS constraints to check if
    it is allowed to suspend a given device, so that an error code is
    returned if the device's own PM QoS constraint is negative or one of
    its children has already been suspended for too long. If this is
    not the case, the maximum estimated time the device is allowed to be
    suspended, computed as the minimum of the device's PM QoS constraint
    and the PM QoS constraints of its children (reduced by the difference
    between the current time and their suspend times) is stored in a new
    device's PM field power.max_time_suspended_ns that can be used by
    the device's subsystem or PM domain to decide whether or not to put
    the device into lower-power (and presumably higher-latency) states
    later (if the constraint is 0, which means "no constraint", the
    power.max_time_suspended_ns is set to -1).

    Additionally, the time of execution of the subsystem-level
    .runtime_suspend() callback for the device is recorded in the new
    power.suspend_time field for later use by the device's subsystem or
    PM domain along with power.max_time_suspended_ns (it also is used
    by the core code when the device's parent is suspended).

    Introduce a new helper function,
    pm_runtime_update_max_time_suspended(), allowing subsystems and PM
    domains (or device drivers) to update the power.max_time_suspended_ns
    field, for example after changing the power state of a suspended
    device.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

18 Nov, 2011

1 commit

  • Commit 4ca46ff3e0d8c234cb40ebb6457653b59584426c (PM / Sleep: Mark
    devices involved in wakeup signaling during suspend) introduced
    the power.wakeup_path field in struct dev_pm_info to mark devices
    whose children are enabled to wake up the system from sleep states,
    so that power domains containing the parents that provide their
    children with wakeup power and/or relay their wakeup signals are not
    turned off. Unfortunately, that introduced a PM regression on SH7372
    whose power consumption in the system "memory sleep" state increased
    as a result of it, because it prevented the power domain containing
    the I2C controller from being turned off when some children of that
    controller were enabled to wake up the system, although the
    controller was not necessary for them to signal wakeup.

    To fix this issue use the observation that devices whose
    power.ignore_children flag is set for runtime PM should be treated
    analogously during system suspend. Namely, they shouldn't be
    included in wakeup paths going through their children. Since the
    SH7372 I2C controller's power.ignore_children flag is set, doing so
    will restore the previous behavior of that SOC.

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

    Rafael J. Wysocki
     

01 Nov, 2011

1 commit


25 Aug, 2011

3 commits

  • Since the PM clock management code in drivers/base/power/clock_ops.c
    is used for both runtime PM and system suspend/hibernation, the
    definitions of data structures and headers related to it should not
    be located in include/linux/pm_rumtime.h. Move them to a separate
    header file.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Currently pm_genpd_runtime_resume() has to walk the list of devices
    from the device's PM domain to find the corresponding device list
    object containing the need_restore field to check if the driver's
    .runtime_resume() callback should be executed for the device.
    This is suboptimal and can be simplified by using power.sybsys_data
    to store device information used by the generic PM domains code.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Introduce struct pm_subsys_data that may be subclassed by subsystems
    to store subsystem-specific information related to the device. Move
    the clock management fields accessed through the power.subsys_data
    pointer in struct device to the new strucutre.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

12 Jul, 2011

1 commit


02 Jul, 2011

3 commits

  • The common PM clock management functions may be used for system
    suspend/resume as well as for runtime PM, so rename them
    accordingly. Modify kerneldoc comments describing these functions
    and kernel messages printed by them, so that they refer to power
    management in general rather that to runtime PM.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Kevin Hilman

    Rafael J. Wysocki
     
  • The common clocks management code in drivers/base/power/clock_ops.c
    is going to be used during system-wide power transitions as well as
    for runtime PM, so it shouldn't depend on CONFIG_PM_RUNTIME.
    However, the suspend/resume functions provided by it for
    CONFIG_PM_RUNTIME unset, to be used during system-wide power
    transitions, should not behave in the same way as their counterparts
    defined for CONFIG_PM_RUNTIME set, because in that case the clocks
    are managed differently at run time.

    The names of the functions still contain the word "runtime" after
    this change, but that is going to be modified by a separate patch
    later.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Kevin Hilman

    Rafael J. Wysocki
     
  • The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
    (PM: Add support for device power domains), which introduced the
    struct dev_power_domain type for representing device power domains,
    evidently confuses some developers who tend to think that objects
    of this type must correspond to "power domains" as defined by
    hardware, which is not the case. Namely, at the kernel level, a
    struct dev_power_domain object can represent arbitrary set of devices
    that are mutually dependent power management-wise and need not belong
    to one hardware power domain. To avoid that confusion, rename struct
    dev_power_domain to struct dev_pm_domain and rename the related
    pointers in struct device and struct pm_clk_notifier_block from
    pwr_domain to pm_domain.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Kevin Hilman

    Rafael J. Wysocki
     

30 Apr, 2011

1 commit

  • Many different platforms and subsystems may want to disable device
    clocks during suspend and enable them during resume which is going to
    be done in a very similar way in all those cases. For this reason,
    provide generic routines for the manipulation of device clocks during
    suspend and resume.

    Convert the ARM shmobile platform to using the new routines.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

15 Mar, 2011

1 commit

  • Currently, wakeup sysfs attributes are created for all devices,
    regardless of whether or not they are wakeup-capable. This is
    excessive and complicates wakeup device identification from user
    space (i.e. to identify wakeup-capable devices user space has to read
    /sys/devices/.../power/wakeup for all devices and see if they are not
    empty).

    Fix this issue by avoiding to create wakeup sysfs files for devices
    that cannot wake up the system from sleep states (i.e. whose
    power.can_wakeup flags are unset during registration) and modify
    device_set_wakeup_capable() so that it adds (or removes) the relevant
    sysfs attributes if a device's wakeup capability status is changed.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

24 Dec, 2010

2 commits

  • The __pm_generic_resume() function changes the given device's runtime
    PM status to RPM_ACTIVE if its driver's callback returns 0, but it
    only should do that if the rumtime PM is enabled for the device.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • This patch (as1431c) makes the synchronous runtime-PM interface
    suitable for use in interrupt handlers. Subsystems can call the new
    pm_runtime_irq_safe() function to tell the PM core that a device's
    runtime_suspend and runtime_resume callbacks should be invoked with
    interrupts disabled and the spinlock held. This permits the
    pm_runtime_get_sync() and the new pm_runtime_put_sync_suspend()
    routines to be called from within interrupt handlers.

    When a device is declared irq-safe in this way, the PM core increments
    the parent's usage count, so the parent will never be runtime
    suspended. This prevents difficult situations in which an irq-safe
    device can't resume because it is forced to wait for its non-irq-safe
    parent.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     

17 Dec, 2010

1 commit

  • There are some situations (e.g. in __pm_generic_call()), where
    pm_runtime_suspended() is used to decide whether or not to execute
    a device's (system) ->suspend() callback. The callback is not
    executed if pm_runtime_suspended() returns true, but it does so
    for devices that don't even support runtime PM, because the
    power.disable_depth device field is ignored by it. This leads to
    problems (i.e. devices are not suspened when they should), so rework
    pm_runtime_suspended() so that it returns false if the device's
    power.disable_depth field is different from zero.

    Signed-off-by: Rafael J. Wysocki
    Cc: stable@kernel.org

    Rafael J. Wysocki
     

17 Oct, 2010

5 commits

  • The patch "PM / Runtime: Implement autosuspend support" introduces
    "autosuspend" facility for runtime PM, but misses helper function
    of pm_request_autosuspend, so add it.

    Signed-off-by: Ming Lei
    Signed-off-by: Rafael J. Wysocki

    Ming Lei
     
  • This patch (as1427) implements the "autosuspend" facility for runtime
    PM. A few new fields are added to the dev_pm_info structure and
    several new PM helper functions are defined, for telling the PM core
    whether or not a device uses autosuspend, for setting the autosuspend
    delay, and for marking periods of device activity.

    Drivers that do not want to use autosuspend can continue using the
    same helper functions as before; their behavior will not change. In
    addition, drivers supporting autosuspend can also call the old helper
    functions to get the old behavior.

    The details are all explained in Documentation/power/runtime_pm.txt
    and Documentation/ABI/testing/sysfs-devices-power.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     
  • Some devices, such as USB interfaces, cannot be power-managed
    independently of their parents, i.e., they cannot be put in low power
    while the parent remains at full power. This patch (as1425) creates a
    new "no_callbacks" flag, which tells the PM core not to invoke the
    runtime-PM callback routines for the such devices but instead to
    assume that the callbacks always succeed. In addition, the
    non-debugging runtime-PM sysfs attributes for the devices are removed,
    since they are pretty much meaningless.

    The advantage of this scheme comes not so much from avoiding the
    callbacks themselves, but rather from the fact that without the need
    for a process context in which to run the callbacks, more work can be
    done in interrupt context.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     
  • This patch (as1424) combines the various public entry points for the
    runtime PM routines into three simple functions: one for idle, one for
    suspend, and one for resume. A new bitflag specifies whether or not
    to increment or decrement the usage_count field.

    The new entry points are named __pm_runtime_idle,
    __pm_runtime_suspend, and __pm_runtime_resume, to reflect that they
    are trampolines. Simultaneously, the corresponding internal routines
    are renamed to rpm_idle, rpm_suspend, and rpm_resume.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     
  • The "from_wq" argument in __pm_runtime_suspend() and
    __pm_runtime_resume() supposedly indicates whether or not the function
    was called by the PM workqueue thread, but in fact it isn't always
    used this way. It really indicates whether or not the function should
    return early if the requested operation is already in progress.

    Along with this badly-named boolean argument, later patches in this
    series will add several other boolean arguments to these functions and
    others. Therefore this patch (as1422) begins the conversion process
    by replacing from_wq with a bitflag argument. The same bitflags are
    also used in __pm_runtime_get() and __pm_runtime_put(), where they
    indicate whether or not the operation should be asynchronous.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki

    Alan Stern