22 Jun, 2011

3 commits

  • Commit 85eb8c8d0b0900c073b0e6f89979ac9c439ade1a (PM / Runtime:
    Generic clock manipulation rountines for runtime PM (v6)) converted
    the shmobile platform to using generic code for runtime PM clock
    management, but it changed the behavior for CONFIG_PM_RUNTIME unset
    incorrectly.

    Specifically, for CONFIG_PM_RUNTIME unset pm_runtime_clk_notify()
    should enable clocks for action equal to BUS_NOTIFY_BIND_DRIVER and
    it should disable them for action equal to BUS_NOTIFY_UNBOUND_DRIVER
    (instead of BUS_NOTIFY_ADD_DEVICE and BUS_NOTIFY_DEL_DEVICE,
    respectively). Make this function behave as appropriate.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Magnus Damm

    Rafael J. Wysocki
     
  • The PM core doesn't handle suspend failures correctly when it comes to
    asynchronously suspended devices. These devices are moved onto the
    dpm_suspended_list as soon as the corresponding async thread is
    started up, and they remain on the list even if they fail to suspend
    or the sleep transition is cancelled before they get suspended. As a
    result, when the PM core unwinds the transition, it tries to resume
    the devices even though they were never suspended.

    This patch (as1474) fixes the problem by adding a new "is_suspended"
    flag to dev_pm_info. Devices are resumed only if the flag is set.

    [rjw:
    * Moved the dev->power.is_suspended check into device_resume(),
    because we need to complete dev->power.completion and clear
    dev->power.is_prepared too for devices whose
    dev->power.is_suspended flags are unset.
    * Fixed __device_suspend() to avoid setting dev->power.is_suspended
    if async_error is different from zero.]

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

    Alan Stern
     
  • This patch (as1473) renames the "in_suspend" field in struct
    dev_pm_info to "is_prepared", in preparation for an upcoming change.
    The new name is more descriptive of what the field really means.

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

    Alan Stern
     

08 Jun, 2011

1 commit

  • The loops over connection ID strings in pm_runtime_clk_notify()
    should actually iterate over the strings and not over the elements
    of the first of them, so make them behave as appropriate.

    This fixes a regression introduced by commit 600b776eb39a13a28b090
    (OMAP1 / PM: Use generic clock manipulation routines for runtime PM).

    Reported-and-tested-by: Janusz Krzysztofik
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

18 May, 2011

6 commits

  • Introduce generic .prepare() and .complete() power management
    callbacks, currently missing, that can be used by subsystems and
    power domains and export them. Provide NULL definitions of all
    the generic system sleep callbacks for CONFIG_PM_SLEEP unset.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • If device drivers allocate substantial amounts of memory (above 1 MB)
    in their hibernate .freeze() callbacks (or in their legacy suspend
    callbcks during hibernation), the subsequent creation of hibernate
    image may fail due to the lack of memory. This is the case, because
    the drivers' .freeze() callbacks are executed after the hibernate
    memory preallocation has been carried out and the preallocated amount
    of memory may be too small to cover the new driver allocations.
    Unfortunately, the drivers' .prepare() callbacks also are executed
    after the hibernate memory preallocation has completed, so they are
    not suitable for allocating additional memory either. Thus the only
    way a driver can safely allocate memory during hibernation is to use
    a hibernate/suspend notifier. However, the notifiers are called
    before the freezing of user space and the drivers wanting to use them
    for allocating additional memory may not know how much memory needs
    to be allocated at that point.

    To let device drivers overcome this difficulty rework the hibernation
    sequence so that the memory preallocation is carried out after the
    drivers' .prepare() callbacks have been executed, so that the
    .prepare() callbacks can be used for allocating additional memory
    to be used by the drivers' .freeze() callbacks. Update documentation
    to match the new behavior of the code.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Now that we have CONFIG_DYNAMIC_DEBUG there is no need for yet
    another flag causing dev_dbg() and pr_debug() statements in the
    core PM code to produce output. Moreover, CONFIG_PM_VERBOSE
    causes so much output to be generated that it's not really useful
    and almost no one sets it.

    References: https://bugzilla.kernel.org/show_bug.cgi?id=23182
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • * power-domains:
    PM: Fix build issue in clock_ops.c for CONFIG_PM_RUNTIME unset
    PM: Revert "driver core: platform_bus: allow runtime override of dev_pm_ops"
    OMAP1 / PM: Use generic clock manipulation routines for runtime PM
    PM / Runtime: Generic clock manipulation rountines for runtime PM (v6)
    PM / Runtime: Add subsystem data field to struct dev_pm_info
    OMAP2+ / PM: move runtime PM implementation to use device power domains
    PM / Platform: Use generic runtime PM callbacks directly
    shmobile: Use power domains for platform runtime PM
    PM: Export platform bus type's default PM callbacks
    PM: Make power domain callbacks take precedence over subsystem ones

    Rafael J. Wysocki
     
  • wakeup_source_add() adds an item into wakeup_sources list.

    There is no need to call synchronize_rcu() at this point.

    Its only needed in wakeup_source_remove()

    Signed-off-by: Eric Dumazet
    Signed-off-by: Rafael J. Wysocki

    Eric Dumazet
     
  • The "wakeup" device sysfs file is only created if CONFIG_PM_SLEEP
    is set, so put it under CONFIG_PM_SLEEP and make a build warning
    related to it go away.

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

    Rafael J. Wysocki
     

