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
     

08 Oct, 2011

4 commits

  • * pm-devfreq:
    PM / devfreq: Add basic governors
    PM / devfreq: Add common sysfs interfaces
    PM: Introduce devfreq: generic DVFS framework with device-specific OPPs
    PM / OPP: Add OPP availability change notifier.

    Rafael J. Wysocki
     
  • * pm-qos:
    PM / QoS: Update Documentation for the pm_qos and dev_pm_qos frameworks
    PM / QoS: Add function dev_pm_qos_read_value() (v3)
    PM QoS: Add global notification mechanism for device constraints
    PM QoS: Implement per-device PM QoS constraints
    PM QoS: Generalize and export constraints management code
    PM QoS: Reorganize data structs
    PM QoS: Code reorganization
    PM QoS: Minor clean-ups
    PM QoS: Move and rename the implementation files

    Rafael J. Wysocki
     
  • * pm-domains:
    PM / Domains: Split device PM domain data into base and need_restore
    ARM: mach-shmobile: sh7372 sleep warning fixes
    ARM: mach-shmobile: sh7372 A3SM support
    ARM: mach-shmobile: sh7372 generic suspend/resume support
    PM / Domains: Preliminary support for devices with power.irq_safe set
    PM: Move clock-related definitions and headers to separate file
    PM / Domains: Use power.sybsys_data to reduce overhead
    PM: Reference counting of power.subsys_data
    PM: Introduce struct pm_subsys_data
    ARM / shmobile: Make A3RV be a subdomain of A4LC on SH7372
    PM / Domains: Rename argument of pm_genpd_add_subdomain()
    PM / Domains: Rename GPD_STATE_WAIT_PARENT to GPD_STATE_WAIT_MASTER
    PM / Domains: Allow generic PM domains to have multiple masters
    PM / Domains: Add "wait for parent" status for generic PM domains
    PM / Domains: Make pm_genpd_poweron() always survive parent removal
    PM / Domains: Do not take parent locks to modify subdomain counters
    PM / Domains: Implement subdomain counters as atomic fields

    Rafael J. Wysocki
     
  • * pm-runtime:
    PM / Tracing: build rpm-traces.c only if CONFIG_PM_RUNTIME is set
    PM / Runtime: Replace dev_dbg() with trace_rpm_*()
    PM / Runtime: Introduce trace points for tracing rpm_* functions
    PM / Runtime: Don't run callbacks under lock for power.irq_safe set
    USB: Add wakeup info to debugging messages
    PM / Runtime: pm_runtime_idle() can be called in atomic context
    PM / Runtime: Add macro to test for runtime PM events
    PM / Runtime: Add might_sleep() to runtime PM functions

    Rafael J. Wysocki
     

05 Oct, 2011

1 commit

  • To read the current PM QoS value for a given device we need to
    make sure that the device's power.constraints object won't be
    removed while we're doing that. For this reason, put the
    operation under dev->power.lock and acquire the lock
    around the initialization and removal of power.constraints.

    Moreover, since we're using the value of power.constraints to
    determine whether or not the object is present, the
    power.constraints_state field isn't necessary any more and may be
    removed. However, dev_pm_qos_add_request() needs to check if the
    device is being removed from the system before allocating a new
    PM QoS constraints object for it, so make it use the
    power.power_state field of struct device for this purpose.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

01 Oct, 2011

1 commit

  • The patch enables to register notifier_block for an OPP-device in order
    to get notified for any changes in the availability of OPPs of the
    device. For example, if a new OPP is inserted or enable/disable status
    of an OPP is changed, the notifier is executed.

    This enables the usage of opp_add, opp_enable, and opp_disable to
    directly take effect with any connected entities such as cpufreq or
    devfreq.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Reviewed-by: Mike Turquette
    Reviewed-by: Kevin Hilman
    Signed-off-by: Rafael J. Wysocki

    MyungJoo Ham
     

28 Sep, 2011

