Merge branch 'acpi-fixes'
* acpi-fixes: ACPI / AC: Add sleep quirk for Thinkpad e530 ACPI / EC: Restart transaction even when the IBF flag set ACPI video: ignore BIOS initial backlight value for HP 1000 ACPI: Fix section to __init. Align with usage in acpixf.h ACPI / PM: Move processor suspend/resume to syscore_ops
This commit is contained in:
@@ -28,6 +28,8 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/dmi.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
@@ -74,6 +76,8 @@ static int acpi_ac_resume(struct device *dev);
|
|||||||
#endif
|
#endif
|
||||||
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
|
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 = {
|
static struct acpi_driver acpi_ac_driver = {
|
||||||
.name = "ac",
|
.name = "ac",
|
||||||
.class = ACPI_AC_CLASS,
|
.class = ACPI_AC_CLASS,
|
||||||
@@ -252,6 +256,16 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
|
|||||||
case ACPI_AC_NOTIFY_STATUS:
|
case ACPI_AC_NOTIFY_STATUS:
|
||||||
case ACPI_NOTIFY_BUS_CHECK:
|
case ACPI_NOTIFY_BUS_CHECK:
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||||
|
/*
|
||||||
|
* A buggy BIOS may notify AC first and then sleep for
|
||||||
|
* a specific time before doing actual operations in the
|
||||||
|
* EC event handler (_Qxx). This will cause the AC state
|
||||||
|
* reported by the ACPI event to be incorrect, so wait for a
|
||||||
|
* specific time for the EC event handler to make progress.
|
||||||
|
*/
|
||||||
|
if (ac_sleep_before_get_state_ms > 0)
|
||||||
|
msleep(ac_sleep_before_get_state_ms);
|
||||||
|
|
||||||
acpi_ac_get_state(ac);
|
acpi_ac_get_state(ac);
|
||||||
acpi_bus_generate_proc_event(device, event, (u32) ac->state);
|
acpi_bus_generate_proc_event(device, event, (u32) ac->state);
|
||||||
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
||||||
@@ -264,6 +278,24 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int thinkpad_e530_quirk(const struct dmi_system_id *d)
|
||||||
|
{
|
||||||
|
ac_sleep_before_get_state_ms = 1000;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct dmi_system_id ac_dmi_table[] = {
|
||||||
|
{
|
||||||
|
.callback = thinkpad_e530_quirk,
|
||||||
|
.ident = "thinkpad e530",
|
||||||
|
.matches = {
|
||||||
|
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
||||||
|
DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
static int acpi_ac_add(struct acpi_device *device)
|
static int acpi_ac_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -312,6 +344,7 @@ static int acpi_ac_add(struct acpi_device *device)
|
|||||||
kfree(ac);
|
kfree(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dmi_check_system(ac_dmi_table);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
|
|||||||
static int ec_poll(struct acpi_ec *ec)
|
static int ec_poll(struct acpi_ec *ec)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int repeat = 2; /* number of command restarts */
|
int repeat = 5; /* number of command restarts */
|
||||||
while (repeat--) {
|
while (repeat--) {
|
||||||
unsigned long delay = jiffies +
|
unsigned long delay = jiffies +
|
||||||
msecs_to_jiffies(ec_delay);
|
msecs_to_jiffies(ec_delay);
|
||||||
@@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec)
|
|||||||
}
|
}
|
||||||
advance_transaction(ec, acpi_ec_read_status(ec));
|
advance_transaction(ec, acpi_ec_read_status(ec));
|
||||||
} while (time_before(jiffies, delay));
|
} while (time_before(jiffies, delay));
|
||||||
if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
|
|
||||||
break;
|
|
||||||
pr_debug(PREFIX "controller reset, restart transaction\n");
|
pr_debug(PREFIX "controller reset, restart transaction\n");
|
||||||
spin_lock_irqsave(&ec->lock, flags);
|
spin_lock_irqsave(&ec->lock, flags);
|
||||||
start_transaction(ec);
|
start_transaction(ec);
|
||||||
|
@@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = {
|
|||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(acpi, processor_device_ids);
|
MODULE_DEVICE_TABLE(acpi, processor_device_ids);
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(acpi_processor_pm,
|
|
||||||
acpi_processor_suspend, acpi_processor_resume);
|
|
||||||
|
|
||||||
static struct acpi_driver acpi_processor_driver = {
|
static struct acpi_driver acpi_processor_driver = {
|
||||||
.name = "processor",
|
.name = "processor",
|
||||||
.class = ACPI_PROCESSOR_CLASS,
|
.class = ACPI_PROCESSOR_CLASS,
|
||||||
@@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = {
|
|||||||
.remove = acpi_processor_remove,
|
.remove = acpi_processor_remove,
|
||||||
.notify = acpi_processor_notify,
|
.notify = acpi_processor_notify,
|
||||||
},
|
},
|
||||||
.drv.pm = &acpi_processor_pm,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INSTALL_NOTIFY_HANDLER 1
|
#define INSTALL_NOTIFY_HANDLER 1
|
||||||
@@ -934,6 +930,8 @@ static int __init acpi_processor_init(void)
|
|||||||
if (result < 0)
|
if (result < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
acpi_processor_syscore_init();
|
||||||
|
|
||||||
acpi_processor_install_hotplug_notify();
|
acpi_processor_install_hotplug_notify();
|
||||||
|
|
||||||
acpi_thermal_cpufreq_init();
|
acpi_thermal_cpufreq_init();
|
||||||
@@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void)
|
|||||||
|
|
||||||
acpi_processor_uninstall_hotplug_notify();
|
acpi_processor_uninstall_hotplug_notify();
|
||||||
|
|
||||||
|
acpi_processor_syscore_exit();
|
||||||
|
|
||||||
acpi_bus_unregister_driver(&acpi_processor_driver);
|
acpi_bus_unregister_driver(&acpi_processor_driver);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <linux/sched.h> /* need_resched() */
|
#include <linux/sched.h> /* need_resched() */
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/cpuidle.h>
|
#include <linux/cpuidle.h>
|
||||||
|
#include <linux/syscore_ops.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Include the apic definitions for x86 to have the APIC timer related defines
|
* Include the apic definitions for x86 to have the APIC timer related defines
|
||||||
@@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static u32 saved_bm_rld;
|
static u32 saved_bm_rld;
|
||||||
|
|
||||||
static void acpi_idle_bm_rld_save(void)
|
int acpi_processor_suspend(void)
|
||||||
{
|
{
|
||||||
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld);
|
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
static void acpi_idle_bm_rld_restore(void)
|
|
||||||
|
void acpi_processor_resume(void)
|
||||||
{
|
{
|
||||||
u32 resumed_bm_rld;
|
u32 resumed_bm_rld;
|
||||||
|
|
||||||
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
|
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
|
||||||
|
if (resumed_bm_rld == saved_bm_rld)
|
||||||
|
return;
|
||||||
|
|
||||||
if (resumed_bm_rld != saved_bm_rld)
|
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
|
||||||
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_processor_suspend(struct device *dev)
|
static struct syscore_ops acpi_processor_syscore_ops = {
|
||||||
|
.suspend = acpi_processor_suspend,
|
||||||
|
.resume = acpi_processor_resume,
|
||||||
|
};
|
||||||
|
|
||||||
|
void acpi_processor_syscore_init(void)
|
||||||
{
|
{
|
||||||
acpi_idle_bm_rld_save();
|
register_syscore_ops(&acpi_processor_syscore_ops);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_processor_resume(struct device *dev)
|
void acpi_processor_syscore_exit(void)
|
||||||
{
|
{
|
||||||
acpi_idle_bm_rld_restore();
|
unregister_syscore_ops(&acpi_processor_syscore_ops);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
#if defined(CONFIG_X86)
|
#if defined(CONFIG_X86)
|
||||||
static void tsc_check_state(int state)
|
static void tsc_check_state(int state)
|
||||||
|
@@ -456,6 +456,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
|
|||||||
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"),
|
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.callback = video_ignore_initial_backlight,
|
||||||
|
.ident = "HP 1000 Notebook PC",
|
||||||
|
.matches = {
|
||||||
|
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
|
||||||
|
DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"),
|
||||||
|
},
|
||||||
|
},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ struct acpi_signal_fatal_info {
|
|||||||
/*
|
/*
|
||||||
* OSL Initialization and shutdown primitives
|
* OSL Initialization and shutdown primitives
|
||||||
*/
|
*/
|
||||||
acpi_status __initdata acpi_os_initialize(void);
|
acpi_status __init acpi_os_initialize(void);
|
||||||
|
|
||||||
acpi_status acpi_os_terminate(void);
|
acpi_status acpi_os_terminate(void);
|
||||||
|
|
||||||
|
@@ -329,10 +329,16 @@ int acpi_processor_power_init(struct acpi_processor *pr);
|
|||||||
int acpi_processor_power_exit(struct acpi_processor *pr);
|
int acpi_processor_power_exit(struct acpi_processor *pr);
|
||||||
int acpi_processor_cst_has_changed(struct acpi_processor *pr);
|
int acpi_processor_cst_has_changed(struct acpi_processor *pr);
|
||||||
int acpi_processor_hotplug(struct acpi_processor *pr);
|
int acpi_processor_hotplug(struct acpi_processor *pr);
|
||||||
int acpi_processor_suspend(struct device *dev);
|
|
||||||
int acpi_processor_resume(struct device *dev);
|
|
||||||
extern struct cpuidle_driver acpi_idle_driver;
|
extern struct cpuidle_driver acpi_idle_driver;
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
void acpi_processor_syscore_init(void);
|
||||||
|
void acpi_processor_syscore_exit(void);
|
||||||
|
#else
|
||||||
|
static inline void acpi_processor_syscore_init(void) {}
|
||||||
|
static inline void acpi_processor_syscore_exit(void) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* in processor_thermal.c */
|
/* in processor_thermal.c */
|
||||||
int acpi_processor_get_limit_info(struct acpi_processor *pr);
|
int acpi_processor_get_limit_info(struct acpi_processor *pr);
|
||||||
extern const struct thermal_cooling_device_ops processor_cooling_ops;
|
extern const struct thermal_cooling_device_ops processor_cooling_ops;
|
||||||
|
Reference in New Issue
Block a user