17 May, 2011

1 commit


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
     

29 Apr, 2011

1 commit

  • Change the PM core's behavior related to power domains in such a way
    that, if a power domain is defined for a given device, its callbacks
    will be executed instead of and not in addition to the device
    subsystem's PM callbacks.

    The idea behind the initial implementation of power domains handling
    by the PM core was that power domain callbacks would be executed in
    addition to subsystem callbacks, so that it would be possible to
    extend the subsystem callbacks by using power domains. It turns out,
    however, that this wouldn't be really convenient in some important
    situations.

    For example, there are systems in which power can only be removed
    from entire power domains. On those systems it is not desirable to
    execute device drivers' PM callbacks until it is known that power is
    going to be removed from the devices in question, which means that
    they should be executed by power domain callbacks rather then by
    subsystem (e.g. bus type) PM callbacks, because subsystems generally
    have no information about what devices belong to which power domain.
    Thus, for instance, if the bus type in question is the platform bus
    type, its PM callbacks generally should not be called in addition to
    power domain callbacks, because they run device drivers' callbacks
    unconditionally if defined.

    While in principle the default subsystem PM callbacks, or a subset of
    them, may be replaced with different functions, it doesn't seem
    correct to do so, because that would change the subsystem's behavior
    with respect to all devices in the system, regardless of whether or
    not they belong to any power domains. Thus, the only remaining
    option is to make power domain callbacks take precedence over
    subsystem callbacks.

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

    Rafael J. Wysocki
     

26 Apr, 2011

1 commit

  • It turns out that some PCI devices are only found to be
    wakeup-capable during registration, in which case, when
    device_set_wakeup_capable() is called, device_is_registered() already
    returns 'true' for the given device, but dpm_sysfs_add() hasn't been
    called for it yet. This leads to situations in which the device's
    power.can_wakeup flag is not set as requested because of failing
    wakeup_sysfs_add() and its wakeup-related sysfs files are not
    created, although they should be present. This is a post-2.6.38
    regression introduced by commit cb8f51bdadb7969139c2e39c2defd4cde98c1
    (PM: Do not create wakeup sysfs files for devices that cannot wake
    up).

    To work around this problem initialize the device's power.entry
    field to an empty list head and make device_set_wakeup_capable()
    check if it is still empty before attempting to add the devices
    wakeup-related sysfs files with wakeup_sysfs_add(). Namely, if
    power.entry is still empty at this point, device_pm_add() hasn't been
    called yet for the device and its wakeup-related files will be
    created later, so device_set_wakeup_capable() doesn't have to create
    them.

    Reported-and-tested-by: Tino Keitel
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

12 Apr, 2011

