Merge tag 'pm+acpi-3.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes and new device IDs from Rafael Wysocki:

- Fix for a cpufreq regression causing stale sysfs files to be left
behind during system resume if cpufreq_add_dev() fails for one or
more CPUs from Viresh Kumar.

- Fix for a bug in cpufreq causing CONFIG_CPU_FREQ_DEFAULT_* to be
ignored when the intel_pstate driver is used from Jason Baron.

- System suspend fix for a memory leak in pm_vt_switch_unregister()
that forgot to release objects after removing them from
pm_vt_switch_list. From Masami Ichikawa.

- Intel Valley View device ID and energy unit encoding update for the
(recently added) Intel RAPL (Running Average Power Limit) driver from
Jacob Pan.

- Intel Bay Trail SoC GPIO and ACPI device IDs for the Low Power
Subsystem (LPSS) ACPI driver from Paul Drews.

* tag 'pm+acpi-3.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
powercap / RAPL: add support for ValleyView Soc
PM / sleep: Fix memory leak in pm_vt_switch_unregister().
cpufreq: Use CONFIG_CPU_FREQ_DEFAULT_* to set initial policy for setpolicy drivers
cpufreq: remove sysfs files for CPUs which failed to come back after resume
ACPI: Add BayTrail SoC GPIO and LPSS ACPI IDs

