Commit 478c7cf7 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull ACPI and power management fixes from Rafael Wysocki:
 "Still fixing regressions (partly by reverting commits that broke
  things for people), fixing other stable-candidate bugs and adding some
  blacklist entries for ACPI video and _OSI.

  Two ACPICA regression fixes (one recent and one for a 3.14 commit), a
  fix for an ACPI-related regression in TPM (introduced in 3.14), a
  revert of the ACPI AC driver conversion in 3.13 that went wrong for an
  unknown reason, two reverts of commits that attempted to remove an old
  user space interface in /proc and broke some utilities, in 3.13 too, a
  fix for a CPU hotplug bug in the ACPI processor driver (stable
  material), two (stable candidate) fixes for intel_pstate and a few new
  blacklist entries, mostly for systems that shipped with Windows 8.

  Specifics:

   - ACPICA fix for a stale pointer access introduced by a recent commit
     in the XSDT validation code from Lv Zheng.

   - ACPICA fix for the default value of the command line switch to
     favor 32-bit FADT addresses (in case there's a conflict between a
     64-bit and a 32-bit address).  The previous default was that the
     32-bit version would take precedence and we tried to change it to
     the other way around and it didn't work.  From Lv Zheng.

   - A TPM commit related to ACPI _DSM in 3.14 caused the driver to
     refuse to load if a specific _DSM was missing and that broke resume
     from system suspend on Chromebooks that require the TPM hardware to
     be restored to a working state during resume by the OS.  Restore
     the old behavior to load the driver if the _DSM in question is not
     present, but prevent it from using the feature the _DSM is for.

   - ACPI AC driver conversion in 3.13 broke thermal management on at
     least one machine and has to be reverted.  From Guenter Roeck.

   - Two reverts of 3.13 commits that attempted to remove the old ACPI
     battery interface in /proc, but turned out to break some utilities
     still using that interface.  From Lan Tianyu.

   - ACPI processor driver fix to prevent acpi_processor_add() from
     modifying the CPU device's .offline field which leads to breakage
     if the initial online of the CPU fails.  From Igor Mammedov.

   - Two intel_pstate fixes, one to take a BayTrail documentation update
     into account and one to avoid forcing the maximum P-state on init
     which causes CPU PM trouble on systems with P-states coordination
     when one of the CPU cores is initialized after an offline/online
     cycle triggered by user space.  Both stable candidates, from Dirk
     Brandewie.

   - Fix for the ACPI video DMI blacklist entry for Dell Inspiron 7520
     from Aaron Lu.

   - Two new ACPI video blacklist entries for machines shipping with
     Win8 that need to use native backlight so that it can be controlled
     in a usual way (which doesn't work otherwise due bugs in the ACPI
     tables) from Hans de Goede.

   - Two ACPI _OSI quirks for systems that need them to work correctly
     with Linux from Edward Lin and Hans de Goede"

* tag 'pm+acpi-3.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / video: Revert native brightness quirk for ThinkPad T530
  intel_pstate: remove setting P state to MAX on init
  ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.
  ACPI / video: correct DMI tag for Dell Inspiron 7520
  intel_pstate: Set turbo VID for BayTrail
  ACPI / TPM: Fix resume regression on Chromebooks
  ACPI / proc: Do not say when /proc interfaces will be deleted in Kconfig
  ACPI / processor: do not mark present at boot but not onlined CPU as onlined
  ACPI: Revert "ACPI / AC: convert ACPI ac driver to platform bus"
  ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX
  ACPI: blacklist win8 OSI for Dell Inspiron 7737
  ACPI / video: Add use_native_backlight quirks for more systems
  ACPI: Revert "ACPI / Battery: Remove battery's proc directory"
  ACPI: Revert "ACPI: Remove CONFIG_ACPI_PROCFS_POWER and cm_sbsc.c"
  ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table().
parents 23de4a7a 658a0f4e
......@@ -47,6 +47,23 @@ config ACPI_SLEEP
depends on SUSPEND || HIBERNATION
default y
config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi directories"
depends on PROC_FS
help
For backwards compatibility, this option allows
deprecated power /proc/acpi/ directories to exist, even when
they have been replaced by functions in /sys.
The deprecated directories (and their replacements) include:
/proc/acpi/battery/* (/sys/class/power_supply/*)
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ directories
and functions, which do not yet exist in /sys
This option, together with the proc directories, will be
deleted in the future.
Say N to delete power /proc/acpi/ directories that have moved to /sys/
config ACPI_EC_DEBUGFS
tristate "EC read/write access through /sys/kernel/debug/ec"
default n
......
......@@ -47,6 +47,7 @@ acpi-y += sysfs.o
acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
acpi-$(CONFIG_ACPI_NUMA) += numa.o
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
ifdef CONFIG_ACPI_VIDEO
acpi-y += video_detect.o
endif
......
......@@ -52,11 +52,39 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL");
static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device);
static void acpi_ac_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id ac_device_ids[] = {
{"ACPI0003", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
#ifdef CONFIG_PM_SLEEP
static int acpi_ac_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static int ac_sleep_before_get_state_ms;
static struct acpi_driver acpi_ac_driver = {
.name = "ac",
.class = ACPI_AC_CLASS,
.ids = ac_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = {
.add = acpi_ac_add,
.remove = acpi_ac_remove,
.notify = acpi_ac_notify,
},
.drv.pm = &acpi_ac_pm,
};
struct acpi_ac {
struct power_supply charger;
struct platform_device *pdev;
struct acpi_device * device;
unsigned long long state;
struct notifier_block battery_nb;
};
......@@ -69,10 +97,12 @@ struct acpi_ac {
static int acpi_ac_get_state(struct acpi_ac *ac)
{
acpi_status status;
acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
acpi_status status = AE_OK;
status = acpi_evaluate_integer(handle, "_PSR", NULL,
if (!ac)
return -EINVAL;
status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL,
&ac->state);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
......@@ -117,10 +147,9 @@ static enum power_supply_property ac_props[] = {
Driver Model
-------------------------------------------------------------------------- */
static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
static void acpi_ac_notify(struct acpi_device *device, u32 event)
{
struct acpi_ac *ac = data;
struct acpi_device *adev;
struct acpi_ac *ac = acpi_driver_data(device);
if (!ac)
return;
......@@ -143,11 +172,10 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
msleep(ac_sleep_before_get_state_ms);
acpi_ac_get_state(ac);
adev = ACPI_COMPANION(&ac->pdev->dev);
acpi_bus_generate_netlink_event(adev->pnp.device_class,
dev_name(&ac->pdev->dev),
event, (u32) ac->state);
acpi_notifier_call_chain(adev, event, (u32) ac->state);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
(u32) ac->state);
acpi_notifier_call_chain(device, event, (u32) ac->state);
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
}
......@@ -192,49 +220,39 @@ static struct dmi_system_id ac_dmi_table[] = {
{},
};
static int acpi_ac_probe(struct platform_device *pdev)
static int acpi_ac_add(struct acpi_device *device)
{
int result = 0;
struct acpi_ac *ac = NULL;
struct acpi_device *adev;
if (!pdev)
return -EINVAL;
adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return -ENODEV;
if (!device)
return -EINVAL;
ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
if (!ac)
return -ENOMEM;
strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
ac->pdev = pdev;
platform_set_drvdata(pdev, ac);
ac->device = device;
strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_AC_CLASS);
device->driver_data = ac;
result = acpi_ac_get_state(ac);
if (result)
goto end;
ac->charger.name = acpi_device_bid(adev);
ac->charger.name = acpi_device_bid(device);
ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property;
result = power_supply_register(&pdev->dev, &ac->charger);
result = power_supply_register(&ac->device->dev, &ac->charger);
if (result)
goto end;
result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
if (result) {
power_supply_unregister(&ac->charger);
goto end;
}
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(adev), acpi_device_bid(adev),
acpi_device_name(device), acpi_device_bid(device),
ac->state ? "on-line" : "off-line");
ac->battery_nb.notifier_call = acpi_ac_battery_notify;
......@@ -256,7 +274,7 @@ static int acpi_ac_resume(struct device *dev)
if (!dev)
return -EINVAL;
ac = platform_get_drvdata(to_platform_device(dev));
ac = acpi_driver_data(to_acpi_device(dev));
if (!ac)
return -EINVAL;
......@@ -270,19 +288,17 @@ static int acpi_ac_resume(struct device *dev)
#else
#define acpi_ac_resume NULL
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume);
static int acpi_ac_remove(struct platform_device *pdev)
static int acpi_ac_remove(struct acpi_device *device)
{
struct acpi_ac *ac;
struct acpi_ac *ac = NULL;
if (!pdev)
if (!device || !acpi_driver_data(device))
return -EINVAL;
acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
ac = acpi_driver_data(device);
ac = platform_get_drvdata(pdev);
if (ac->charger.dev)
power_supply_unregister(&ac->charger);
unregister_acpi_notifier(&ac->battery_nb);
......@@ -292,23 +308,6 @@ static int acpi_ac_remove(struct platform_device *pdev)
return 0;
}
static const struct acpi_device_id acpi_ac_match[] = {
{ "ACPI0003", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, acpi_ac_match);
static struct platform_driver acpi_ac_driver = {
.probe = acpi_ac_probe,
.remove = acpi_ac_remove,
.driver = {
.name = "acpi-ac",
.owner = THIS_MODULE,
.pm = &acpi_ac_pm_ops,
.acpi_match_table = ACPI_PTR(acpi_ac_match),
},
};
static int __init acpi_ac_init(void)
{
int result;
......@@ -316,7 +315,7 @@ static int __init acpi_ac_init(void)
if (acpi_disabled)
return -ENODEV;
result = platform_driver_register(&acpi_ac_driver);
result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0)
return -ENODEV;
......@@ -325,7 +324,7 @@ static int __init acpi_ac_init(void)
static void __exit acpi_ac_exit(void)
{
platform_driver_unregister(&acpi_ac_driver);
acpi_bus_unregister_driver(&acpi_ac_driver);
}
module_init(acpi_ac_init);
module_exit(acpi_ac_exit);
......@@ -29,7 +29,6 @@ ACPI_MODULE_NAME("platform");
static const struct acpi_device_id acpi_platform_device_ids[] = {
{ "PNP0D40" },
{ "ACPI0003" },
{ "VPC2004" },
{ "BCM4752" },
......
......@@ -405,7 +405,6 @@ static int acpi_processor_add(struct acpi_device *device,
goto err;
pr->dev = dev;
dev->offline = pr->flags.need_hotplug_init;
/* Trigger the processor driver's .probe() if present. */
if (device_attach(dev) >= 0)
......
......@@ -141,9 +141,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
* address. Although ACPICA adheres to the ACPI specification which
* requires the use of the corresponding 64-bit address if it is non-zero,
* some machines have been found to have a corrupted non-zero 64-bit
* address. Default is FALSE, do not favor the 32-bit addresses.
* address. Default is TRUE, favor the 32-bit addresses.
*/
ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
/*
* Optionally truncate I/O addresses to 16 bits. Provides compatibility
......
......@@ -461,6 +461,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
u32 table_count;
struct acpi_table_header *table;
acpi_physical_address address;
acpi_physical_address rsdt_address;
u32 length;
u8 *table_entry;
acpi_status status;
......@@ -488,11 +489,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
* as per the ACPI specification.
*/
address = (acpi_physical_address) rsdp->xsdt_physical_address;
rsdt_address =
(acpi_physical_address) rsdp->rsdt_physical_address;
table_entry_size = ACPI_XSDT_ENTRY_SIZE;
} else {
/* Root table is an RSDT (32-bit physical addresses) */
address = (acpi_physical_address) rsdp->rsdt_physical_address;
rsdt_address = address;
table_entry_size = ACPI_RSDT_ENTRY_SIZE;
}
......@@ -515,8 +519,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
/* Fall back to the RSDT */
address =
(acpi_physical_address) rsdp->rsdt_physical_address;
address = rsdt_address;
table_entry_size = ACPI_RSDT_ENTRY_SIZE;
}
}
......
This diff is collapsed.
......@@ -314,6 +314,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "Dell Inspiron 7737",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
},
},
/*
* BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
......@@ -374,6 +382,19 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"),
},
},
/*
* Without this this EEEpc exports a non working WMI interface, with
* this it exports a working "good old" eeepc_laptop interface, fixing
* both brightness control, and rfkill not working.
*/
{
.callback = dmi_enable_osi_linux,
.ident = "Asus EEE PC 1015PX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
},
},
{}
};
......
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define PREFIX "ACPI: "
ACPI_MODULE_NAME("cm_sbs");
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_BATTERY_CLASS "battery"
#define _COMPONENT ACPI_SBS_COMPONENT
static struct proc_dir_entry *acpi_ac_dir;
static struct proc_dir_entry *acpi_battery_dir;
static DEFINE_MUTEX(cm_sbs_mutex);
static int lock_ac_dir_cnt;
static int lock_battery_dir_cnt;
struct proc_dir_entry *acpi_lock_ac_dir(void)
{
mutex_lock(&cm_sbs_mutex);
if (!acpi_ac_dir)
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (acpi_ac_dir) {
lock_ac_dir_cnt++;
} else {
printk(KERN_ERR PREFIX
"Cannot create %s\n", ACPI_AC_CLASS);
}
mutex_unlock(&cm_sbs_mutex);
return acpi_ac_dir;
}
EXPORT_SYMBOL(acpi_lock_ac_dir);
void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
{
mutex_lock(&cm_sbs_mutex);
if (acpi_ac_dir_param)
lock_ac_dir_cnt--;
if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
acpi_ac_dir = NULL;
}
mutex_unlock(&cm_sbs_mutex);
}
EXPORT_SYMBOL(acpi_unlock_ac_dir);
struct proc_dir_entry *acpi_lock_battery_dir(void)
{
mutex_lock(&cm_sbs_mutex);
if (!acpi_battery_dir) {
acpi_battery_dir =
proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
}
if (acpi_battery_dir) {
lock_battery_dir_cnt++;
} else {
printk(KERN_ERR PREFIX
"Cannot create %s\n", ACPI_BATTERY_CLASS);
}
mutex_unlock(&cm_sbs_mutex);
return acpi_battery_dir;
}
EXPORT_SYMBOL(acpi_lock_battery_dir);
void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
{
mutex_lock(&cm_sbs_mutex);
if (acpi_battery_dir_param)
lock_battery_dir_cnt--;
if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
&& acpi_battery_dir) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
acpi_battery_dir = NULL;
}
mutex_unlock(&cm_sbs_mutex);
return;
}
EXPORT_SYMBOL(acpi_unlock_battery_dir);
......@@ -457,10 +457,10 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad T430s",
.ident = "ThinkPad T430 and T430s",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430"),
},
},
{
......@@ -500,7 +500,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
.ident = "Dell Inspiron 7520",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"),
},
},
{
......@@ -511,6 +511,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire 5742G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5742G"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire V5-431",
......
......@@ -328,13 +328,11 @@ int tpm_add_ppi(struct kobject *parent)
/* Cache TPM ACPI handle and version string */
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
ppi_callback, NULL, NULL, &tpm_ppi_handle);
if (tpm_ppi_handle == NULL)
return -ENODEV;
return sysfs_create_group(parent, &ppi_attr_grp);
return tpm_ppi_handle ? sysfs_create_group(parent, &ppi_attr_grp) : 0;
}
void tpm_remove_ppi(struct kobject *parent)
{
if (tpm_ppi_handle)
sysfs_remove_group(parent, &ppi_attr_grp);
}
......@@ -37,6 +37,7 @@
#define BYT_RATIOS 0x66a
#define BYT_VIDS 0x66b
#define BYT_TURBO_RATIOS 0x66c
#define BYT_TURBO_VIDS 0x66d
#define FRAC_BITS 6
......@@ -70,8 +71,9 @@ struct pstate_data {
};
struct vid_data {
int32_t min;
int32_t max;
int min;
int max;
int turbo;
int32_t ratio;
};
......@@ -359,14 +361,14 @@ static int byt_get_min_pstate(void)
{
u64 value;
rdmsrl(BYT_RATIOS, value);
return (value >> 8) & 0xFF;
return (value >> 8) & 0x3F;
}
static int byt_get_max_pstate(void)
{
u64 value;
rdmsrl(BYT_RATIOS, value);
return (value >> 16) & 0xFF;
return (value >> 16) & 0x3F;
}
static int byt_get_turbo_pstate(void)
......@@ -393,6 +395,9 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate)
vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max);
vid = fp_toint(vid_fp);
if (pstate > cpudata->pstate.max_pstate)
vid = cpudata->vid.turbo;
val |= vid;
wrmsrl(MSR_IA32_PERF_CTL, val);
......@@ -402,13 +407,17 @@ static void byt_get_vid(struct cpudata *cpudata)
{
u64 value;
rdmsrl(BYT_VIDS, value);
cpudata->vid.min = int_tofp((value >> 8) & 0x7f);
cpudata->vid.max = int_tofp((value >> 16) & 0x7f);
cpudata->vid.min = int_tofp((value >> 8) & 0x3f);
cpudata->vid.max = int_tofp((value >> 16) & 0x3f);
cpudata->vid.ratio = div_fp(
cpudata->vid.max - cpudata->vid.min,
int_tofp(cpudata->pstate.max_pstate -
cpudata->pstate.min_pstate));
rdmsrl(BYT_TURBO_VIDS, value);
cpudata->vid.turbo = value & 0x7f;
}
......@@ -545,12 +554,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
if (pstate_funcs.get_vid)
pstate_funcs.get_vid(cpu);
/*
* goto max pstate so we don't slow up boot if we are built-in if we are
* a module we will take care of it during normal operation
*/
intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate);
}
static inline void intel_pstate_calc_busy(struct cpudata *cpu,
......@@ -695,11 +699,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu = all_cpu_data[cpunum];
intel_pstate_get_cpu_pstates(cpu);
if (!cpu->pstate.current_pstate) {
all_cpu_data[cpunum] = NULL;
kfree(cpu);
return -ENODATA;
}
cpu->cpu = cpunum;
......@@ -710,7 +709,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu->timer.expires = jiffies + HZ/100;
intel_pstate_busy_pid_reset(cpu);
intel_pstate_sample(cpu);
intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
add_timer_on(&cpu->timer, cpunum);
......
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