1 commit

  • Xen save/restore is going to use hibernate device callbacks for
    quiescing devices and putting them back to normal operations and it
    would need to select CONFIG_HIBERNATION for this purpose. However,
    that also would cause the hibernate interfaces for user space to be
    enabled, which might confuse user space, because the Xen kernels
    don't support hibernation. Moreover, it would be wasteful, as it
    would make the Xen kernels include a substantial amount of code that
    they would never use.

    To address this issue introduce new power management Kconfig option
    CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
    that is necessary for the hibernate device callbacks to work and make
    CONFIG_HIBERNATION select it. Then, Xen save/restore will be able to
    select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
    hibernate code along with it.

    Signed-off-by: Rafael J. Wysocki
    Tested-by: Shriram Rajagopalan

    Rafael J. Wysocki
     

31 Mar, 2011

1 commit


15 Mar, 2011

10 commits

  • opp_find_freq_exact() documentation has is_available instead
    of available. This also fixes warning with the kernel-doc:
    scripts/kernel-doc drivers/base/power/opp.c >/dev/null
    Warning(drivers/base/power/opp.c:246): No description found for parameter 'available'
    Warning(drivers/base/power/opp.c:246): Excess function parameter 'is_available' description in 'opp_find_freq_exact'

    Signed-off-by: Nishanth Menon
    Signed-off-by: Rafael J. Wysocki

    Nishanth Menon
     
  • The code handling system-wide power transitions (eg. suspend-to-RAM)
    can in theory execute callbacks provided by the device's bus type,
    device type and class in each phase of the power transition. In
    turn, the runtime PM core code only calls one of those callbacks at
    a time, preferring bus type callbacks to device type or class
    callbacks and device type callbacks to class callbacks.

    It seems reasonable to make them both behave in the same way in that
    respect. Moreover, even though a device may belong to two subsystems
    (eg. bus type and device class) simultaneously, in practice power
    management callbacks for system-wide power transitions are always
    provided by only one of them (ie. if the bus type callbacks are
    defined, the device class ones are not and vice versa). Thus it is
    possible to modify the code handling system-wide power transitions
    so that it follows the core runtime PM code (ie. treats the
    subsystem callbacks as mutually exclusive).

    On the other hand, the core runtime PM code will choose to execute,
    for example, a runtime suspend callback provided by the device type
    even if the bus type's struct dev_pm_ops object exists, but the
    runtime_suspend pointer in it happens to be NULL. This is confusing,
    because it may lead to the execution of callbacks from different
    subsystems during different operations (eg. the bus type suspend
    callback may be executed during runtime suspend of the device, while
    the device type callback will be executed during system suspend).

    Make all of the power management code treat subsystem callbacks in
    a consistent way, such that:
    (1) If the device's type is defined (eg. dev->type is not NULL)
    and its pm pointer is not NULL, the callbacks from dev->type->pm
    will be used.
    (2) If dev->type is NULL or dev->type->pm is NULL, but the device's
    class is defined (eg. dev->class is not NULL) and its pm pointer
    is not NULL, the callbacks from dev->class->pm will be used.
    (3) If dev->type is NULL or dev->type->pm is NULL and dev->class is
    NULL or dev->class->pm is NULL, the callbacks from dev->bus->pm
    will be used provided that both dev->bus and dev->bus->pm are
    not NULL.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Kevin Hilman
    Reasoning-sounds-sane-to: Grant Likely
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • The platform bus type is often used to handle Systems-on-a-Chip (SoC)
    where all devices are represented by objects of type struct
    platform_device. In those cases the same "platform" device driver
    may be used with multiple different system configurations, but the
    actions needed to put the devices it handles into a low-power state
    and back into the full-power state may depend on the design of the
    given SoC. The driver, however, cannot possibly include all the
    information necessary for the power management of its device on all
    the systems it is used with. Moreover, the device hierarchy in its
    current form also is not suitable for representing this kind of
    information.

    The patch below attempts to address this problem by introducing
    objects of type struct dev_power_domain that can be used for
    representing power domains within a SoC. Every struct
    dev_power_domain object provides a sets of device power
    management callbacks that can be used to perform what's needed for
    device power management in addition to the operations carried out by
    the device's driver and subsystem.

    Namely, if a struct dev_power_domain object is pointed to by the
    pwr_domain field in a struct device, the callbacks provided by its
    ops member will be executed in addition to the corresponding
    callbacks provided by the device's subsystem and driver during all
    power transitions.

    Signed-off-by: Rafael J. Wysocki
    Tested-and-acked-by: Kevin Hilman

    Rafael J. Wysocki
     
  • The dpm_prepare() function increments the runtime PM reference
    counters of all devices to prevent pm_runtime_suspend() from
    executing subsystem-level callbacks. However, this was supposed to
    guard against a specific race condition that cannot happen, because
    the power management workqueue is freezable, so pm_runtime_suspend()
    can only be called synchronously during system suspend and we can
    rely on subsystems and device drivers to avoid doing that
    unnecessarily.

    Make dpm_prepare() drop the runtime PM reference to each device
    after making sure that runtime resume is not pending for it.

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

    Rafael J. Wysocki
     
  • After redefining CONFIG_PM to depend on (CONFIG_PM_SLEEP ||
    CONFIG_PM_RUNTIME) the CONFIG_PM_OPS option is redundant and can be
    replaced with CONFIG_PM.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • 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
     
  • printk()s without a priority level default to KERN_WARNING. To reduce
    noise at KERN_WARNING, this patch sets the priority level appriopriately
    for unleveled printks()s. This should be useful to folks that look at
    dmesg warnings closely.

    Changed these messages to pr_info().

    Signed-off-by: Mandeep Singh Baines
    Signed-off-by: Rafael J. Wysocki

    Mandeep Singh Baines
     
  • Since pm_save_wakeup_count() has just been changed to clear
    events_check_enabled unconditionally before checking if there are
    any new wakeup events registered since the last read from
    /sys/power/wakeup_count, the detection of wakeup events during
    suspend may be disabled, after it's been enabled, by writing a
    "wrong" value back to /sys/power/wakeup_count. For this reason,
    it is not necessary to update events_check_enabled in
    pm_get_wakeup_count() any more.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • According to Documentation/ABI/testing/sysfs-power, the
    /sys/power/wakeup_count interface should only make the kernel react
    to wakeup events during suspend if the last write to it has been
    successful. However, if /sys/power/wakeup_count is written to two
    times in a row, where the first write is successful and the second
    is not, the kernel will still react to wakeup events during suspend
    due to a bug in pm_save_wakeup_count().

    Fix the bug by making pm_save_wakeup_count() clear
    events_check_enabled unconditionally before checking if there are
    any new wakeup events registered since the previous read from
    /sys/power/wakeup_count.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The memory barrier in wakeup_source_deactivate() is supposed to
    prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
    from seeing the new value of events_in_progress (0, in particular)
    and the old value of event_count at the same time. However, if
    wakeup_source_deactivate() is executed by CPU0 and, for instance,
    pm_wakeup_pending() is executed by CPU1, where both processors can
    reorder operations, the memory barrier in wakeup_source_deactivate()
    doesn't affect CPU1 which can reorder reads. In that case CPU1 may
    very well decide to fetch event_count before it's modified and
    events_in_progress after it's been updated, so pm_wakeup_pending()
    may fail to detect a wakeup event. This issue can be addressed by
    using a single atomic variable to store both events_in_progress
    and event_count, so that they can be updated together in a single
    atomic operation.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

26 Jan, 2011

1 commit

  • This patch (as1445) fixes a bug in the runtime PM core left over from
    the addition of the no_callbacks flag. If this flag is set then it is
    possible for rpm_suspend() to be called in_interrupt, so when
    releasing spinlocks it's important not to re-enable interrupts.

    To avoid an unnecessary save-and-restore of the interrupt flag, the
    patch also inlines a pm_request_idle() call.

    This fixes Bugzilla #27482.

    (The offending code was added in 2.6.37, so it's not necessary to apply
    this to any earlier stable kernels.)

    Signed-off-by: Alan Stern
    Reported-by: tim blechmann
    CC:
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     

14 Jan, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

24 Dec, 2010

12 commits