Merge tag 'pm-for-3.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Oct 2012 01:32:35 +0000 (18:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Oct 2012 01:32:35 +0000 (18:32 -0700)
Pull power management updates from Rafael J Wysocki:

 - Improved system suspend/resume and runtime PM handling for the SH
   TMU, CMT and MTU2 clock event devices (also used by ARM/shmobile).

 - Generic PM domains framework extensions related to cpuidle support
   and domain objects lookup using names.

 - ARM/shmobile power management updates including improved support for
   the SH7372's A4S power domain containing the CPU core.

 - cpufreq changes related to AMD CPUs support from Matthew Garrett,
   Andre Przywara and Borislav Petkov.

 - cpu0 cpufreq driver from Shawn Guo.

 - cpufreq governor fixes related to the relaxing of limit from Michal
   Pecio.

 - OMAP cpufreq updates from Axel Lin and Richard Zhao.

 - cpuidle ladder governor fixes related to the disabling of states from
   Carsten Emde and me.

 - Runtime PM core updates related to the interactions with the system
   suspend core from Alan Stern and Kevin Hilman.

 - Wakeup sources modification allowing more helper functions to be
   called from interrupt context from John Stultz and additional
   diagnostic code from Todd Poynor.

 - System suspend error code path fix from Feng Hong.

Fixed up conflicts in cpufreq/powernow-k8 that stemmed from the
workqueue fixes conflicting fairly badly with the removal of support for
hardware P-state chips.  The changes were independent but somewhat
intertwined.

* tag 'pm-for-3.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (76 commits)
  Revert "PM QoS: Use spinlock in the per-device PM QoS constraints code"
  PM / Runtime: let rpm_resume() succeed if RPM_ACTIVE, even when disabled, v2
  cpuidle: rename function name "__cpuidle_register_driver", v2
  cpufreq: OMAP: Check IS_ERR() instead of NULL for omap_device_get_by_hwmod_name
  cpuidle: remove some empty lines
  PM: Prevent runtime suspend during system resume
  PM QoS: Use spinlock in the per-device PM QoS constraints code
  PM / Sleep: use resume event when call dpm_resume_early
  cpuidle / ACPI : move cpuidle_device field out of the acpi_processor_power structure
  ACPI / processor: remove pointless variable initialization
  ACPI / processor: remove unused function parameter
  cpufreq: OMAP: remove loops_per_jiffy recalculate for smp
  sections: fix section conflicts in drivers/cpufreq
  cpufreq: conservative: update frequency when limits are relaxed
  cpufreq / ondemand: update frequency when limits are relaxed
  properly __init-annotate pm_sysrq_init()
  cpufreq: Add a generic cpufreq-cpu0 driver
  PM / OPP: Initialize OPP table from device tree
  ARM: add cpufreq transiton notifier to adjust loops_per_jiffy for smp
  cpufreq: Remove support for hardware P-state chips from powernow-k8
  ...

17 files changed:
1  2 
arch/arm/kernel/smp.c
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-armadillo800eva.c
arch/arm/mach-shmobile/board-mackerel.c
arch/arm/mach-shmobile/include/mach/common.h
arch/arm/mach-shmobile/include/mach/r8a7779.h
arch/arm/mach-shmobile/pm-rmobile.c
arch/arm/mach-shmobile/pm-sh7372.c
drivers/base/platform.c
drivers/base/power/main.c
drivers/cpufreq/cpufreq_conservative.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/cpufreq/powernow-k8.c
drivers/pci/pci-driver.c
include/linux/device.h
include/linux/pm.h
kernel/time/timekeeping.c

index aa4ffe6e5ecfbd9a8feeedf1c002ca50861ae541,8e03567c958354b030da70a27a9db1d01e335757..dea7a925c7e249375a86c9c943302a926c865433
  #include <linux/percpu.h>
  #include <linux/clockchips.h>
  #include <linux/completion.h>
