15 Jul, 2013

1 commit

  • Prevent automatic system suspend from happening during system
    shutdown by making try_to_suspend() check system_state and return
    immediately if it is not SYSTEM_RUNNING.

    This prevents the following breakage from happening (scenario from
    Zhang Yanmin):

    Kernel starts shutdown and calls all device driver's shutdown
    callback. When a driver's shutdown is called, the last wakelock is
    released and suspend-to-ram starts. However, as some driver's shut
    down callbacks already shut down devices and disabled runtime pm,
    the suspend-to-ram calls driver's suspend callback without noticing
    that device is already off and causes crash.

    [rjw: Changelog]
    Signed-off-by: Liu ShuoX
    Cc: 3.5+
    Signed-off-by: Rafael J. Wysocki

    Liu ShuoX
     

26 Jan, 2013

1 commit


02 May, 2012

2 commits

  • Android uses one wakelock statistics that is only necessary for
    opportunistic sleep. Namely, the prevent_suspend_time field
    accumulates the total time the given wakelock has been locked
    while "automatic suspend" was enabled. Add an analogous field,
    prevent_sleep_time, to wakeup sources and make it behave in a similar
    way.

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

    Rafael J. Wysocki
     
  • Introduce a mechanism by which the kernel can trigger global
    transitions to a sleep state chosen by user space if there are no
    active wakeup sources.

    It consists of a new sysfs attribute, /sys/power/autosleep, that
    can be written one of the strings returned by reads from
    /sys/power/state, an ordered workqueue and a work item carrying out
    the "suspend" operations. If a string representing the system's
    sleep state is written to /sys/power/autosleep, the work item
    triggering transitions to that state is queued up and it requeues
    itself after every execution until user space writes "off" to
    /sys/power/autosleep.

    That work item enables the detection of wakeup events using the
    functions already defined in drivers/base/power/wakeup.c (with one
    small modification) and calls either pm_suspend(), or hibernate() to
    put the system into a sleep state. If a wakeup event is reported
    while the transition is in progress, it will abort the transition and
    the "system suspend" work item will be queued up again.

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

    Rafael J. Wysocki