Merge branches 'pm-sleep' and 'pm-runtime'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 18 Jun 2015 23:18:02 +0000 (01:18 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 18 Jun 2015 23:18:02 +0000 (01:18 +0200)
* pm-sleep:
  PM / sleep: trace_device_pm_callback coverage in dpm_prepare/complete
  PM / wakeup: add a dummy wakeup_source to record statistics
  PM / sleep: Make suspend-to-idle-specific code depend on CONFIG_SUSPEND
  PM / sleep: Return -EBUSY from suspend_enter() on wakeup detection
  PM / tick: Add tracepoints for suspend-to-idle diagnostics
  PM / sleep: Fix symbol name in a comment in kernel/power/main.c
  leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger
  ARM: omap-device: use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS
  bus: omap_l3_noc: add missed callbacks for suspend-to-disk
  PM / sleep: Add macro to define common noirq system PM callbacks
  PM / sleep: Refine diagnostic messages in enter_state()
  PM / wakeup: validate wakeup source before activating it.

* pm-runtime:
  PM / Runtime: Update last_busy in rpm_resume
  PM / runtime: add note about re-calling in during device probe()

1  2  3 
drivers/bus/omap_l3_noc.c
drivers/cpuidle/cpuidle.c
include/linux/cpuidle.h

index ebee57d715d2314df6b3ab0bff60cde656691a93,6ae38848719e69c55a8aa3c6c78263ea91e2eb91,ebee57d715d2314df6b3ab0bff60cde656691a93..5012e3ad12256f952616a2dcca95e91a4783ac62
@@@@ -1,7 -1,7 -1,7 +1,7 @@@@
   /*
    * OMAP L3 Interconnect error handling driver
    *
 -  * Copyright (C) 2011-2014 Texas Instruments Incorporated - http://www.ti.com/
 +  * Copyright (C) 2011-2015 Texas Instruments Incorporated - http://www.ti.com/
    *   Santosh Shilimkar <santosh.shilimkar@ti.com>
    *   Sricharan <r.sricharan@ti.com>
    *
@@@@ -233,8 -233,7 -233,8 +233,8 @@@@ static irqreturn_t l3_interrupt_handler
   }
   
   static const struct of_device_id l3_noc_match[] = {
 -      {.compatible = "ti,omap4-l3-noc", .data = &omap_l3_data},
 +      {.compatible = "ti,omap4-l3-noc", .data = &omap4_l3_data},
 +      {.compatible = "ti,omap5-l3-noc", .data = &omap5_l3_data},
        {.compatible = "ti,dra7-l3-noc", .data = &dra_l3_data},
        {.compatible = "ti,am4372-l3-noc", .data = &am4372_l3_data},
        {},
@@@@ -301,7 -300,7 -301,7 +301,7 @@@@ static int omap_l3_probe(struct platfor
        return ret;
   }
   
- -#ifdef       CONFIG_PM
+ +#ifdef       CONFIG_PM_SLEEP
   
   /**
    * l3_resume_noirq() - resume function for l3_noc
@@@@ -347,7 -346,7 -347,7 +347,7 @@@@ static int l3_resume_noirq(struct devic
   }
   
   static const struct dev_pm_ops l3_dev_pm_ops = {
- -     .resume_noirq           = l3_resume_noirq,
+ +     SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, l3_resume_noirq)
   };
   
   #define L3_DEV_PM_OPS (&l3_dev_pm_ops)
index 7f1b8f507a56de62f2fdbfbd1b081de2ef66acb7,71459f54614520cc1cd76405e5025139f9dad325,61c417b9e53f8795175b29d71dfd201f15be151c..e8e2775c3821e26dc179ea6e300025d0cf6e75e5
@@@@ -65,7 -65,7 -65,7 +65,7 @@@@ int cpuidle_play_dead(void
                return -ENODEV;
   
        /* Find lowest-power state that supports long-term idle */
 --     for (i = drv->state_count - 1; i >= CPUIDLE_DRIVER_STATE_START; i--)
 ++     for (i = drv->state_count - 1; i >= 0; i--)
                if (drv->states[i].enter_dead)
                        return drv->states[i].enter_dead(dev, i);
   
   }
   
   static int find_deepest_state(struct cpuidle_driver *drv,
 --                           struct cpuidle_device *dev, bool freeze)
 ++                           struct cpuidle_device *dev,
 ++                           unsigned int max_latency,
 ++                           unsigned int forbidden_flags,
 ++                           bool freeze)
   {
        unsigned int latency_req = 0;
 --     int i, ret = freeze ? -1 : CPUIDLE_DRIVER_STATE_START - 1;
 ++     int i, ret = -ENXIO;
   
 --     for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
 ++     for (i = 0; i < drv->state_count; i++) {
                struct cpuidle_state *s = &drv->states[i];
                struct cpuidle_state_usage *su = &dev->states_usage[i];
   
                if (s->disabled || su->disable || s->exit_latency <= latency_req
 ++                 || s->exit_latency > max_latency
 ++                 || (s->flags & forbidden_flags)
                    || (freeze && !s->enter_freeze))
                        continue;
   
        return ret;
   }
   
+ +#ifdef CONFIG_SUSPEND
   /**
    * cpuidle_find_deepest_state - Find the deepest available idle state.
    * @drv: cpuidle driver for the given CPU.
   int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
                               struct cpuidle_device *dev)
   {
 --     return find_deepest_state(drv, dev, false);
 ++     return find_deepest_state(drv, dev, UINT_MAX, 0, false);
   }
   
   static void enter_freeze_proper(struct cpuidle_driver *drv,
@@@@ -144,18 -140,19 -139,18 +145,19 @@@@ int cpuidle_enter_freeze(struct cpuidle
         * that interrupts won't be enabled when it exits and allows the tick to
         * be frozen safely.
         */
 --     index = find_deepest_state(drv, dev, true);
 ++     index = find_deepest_state(drv, dev, UINT_MAX, 0, true);
        if (index >= 0)
                enter_freeze_proper(drv, dev, index);
   
        return index;
   }