+ #include <linux/cpufreq.h>
  
  #include <linux/atomic.h>
 +#include <asm/smp.h>
  #include <asm/cacheflush.h>
  #include <asm/cpu.h>
  #include <asm/cputype.h>
index bc3b5da59e256ffd050ee6bbfb9168fcc5f6cb22,264340a60f65ca9584de004d361525d8cd303027..790dc68c431250a8ae7021bf622102826471ba16
@@@ -1226,11 -1224,20 +1226,20 @@@ static struct i2c_board_info i2c1_devic
  };
  
  
 -#define GPIO_PORT9CR  0xE6051009
 -#define GPIO_PORT10CR 0xE605100A
 -#define USCCR1                0xE6058144
 +#define GPIO_PORT9CR  IOMEM(0xE6051009)
 +#define GPIO_PORT10CR IOMEM(0xE605100A)
 +#define USCCR1                IOMEM(0xE6058144)
  static void __init ap4evb_init(void)
  {
+       struct pm_domain_device domain_devices[] = {
+               { "A4LC", &lcdc1_device, },
+               { "A4LC", &lcdc_device, },
+               { "A4MP", &fsi_device, },
+               { "A3SP", &sh_mmcif_device, },
+               { "A3SP", &sdhi0_device, },
+               { "A3SP", &sdhi1_device, },
+               { "A4R", &ceu_device, },
+       };
        u32 srcr4;
        struct clk *clk;
  
index 62783b5d881389d405653ba9ea2550e2b6252e0a,c76776a3e70da10aaf2027537f5630b020c3f505..0c27c810cf99d0906b655f298091ffab257644fc
@@@ -1404,14 -1402,30 +1404,30 @@@ static struct i2c_board_info i2c1_devic
        },
  };
  
 -#define GPIO_PORT9CR  0xE6051009
 -#define GPIO_PORT10CR 0xE605100A
 -#define GPIO_PORT167CR        0xE60520A7
 -#define GPIO_PORT168CR        0xE60520A8
 -#define SRCR4         0xe61580bc
 -#define USCCR1                0xE6058144
 +#define GPIO_PORT9CR  IOMEM(0xE6051009)
 +#define GPIO_PORT10CR IOMEM(0xE605100A)
 +#define GPIO_PORT167CR        IOMEM(0xE60520A7)
 +#define GPIO_PORT168CR        IOMEM(0xE60520A8)
 +#define SRCR4         IOMEM(0xe61580bc)
 +#define USCCR1                IOMEM(0xE6058144)
  static void __init mackerel_init(void)
  {
+       struct pm_domain_device domain_devices[] = {
+               { "A4LC", &lcdc_device, },
+               { "A4LC", &hdmi_lcdc_device, },
+               { "A4LC", &meram_device, },
+               { "A4MP", &fsi_device, },
+               { "A3SP", &usbhs0_device, },
+               { "A3SP", &usbhs1_device, },
+               { "A3SP", &nand_flash_device, },
+               { "A3SP", &sh_mmcif_device, },
+               { "A3SP", &sdhi0_device, },
+ #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
+               { "A3SP", &sdhi1_device, },
+ #endif
+               { "A3SP", &sdhi2_device, },
+               { "A4R", &ceu_device, },
+       };
        u32 srcr4;
        struct clk *clk;
  
index f80f9c549393e14e1c5c35673ab0707d7c641eed,eb89293fff4d36068a7fc3baf305bd7010209799..ed77ab8c91437c5bfc1cae270351b0bd06a253d6
@@@ -73,10 -81,13 +75,8 @@@ extern void r8a7779_pinmux_init(void)
  extern void r8a7779_pm_init(void);
  extern void r8a7740_meram_workaround(void);
  
 -extern unsigned int r8a7779_get_core_count(void);
 -extern int r8a7779_platform_cpu_kill(unsigned int cpu);
 -extern void r8a7779_secondary_init(unsigned int cpu);
 -extern int r8a7779_boot_secondary(unsigned int cpu);
 -extern void r8a7779_smp_prepare_cpus(void);
  extern void r8a7779_register_twd(void);
  
- extern void shmobile_init_late(void);
  #ifdef CONFIG_SUSPEND
  int shmobile_suspend_init(void);
  #else
@@@ -89,15 -100,10 +89,21 @@@ int shmobile_cpuidle_init(void)
  static inline int shmobile_cpuidle_init(void) { return 0; }
  #endif
  
 +extern void shmobile_cpu_die(unsigned int cpu);
 +extern int shmobile_cpu_disable(unsigned int cpu);
 +
 +#ifdef CONFIG_HOTPLUG_CPU
 +extern int shmobile_cpu_is_dead(unsigned int cpu);
 +#else
 +static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; }
 +#endif
 +
 +extern void shmobile_smp_init_cpus(unsigned int ncores);
 +