2 commits

  • This patch replaces dev_dbg with trace_rpm_* inside
    the three important functions:

    rpm_idle
    rpm_suspend
    rpm_resume

    Trace points have the below advantages compared with dev_dbg:

    - trace points include much runtime information(such as
    running cpu, current task, ...)

    - most of linux distributions may disable "verbose debug"
    driver debug compile switch, so it is very difficult to
    report/debug runtime pm related problems from distribution
    users without this kind of debug information.

    - for upstream kernel users, enableing the debug switch will
    produce many useless "rpm_resume" output, and it is very noise.

    - dev_dbg inside rpm_suspend/rpm_resume may have some effects
    on runtime pm behaviour of console devicer

    Signed-off-by: Ming Lei
    Acked-by: Steven Rostedt
    Signed-off-by: Rafael J. Wysocki

    Ming Lei
     
  • The rpm_suspend() and rpm_resume() routines execute subsystem or PM
    domain callbacks under power.lock if power.irq_safe is set for the
    given device. This is inconsistent with that rpm_idle() does after
    commit 02b2677 (PM / Runtime: Allow _put_sync() from
    interrupts-disabled context) and is problematic for subsystems and PM
    domains wanting to use power.lock for synchronization in their
    runtime PM callbacks.

    This change requires the code checking if the device's runtime PM
    status is RPM_SUSPENDING or RPM_RESUMING to be modified too, to take
    the power.irq_safe set case into account (that code wasn't reachable
    before with power.irq_safe set, because it's executed with the
    device's power.lock held).

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

    Rafael J. Wysocki
     

27 Sep, 2011

3 commits

  • The struct pm_domain_data data type is defined in such a way that
    adding new fields specific to the generic PM domains code will
    require include/linux/pm.h to be modified. As a result, data types
    used only by the generic PM domains code will be defined in two
    headers, although they all should be defined in pm_domain.h and
    pm.h will need to include more headers, which won't be very nice.

    For this reason change the definition of struct pm_subsys_data
    so that its domain_data member is a pointer, which will allow
    struct pm_domain_data to be subclassed by various PM domains
    implementations. Remove the need_restore member from
    struct pm_domain_data and make the generic PM domains code
    subclass it by adding the need_restore member to the new data type.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Merge commit e8b364b88cc4001b21c28c1ecf1e1e3ffbe162e6
    (PM / Clocks: Do not acquire a mutex under a spinlock) fixing
    a regression in drivers/base/power/clock_ops.c.

    Conflicts:
    drivers/base/power/clock_ops.c

    Rafael J. Wysocki
     
  • Commit b7ab83e (PM: Use spinlock instead of mutex in clock
    management functions) introduced a regression causing clocks_mutex
    to be acquired under a spinlock. This happens because
    pm_clk_suspend() and pm_clk_resume() call pm_clk_acquire() under
    pcd->lock, but pm_clk_acquire() executes clk_get() which causes
    clocks_mutex to be acquired. Similarly, __pm_clk_remove(),
    executed under pcd->lock, calls clk_put(), which also causes
    clocks_mutex to be acquired.

    To fix those problems make pm_clk_add() call pm_clk_acquire(), so
    that pm_clk_suspend() and pm_clk_resume() don't have to do that.
    Change pm_clk_remove() and pm_clk_destroy() to separate
    modifications of the pcd->clock_list list from the actual removal of
    PM clock entry objects done by __pm_clk_remove().

    Reported-and-tested-by: Guennadi Liakhovetski
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Russell King

    Rafael J. Wysocki
     

25 Aug, 2011

12 commits

  • The generic PM domains framework currently doesn't work with devices
    whose power.irq_safe flag is set, because runtime PM callbacks for
    such devices are run with interrupts disabled and the callbacks
    provided by the generic PM domains framework use domain mutexes
    and may sleep. However, such devices very well may belong to
    power domains on some systems, so the generic PM domains framework
    should take them into account.

    For this reason, modify the generic PM domains framework so that the
    domain .power_off() and .power_on() callbacks are never executed for
    a domain containing devices with power.irq_safe set, although the
    .stop_device() and .start_device() callbacks are still run for them.

    Additionally, introduce a flag allowing the creator of a
    struct generic_pm_domain object to indicate that its .stop_device()
    and .start_device() callbacks may be run in interrupt context
    (might_sleep_if() triggers if that flag is not set and one of those
    callbacks is run in interrupt context).

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Add a global notification chain that gets called upon changes to the
    aggregated constraint value for any device.
    The notification callbacks are passing the full constraint request data
    in order for the callees to have access to it. The current use is for the
    platform low-level code to access the target device of the constraint.

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

    Jean Pihet
     
  • Implement the per-device PM QoS constraints by creating a device
    PM QoS API, which calls the PM QoS constraints management core code.

    The per-device latency constraints data strctures are stored
    in the device dev_pm_info struct.

    The device PM code calls the init and destroy of the per-device constraints
    data struct in order to support the dynamic insertion and removal of the
    devices in the system.

    To minimize the data usage by the per-device constraints, the data struct
    is only allocated at the first call to dev_pm_qos_add_request.
    The data is later free'd when the device is removed from the system.
    A global mutex protects the constraints users from the data being
    allocated and free'd.

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

    Jean Pihet
     
  • 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
     
  • Since the power.subsys_data device field will be used by multiple
    filesystems, introduce a reference counting mechanism for it to avoid
    freeing it prematurely or changing its value at a wrong time.

    Make the PM clocks management code that currently is the only user of
    power.subsys_data use the new reference counting.

    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
     
  • Change the name of the second argument of pm_genpd_add_subdomain()
    so that it is (a) shorter and (b) in agreement with the name of
    the second argument of pm_genpd_add_subdomain().

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Since it is now possible for a PM domain to have multiple masters
    instead of one parent, rename the "wait for parent" status to reflect
    the new situation.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Currently, for a given generic PM domain there may be only one parent
    domain (i.e. a PM domain it depends on). However, there is at least
    one real-life case in which there should be two parents (masters) for
    one PM domain (the A3RV domain on SH7372 turns out to depend on the
    A4LC domain and it depends on the A4R domain and the same time). For
    this reason, allow a PM domain to have multiple parents (masters) by
    introducing objects representing links between PM domains.

    The (logical) links between PM domains represent relationships in
    which one domain is a master (i.e. it is depended on) and another
    domain is a slave (i.e. it depends on the master) with the rule that
    the slave cannot be powered on if the master is not powered on and
    the master cannot be powered off if the slave is not powered off.
    Each struct generic_pm_domain object representing a PM domain has
    two lists of links, a list of links in which it is a master and
    a list of links in which it is a slave. The first of these lists
    replaces the list of subdomains and the second one is used in place
    of the parent pointer.

    Each link is represented by struct gpd_link object containing
    pointers to the master and the slave and two struct list_head
    members allowing it to hook into two lists (the master's list
    of "master" links and the slave's list of "slave" links). This
    allows the code to get to the link from each side (either from
    the master or from the slave) and follow it in each direction.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The next patch will make it possible for a generic PM domain to have
    multiple parents (i.e. multiple PM domains it depends on). To
    prepare for that change it is necessary to change pm_genpd_poweron()
    so that it doesn't jump to the start label after running itself
    recursively for the parent domain. For this purpose, introduce a new
    PM domain status value GPD_STATE_WAIT_PARENT that will be set by
    pm_genpd_poweron() before calling itself recursively for the parent
    domain and modify the code in drivers/base/power/domain.c so that
    the GPD_STATE_WAIT_PARENT status is guaranteed to be preserved during
    the execution of pm_genpd_poweron() for the parent.

    This change also causes pm_genpd_add_subdomain() and
    pm_genpd_remove_subdomain() to wait for started pm_genpd_poweron() to
    complete and allows pm_genpd_runtime_resume() to avoid dropping the
    lock after powering on the PM domain.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • If pm_genpd_remove_subdomain() is called to remove a PM domain's
    subdomain and pm_genpd_poweron() is called for that subdomain at
    the same time, and the pm_genpd_poweron() called by it recursively
    for the parent returns an error, the first pm_genpd_poweron()'s
    error code path will attempt to decrement the subdomain counter of
    a PM domain that it's not a subdomain of any more.

    Rearrange the code in pm_genpd_poweron() to prevent this from
    happening.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki