History

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

Linus Torvalds committed 12 years ago

Commit bddffa22 parents f41bfc9 bfde19c5 files · +51 −34Browse files

Unified · Split

5 files
  1. drivers/acpi/acpi_lpss.c +1 −0
  2. drivers/cpufreq/cpufreq.c +37 −32
  3. drivers/pinctrl/pinctrl-baytrail.c +1 −0
  4. drivers/powercap/intel_rapl.c +11 −2
  5. kernel/power/console.c +1 −0
drivers/acpi/acpi_lpss.c+1−0
@@ -162,6 +162,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { · 161 unmodified lines
162162 { "80860F14", (unsigned long)&byt_sdio_dev_desc },
163163 { "80860F41", (unsigned long)&byt_i2c_dev_desc },
164164 { "INT33B2", },
165+ { "INT33FC", },
165166
166167 { "INT3430", (unsigned long)&lpt_dev_desc },
167168 { "INT3431", (unsigned long)&lpt_dev_desc },
drivers/cpufreq/cpufreq.c+37−32
@@ -828,6 +828,12 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) · 827 unmodified lines
828828 int ret = 0;
829829
830830 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+
831837 /* assure that the starting sequence is run in cpufreq_set_policy */
832838 policy->governor = NULL;
833839
@@ -845,8 +851,7 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) · 11 unmodified lines
845851
846852 #ifdef CONFIG_HOTPLUG_CPU
847853 static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy,
848− unsigned int cpu, struct device *dev,
849− bool frozen)
854+ unsigned int cpu, struct device *dev)
850855 {
851856 int ret = 0;
852857 unsigned long flags;
@@ -877,11 +882,7 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, · 24 unmodified lines
877882 }
878883 }
879884
880− /* Don't touch sysfs links during light-weight init */
881− if (!frozen)
882− ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
883−
884− return ret;
885+ return sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
885886 }
886887 #endif
887888
@@ -926,6 +927,27 @@ err_free_policy: · 38 unmodified lines
926927 return NULL;
927928 }
928929
930+static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
931+{
932+ struct kobject *kobj;
933+ struct completion *cmp;
934+
935+ down_read(&policy->rwsem);
936+ kobj = &policy->kobj;
937+ cmp = &policy->kobj_unregister;
938+ up_read(&policy->rwsem);
939+ kobject_put(kobj);
940+
941+ /*
942+ * We need to make sure that the underlying kobj is
943+ * actually not referenced anymore by anybody before we
944+ * proceed with unloading.
945+ */
946+ pr_debug("waiting for dropping of refcount\n");
947+ wait_for_completion(cmp);
948+ pr_debug("wait complete\n");
949+}
950+
929951 static void cpufreq_policy_free(struct cpufreq_policy *policy)
930952 {
931953 free_cpumask_var(policy->related_cpus);
@@ -986,7 +1008,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, · 54 unmodified lines
9861008 list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) {
9871009 if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) {
9881010 read_unlock_irqrestore(&cpufreq_driver_lock, flags);
989− ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen);
1011+ ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev);
9901012 up_read(&cpufreq_rwsem);
9911013 return ret;
9921014 }
@@ -1096,7 +1118,10 @@ err_get_freq: · 103 unmodified lines
10961118 if (cpufreq_driver->exit)
10971119 cpufreq_driver->exit(policy);
10981120 err_set_policy_cpu:
1121+ if (frozen)
1122+ cpufreq_policy_put_kobj(policy);
10991123 cpufreq_policy_free(policy);
1124+
11001125 nomem_out:
11011126 up_read(&cpufreq_rwsem);
11021127
@@ -1118,7 +1143,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) · 15 unmodified lines
11181143 }
11191144
11201145 static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy,
1121− unsigned int old_cpu, bool frozen)
1146+ unsigned int old_cpu)
11221147 {
11231148 struct device *cpu_dev;
11241149 int ret;
@@ -1126,10 +1151,6 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, · 1 unmodified line
11261151 /* first sibling now owns the new sysfs dir */
11271152 cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu));
11281153
1129− /* Don't touch sysfs files during light-weight tear-down */
1130− if (frozen)
1131− return cpu_dev->id;
1132−
11331154 sysfs_remove_link(&cpu_dev->kobj, "cpufreq");
11341155 ret = kobject_move(&policy->kobj, &cpu_dev->kobj);
11351156 if (ret) {
@@ -1196,7 +1217,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, · 60 unmodified lines
11961217 if (!frozen)
11971218 sysfs_remove_link(&dev->kobj, "cpufreq");
11981219 } else if (cpus > 1) {
1199− new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen);
1220+ new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
12001221 if (new_cpu >= 0) {
12011222 update_policy_cpu(policy, new_cpu);
12021223
@@ -1218,8 +1239,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev, · 15 unmodified lines
12181239 int ret;
12191240 unsigned long flags;
12201241 struct cpufreq_policy *policy;
1221− struct kobject *kobj;
1222− struct completion *cmp;
12231242
12241243 read_lock_irqsave(&cpufreq_driver_lock, flags);
12251244 policy = per_cpu(cpufreq_cpu_data, cpu);
@@ -1249,22 +1268,8 @@ static int __cpufreq_remove_dev_finish(struct device *dev, · 23 unmodified lines
12491268 }
12501269 }
12511270
1252− if (!frozen) {
1253− down_read(&policy->rwsem);
1254− kobj = &policy->kobj;
1255− cmp = &policy->kobj_unregister;
1256− up_read(&policy->rwsem);
1257− kobject_put(kobj);
1258−
1259− /*
1260− * We need to make sure that the underlying kobj is
1261− * actually not referenced anymore by anybody before we
1262− * proceed with unloading.
1263− */
1264− pr_debug("waiting for dropping of refcount\n");
1265− wait_for_completion(cmp);
1266− pr_debug("wait complete\n");
1267− }
1271+ if (!frozen)
1272+ cpufreq_policy_put_kobj(policy);
12681273
12691274 /*
12701275 * Perform the ->exit() even during light-weight tear-down,
drivers/pinctrl/pinctrl-baytrail.c+1−0
@@ -512,6 +512,7 @@ static const struct dev_pm_ops byt_gpio_pm_ops = { · 511 unmodified lines
512512
513513 static const struct acpi_device_id byt_gpio_acpi_match[] = {
514514 { "INT33B2", 0 },
515+ { "INT33FC", 0 },
515516 { }
516517 };
517518 MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
drivers/powercap/intel_rapl.c+11−2
@@ -833,6 +833,11 @@ static int rapl_write_data_raw(struct rapl_domain *rd, · 832 unmodified lines
833833 return 0;
834834 }
835835
836+static const struct x86_cpu_id energy_unit_quirk_ids[] = {
837+ { X86_VENDOR_INTEL, 6, 0x37},/* VLV */
838+ {}
839+};
840+
836841 static int rapl_check_unit(struct rapl_package *rp, int cpu)
837842 {
838843 u64 msr_val;
@@ -853,8 +858,11 @@ static int rapl_check_unit(struct rapl_package *rp, int cpu) · 14 unmodified lines
853858 * time unit: 1/time_unit_divisor Seconds
854859 */
855860 value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET;
856− rp->energy_unit_divisor = 1 << value;
857−
861+ /* some CPUs have different way to calculate energy unit */
862+ if (x86_match_cpu(energy_unit_quirk_ids))
863+ rp->energy_unit_divisor = 1000000 / (1 << value);
864+ else
865+ rp->energy_unit_divisor = 1 << value;
858866
859867 value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET;
860868 rp->power_unit_divisor = 1 << value;
@@ -941,6 +949,7 @@ static void package_power_limit_irq_restore(int package_id) · 80 unmodified lines
941949 static const struct x86_cpu_id rapl_ids[] = {
942950 { X86_VENDOR_INTEL, 6, 0x2a},/* SNB */
943951 { X86_VENDOR_INTEL, 6, 0x2d},/* SNB EP */
952+ { X86_VENDOR_INTEL, 6, 0x37},/* VLV */
944953 { X86_VENDOR_INTEL, 6, 0x3a},/* IVB */
945954 { X86_VENDOR_INTEL, 6, 0x45},/* HSW */
946955 /* TODO: Add more CPU IDs after testing */
kernel/power/console.c+1−0
@@ -81,6 +81,7 @@ void pm_vt_switch_unregister(struct device *dev) · 80 unmodified lines
8181 list_for_each_entry(tmp, &pm_vt_switch_list, head) {
8282 if (tmp->dev == dev) {
8383 list_del(&tmp->head);
84+ kfree(tmp);
8485 break;
8586 }
8687 }