Changed files
+51 -34
drivers
acpi
cpufreq
pinctrl
powercap
kernel
power
+1
drivers/acpi/acpi_lpss.c
··· 162 { "80860F14", (unsigned long)&byt_sdio_dev_desc }, 163 { "80860F41", (unsigned long)&byt_i2c_dev_desc }, 164 { "INT33B2", }, 165 166 { "INT3430", (unsigned long)&lpt_dev_desc }, 167 { "INT3431", (unsigned long)&lpt_dev_desc },
··· 162 { "80860F14", (unsigned long)&byt_sdio_dev_desc }, 163 { "80860F41", (unsigned long)&byt_i2c_dev_desc }, 164 { "INT33B2", }, 165 + { "INT33FC", }, 166 167 { "INT3430", (unsigned long)&lpt_dev_desc }, 168 { "INT3431", (unsigned long)&lpt_dev_desc },
+37 -32
drivers/cpufreq/cpufreq.c
··· 828 int ret = 0; 829 830 memcpy(&new_policy, policy, sizeof(*policy)); 831 /* assure that the starting sequence is run in cpufreq_set_policy */ 832 policy->governor = NULL; 833 ··· 851 852 #ifdef CONFIG_HOTPLUG_CPU 853 static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, 854 - unsigned int cpu, struct device *dev, 855 - bool frozen) 856 { 857 int ret = 0; 858 unsigned long flags; ··· 882 } 883 } 884 885 - /* Don't touch sysfs links during light-weight init */ 886 - if (!frozen) 887 - ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); 888 - 889 - return ret; 890 } 891 #endif 892 ··· 925 kfree(policy); 926 927 return NULL; 928 } 929 930 static void cpufreq_policy_free(struct cpufreq_policy *policy) ··· 1008 list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) { 1009 if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) { 1010 read_unlock_irqrestore(&cpufreq_driver_lock, flags); 1011 - ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen); 1012 up_read(&cpufreq_rwsem); 1013 return ret; 1014 } ··· 1118 if (cpufreq_driver->exit) 1119 cpufreq_driver->exit(policy); 1120 err_set_policy_cpu: 1121 cpufreq_policy_free(policy); 1122 nomem_out: 1123 up_read(&cpufreq_rwsem); 1124 ··· 1143 } 1144 1145 static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, 1146 - unsigned int old_cpu, bool frozen) 1147 { 1148 struct device *cpu_dev; 1149 int ret; 1150 1151 /* first sibling now owns the new sysfs dir */ 1152 cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu)); 1153 - 1154 - /* Don't touch sysfs files during light-weight tear-down */ 1155 - if (frozen) 1156 - return cpu_dev->id; 1157 1158 sysfs_remove_link(&cpu_dev->kobj, "cpufreq"); 1159 ret = kobject_move(&policy->kobj, &cpu_dev->kobj); ··· 1217 if (!frozen) 1218 sysfs_remove_link(&dev->kobj, "cpufreq"); 1219 } else if (cpus > 1) { 1220 - new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen); 1221 if (new_cpu >= 0) { 1222 update_policy_cpu(policy, new_cpu); 1223 ··· 1239 int ret; 1240 unsigned long flags; 1241 struct cpufreq_policy *policy; 1242 - struct kobject *kobj; 1243 - struct completion *cmp; 1244 1245 read_lock_irqsave(&cpufreq_driver_lock, flags); 1246 policy = per_cpu(cpufreq_cpu_data, cpu); ··· 1268 } 1269 } 1270 1271 - if (!frozen) { 1272 - down_read(&policy->rwsem); 1273 - kobj = &policy->kobj; 1274 - cmp = &policy->kobj_unregister; 1275 - up_read(&policy->rwsem); 1276 - kobject_put(kobj); 1277 - 1278 - /* 1279 - * We need to make sure that the underlying kobj is 1280 - * actually not referenced anymore by anybody before we 1281 - * proceed with unloading. 1282 - */ 1283 - pr_debug("waiting for dropping of refcount\n"); 1284 - wait_for_completion(cmp); 1285 - pr_debug("wait complete\n"); 1286 - } 1287 1288 /* 1289 * Perform the ->exit() even during light-weight tear-down,
··· 828 int ret = 0; 829 830 memcpy(&new_policy, policy, sizeof(*policy)); 831 + 832 + /* Use the default policy if its valid. */ 833 + if (cpufreq_driver->setpolicy) 834 + cpufreq_parse_governor(policy->governor->name, 835 + &new_policy.policy, NULL); 836 + 837 /* assure that the starting sequence is run in cpufreq_set_policy */ 838 policy->governor = NULL; 839 ··· 845 846 #ifdef CONFIG_HOTPLUG_CPU 847 static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, 848 + unsigned int cpu, struct device *dev) 849 { 850 int ret = 0; 851 unsigned long flags; ··· 877 } 878 } 879 880 + return sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); 881 } 882 #endif 883 ··· 924 kfree(policy); 925 926 return NULL; 927 + } 928 + 929 + static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) 930 + { 931 + struct kobject *kobj; 932 + struct completion *cmp; 933 + 934 + down_read(&policy->rwsem); 935 + kobj = &policy->kobj; 936 + cmp = &policy->kobj_unregister; 937 + up_read(&policy->rwsem); 938 + kobject_put(kobj); 939 + 940 + /* 941 + * We need to make sure that the underlying kobj is 942 + * actually not referenced anymore by anybody before we 943 + * proceed with unloading. 944 + */ 945 + pr_debug("waiting for dropping of refcount\n"); 946 + wait_for_completion(cmp); 947 + pr_debug("wait complete\n"); 948 } 949 950 static void cpufreq_policy_free(struct cpufreq_policy *policy) ··· 986 list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) { 987 if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) { 988 read_unlock_irqrestore(&cpufreq_driver_lock, flags); 989 + ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev); 990 up_read(&cpufreq_rwsem); 991 return ret; 992 } ··· 1096 if (cpufreq_driver->exit) 1097 cpufreq_driver->exit(policy); 1098 err_set_policy_cpu: 1099 + if (frozen) 1100 + cpufreq_policy_put_kobj(policy); 1101 cpufreq_policy_free(policy); 1102 + 1103 nomem_out: 1104 up_read(&cpufreq_rwsem); 1105 ··· 1118 } 1119 1120 static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, 1121 + unsigned int old_cpu) 1122 { 1123 struct device *cpu_dev; 1124 int ret; 1125 1126 /* first sibling now owns the new sysfs dir */ 1127 cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu)); 1128 1129 sysfs_remove_link(&cpu_dev->kobj, "cpufreq"); 1130 ret = kobject_move(&policy->kobj, &cpu_dev->kobj); ··· 1196 if (!frozen) 1197 sysfs_remove_link(&dev->kobj, "cpufreq"); 1198 } else if (cpus > 1) { 1199 + new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); 1200 if (new_cpu >= 0) { 1201 update_policy_cpu(policy, new_cpu); 1202 ··· 1218 int ret; 1219 unsigned long flags; 1220 struct cpufreq_policy *policy; 1221 1222 read_lock_irqsave(&cpufreq_driver_lock, flags); 1223 policy = per_cpu(cpufreq_cpu_data, cpu); ··· 1249 } 1250 } 1251 1252 + if (!frozen) 1253 + cpufreq_policy_put_kobj(policy); 1254 1255 /* 1256 * Perform the ->exit() even during light-weight tear-down,
+1
drivers/pinctrl/pinctrl-baytrail.c
··· 512 513 static const struct acpi_device_id byt_gpio_acpi_match[] = { 514 { "INT33B2", 0 }, 515 { } 516 }; 517 MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
··· 512 513 static const struct acpi_device_id byt_gpio_acpi_match[] = { 514 { "INT33B2", 0 }, 515 + { "INT33FC", 0 }, 516 { } 517 }; 518 MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
+11 -2
drivers/powercap/intel_rapl.c
··· 833 return 0; 834 } 835 836 static int rapl_check_unit(struct rapl_package *rp, int cpu) 837 { 838 u64 msr_val; ··· 858 * time unit: 1/time_unit_divisor Seconds 859 */ 860 value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET; 861 - rp->energy_unit_divisor = 1 << value; 862 - 863 864 value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET; 865 rp->power_unit_divisor = 1 << value; ··· 949 static const struct x86_cpu_id rapl_ids[] = { 950 { X86_VENDOR_INTEL, 6, 0x2a},/* SNB */ 951 { X86_VENDOR_INTEL, 6, 0x2d},/* SNB EP */ 952 { X86_VENDOR_INTEL, 6, 0x3a},/* IVB */ 953 { X86_VENDOR_INTEL, 6, 0x45},/* HSW */ 954 /* TODO: Add more CPU IDs after testing */
··· 833 return 0; 834 } 835 836 + static const struct x86_cpu_id energy_unit_quirk_ids[] = { 837 + { X86_VENDOR_INTEL, 6, 0x37},/* VLV */ 838 + {} 839 + }; 840 + 841 static int rapl_check_unit(struct rapl_package *rp, int cpu) 842 { 843 u64 msr_val; ··· 853 * time unit: 1/time_unit_divisor Seconds 854 */ 855 value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET; 856 + /* some CPUs have different way to calculate energy unit */ 857 + if (x86_match_cpu(energy_unit_quirk_ids)) 858 + rp->energy_unit_divisor = 1000000 / (1 << value); 859 + else 860 + rp->energy_unit_divisor = 1 << value; 861 862 value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET; 863 rp->power_unit_divisor = 1 << value; ··· 941 static const struct x86_cpu_id rapl_ids[] = { 942 { X86_VENDOR_INTEL, 6, 0x2a},/* SNB */ 943 { X86_VENDOR_INTEL, 6, 0x2d},/* SNB EP */ 944 + { X86_VENDOR_INTEL, 6, 0x37},/* VLV */ 945 { X86_VENDOR_INTEL, 6, 0x3a},/* IVB */ 946 { X86_VENDOR_INTEL, 6, 0x45},/* HSW */ 947 /* TODO: Add more CPU IDs after testing */
+1
kernel/power/console.c
··· 81 list_for_each_entry(tmp, &pm_vt_switch_list, head) { 82 if (tmp->dev == dev) { 83 list_del(&tmp->head); 84 break; 85 } 86 }
··· 81 list_for_each_entry(tmp, &pm_vt_switch_list, head) { 82 if (tmp->dev == dev) { 83 list_del(&tmp->head); 84 + kfree(tmp); 85 break; 86 } 87 }