+ +#endif /* CONFIG_SUSPEND */
   
   /**
    * cpuidle_enter_state - enter the state and update stats
    * @dev: cpuidle device for this cpu
    * @drv: cpuidle driver for this cpu
 -- * @next_state: index into drv->states of the state to enter
 ++ * @index: index into the states table in @drv of the state to enter
    */
   int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
                        int index)
         * local timer will be shut down.  If a local timer is used from another
         * CPU as a broadcast timer, this call may fail if it is not available.
         */
 --     if (broadcast && tick_broadcast_enter())
 --             return -EBUSY;
 ++     if (broadcast && tick_broadcast_enter()) {
 ++             index = find_deepest_state(drv, dev, target_state->exit_latency,
 ++                                        CPUIDLE_FLAG_TIMER_STOP, false);
 ++             if (index < 0) {
 ++                     default_idle_call();
 ++                     return -EBUSY;
 ++             }
 ++             target_state = &drv->states[index];
 ++     }
 ++
 ++     /* Take note of the planned idle state. */
 ++     sched_idle_set_state(target_state);
   
        trace_cpu_idle_rcuidle(index, dev->cpu);
        time_start = ktime_get();
        time_end = ktime_get();
        trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
   
 ++     /* The cpu is no longer idle or about to enter idle. */
 ++     sched_idle_set_state(NULL);
 ++
        if (broadcast) {
                if (WARN_ON_ONCE(!irqs_disabled()))
                        local_irq_disable();
@@@@ -267,7 -251,7 -249,7 +269,7 @@@@ int cpuidle_enter(struct cpuidle_drive
    */
   void cpuidle_reflect(struct cpuidle_device *dev, int index)
   {
 --     if (cpuidle_curr_governor->reflect)
 ++     if (cpuidle_curr_governor->reflect && index >= 0)
                cpuidle_curr_governor->reflect(dev, index);
   }
   
diff --combined include/linux/cpuidle.h
index c7a63643658e8c8dc243b0f04d7b9925e5c25a19,13ee266ca98c5262d8ab004eba53ae222f231c98,9c5e892547961544eae22a53669ba600e5ad4973..d075d34279df3dbde3fadb6317ae403e9955f414
@@@@ -151,10 -151,6 -151,10 +151,6 @@@@ extern void cpuidle_resume(void)
   extern int cpuidle_enable_device(struct cpuidle_device *dev);
   extern void cpuidle_disable_device(struct cpuidle_device *dev);
   extern int cpuidle_play_dead(void);
- -extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
- -                                   struct cpuidle_device *dev);
- -extern int cpuidle_enter_freeze(struct cpuidle_driver *drv,
- -                             struct cpuidle_device *dev);
   
   extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
   #else
@@@@ -190,20 -186,24 -190,16 +186,28 @@@@ static inline int cpuidle_enable_device
   {return -ENODEV; }
   static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
   static inline int cpuidle_play_dead(void) {return -ENODEV; }
+ +static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
+ +     struct cpuidle_device *dev) {return NULL; }
+ +#endif
+ +
+ +#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND)
+ +extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
+ +                                   struct cpuidle_device *dev);
+ +extern int cpuidle_enter_freeze(struct cpuidle_driver *drv,
+ +                             struct cpuidle_device *dev);
+ +#else
   static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
                                             struct cpuidle_device *dev)
   {return -ENODEV; }
   static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv,
                                       struct cpuidle_device *dev)
   {return -ENODEV; }
- -static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
- -     struct cpuidle_device *dev) {return NULL; }
   #endif
   
 ++/* kernel/sched/idle.c */
 ++extern void sched_idle_set_state(struct cpuidle_state *idle_state);
 ++extern void default_idle_call(void);
 ++
   #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
   void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a);
   #else