+ static inline void shmobile_init_late(void)
+ {
+       shmobile_suspend_init();
+       shmobile_cpuidle_init();
+ }
  #endif /* __ARCH_MACH_COMMON_H */
index f504c5e81b476a8647c2659a1847e30c9d31a9bf,7ad47977d2e7ba15e1b0674b0b96c292e050dd3d..499f52d2a4a193acbcf659af657aed58d7e27ffb
@@@ -347,19 -347,9 +347,11 @@@ extern int r8a7779_sysc_power_down(stru
  extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch);
  
  #ifdef CONFIG_PM
- extern struct r8a7779_pm_domain r8a7779_sh4a;
- extern struct r8a7779_pm_domain r8a7779_sgx;
- extern struct r8a7779_pm_domain r8a7779_vdp1;
- extern struct r8a7779_pm_domain r8a7779_impx3;
- extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd);
- extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd,
-                                       struct platform_device *pdev);
+ extern void __init r8a7779_init_pm_domains(void);
  #else
- #define r8a7779_init_pm_domain(pd) do { } while (0)
- #define r8a7779_add_device_to_domain(pd, pdev) do { } while (0)
+ static inline void r8a7779_init_pm_domains(void) {}
  #endif /* CONFIG_PM */
  
 +extern struct smp_operations r8a7779_smp_ops;
 +
  #endif /* __ASM_R8A7779_H__ */
Simple merge
Simple merge
index ddeca142293ccbe378f5b5c207465f4e1f5e3056,d51514b79efedc4ad446e5ce6dd87a8ee9d2fb6d..8727e9c5eea47dd78170e091635f31d29fc7cb52
  #include <linux/err.h>
  #include <linux/slab.h>
  #include <linux/pm_runtime.h>
 +#include <linux/idr.h>
  
  #include "base.h"
+ #include "power/power.h"
  
 +/* For automatically allocated device IDs */
 +static DEFINE_IDA(platform_devid_ida);
 +
  #define to_platform_driver(drv)       (container_of((drv), struct platform_driver, \
                                 driver))
  
Simple merge
Simple merge
index 1a40935c85fdcc1f21e976ad8dbd5298a87d6060,0b19faf002eeb30d44c28e56b57a8a907814989d..129e80bfff22e1d399fbe5320012f5721de1bcaf
@@@ -1104,52 -978,11 +977,18 @@@ static int transition_frequency_fidvid(
        return res;
  }
  
