14 Jan, 2012

2 commits


26 Dec, 2011

3 commits

  • * pm-domains:
    PM / shmobile: Allow the A4R domain to be turned off at run time
    PM / input / touchscreen: Make st1232 use device PM QoS constraints
    PM / QoS: Introduce dev_pm_qos_add_ancestor_request()
    PM / shmobile: Remove the stay_on flag from SH7372's PM domains
    PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume
    PM / shmobile: Add support for the sh7372 A4S power domain / sleep mode
    ARM: S3C64XX: Implement basic power domain support
    PM / shmobile: Use common always on power domain governor
    PM / Domains: Provide an always on power domain governor
    PM / Domains: Fix default system suspend/resume operations
    PM / Domains: Make it possible to assign names to generic PM domains
    PM / Domains: fix compilation failure for CONFIG_PM_GENERIC_DOMAINS unset
    PM / Domains: Automatically update overoptimistic latency information
    PM / Domains: Add default power off governor function (v4)
    PM / Domains: Add device stop governor function (v4)
    PM / Domains: Rework system suspend callback routines (v2)
    PM / Domains: Introduce "save/restore state" device callbacks
    PM / Domains: Make it possible to use per-device domain callbacks

    Rafael J. Wysocki
     
  • * pm-runtime:
    PM / Runtime: Use device PM QoS constraints (v2)

    Rafael J. Wysocki
     
  • Some devices, like the I2C controller on SH7372, are not
    necessary for providing power to their children or forwarding
    wakeup signals (and generally interrupts) from them. They are
    only needed by their children when there's some data to transfer,
    so they may be suspended for the majority of time and resumed
    on demand, when the children have data to send or receive. For this
    purpose, however, their power.ignore_children flags have to be set,
    or the PM core wouldn't allow them to be suspended while their
    children were active.

    Unfortunately, in some situations it may take too much time to
    resume such devices so that they can assist their children in
    transferring data. For example, if such a device belongs to a PM
    domain which goes to the "power off" state when that device is
    suspended, it may take too much time to restore power to the
    domain in response to the request from one of the device's
    children. In that case, if the parent's resume time is critical,
    the domain should stay in the "power on" state, although it still may
    be desirable to power manage the parent itself (e.g. by manipulating
    its clock).

    In general, device PM QoS may be used to address this problem.
    Namely, if the device's children added PM QoS latency constraints
    for it, they would be able to prevent it from being put into an
    overly deep low-power state. However, in some cases the devices
    needing to be serviced are not the immediate children of a
    "children-ignoring" device, but its grandchildren or even less
    direct descendants. In those cases, the entity wanting to add a
    PM QoS request for a given device's ancestor that ignores its
    children will have to find it in the first place, so introduce a new
    helper function that may be used to achieve that. This function,
    dev_pm_qos_add_ancestor_request(), will search for the first
    ancestor of the given device whose power.ignore_children flag is
    set and will add a device PM QoS latency request for that ancestor
    on behalf of the caller. The request added this way may be removed
    with the help of dev_pm_qos_remove_request() in the future, like
    any other device PM QoS latency request.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

22 Dec, 2011

3 commits

  • Since the PM core is now going to execute driver callbacks directly
    if the corresponding subsystem callbacks are not present,
    forward-only subsystem callbacks (i.e. such that only execute the
    corresponding driver callbacks) are not necessary any more. Thus
    it is possible to remove generic_subsys_pm_ops, because the only
    callback in there that is not forward-only, .runtime_idle, is not
    really used by the only user of generic_subsys_pm_ops, which is
    vio_bus_type.

    However, the generic callback routines themselves cannot be removed
    from generic_ops.c, because they are used individually by a number
    of subsystems.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Make the PM core execute driver PM callbacks directly if the
    corresponding subsystem callbacks are not present.

    There are three reasons for doing that. First, it reflects the
    behavior of drivers/base/dd.c:really_probe() that runs the driver's
    .probe() callback directly if the bus type's one is not defined, so
    this change will remove one arbitrary difference between the PM core
    and the remaining parts of the driver core. Second, it will allow
    some subsystems, whose PM callbacks don't do anything except for
    executing driver callbacks, to be simplified quite a bit by removing
    those "forward-only" callbacks. Finally, it will allow us to remove
    one level of indirection in the system suspend and resume code paths
    where it is not necessary, which is going to lead to less debug noise
    with initcall_debug passed in the kernel command line (messages won't
    be printed for driverless devices whose subsystems don't provide
    PM callbacks among other things).

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Make the pm_op() and pm_noirq_op() functions return pointers to
    appropriate callbacks instead of executing those callbacks and
    returning their results.

    This change is required for a subsequent modification that will
    execute the corresponding driver callback if the subsystem
    callback returned by either pm_op(), or pm_noirq_op() is NULL.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

