Commit 795233bf authored by Linus Torvalds's avatar Linus Torvalds

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

Pull ACPI and power management fixes from Rafael Wysocki:
 "These include two fixes for recent regressions related to ACPI, a
  cpufreq fix for breakage overlooked by a previous fix commit, two
  intel_pstate fixes for stuff added during the 3.13 cycle that need to
  go into -stable, three fixes for older bugs that also are -stable
  candidates, ACPI video blacklist changes related to BIOSes that behave
  in a special way on Windows 8, several build fixes for CONFIG_PM_SLEEP
  unset in ACPI drivers and an ACPI driver cleanup.

  Specifics:

   - Fix for a recent probing regression in the nouveau driver
     introduced by an ACPI change related to the handling of _DSM from
     Jiang Liu.

   - Fix for a dock station sysfs attribute that stopped working
     correctly after recent changes in the ACPI core.

   - cpufreq fix taking care of broken code related to CPU removal and
     overlooked by a previous recent fix in that area.  From Viresh
     Kumar.

   - Two intel_pstate fixes related to Baytrail support added during the
     3.13 cycle (candidates for -stable) from Dirk Brandewie.

   - ACPI video fix removing duplicate brightness values from the _BCL
     table which makes its user space interface behave sanely.  From
     Hans de Goede.

   - Fix for the powernow-k8 cpufreq driver making it initialize its
     per-CPU data structures correctly from Srivatsa S Bhat.

   - Fix for an obscure memory leak in the ACPI PCI interrupt allocation
     code (related to ISA) from Tomasz Nowicki.

   - ACPI video blacklist changes moving several systems that should use
     the native backlight interface instead of the ACPI one from the
     general ACPI _OSI blacklist the the ACPI video driver's blacklist
     where they belong.  This consists of an ACPI video driver update
     from Aaron Lu and a revert of a previous commit adding systems to
     the ACPI _OSI blacklist requested by Takashi Iwai.

   - Several fixes for build issues in ACPI drivers occuring when
     CONFIG_PM_SLEEP is unset from Shuah Khan.

   - Fix for an sscanf() format string in the ACPI Smart Battery
     Subsystem (SBS) driver from Luis G.F"

* tag 'pm+acpi-3.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  intel_pstate: Add support for Baytrail turbo P states
  intel_pstate: Use LFM bus ratio as min ratio/P state
  ACPI / nouveau: fix probing regression related to _DSM
  Revert "ACPI: Blacklist Win8 OSI for some HP laptop 2013 models"
  ACPI / video: Add systems that should favour native backlight interface
  ACPI / video: Filter the _BCL table for duplicate brightness values
  cpufreq: powernow-k8: Initialize per-cpu data-structures properly
  cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()
  ACPI / dock: Make 'docked' sysfs attribute work as documented
  ACPI / SBS: Fix incorrect sscanf() string
  ACPI / thermal: fix thermal driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / SBS: fix SBS driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / fan: fix fan driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / button: fix button driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / battery: fix battery driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / AC: fix AC driver compile error when CONFIG_PM_SLEEP is undefined