- /* Take a frequency, and issue the hardware pstate transition command */
- static int transition_frequency_pstate(struct powernow_k8_data *data,
-               unsigned int index)
- {
-       u32 pstate = 0;
-       int res, i;
-       struct cpufreq_freqs freqs;
-       pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index);
-       /* get MSR index for hardware pstate transition */
-       pstate = index & HW_PSTATE_MASK;
-       if (pstate > data->max_hw_pstate)
-               return -EINVAL;
-       freqs.old = find_khz_freq_from_pstate(data->powernow_table,
-                       data->currpstate);
-       freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
-       for_each_cpu(i, data->available_cores) {
-               freqs.cpu = i;
-               cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-       }
-       res = transition_pstate(data, pstate);
-       freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
-       for_each_cpu(i, data->available_cores) {
-               freqs.cpu = i;
-               cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-       }
-       return res;
- }
 -/* Driver entry point to switch to the target frequency */
 -static int powernowk8_target(struct cpufreq_policy *pol,
 -              unsigned targfreq, unsigned relation)
 +struct powernowk8_target_arg {
 +      struct cpufreq_policy           *pol;
 +      unsigned                        targfreq;
 +      unsigned                        relation;
 +};
 +
 +static long powernowk8_target_fn(void *arg)
  {
 -      cpumask_var_t oldmask;
 +      struct powernowk8_target_arg *pta = arg;
 +      struct cpufreq_policy *pol = pta->pol;
 +      unsigned targfreq = pta->targfreq;
 +      unsigned relation = pta->relation;
        struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
        u32 checkfid;
        u32 checkvid;
                pol->cpu, targfreq, pol->min, pol->max, relation);
  
        if (query_current_values_with_pending_wait(data))
 -              goto err_out;
 +              return -EIO;
  
-       if (cpu_family != CPU_HW_PSTATE) {
-               pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
-               data->currfid, data->currvid);
+       pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
+                data->currfid, data->currvid);
  
-               if ((checkvid != data->currvid) ||
-                   (checkfid != data->currfid)) {
-                       printk(KERN_INFO PFX
-                               "error - out of sync, fix 0x%x 0x%x, "
-                               "vid 0x%x 0x%x\n",
-                               checkfid, data->currfid,
-                               checkvid, data->currvid);
-               }
+       if ((checkvid != data->currvid) ||
+           (checkfid != data->currfid)) {
+               pr_info(PFX
+                      "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
+                      checkfid, data->currfid,
+                      checkvid, data->currvid);
        }
  
        if (cpufreq_frequency_table_target(pol, data->powernow_table,
  
        powernow_k8_acpi_pst_values(data, newstate);
  
-       if (cpu_family == CPU_HW_PSTATE)
-               ret = transition_frequency_pstate(data,
-                       data->powernow_table[newstate].index);
-       else
-               ret = transition_frequency_fidvid(data, newstate);
+       ret = transition_frequency_fidvid(data, newstate);
        if (ret) {
                printk(KERN_ERR PFX "transition frequency failed\n");
 -              ret = 1;
                mutex_unlock(&fidvid_mutex);
 -              goto err_out;
 +              return 1;
        }
        mutex_unlock(&fidvid_mutex);
  
-       if (cpu_family == CPU_HW_PSTATE)
-               pol->cur = find_khz_freq_from_pstate(data->powernow_table,
-                               data->powernow_table[newstate].index);
-       else
-               pol->cur = find_khz_freq_from_fid(data->currfid);
+       pol->cur = find_khz_freq_from_fid(data->currfid);
 -      ret = 0;
  
 -err_out:
 -      set_cpus_allowed_ptr(current, oldmask);
 -      free_cpumask_var(oldmask);
 -      return ret;
 +      return 0;
 +}
 +
 +/* Driver entry point to switch to the target frequency */
 +static int powernowk8_target(struct cpufreq_policy *pol,
 +              unsigned targfreq, unsigned relation)
 +{
 +      struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq,
 +                                           .relation = relation };
 +
 +      /*
 +       * Must run on @pol->cpu.  cpufreq core is responsible for ensuring
 +       * that we're bound to the current CPU and pol->cpu stays online.
 +       */
 +      if (smp_processor_id() == pol->cpu)
 +              return powernowk8_target_fn(&pta);
 +      else
 +              return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
  }
  
  /* Driver entry point to verify the policy and range of frequencies */
Simple merge
Simple merge
Simple merge
Simple merge