18 Dec, 2011

2 commits

  • After the change that removed the code related to runtime PM
    from __pm_generic_call() and __pm_generic_resume() these two
    functions need not be separate any more, so merge them.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The pm_runtime_suspended() check in __pm_generic_call() doesn't
    really help and may cause problems to happen, because in some cases
    the system suspend callbacks need to be called even if the given
    device has been suspended by runtime PM. For example, if the device
    generally supports remote wakeup and is not enabled to wake up
    the system from sleep, it should be prevented from generating wakeup
    signals during system suspend and that has to be done by the
    suspend callbacks that the pm_runtime_suspended() check prevents from
    being executed.

    Similarly, it may not be a good idea to unconditionally change
    the runtime PM status of the device to 'active' in
    __pm_generic_resume(), because the driver may want to leave the
    device in the 'suspended' state, depending on what happened to it
    before the system suspend and whether or not it is enabled to
    wake up the system.

    For the above reasons, remove the pm_runtime_suspended()
    check from __pm_generic_call() and remove the code changing the
    device's runtime PM status from __pm_generic_resume().

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

10 Dec, 2011

1 commit

  • Since systems are likely to have power domains that can't be turned off
    for various reasons at least temporarily while implementing power domain
    support provide a default governor which will always refuse to power off
    the domain, saving platforms having to implement their own.

    Since the code is so tiny don't bother with a Kconfig symbol for it.

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

    Mark Brown
     

09 Dec, 2011

1 commit

  • Commit d23b9b00cdde5c93b914a172cecd57d5625fcd04 (PM / Domains: Rework
    system suspend callback routines (v2)) broke the system suspend and
    resume handling by devices belonging to generic PM domains, because
    it used freeze/thaw callbacks instead of suspend/resume ones and
    didn't initialize device callbacks for system suspend/resume
    properly at all. Fix those problems.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

07 Dec, 2011

2 commits


02 Dec, 2011

7 commits

  • Measure the time of execution of the .stop(), .start(), .save_state()
    and .restore_state() PM domain device callbacks and if the result
    is greater than the corresponding latency value stored in the
    device's struct generic_pm_domain_data object, replace the inaccurate
    value with the measured time.

    Do analogously for the PM domains' .power_off() and .power_off()
    callbacks.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Add a function deciding whether or not a given PM domain should
    be powered off on the basis of the PM QoS constraints of devices
    belonging to it and their PM QoS timing data.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Add a function deciding whether or not devices should be stopped in
    pm_genpd_runtime_suspend() depending on their PM QoS constraints
    and stop/start timing values. Make it possible to add information
    used by this function to device objects.

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

    Rafael J. Wysocki
     
  • The current generic PM domains code attempts to use the generic
    system suspend operations along with the domains' device stop/start
    routines, which requires device drivers to assume that their
    system suspend/resume (and hibernation/restore) callbacks will always
    be used with generic PM domains. However, in theory, the same
    hardware may be used in devices that don't belong to any PM domain,
    in which case it would be necessary to add "fake" PM domains to
    satisfy the above assumption. Also, the domain the hardware belongs
    to may not be handled with the help of the generic code.

    To allow device drivers that may be used along with the generic PM
    domains code of more flexibility, add new device callbacks,
    .suspend(), .suspend_late(), .resume_early(), .resume(), .freeze(),
    .freeze_late(), .thaw_early(), and .thaw(), that can be supplied by
    the drivers in addition to their "standard" system suspend and
    hibernation callbacks. These new callbacks, if defined, will be used
    by the generic PM domains code for the handling of system suspend and
    hibernation instead of the "standard" ones. This will allow drivers
    to be designed to work with generic PM domains as well as without
    them.

    For backwards compatibility, introduce default implementations of the
    new callbacks for PM domains that will execute pm_generic_suspend(),
    pm_generic_suspend_noirq(), pm_generic_resume_noirq(),
    pm_generic_resume(), pm_generic_freeze(), pm_generic_freeze_noirq(),
    pm_generic_thaw_noirq(), and pm_generic_thaw(), respectively, for the
    given device if its driver doesn't define those callbacks.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The current PM domains code uses device drivers' .runtime_suspend()
    and .runtime_resume() callbacks as the "save device state" and
    "restore device state" operations, which may not be appropriate in
    general, because it forces drivers to assume that they always will
    be used with generic PM domains. However, in theory, the same
    hardware may be used in devices that don't belong to any PM
    domain, in which case it would be necessary to add "fake" PM
    domains to satisfy the above assumption. It also may be located in
    a PM domain that's not handled with the help of the generic code.

    To allow device drivers that may be used along with the generic PM
    domains code of more flexibility, introduce new device callbacks,
    .save_state() and .restore_state(), that can be supplied by the
    drivers in addition to their "standard" runtime PM callbacks. This
    will allow the drivers to be designed to work with generic PM domains
    as well as without them.

    For backwards compatibility, introduce default .save_state() and
    .restore_state() callback routines for PM domains that will execute
    a device driver's .runtime_suspend() and .runtime_resume() callbacks,
    respectively, for the given device if the driver doesn't provide its
    own implementations of .save_state() and .restore_state().

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The current generic PM domains code requires that the same .stop(),
    .start() and .active_wakeup() device callback routines be used for
    all devices in the given domain, which is inflexible and may not
    cover some specific use cases. For this reason, make it possible to
    use device specific .start()/.stop() and .active_wakeup() callback
    routines by adding corresponding callback pointers to struct
    generic_pm_domain_data. Add a new helper routine,
    pm_genpd_register_callbacks(), that can be used to populate
    the new per-device callback pointers.

    Modify the shmobile's power domains code to allow drivers to add
    their own code to be run during the device stop and start operations
    with the help of the new callback pointers.

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

    Rafael J. Wysocki
     
  • 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
     

24 Nov, 2011

2 commits


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
     

10 Nov, 2011

2 commits

  • Make dev_pm_qos_add_request() use WARN() in a better way and do not hardcode
    the function's name into the message (use __func__ instead).

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Rafael J. Wysocki

    Guennadi Liakhovetski
     
  • Refrain from running clk_disable() on clocks that
    have not been enabled. A typical case when this can
    happen is during Suspend-to-RAM for devices that have
    no driver associated with them. In such case the clock
    may be in default ACQUIRED state.

    Without this patch the sh7372 Mackerel board crashes
    in __clk_disable() during Suspend-to-RAM with:
    "Trying to disable clock 0xdeadbeef with 0 usecount"
    This happens for the CEU device which is added during
    boot. The test case has no CEU driver included in the
    kernel configuration. Needed for v3.2-rc1.

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

    Magnus Damm
     

09 Nov, 2011