parents 7777d934 fee5ae96
...@@ -243,6 +243,8 @@ static int acpi_ac_resume(struct device *dev) ...@@ -243,6 +243,8 @@ static int acpi_ac_resume(struct device *dev)
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
return 0; return 0;
} }
#else
#define acpi_ac_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume); static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume);
......
...@@ -841,6 +841,8 @@ static int acpi_battery_resume(struct device *dev) ...@@ -841,6 +841,8 @@ static int acpi_battery_resume(struct device *dev)
acpi_battery_update(battery); acpi_battery_update(battery);
return 0; return 0;
} }
#else
#define acpi_battery_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume); static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
......
...@@ -260,14 +260,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { ...@@ -260,14 +260,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
}, },
{ {
.callback = dmi_disable_osi_win8, .callback = dmi_disable_osi_win8,
.ident = "Dell Inspiron 15R SE",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad Edge E530", .ident = "ThinkPad Edge E530",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
...@@ -322,56 +314,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { ...@@ -322,56 +314,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
}, },
}, },
{
.callback = dmi_disable_osi_win8,
.ident = "HP ProBook 2013 models",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "),
DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "HP EliteBook 2013 models",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "HP ZBook 14",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "HP ZBook 15",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "HP ZBook 17",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "HP EliteBook 8780w",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"),
},
},
/* /*
* BIOS invocation of _OSI(Linux) is almost always a BIOS bug. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
......
...@@ -80,6 +80,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event); ...@@ -80,6 +80,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int acpi_button_resume(struct device *dev); static int acpi_button_resume(struct device *dev);
#else
#define acpi_button_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume); static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume);
......
...@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, ...@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl,
static ssize_t show_docked(struct device *dev, static ssize_t show_docked(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct acpi_device *tmp;
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
struct acpi_device *adev = NULL;
if (!acpi_bus_get_device(dock_station->handle, &tmp)) acpi_bus_get_device(dock_station->handle, &adev);
return snprintf(buf, PAGE_SIZE, "1\n"); return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
return snprintf(buf, PAGE_SIZE, "0\n");
} }
static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
......
...@@ -55,6 +55,9 @@ MODULE_DEVICE_TABLE(acpi, fan_device_ids); ...@@ -55,6 +55,9 @@ MODULE_DEVICE_TABLE(acpi, fan_device_ids);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int acpi_fan_suspend(struct device *dev); static int acpi_fan_suspend(struct device *dev);
static int acpi_fan_resume(struct device *dev); static int acpi_fan_resume(struct device *dev);
#else
#define acpi_fan_suspend NULL
#define acpi_fan_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume); static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
......
...@@ -430,6 +430,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -430,6 +430,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
pin_name(pin)); pin_name(pin));
} }
kfree(entry);
return 0; return 0;
} }
......
...@@ -450,7 +450,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, ...@@ -450,7 +450,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
{ {
unsigned long x; unsigned long x;
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
if (sscanf(buf, "%ld\n", &x) == 1) if (sscanf(buf, "%lu\n", &x) == 1)
battery->alarm_capacity = x / battery->alarm_capacity = x /
(1000 * acpi_battery_scale(battery)); (1000 * acpi_battery_scale(battery));
if (battery->present) if (battery->present)
...@@ -668,6 +668,8 @@ static int acpi_sbs_resume(struct device *dev) ...@@ -668,6 +668,8 @@ static int acpi_sbs_resume(struct device *dev)
acpi_sbs_callback(sbs); acpi_sbs_callback(sbs);
return 0; return 0;
} }
#else
#define acpi_sbs_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume); static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
......
...@@ -102,6 +102,8 @@ MODULE_DEVICE_TABLE(acpi, thermal_device_ids); ...@@ -102,6 +102,8 @@ MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int acpi_thermal_resume(struct device *dev); static int acpi_thermal_resume(struct device *dev);
#else
#define acpi_thermal_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
......
...@@ -81,11 +81,12 @@ static bool allow_duplicates; ...@@ -81,11 +81,12 @@ static bool allow_duplicates;
module_param(allow_duplicates, bool, 0644); module_param(allow_duplicates, bool, 0644);
/* /*
* For Windows 8 systems: if set ture and the GPU driver has * For Windows 8 systems: used to decide if video module
* registered a backlight interface, skip registering ACPI video's. * should skip registering backlight interface of its own.
*/ */
static bool use_native_backlight = false; static int use_native_backlight_param = -1;
module_param(use_native_backlight, bool, 0644); module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
static bool use_native_backlight_dmi = false;
static int register_count; static int register_count;
static struct mutex video_list_lock; static struct mutex video_list_lock;
...@@ -231,9 +232,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, ...@@ -231,9 +232,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
static int acpi_video_switch_brightness(struct acpi_video_device *device, static int acpi_video_switch_brightness(struct acpi_video_device *device,
int event); int event);
static bool acpi_video_use_native_backlight(void)
{
if (use_native_backlight_param != -1)
return use_native_backlight_param;
else
return use_native_backlight_dmi;
}
static bool acpi_video_verify_backlight_support(void) static bool acpi_video_verify_backlight_support(void)
{ {
if (acpi_osi_is_win8() && use_native_backlight && if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
backlight_device_registered(BACKLIGHT_RAW)) backlight_device_registered(BACKLIGHT_RAW))
return false; return false;
return acpi_video_backlight_support(); return acpi_video_backlight_support();
...@@ -398,6 +407,12 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d) ...@@ -398,6 +407,12 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
return 0; return 0;
} }
static int __init video_set_use_native_backlight(const struct dmi_system_id *d)
{
use_native_backlight_dmi = true;
return 0;
}
static struct dmi_system_id video_dmi_table[] __initdata = { static struct dmi_system_id video_dmi_table[] __initdata = {
/* /*
* Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
...@@ -442,6 +457,120 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -442,6 +457,120 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
}, },
}, },
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad T430s",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad X230",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad X1 Carbon",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X1 Carbon"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Lenovo Yoga 13",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Dell Inspiron 7520",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire 5733Z",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire V5-431",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-431"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP ProBook 4340s",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4340s"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP ProBook 2013 models",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "),
DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP EliteBook 2013 models",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP ZBook 14",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP ZBook 15",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP ZBook 17",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "HP EliteBook 8780w",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"),
},
},
{} {}
}; };
...@@ -685,6 +814,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) ...@@ -685,6 +814,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
union acpi_object *o; union acpi_object *o;
struct acpi_video_device_brightness *br = NULL; struct acpi_video_device_brightness *br = NULL;
int result = -EINVAL; int result = -EINVAL;
u32 value;
if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
...@@ -715,7 +845,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) ...@@ -715,7 +845,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
printk(KERN_ERR PREFIX "Invalid data\n"); printk(KERN_ERR PREFIX "Invalid data\n");
continue; continue;
} }
br->levels[count] = (u32) o->integer.value; value = (u32) o->integer.value;
/* Skip duplicate entries */
if (count > 2 && br->levels[count - 1] == value)
continue;
br->levels[count] = value;
if (br->levels[count] > max_level) if (br->levels[count] > max_level)
max_level = br->levels[count]; max_level = br->levels[count];
......
...@@ -168,22 +168,6 @@ static struct dmi_system_id video_detect_dmi_table[] = { ...@@ -168,22 +168,6 @@ static struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
}, },
}, },
{
.callback = video_detect_force_vendor,
.ident = "HP EliteBook Revolve 810",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Revolve 810 G1"),
},
},
{
.callback = video_detect_force_vendor,
.ident = "Lenovo Yoga 13",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"),
},
},
{ }, { },
}; };
......
...@@ -1323,7 +1323,6 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, ...@@ -1323,7 +1323,6 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
up_read(&policy->rwsem); up_read(&policy->rwsem);
if (cpu != policy->cpu) { if (cpu != policy->cpu) {
if (!frozen)
sysfs_remove_link(&dev->kobj, "cpufreq"); sysfs_remove_link(&dev->kobj, "cpufreq");
} else if (cpus > 1) { } else if (cpus > 1) {
new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#define BYT_RATIOS 0x66a #define BYT_RATIOS 0x66a
#define BYT_VIDS 0x66b #define BYT_VIDS 0x66b
#define BYT_TURBO_RATIOS 0x66c
#define FRAC_BITS 8 #define FRAC_BITS 8
#define int_tofp(X) ((int64_t)(X) << FRAC_BITS) #define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
...@@ -357,7 +359,7 @@ static int byt_get_min_pstate(void) ...@@ -357,7 +359,7 @@ static int byt_get_min_pstate(void)
{ {
u64 value; u64 value;
rdmsrl(BYT_RATIOS, value); rdmsrl(BYT_RATIOS, value);
return value & 0xFF; return (value >> 8) & 0xFF;
} }
static int byt_get_max_pstate(void) static int byt_get_max_pstate(void)
...@@ -367,6 +369,13 @@ static int byt_get_max_pstate(void) ...@@ -367,6 +369,13 @@ static int byt_get_max_pstate(void)
return (value >> 16) & 0xFF; return (value >> 16) & 0xFF;
} }
static int byt_get_turbo_pstate(void)
{
u64 value;
rdmsrl(BYT_TURBO_RATIOS, value);
return value & 0x3F;
}
static void byt_set_pstate(struct cpudata *cpudata, int pstate) static void byt_set_pstate(struct cpudata *cpudata, int pstate)
{ {
u64 val; u64 val;
...@@ -469,7 +478,7 @@ static struct cpu_defaults byt_params = { ...@@ -469,7 +478,7 @@ static struct cpu_defaults byt_params = {
.funcs = { .funcs = {
.get_max = byt_get_max_pstate, .get_max = byt_get_max_pstate,
.get_min = byt_get_min_pstate, .get_min = byt_get_min_pstate,
.get_turbo = byt_get_max_pstate, .get_turbo = byt_get_turbo_pstate,
.set = byt_set_pstate, .set = byt_set_pstate,
.get_vid = byt_get_vid, .get_vid = byt_get_vid,
}, },
......
...@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
{ {
struct powernow_k8_data *data; struct powernow_k8_data *data;
struct init_on_cpu init_on_cpu; struct init_on_cpu init_on_cpu;
int rc; int rc, cpu;
smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1);
if (rc) if (rc)
...@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",
data->currfid, data->currvid); data->currfid, data->currvid);
per_cpu(powernow_data, pol->cpu) = data; /* Point all the CPUs in this policy to the same data */
for_each_cpu(cpu, pol->cpus)
per_cpu(powernow_data, cpu) = data;
return 0; return 0;
...@@ -1155,6 +1157,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1155,6 +1157,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
static int powernowk8_cpu_exit(struct cpufreq_policy *pol) static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
{ {
struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
int cpu;
if (!data) if (!data)
return -EINVAL; return -EINVAL;
...@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol) ...@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
kfree(data->powernow_table); kfree(data->powernow_table);
kfree(data); kfree(data);
per_cpu(powernow_data, pol->cpu) = NULL; for_each_cpu(cpu, pol->cpus)
per_cpu(powernow_data, cpu) = NULL;
return 0; return 0;
} }
......
...@@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * ...@@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
return 0; return 0;
} }
/*
* On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special
* requirements on the fourth parameter, so a private implementation
* instead of using acpi_check_dsm().
*/
static int nouveau_check_optimus_dsm(acpi_handle handle)
{
int result;
/*
* Function 0 returns a Buffer containing available functions.
* The args parameter is ignored for function 0, so just put 0 in it
*/
if (nouveau_optimus_dsm(handle, 0, 0, &result))
return 0;
/*
* ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.
* If the n-th bit is enabled, function n is supported
*/
return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);
}
static int nouveau_dsm(acpi_handle handle, int func, int arg) static int nouveau_dsm(acpi_handle handle, int func, int arg)
{ {
int ret = 0; int ret = 0;
...@@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) ...@@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
1 << NOUVEAU_DSM_POWER)) 1 << NOUVEAU_DSM_POWER))
retval |= NOUVEAU_DSM_HAS_MUX; retval |= NOUVEAU_DSM_HAS_MUX;
if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100, if (nouveau_check_optimus_dsm(dhandle))
1 << NOUVEAU_DSM_OPTIMUS_CAPS))
retval |= NOUVEAU_DSM_HAS_OPT; retval |= NOUVEAU_DSM_HAS_OPT;
if (retval & NOUVEAU_DSM_HAS_OPT) { if (retval & NOUVEAU_DSM_HAS_OPT) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment