1. 19 9月, 2012 1 次提交
  2. 07 9月, 2012 1 次提交
  3. 18 8月, 2012 1 次提交
    • T
      PM / Sleep: Print name of wakeup source that aborts suspend · a938da06
      Todd Poynor 提交于
      A driver or app may repeatedly request a wakeup source while the system
      is attempting to enter suspend, which may indicate a bug or at least
      point out a highly active system component that is responsible for
      decreased battery life on a mobile device.  Even when the incidence
      of suspend abort is not severe, identifying wakeup sources that
      frequently abort suspend can be a useful clue for power management
      analysis.
      
      In some cases the existing stats can point out the offender where there is
      an unexpectedly high activation count that stands out from the others, but
      in other cases the wakeup source frequently taken just after the rest of
      the system thinks its time to suspend might not stand out in the overall
      stats.
      
      It is also often useful to have information about what's been happening
      recently, rather than totals of all activity for the system boot.
      
      It's suggested to dump a line about which wakeup source
      aborted suspend to aid analysis of these situations.
      Signed-off-by: NTodd Poynor <toddpoynor@google.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      a938da06
  4. 09 8月, 2012 1 次提交
  5. 19 7月, 2012 3 次提交
  6. 13 7月, 2012 2 次提交
  7. 11 7月, 2012 3 次提交
    • S
      PM / Domains: Replace plain integer with NULL pointer in domain.c file · db79e53d
      Sachin Kamat 提交于
      Fixes the following sparse warning:
      drivers/base/power/domain.c:1679:55: warning: Using plain integer as NULL pointer
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      db79e53d
    • S
      PM / Domains: Add missing static storage class specifier in domain.c file · 8951ef02
      Sachin Kamat 提交于
      Fixes the folloiwng sparse warning:
      drivers/base/power/domain.c:149:5:
      warning: symbol '__pm_genpd_poweron' was not declared. Should it be static?
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8951ef02
    • P
      PM / cpuidle: System resume hang fix with cpuidle · 8651f97b
      Preeti U Murthy 提交于
      On certain bios, resume hangs if cpus are allowed to enter idle states
      during suspend [1].
      
      This was fixed in apci idle driver [2].But intel_idle driver does not
      have this fix. Thus instead of replicating the fix in both the idle
      drivers, or in more platform specific idle drivers if needed, the
      more general cpuidle infrastructure could handle this.
      
      A suspend callback in cpuidle_driver could handle this fix. But
      a cpuidle_driver provides only basic functionalities like platform idle
      state detection capability and mechanisms to support entry and exit
      into CPU idle states. All other cpuidle functions are found in the
      cpuidle generic infrastructure for good reason that all cpuidle
      drivers, irrepective of their platforms will support these functions.
      
      One option therefore would be to register a suspend callback in cpuidle
      which handles this fix. This could be called through a PM_SUSPEND_PREPARE
      notifier. But this is too generic a notfier for a driver to handle.
      
      Also, ideally the job of cpuidle is not to handle side effects of suspend.
      It should expose the interfaces which "handle cpuidle 'during' suspend"
      or any other operation, which the subsystems call during that respective
      operation.
      
      The fix demands that during suspend, no cpus should be allowed to enter
      deep C-states. The interface cpuidle_uninstall_idle_handler() in cpuidle
      ensures that. Not just that it also kicks all the cpus which are already
      in idle out of their idle states which was being done during cpu hotplug
      through a CPU_DYING_FROZEN callbacks.
      
      Now the question arises about when during suspend should
      cpuidle_uninstall_idle_handler() be called. Since we are dealing with
      drivers it seems best to call this function during dpm_suspend().
      Delaying the call till dpm_suspend_noirq() does no harm, as long as it is
      before cpu_hotplug_begin() to avoid race conditions with cpu hotpulg
      operations. In dpm_suspend_noirq(), it would be wise to place this call
      before suspend_device_irqs() to avoid ugly interactions with the same.
      
      Ananlogously, during resume.
      
      References:
      [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/674075.
      [2] http://marc.info/?l=linux-pm&m=133958534231884&w=2Reported-and-tested-by: NDave Hansen <dave@linux.vnet.ibm.com>
      Signed-off-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8651f97b
  8. 06 7月, 2012 2 次提交
    • R
      PM / Domains: Allow device callbacks to be added at any time · 62d44902
      Rafael J. Wysocki 提交于
      Make it possible to modify device callbacks used by the generic PM
      domains core code at any time, not only after the device has been
      added to a domain.  This will allow device drivers to provide their
      own device PM domain callbacks even if they are registered before
      adding the devices to PM domains.
      
      For this purpose, use the observation that the struct
      generic_pm_domain_data object containing the relevant callback
      pointers may be allocated by pm_genpd_add_callbacks() and the
      callbacks may be set before __pm_genpd_add_device() is run for
      the given device.  This object will then be used by
      __pm_genpd_add_device(), but it has to be protected from
      premature removal by reference counting.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      62d44902
    • R
      PM / Domains: Add device domain data reference counter · 1d5fcfec
      Rafael J. Wysocki 提交于
      Add a mechanism for counting references to the
      struct generic_pm_domain_data object pointed to by
      dev->power.subsys_data->domain_data if the device in question
      belongs to a generic PM domain.
      
      This change is necessary for a subsequent patch making it possible to
      allocate that object from within pm_genpd_add_callbacks(), so that
      drivers can attach their PM domain device callbacks to devices before
      those devices are added to PM domains.
      
      This patch has been tested on the SH7372 Mackerel board.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      1d5fcfec
  9. 04 7月, 2012 1 次提交
    • R
      PM / Domains: Add preliminary support for cpuidle, v2 · cbc9ef02
      Rafael J. Wysocki 提交于
      On some systems there are CPU cores located in the same power
      domains as I/O devices.  Then, power can only be removed from the
      domain if all I/O devices in it are not in use and the CPU core
      is idle.  Add preliminary support for that to the generic PM domains
      framework.
      
      First, the platform is expected to provide a cpuidle driver with one
      extra state designated for use with the generic PM domains code.
      This state should be initially disabled and its exit_latency value
      should be set to whatever time is needed to bring up the CPU core
      itself after restoring power to it, not including the domain's
      power on latency.  Its .enter() callback should point to a procedure
      that will remove power from the domain containing the CPU core at
      the end of the CPU power transition.
      
      The remaining characteristics of the extra cpuidle state, referred to
      as the "domain" cpuidle state below, (e.g. power usage, target
      residency) should be populated in accordance with the properties of
      the hardware.
      
      Next, the platform should execute genpd_attach_cpuidle() on the PM
      domain containing the CPU core.  That will cause the generic PM
      domains framework to treat that domain in a special way such that:
      
       * When all devices in the domain have been suspended and it is about
         to be turned off, the states of the devices will be saved, but
         power will not be removed from the domain.  Instead, the "domain"
         cpuidle state will be enabled so that power can be removed from
         the domain when the CPU core is idle and the state has been chosen
         as the target by the cpuidle governor.
      
       * When the first I/O device in the domain is resumed and
         __pm_genpd_poweron(() is called for the first time after
         power has been removed from the domain, the "domain" cpuidle
         state will be disabled to avoid subsequent surprise power removals
         via cpuidle.
      
      The effective exit_latency value of the "domain" cpuidle state
      depends on the time needed to bring up the CPU core itself after
      restoring power to it as well as on the power on latency of the
      domain containing the CPU core.  Thus the "domain" cpuidle state's
      exit_latency has to be recomputed every time the domain's power on
      latency is updated, which may happen every time power is restored
      to the domain, if the measured power on latency is greater than
      the latency stored in the corresponding generic_pm_domain structure.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      cbc9ef02
  10. 01 7月, 2012 4 次提交
    • R
      PM / Domains: Do not stop devices after restoring their states · 80de3d7f
      Rafael J. Wysocki 提交于
      While resuming a device belonging to a PM domain,
      pm_genpd_runtime_resume() calls __pm_genpd_restore_device() to
      restore its state, if necessary.  The latter starts the device,
      using genpd_start_dev(), restores its state, using
      genpd_restore_dev(), and then stops it, using genpd_stop_dev().
      However, this last operation is not necessary, because the
      device is supposed to be operational after pm_genpd_runtime_resume()
      has returned and because of it pm_genpd_runtime_resume() has to
      call genpd_start_dev() once again for the "restored" device, which
      is inefficient.
      
      To make things more efficient, remove the call to genpd_stop_dev()
      from __pm_genpd_restore_device() and the direct call to
      genpd_start_dev() from pm_genpd_runtime_resume().  [Of course,
      genpd_start_dev() still has to be called by it for devices with the
      power.irq_safe flag set, because __pm_genpd_restore_device() is not
      executed for them.]
      
      This change has been tested on the SH7372 Mackerel board.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      80de3d7f
    • R
      PM / Domains: Use subsystem runtime suspend/resume callbacks by default · 0b589741
      Rafael J. Wysocki 提交于
      Currently, the default "save state" and "restore state" routines
      for generic PM domains, pm_genpd_default_save_state() and
      pm_genpd_default_restore_state(), respectively, only use runtime PM
      callbacks provided by device drivers, but in general those callbacks
      need not provide the entire necessary functionality.  Namely, in
      general it may be necessary to execute subsystem (i.e. device type,
      device class or bus type) callbacks that will carry out all of the
      necessary operations.
      
      For this reason, modify pm_genpd_default_save_state() and
      pm_genpd_default_restore_state() to execute subsystem callbacks,
      if they are provided, and fall back to driver callbacks otherwise.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0b589741
    • R
      PM / Sleep: Separate printing suspend times from initcall_debug · b2df1d4f
      Rafael J. Wysocki 提交于
      Change the behavior of the newly introduced
      /sys/power/pm_print_times attribute so that its initial value
      depends on initcall_debug, but setting it to 0 will cause device
      suspend/resume times not to be printed, even if initcall_debug has
      been set.  This way, the people who use initcall_debug for reasons
      other than PM debugging will be able to switch the suspend/resume
      times printing off, if need be.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2df1d4f
    • S
      PM / Sleep: add knob for printing device resume times · 4b7760ba
      Sameer Nanda 提交于
      Added a new knob called /sys/power/pm_print_times. Setting it to 1
      enables printing of time taken by devices to suspend and resume.
      Setting it to 0 disables this printing (unless overridden by
      initcall_debug kernel command line option).
      Signed-off-by: NSameer Nanda <snanda@chromium.org>
      Acked-by: NGreg KH <gregkh@linuxfoundation.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4b7760ba
  11. 25 6月, 2012 1 次提交
  12. 19 5月, 2012 1 次提交
    • R
      PM / Domains: Make it possible to add devices to inactive domains · ca1d72f0
      Rafael J. Wysocki 提交于
      The generic PM domains core code currently requires domains to be in
      the "power on" state for adding devices to them, but this limitation
      turns out to be inconvenient in some situations, so remove it.
      
      For this purpose, make __pm_genpd_add_device() set the device's
      need_restore flag if the domain is in the "power off" state, so that
      the device's "restore state" (usually .runtime_resume()) callback
      is executed when it is resumed after the domain has been turned on.
      If the domain is in the "power on" state, the device's need_restore
      flag will be cleared by __pm_genpd_add_device(), so that its "save
      state" (usually .runtime_suspend()) callback is executed when the
      domain is about to be turned off.  However, since that default
      behavior need not be always desirable, add a helper function
      pm_genpd_dev_need_restore() allowing a device's need_restore flag
      to be set/unset at any time.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ca1d72f0
  13. 12 5月, 2012 2 次提交
    • R
      PM / Domains: Fix computation of maximum domain off time · b723b0eb
      Rafael J. Wysocki 提交于
      The default domain power off governor function for generic PM
      domains, default_power_down_ok(), may violate subdomain maximum
      off time limit by allowing the master domain to be off for too
      long.  Namely, it only finds the minium of all device maximum
      off times over the domain's devices and uses that to compute the
      domain's maximum off time, but it should do the same for the
      subdomains.
      
      Fix this problem by modifying default_power_down_ok() to compute
      the given domain's maximum off time as the difference between the
      minimum off time over all devices and subdomains in the domain and
      its power on latency.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b723b0eb
    • H
      PM / Domains: Fix link checking when add subdomain · 4fcac10d
      Huang Ying 提交于
      Current pm_genpd_add_subdomain() will allow duplicated link between
      master and slave domain.  This patch fixed it.
      
      Because when current pm_genpd_add_subdomain() checks whether the link
      between the master and slave generic PM domain already exists,
      slave_links instead of master_links of master domain is used.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4fcac10d
  14. 06 5月, 2012 2 次提交
    • R
      PM / Domains: Cache device stop and domain power off governor results, v3 · 6ff7bb0d
      Rafael J. Wysocki 提交于
      The results of the default device stop and domain power off governor
      functions for generic PM domains, default_stop_ok() and
      default_power_down_ok(), depend only on the timing data of devices,
      which are static, and on their PM QoS constraints.  Thus, in theory,
      these functions only need to carry out their computations, which may
      be time consuming in general, when it is known that the PM QoS
      constraint of at least one of the devices in question has changed.
      
      Use the PM QoS notifiers of devices to implement that.  First,
      introduce new fields, constraint_changed and max_off_time_changed,
      into struct gpd_timing_data and struct generic_pm_domain,
      respectively, and register a PM QoS notifier function when adding
      a device into a domain that will set those fields to 'true' whenever
      the device's PM QoS constraint is modified.  Second, make
      default_stop_ok() and default_power_down_ok() use those fields to
      decide whether or not to carry out their computations from scratch.
      
      The device and PM domain hierarchies are taken into account in that
      and the expense is that the changes of PM QoS constraints of
      suspended devices will not be taken into account immediately, which
      isn't guaranteed anyway in general.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6ff7bb0d
    • R
      PM / Domains: Make device removal more straightforward · efa69025
      Rafael J. Wysocki 提交于
      The removal of a device from a PM domain doesn't have to browse
      the domain's device list, because it can check directly if the
      device belongs to the given domain.  Moreover, it should clear
      the domain_data pointer in dev->power.subsys_data, because
      dev_pm_put_subsys_data(dev) may not remove dev->power.subsys_data
      and the stale domain data pointer may cause problems to happen.
      
      Rework pm_genpd_remove_device() taking the above observations into
      account.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      efa69025
  15. 02 5月, 2012 11 次提交
    • R
      PM / QoS: Create device constraints objects on notifier registration · 23e0fc5a
      Rafael J. Wysocki 提交于
      The current behavior of dev_pm_qos_add_notifier() makes device PM QoS
      notifiers less than useful.  Namely, it silently returns success when
      called before any PM QoS constraints are added for the device, so the
      caller will assume that the notifier has been registered, but when
      someone actually adds some nontrivial constraints for the device
      eventually, the previous callers of dev_pm_qos_add_notifier()
      will not know about that and their notifier routines will not be
      executed (contrary to their expectations).
      
      To address this problem make dev_pm_qos_add_notifier() create the
      constraints object for the device if it is not present when the
      routine is called.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by : markgross <markgross@thegnar.org>
      23e0fc5a
    • R
      PM / Runtime: Remove device fields related to suspend time, v2 · 76e267d8
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      76e267d8
    • R
      PM / Domains: Rework default domain power off governor function, v2 · dd8683e9
      Rafael J. Wysocki 提交于
      The existing default domain power down governor function for PM
      domains, default_power_down_ok(), is supposed to check whether or not
      the PM QoS latency constraints of the devices in the domain will be
      violated if the domain is turned off by pm_genpd_poweroff().
      However, the computations carried out by it don't reflect the
      definition of the PM QoS latency constrait in
      Documentation/ABI/testing/sysfs-devices-power.
      
      Make default_power_down_ok() follow the definition of the PM QoS
      latency constrait.  In particular, make it only take latencies into
      account, because it doesn't matter how much time has elapsed since
      the domain's devices were suspended for the computation.
      
      Remove the break_even_ns and power_off_time fields from
      struct generic_pm_domain, because they are not necessary any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      dd8683e9
    • R
      PM / Domains: Rework default device stop governor function, v2 · a5bef810
      Rafael J. Wysocki 提交于
      The existing default device stop governor function for PM domains,
      default_stop_ok(), is supposed to check whether or not the device's
      PM QoS latency constraint will be violated if the device is stopped
      by pm_genpd_runtime_suspend().  However, the computations carried out
      by it don't reflect the definition of the PM QoS latency constrait in
      Documentation/ABI/testing/sysfs-devices-power.
      
      Make default_stop_ok() follow the definition of the PM QoS latency
      constrait.  In particular, make it take the device's start and stop
      latencies correctly.
      
      Add a new field, effective_constraint_ns, to struct gpd_timing_data
      and use it to store the difference between the device's PM QoS
      constraint and its resume latency for use by the device's parent
      (the effective_constraint_ns values for the children are used for
      computing the parent's one along with its PM QoS constraint).
      
      Remove the break_even_ns field from struct gpd_timing_data, because
      it's not used any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      a5bef810
    • R
      PM / Sleep: Add user space interface for manipulating wakeup sources, v3 · b86ff982
      Rafael J. Wysocki 提交于
      Android allows user space to manipulate wakelocks using two
      sysfs file located in /sys/power/, wake_lock and wake_unlock.
      Writing a wakelock name and optionally a timeout to the wake_lock
      file causes the wakelock whose name was written to be acquired (it
      is created before is necessary), optionally with the given timeout.
      Writing the name of a wakelock to wake_unlock causes that wakelock
      to be released.
      
      Implement an analogous interface for user space using wakeup sources.
      Add the /sys/power/wake_lock and /sys/power/wake_unlock files
      allowing user space to create, activate and deactivate wakeup
      sources, such that writing a name and optionally a timeout to
      wake_lock causes the wakeup source of that name to be activated,
      optionally with the given timeout.  If that wakeup source doesn't
      exist, it will be created and then activated.  Writing a name to
      wake_unlock causes the wakeup source of that name, if there is one,
      to be deactivated.  Wakeup sources created with the help of
      wake_lock that haven't been used for more than 5 minutes are garbage
      collected and destroyed.  Moreover, there can be only WL_NUMBER_LIMIT
      wakeup sources created with the help of wake_lock present at a time.
      
      The data type used to track wakeup sources created by user space is
      called "struct wakelock" to indicate the origins of this feature.
      
      This version of the patch includes an rbtree manipulation fix from John Stultz.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NNeilBrown <neilb@suse.de>
      b86ff982
    • R
      PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources · 55850945
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55850945
    • R
      PM / Sleep: Implement opportunistic sleep, v2 · 7483b4a4
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NNeilBrown <neilb@suse.de>
      7483b4a4
    • A
      PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints · 6791e36c
      Arve Hjønnevåg 提交于
      Add tracepoints to wakeup_source_activate and wakeup_source_deactivate.
      Useful for checking that specific wakeup sources overlap as expected.
      Signed-off-by: NArve Hjønnevåg <arve@android.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6791e36c
    • R
      PM / Sleep: Change wakeup source statistics to follow Android · 30e3ce6d
      Rafael J. Wysocki 提交于
      Wakeup statistics used by Android are slightly different from what we
      have in wakeup sources at the moment and there aren't any known
      users of those statistics other than Android, so modify them to make
      it easier for Android to switch to wakeup sources.
      
      This removes the struct wakeup_source's hit_cout field, which is very
      rough and therefore not very useful, and adds two new fields,
      wakeup_count and expire_count.  The first one tracks how many times
      the wakeup source is activated with events_check_enabled set (which
      roughly corresponds to the situations when a system power transition
      to a sleep state is in progress and would be aborted by this wakeup
      source if it were the only active one at that time) and the second
      one is the number of times the wakeup source has been activated with
      a timeout that expired.
      
      Additionally, the last_time field is now updated when the wakeup
      source is deactivated too (previously it was only updated during
      the wakeup source's activation), which seems to be what Android does
      with the analogous counter for wakelocks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30e3ce6d
    • R
      PM / Sleep: Use wait queue to signal "no wakeup events in progress" · 60af1066
      Rafael J. Wysocki 提交于
      The current wakeup source deactivation code doesn't do anything when
      the counter of wakeup events in progress goes down to zero, which
      requires pm_get_wakeup_count() to poll that counter periodically.
      Although this reduces the average time it takes to deactivate a
      wakeup source, it also may lead to a substantial amount of unnecessary
      polling if there are extended periods of wakeup activity.  Thus it
      seems reasonable to use a wait queue for signaling the "no wakeup
      events in progress" condition and remove the polling.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: Nmark gross <markgross@thegnar.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      60af1066
    • R
      PM / Sleep: Look for wakeup events in later stages of device suspend · 52d136cc
      Rafael J. Wysocki 提交于
      Currently, the device suspend code in drivers/base/power/main.c
      only checks if there have been any wakeup events, and therefore the
      ongoing system transition to a sleep state should be aborted, during
      the first (i.e. "suspend") device suspend phase.  However, wakeup
      events may be reported later as well, so it's reasonable to look for
      them in the in the subsequent (i.e. "late suspend" and "suspend
      noirq") phases.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52d136cc
  16. 27 3月, 2012 1 次提交
    • A
      PM / Runtime: don't forget to wake up waitqueue on failure · f2791d73
      Alan Stern 提交于
      This patch (as1535) fixes a bug in the runtime PM core.  When a
      runtime suspend attempt completes, whether successfully or not, the
      device's power.wait_queue is supposed to be signalled.  But this
      doesn't happen in the failure pathway of rpm_suspend() when another
      autosuspend attempt is rescheduled.  As a result, a task can get stuck
      indefinitely on the wait queue (I have seen this happen in testing).
      
      The patch fixes the problem by moving the wake_up_all() call up near
      the start of the failure code.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      f2791d73
  17. 19 3月, 2012 1 次提交
  18. 17 3月, 2012 2 次提交
    • R
      PM / Domains: Introduce "always on" device flag · 1e78a0c7
      Rafael J. Wysocki 提交于
      The TMU device on the Mackerel board belongs to the A4R power domain
      and loses power when the domain is turned off.  Unfortunately, the
      TMU driver is not prepared to cope with such situations and crashes
      the system when that happens.  To work around this problem introduce
      a new helper function, pm_genpd_dev_always_on(), allowing a device
      driver to mark its device as "always on" in case it belongs to a PM
      domain, which will make the generic PM domains core code avoid
      powering off the domain containing the device, both at run time and
      during system suspend.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NSimon Horman <horms@verge.net.au>
      Acked-by: NPaul Mundt <lethal@linux-sh.org>
      Cc: stable@vger.kernel.org
      1e78a0c7
    • R
      PM / Domains: Fix hibernation restore of devices, v2 · 65533bbf
      Rafael J. Wysocki 提交于
      During resume from hibernation pm_genpd_restore_noirq() should only
      power off domains whose suspend_power_off flags are set once and
      not every time it is called for a device in the given domain.
      Moreover, it shouldn't decrement genpd->suspended_count, because
      that field is not touched during device freezing and therefore it is
      always equal to 0 when pm_genpd_restore_noirq() runs for the first
      device in the given domain.
      
      This means pm_genpd_restore_noirq() may use genpd->suspended_count
      to determine whether or not it it has been called for the domain in
      question already in this cycle (it only needs to increment that
      field every time it runs for this purpose) and whether or not it
      should check if the domain needs to be powered off.  For that to
      work, though, pm_genpd_prepare() has to clear genpd->suspended_count
      when it runs for the first device in the given domain (in which case
      that flag need not be cleared during domain initialization).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@vger.kernel.org
      65533bbf