1 commit

  • Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

    [The semantic patch that makes this change is available
    in scripts/coccinelle/api/err_cast.cocci.

    More information about semantic patching is available at
    http://coccinelle.lip6.fr/]

    Signed-off-by: Thomas Meyer
    Signed-off-by: Rafael J. Wysocki

    Thomas Meyer
     

07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

05 Nov, 2011

2 commits

  • Originally, the runtime PM core would send an idle notification
    whenever a suspend attempt failed. The idle callback routine could
    then schedule a delayed suspend for some time later.

    However this behavior was changed by commit
    f71648d73c1650b8b4aceb3856bebbde6daa3b86 (PM / Runtime: Remove idle
    notification after failing suspend). No notifications were sent, and
    there was no clear mechanism to retry failed suspends.

    This caused problems for the usbhid driver, because it fails
    autosuspend attempts as long as a key is being held down. Therefore
    this patch (as1492) adds a mechanism for retrying failed
    autosuspends. If the callback routine updates the last_busy field so
    that the next autosuspend expiration time is in the future, the
    autosuspend will automatically be rescheduled.

    Signed-off-by: Alan Stern
    Tested-by: Henrik Rydberg
    Cc:
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     
  • With delta type being int, its value is made zero
    for all values of now > 0x80000000.
    Hence fixing it.

    Signed-off-by: venu byravarasu
    Signed-off-by: Rafael J. Wysocki

    venu byravarasu
     

01 Nov, 2011

2 commits


22 Oct, 2011

3 commits

  • Since kfree() checks it its argument is not NULL, it is not necessary
    to duplicate this check in __pm_clk_remove().

    [rjw: Added the changelog.]

    Signed-off-by: Jonghwan Choi
    Signed-off-by: Rafael J. Wysocki

    Jonghwan Choi
     
  • * pm-domains:
    ARM: mach-shmobile: sh7372 A4R support (v4)
    ARM: mach-shmobile: sh7372 A3SP support (v4)
    PM / Sleep: Mark devices involved in wakeup signaling during suspend

    Rafael J. Wysocki
     
  • The generic PM domains code in drivers/base/power/domain.c has
    to avoid powering off domains that provide power to wakeup devices
    during system suspend. Currently, however, this only works for
    wakeup devices directly belonging to the given domain and not for
    their children (or the children of their children and so on).
    Thus, if there's a wakeup device whose parent belongs to a power
    domain handled by the generic PM domains code, the domain will be
    powered off during system suspend preventing the device from
    signaling wakeup.

    To address this problem introduce a device flag, power.wakeup_path,
    that will be set during system suspend for all wakeup devices,
    their parents, the parents of their parents and so on. This way,
    all wakeup paths in the device hierarchy will be marked and the
    generic PM domains code will only need to avoid powering off
    domains containing devices whose power.wakeup_path is set.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

17 Oct, 2011

5 commits

  • This patch (as1485) documents a change to the kernel's default wakeup
    policy. Devices that forward wakeup requests between buses should be
    enabled for wakeup by default.

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

    Alan Stern
     
  • Record S3 failure time about each reason and the latest two failed
    devices' names in S3 progress.
    We can check it through 'suspend_stats' entry in debugfs.

    The motivation of the patch:

    We are enabling power features on Medfield. Comparing with PC/notebook,
    a mobile enters/exits suspend-2-ram (we call it s3 on Medfield) far
    more frequently. If it can't enter suspend-2-ram in time, the power
    might be used up soon.

    We often find sometimes, a device suspend fails. Then, system retries
    s3 over and over again. As display is off, testers and developers
    don't know what happens.

    Some testers and developers complain they don't know if system
    tries suspend-2-ram, and what device fails to suspend. They need
    such info for a quick check. The patch adds suspend_stats under
    debugfs for users to check suspend to RAM statistics quickly.

    If not using this patch, we have other methods to get info about
    what device fails. One is to turn on CONFIG_PM_DEBUG, but users
    would get too much info and testers need recompile the system.

    In addition, dynamic debug is another good tool to dump debug info.
    But it still doesn't match our utilization scenario closely.
    1) user need write a user space parser to process the syslog output;
    2) Our testing scenario is we leave the mobile for at least hours.
    Then, check its status. No serial console available during the
    testing. One is because console would be suspended, and the other
    is serial console connecting with spi or HSU devices would consume
    power. These devices are powered off at suspend-2-ram.

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

    ShuoX Liu
     
  • * pm-runtime:
    PM / Runtime: Handle .runtime_suspend() failure correctly
    PM / Runtime: Fix kerneldoc comment for rpm_suspend()
    PM / Runtime: Update document about callbacks

    Rafael J. Wysocki
     
  • If .runtime_suspend() returns -EAGAIN or -EBUSY, the device should
    still be in ACTIVE state, so it is not necessary to send an idle
    notification to its parent. If .runtime_suspend() returns other
    fatal failure, it doesn't make sense to send idle notification to
    its parent.

    Skip parent idle notification when failure is returned from
    .runtime_suspend() and update comments in rpm_suspend() to reflect
    that change.

    [rjw: Modified the subject and changelog slightly.]

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

    Ming Lei
     
  • This patch fix kerneldoc comments for rpm_suspend():

    - 'Cancel a pending idle notification' should be put before, also
    should be changed to 'Cancel a pending idle notification,
    autosuspend or suspend'.

    - idle notification for the device after succeeding suspend has
    been removed, so update the comment accordingly.

    [rjw: Modified the subject and changelog slightly.]

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

    Ming Lei