mirror of
https://github.com/adulau/aha.git
synced 2024-12-05 00:17:23 +00:00
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (34 commits) classmate-laptop: add support for Classmate PC ACPI devices hp-wmi: Fix two memleaks acer-wmi, msi-wmi: Remove needless DMI MODULE_ALIAS dell-wmi: do not keep driver loaded on unsupported boxes wmi: Free the allocated acpi objects through wmi_get_event_data drivers/platform/x86/acerhdf.c: check BIOS information whether it begins with string of table acerhdf: add new BIOS versions acerhdf: limit modalias matching to supported toshiba_acpi: convert to seq_file asus_acpi: convert to seq_file ACPI: do not select ACPI_DOCK from ATA_ACPI sony-laptop: enumerate rfkill devices using SN06 sony-laptop: rfkill support for newer models ACPI: fix OSC regression that caused aer and pciehp not to load MAINTAINERS: add maintainer for msi-wmi driver fujitu-laptop: fix tests of acpi_evaluate_integer() return value arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c: avoid cross-CPU interrupts by using smp_call_function_any() ACPI: processor: remove _PDC object list from struct acpi_processor ACPI: processor: change acpi_processor_set_pdc() interface ACPI: processor: open code acpi_processor_cleanup_pdc ...
This commit is contained in:
commit
71492fd1bd
32 changed files with 1435 additions and 667 deletions
11
MAINTAINERS
11
MAINTAINERS
|
@ -1472,6 +1472,12 @@ L: linux-scsi@vger.kernel.org
|
|||
S: Supported
|
||||
F: drivers/scsi/fnic/
|
||||
|
||||
CMPC ACPI DRIVER
|
||||
M: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
|
||||
M: Daniel Oliveira Nascimento <don@syst.com.br>
|
||||
S: Supported
|
||||
F: drivers/platform/x86/classmate-laptop.c
|
||||
|
||||
CODA FILE SYSTEM
|
||||
M: Jan Harkes <jaharkes@cs.cmu.edu>
|
||||
M: coda@cs.cmu.edu
|
||||
|
@ -3646,6 +3652,11 @@ W: http://0pointer.de/lennart/tchibo.html
|
|||
S: Maintained
|
||||
F: drivers/platform/x86/msi-laptop.c
|
||||
|
||||
MSI WMI SUPPORT
|
||||
M: Anisse Astier <anisse@astier.eu>
|
||||
S: Supported
|
||||
F: drivers/platform/x86/msi-wmi.c
|
||||
|
||||
MULTIFUNCTION DEVICES (MFD)
|
||||
M: Samuel Ortiz <sameo@linux.intel.com>
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git
|
||||
|
|
|
@ -132,6 +132,12 @@ extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
|
|||
extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
|
||||
#endif
|
||||
|
||||
static inline bool arch_has_acpi_pdc(void) { return true; }
|
||||
static inline void arch_acpi_set_pdc_bits(u32 *buf)
|
||||
{
|
||||
buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
|
||||
}
|
||||
|
||||
#define acpi_unlazy_tlb(x)
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
|
|
|
@ -18,10 +18,6 @@ obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
|
|||
obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
|
||||
obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
|
||||
|
||||
ifneq ($(CONFIG_ACPI_PROCESSOR),)
|
||||
obj-y += acpi-processor.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_IA64_PALINFO) += palinfo.o
|
||||
obj-$(CONFIG_IOSAPIC) += iosapic.o
|
||||
obj-$(CONFIG_MODULES) += module.o
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* arch/ia64/kernel/acpi-processor.c
|
||||
*
|
||||
* Copyright (C) 2005 Intel Corporation
|
||||
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
|
||||
* - Added _PDC for platforms with Intel CPUs
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
|
||||
#include <acpi/processor.h>
|
||||
#include <asm/acpi.h>
|
||||
|
||||
static void init_intel_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
struct acpi_object_list *obj_list;
|
||||
union acpi_object *obj;
|
||||
u32 *buf;
|
||||
|
||||
/* allocate and initialize pdc. It will be used later. */
|
||||
obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
|
||||
if (!obj_list) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
|
||||
if (!obj) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj_list);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = kmalloc(12, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj);
|
||||
kfree(obj_list);
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = ACPI_PDC_REVISION_ID;
|
||||
buf[1] = 1;
|
||||
buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
|
||||
/*
|
||||
* The default of PDC_SMP_T_SWCOORD bit is set for IA64 cpu so
|
||||
* that OSPM is capable of native ACPI throttling software
|
||||
* coordination using BIOS supplied _TSD info.
|
||||
*/
|
||||
buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
|
||||
|
||||
obj->type = ACPI_TYPE_BUFFER;
|
||||
obj->buffer.length = 12;
|
||||
obj->buffer.pointer = (u8 *) buf;
|
||||
obj_list->count = 1;
|
||||
obj_list->pointer = obj;
|
||||
pr->pdc = obj_list;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize _PDC data based on the CPU vendor */
|
||||
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
pr->pdc = NULL;
|
||||
init_intel_pdc(pr);
|
||||
return;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
|
||||
|
||||
void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
if (pr->pdc) {
|
||||
kfree(pr->pdc->pointer->buffer.pointer);
|
||||
kfree(pr->pdc->pointer);
|
||||
kfree(pr->pdc);
|
||||
pr->pdc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
|
|
@ -142,6 +142,32 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
|
|||
return max_cstate;
|
||||
}
|
||||
|
||||
static inline bool arch_has_acpi_pdc(void)
|
||||
{
|
||||
struct cpuinfo_x86 *c = &cpu_data(0);
|
||||
return (c->x86_vendor == X86_VENDOR_INTEL ||
|
||||
c->x86_vendor == X86_VENDOR_CENTAUR);
|
||||
}
|
||||
|
||||
static inline void arch_acpi_set_pdc_bits(u32 *buf)
|
||||
{
|
||||
struct cpuinfo_x86 *c = &cpu_data(0);
|
||||
|
||||
buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_EST))
|
||||
buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_ACPI))
|
||||
buf[2] |= ACPI_PDC_T_FFH;
|
||||
|
||||
/*
|
||||
* If mwait/monitor is unsupported, C2/C3_FFH will be disabled
|
||||
*/
|
||||
if (!cpu_has(c, X86_FEATURE_MWAIT))
|
||||
buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_ACPI */
|
||||
|
||||
#define acpi_lapic 0
|
||||
|
|
|
@ -4,7 +4,7 @@ obj-$(CONFIG_ACPI) += boot.o
|
|||
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o
|
||||
|
||||
ifneq ($(CONFIG_ACPI_PROCESSOR),)
|
||||
obj-y += cstate.o processor.o
|
||||
obj-y += cstate.o
|
||||
endif
|
||||
|
||||
$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Intel Corporation
|
||||
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
|
||||
* - Added _PDC for platforms with Intel CPUs
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
|
||||
#include <acpi/processor.h>
|
||||
#include <asm/acpi.h>
|
||||
|
||||
static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
|
||||
{
|
||||
struct acpi_object_list *obj_list;
|
||||
union acpi_object *obj;
|
||||
u32 *buf;
|
||||
|
||||
/* allocate and initialize pdc. It will be used later. */
|
||||
obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
|
||||
if (!obj_list) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
|
||||
if (!obj) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj_list);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = kmalloc(12, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj);
|
||||
kfree(obj_list);
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = ACPI_PDC_REVISION_ID;
|
||||
buf[1] = 1;
|
||||
buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
|
||||
|
||||
/*
|
||||
* The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
|
||||
* that OSPM is capable of native ACPI throttling software
|
||||
* coordination using BIOS supplied _TSD info.
|
||||
*/
|
||||
buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
|
||||
if (cpu_has(c, X86_FEATURE_EST))
|
||||
buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_ACPI))
|
||||
buf[2] |= ACPI_PDC_T_FFH;
|
||||
|
||||
/*
|
||||
* If mwait/monitor is unsupported, C2/C3_FFH will be disabled
|
||||
*/
|
||||
if (!cpu_has(c, X86_FEATURE_MWAIT))
|
||||
buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
|
||||
|
||||
obj->type = ACPI_TYPE_BUFFER;
|
||||
obj->buffer.length = 12;
|
||||
obj->buffer.pointer = (u8 *) buf;
|
||||
obj_list->count = 1;
|
||||
obj_list->pointer = obj;
|
||||
pr->pdc = obj_list;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize _PDC data based on the CPU vendor */
|
||||
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
struct cpuinfo_x86 *c = &cpu_data(pr->id);
|
||||
|
||||
pr->pdc = NULL;
|
||||
if (c->x86_vendor == X86_VENDOR_INTEL ||
|
||||
c->x86_vendor == X86_VENDOR_CENTAUR)
|
||||
init_intel_pdc(pr, c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
|
||||
|
||||
void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
if (pr->pdc) {
|
||||
kfree(pr->pdc->pointer->buffer.pointer);
|
||||
kfree(pr->pdc->pointer);
|
||||
kfree(pr->pdc);
|
||||
pr->pdc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
|
|
@ -190,9 +190,11 @@ static void do_drv_write(void *_cmd)
|
|||
|
||||
static void drv_read(struct drv_cmd *cmd)
|
||||
{
|
||||
int err;
|
||||
cmd->val = 0;
|
||||
|
||||
smp_call_function_single(cpumask_any(cmd->mask), do_drv_read, cmd, 1);
|
||||
err = smp_call_function_any(cmd->mask, do_drv_read, cmd, 1);
|
||||
WARN_ON_ONCE(err); /* smp_call_function_any() was buggy? */
|
||||
}
|
||||
|
||||
static void drv_write(struct drv_cmd *cmd)
|
||||
|
|
|
@ -32,6 +32,7 @@ acpi-$(CONFIG_ACPI_SLEEP) += proc.o
|
|||
#
|
||||
acpi-y += bus.o glue.o
|
||||
acpi-y += scan.o
|
||||
acpi-y += processor_pdc.o
|
||||
acpi-y += ec.o
|
||||
acpi-$(CONFIG_ACPI_DOCK) += dock.o
|
||||
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
|
||||
|
|
|
@ -185,6 +185,12 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
|
|||
acpi_osi_setup("!Windows 2006");
|
||||
return 0;
|
||||
}
|
||||
static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
|
||||
{
|
||||
printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
|
||||
acpi_osi_setup("!Windows 2009");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
|
||||
{
|
||||
|
@ -211,6 +217,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
|
|||
DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.callback = dmi_disable_osi_win7,
|
||||
.ident = "ASUS K50IJ",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
* BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
|
||||
|
|
|
@ -397,6 +397,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
|||
union acpi_object *out_obj;
|
||||
u8 uuid[16];
|
||||
u32 errors;
|
||||
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||
|
||||
if (!context)
|
||||
return AE_ERROR;
|
||||
|
@ -419,16 +420,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
|||
in_params[3].buffer.length = context->cap.length;
|
||||
in_params[3].buffer.pointer = context->cap.pointer;
|
||||
|
||||
status = acpi_evaluate_object(handle, "_OSC", &input, &context->ret);
|
||||
status = acpi_evaluate_object(handle, "_OSC", &input, &output);
|
||||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
|
||||
/* return buffer should have the same length as cap buffer */
|
||||
if (context->ret.length != context->cap.length)
|
||||
if (!output.length)
|
||||
return AE_NULL_OBJECT;
|
||||
|
||||
out_obj = context->ret.pointer;
|
||||
if (out_obj->type != ACPI_TYPE_BUFFER) {
|
||||
out_obj = output.pointer;
|
||||
if (out_obj->type != ACPI_TYPE_BUFFER
|
||||
|| out_obj->buffer.length != context->cap.length) {
|
||||
acpi_print_osc_error(handle, context,
|
||||
"_OSC evaluation returned wrong type");
|
||||
status = AE_TYPE;
|
||||
|
@ -457,11 +458,20 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
|||
goto out_kfree;
|
||||
}
|
||||
out_success:
|
||||
return AE_OK;
|
||||
context->ret.length = out_obj->buffer.length;
|
||||
context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
|
||||
if (!context->ret.pointer) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto out_kfree;
|
||||
}
|
||||
memcpy(context->ret.pointer, out_obj->buffer.pointer,
|
||||
context->ret.length);
|
||||
status = AE_OK;
|
||||
|
||||
out_kfree:
|
||||
kfree(context->ret.pointer);
|
||||
context->ret.pointer = NULL;
|
||||
kfree(output.pointer);
|
||||
if (status != AE_OK)
|
||||
context->ret.pointer = NULL;
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_run_osc);
|
||||
|
@ -888,6 +898,8 @@ static int __init acpi_bus_init(void)
|
|||
goto error1;
|
||||
}
|
||||
|
||||
acpi_early_processor_set_pdc();
|
||||
|
||||
/*
|
||||
* Maybe EC region is required at bus_scan/acpi_get_devices. So it
|
||||
* is necessary to enable it as early as possible.
|
||||
|
|
|
@ -916,6 +916,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
|
|||
/* MSI EC needs special treatment, enable it */
|
||||
static int ec_flag_msi(const struct dmi_system_id *id)
|
||||
{
|
||||
printk(KERN_DEBUG PREFIX "Detected MSI hardware, enabling workarounds.\n");
|
||||
EC_FLAGS_MSI = 1;
|
||||
EC_FLAGS_VALIDATE_ECDT = 1;
|
||||
return 0;
|
||||
|
@ -928,8 +929,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
|
|||
DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL},
|
||||
{
|
||||
ec_flag_msi, "MSI hardware", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star"),
|
||||
DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star") }, NULL},
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star")}, NULL},
|
||||
{
|
||||
ec_flag_msi, "MSI hardware", {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star")}, NULL},
|
||||
{
|
||||
ec_flag_msi, "MSI hardware", {
|
||||
DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL},
|
||||
{
|
||||
ec_validate_ecdt, "ASUS hardware", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
|
||||
|
|
|
@ -43,6 +43,7 @@ int acpi_power_transition(struct acpi_device *device, int state);
|
|||
extern int acpi_power_nocheck;
|
||||
|
||||
int acpi_wakeup_device_init(void);
|
||||
void acpi_early_processor_set_pdc(void);
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Embedded Controller
|
||||
|
|
|
@ -124,29 +124,6 @@ static const struct file_operations acpi_processor_info_fops = {
|
|||
|
||||
DEFINE_PER_CPU(struct acpi_processor *, processors);
|
||||
struct acpi_processor_errata errata __read_mostly;
|
||||
static int set_no_mwait(const struct dmi_system_id *id)
|
||||
{
|
||||
printk(KERN_NOTICE PREFIX "%s detected - "
|
||||
"disabling mwait for CPU C-states\n", id->ident);
|
||||
idle_nomwait = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
|
||||
{
|
||||
set_no_mwait, "IFL91 board", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
|
||||
{
|
||||
set_no_mwait, "Extensa 5220", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
|
||||
{},
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Errata Handling
|
||||
|
@ -276,45 +253,6 @@ static int acpi_processor_errata(struct acpi_processor *pr)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Common ACPI processor functions
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* _PDC is required for a BIOS-OS handshake for most of the newer
|
||||
* ACPI processor features.
|
||||
*/
|
||||
static int acpi_processor_set_pdc(struct acpi_processor *pr)
|
||||
{
|
||||
struct acpi_object_list *pdc_in = pr->pdc;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
if (!pdc_in)
|
||||
return status;
|
||||
if (idle_nomwait) {
|
||||
/*
|
||||
* If mwait is disabled for CPU C-states, the C2C3_FFH access
|
||||
* mode will be disabled in the parameter of _PDC object.
|
||||
* Of course C1_FFH access mode will also be disabled.
|
||||
*/
|
||||
union acpi_object *obj;
|
||||
u32 *buffer = NULL;
|
||||
|
||||
obj = pdc_in->pointer;
|
||||
buffer = (u32 *)(obj->buffer.pointer);
|
||||
buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
|
||||
|
||||
}
|
||||
status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Could not evaluate _PDC, using legacy perf. control...\n"));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -825,9 +763,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
|
|||
}
|
||||
|
||||
/* _PDC call should be done before doing anything else (if reqd.). */
|
||||
arch_acpi_processor_init_pdc(pr);
|
||||
acpi_processor_set_pdc(pr);
|
||||
arch_acpi_processor_cleanup_pdc(pr);
|
||||
acpi_processor_set_pdc(pr->handle);
|
||||
|
||||
#ifdef CONFIG_CPU_FREQ
|
||||
acpi_processor_ppc_has_changed(pr, 0);
|
||||
|
@ -1145,11 +1081,6 @@ static int __init acpi_processor_init(void)
|
|||
if (!acpi_processor_dir)
|
||||
return -ENOMEM;
|
||||
#endif
|
||||
/*
|
||||
* Check whether the system is DMI table. If yes, OSPM
|
||||
* should not use mwait for CPU-states.
|
||||
*/
|
||||
dmi_check_system(processor_idle_dmi_table);
|
||||
result = cpuidle_register_driver(&acpi_idle_driver);
|
||||
if (result < 0)
|
||||
goto out_proc;
|
||||
|
|
165
drivers/acpi/processor_pdc.c
Normal file
165
drivers/acpi/processor_pdc.c
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Intel Corporation
|
||||
* Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* Alex Chiang <achiang@hp.com>
|
||||
* - Unified x86/ia64 implementations
|
||||
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
|
||||
* - Added _PDC for platforms with Intel CPUs
|
||||
*/
|
||||
#include <linux/dmi.h>
|
||||
|
||||
#include <acpi/acpi_drivers.h>
|
||||
#include <acpi/processor.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
|
||||
ACPI_MODULE_NAME("processor_pdc");
|
||||
|
||||
static int set_no_mwait(const struct dmi_system_id *id)
|
||||
{
|
||||
printk(KERN_NOTICE PREFIX "%s detected - "
|
||||
"disabling mwait for CPU C-states\n", id->ident);
|
||||
idle_nomwait = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
|
||||
{
|
||||
set_no_mwait, "IFL91 board", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
|
||||
{
|
||||
set_no_mwait, "Extensa 5220", {
|
||||
DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
|
||||
{},
|
||||
};
|
||||
|
||||
static void acpi_set_pdc_bits(u32 *buf)
|
||||
{
|
||||
buf[0] = ACPI_PDC_REVISION_ID;
|
||||
buf[1] = 1;
|
||||
|
||||
/* Enable coordination with firmware's _TSD info */
|
||||
buf[2] = ACPI_PDC_SMP_T_SWCOORD;
|
||||
|
||||
/* Twiddle arch-specific bits needed for _PDC */
|
||||
arch_acpi_set_pdc_bits(buf);
|
||||
}
|
||||
|
||||
static struct acpi_object_list *acpi_processor_alloc_pdc(void)
|
||||
{
|
||||
struct acpi_object_list *obj_list;
|
||||
union acpi_object *obj;
|
||||
u32 *buf;
|
||||
|
||||
/* allocate and initialize pdc. It will be used later. */
|
||||
obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
|
||||
if (!obj_list) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
|
||||
if (!obj) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = kmalloc(12, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
printk(KERN_ERR "Memory allocation error\n");
|
||||
kfree(obj);
|
||||
kfree(obj_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
acpi_set_pdc_bits(buf);
|
||||
|
||||
obj->type = ACPI_TYPE_BUFFER;
|
||||
obj->buffer.length = 12;
|
||||
obj->buffer.pointer = (u8 *) buf;
|
||||
obj_list->count = 1;
|
||||
obj_list->pointer = obj;
|
||||
|
||||
return obj_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* _PDC is required for a BIOS-OS handshake for most of the newer
|
||||
* ACPI processor features.
|
||||
*/
|
||||
static int
|
||||
acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
if (idle_nomwait) {
|
||||
/*
|
||||
* If mwait is disabled for CPU C-states, the C2C3_FFH access
|
||||
* mode will be disabled in the parameter of _PDC object.
|
||||
* Of course C1_FFH access mode will also be disabled.
|
||||
*/
|
||||
union acpi_object *obj;
|
||||
u32 *buffer = NULL;
|
||||
|
||||
obj = pdc_in->pointer;
|
||||
buffer = (u32 *)(obj->buffer.pointer);
|
||||
buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
|
||||
|
||||
}
|
||||
status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Could not evaluate _PDC, using legacy perf. control.\n"));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void acpi_processor_set_pdc(acpi_handle handle)
|
||||
{
|
||||
struct acpi_object_list *obj_list;
|
||||
|
||||
if (arch_has_acpi_pdc() == false)
|
||||
return;
|
||||
|
||||
obj_list = acpi_processor_alloc_pdc();
|
||||
if (!obj_list)
|
||||
return;
|
||||
|
||||
acpi_processor_eval_pdc(handle, obj_list);
|
||||
|
||||
kfree(obj_list->pointer->buffer.pointer);
|
||||
kfree(obj_list->pointer);
|
||||
kfree(obj_list);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_processor_set_pdc);
|
||||
|
||||
static acpi_status
|
||||
early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
|
||||
{
|
||||
acpi_processor_set_pdc(handle);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
void acpi_early_processor_set_pdc(void)
|
||||
{
|
||||
/*
|
||||
* Check whether the system is DMI table. If yes, OSPM
|
||||
* should not use mwait for CPU-states.
|
||||
*/
|
||||
dmi_check_system(processor_idle_dmi_table);
|
||||
|
||||
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
early_init_pdc, NULL, NULL, NULL);
|
||||
}
|
|
@ -40,7 +40,6 @@ config ATA_VERBOSE_ERROR
|
|||
config ATA_ACPI
|
||||
bool "ATA ACPI Support"
|
||||
depends on ACPI && PCI
|
||||
select ACPI_DOCK
|
||||
default y
|
||||
help
|
||||
This option adds support for ATA-related ACPI objects.
|
||||
|
|
|
@ -464,4 +464,16 @@ config TOSHIBA_BT_RFKILL
|
|||
|
||||
If you have a modern Toshiba laptop with a Bluetooth and an
|
||||
RFKill switch (such as the Portege R500), say Y.
|
||||
|
||||
config ACPI_CMPC
|
||||
tristate "CMPC Laptop Extras"
|
||||
depends on X86 && ACPI
|
||||
select INPUT
|
||||
select BACKLIGHT_CLASS_DEVICE
|
||||
default n
|
||||
help
|
||||
Support for Intel Classmate PC ACPI devices, including some
|
||||
keys as input device, backlight device, tablet and accelerometer
|
||||
devices.
|
||||
|
||||
endif # X86_PLATFORM_DEVICES
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
|
||||
obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
|
||||
obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
|
||||
obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o
|
||||
obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
|
||||
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
|
||||
obj-$(CONFIG_DELL_WMI) += dell-wmi.o
|
||||
|
|
|
@ -96,9 +96,6 @@ struct acer_quirks {
|
|||
MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
|
||||
MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3");
|
||||
|
||||
/* Temporary workaround until the WMI sysfs interface goes in */
|
||||
MODULE_ALIAS("dmi:*:*Acer*:*:");
|
||||
|
||||
/*
|
||||
* Interface capability flags
|
||||
*/
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
#undef START_IN_KERNEL_MODE
|
||||
|
||||
#define DRV_VER "0.5.20"
|
||||
#define DRV_VER "0.5.22"
|
||||
|
||||
/*
|
||||
* According to the Atom N270 datasheet,
|
||||
|
@ -156,19 +156,25 @@ static const struct bios_settings_t bios_tbl[] = {
|
|||
{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
/* Acer 1410 */
|
||||
{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
/* special BIOS / other */
|
||||
{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
/* Acer 1810xx */
|
||||
{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
/* Gateway */
|
||||
{"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58,
|
||||
{0x10, 0x0f, 0x00} },
|
||||
{"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58,
|
||||
{0x10, 0x0f, 0x00} },
|
||||
{"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58,
|
||||
{0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
{"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x10, 0x0f, 0x00} },
|
||||
/* Packard Bell */
|
||||
{"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} },
|
||||
{"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
{"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
|
||||
/* pewpew-terminator */
|
||||
{"", "", "", 0, 0, {0, 0, 0} }
|
||||
};
|
||||
|
@ -486,13 +492,26 @@ static struct platform_driver acerhdf_driver = {
|
|||
.remove = acerhdf_remove,
|
||||
};
|
||||
|
||||
/* checks if str begins with start */
|
||||
static int str_starts_with(const char *str, const char *start)
|
||||
{
|
||||
unsigned long str_len = 0, start_len = 0;
|
||||
|
||||
str_len = strlen(str);
|
||||
start_len = strlen(start);
|
||||
|
||||
if (str_len >= start_len &&
|
||||
!strncmp(str, start, start_len))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check hardware */
|
||||
static int acerhdf_check_hardware(void)
|
||||
{
|
||||
char const *vendor, *version, *product;
|
||||
int i;
|
||||
unsigned long prod_len = 0;
|
||||
const struct bios_settings_t *bt = NULL;
|
||||
|
||||
/* get BIOS data */
|
||||
vendor = dmi_get_system_info(DMI_SYS_VENDOR);
|
||||
|
@ -514,20 +533,20 @@ static int acerhdf_check_hardware(void)
|
|||
kernelmode = 0;
|
||||
}
|
||||
|
||||
prod_len = strlen(product);
|
||||
|
||||
if (verbose)
|
||||
pr_info("BIOS info: %s %s, product: %s\n",
|
||||
vendor, version, product);
|
||||
|
||||
/* search BIOS version and vendor in BIOS settings table */
|
||||
for (i = 0; bios_tbl[i].version[0]; i++) {
|
||||
if (strlen(bios_tbl[i].product) >= prod_len &&
|
||||
!strncmp(bios_tbl[i].product, product,
|
||||
strlen(bios_tbl[i].product)) &&
|
||||
!strcmp(bios_tbl[i].vendor, vendor) &&
|
||||
!strcmp(bios_tbl[i].version, version)) {
|
||||
bios_cfg = &bios_tbl[i];
|
||||
for (bt = bios_tbl; bt->vendor[0]; bt++) {
|
||||
/*
|
||||
* check if actual hardware BIOS vendor, product and version
|
||||
* IDs start with the strings of BIOS table entry
|
||||
*/
|
||||
if (str_starts_with(vendor, bt->vendor) &&
|
||||
str_starts_with(product, bt->product) &&
|
||||
str_starts_with(version, bt->version)) {
|
||||
bios_cfg = bt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -640,9 +659,14 @@ static void __exit acerhdf_exit(void)
|
|||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Peter Feuerer");
|
||||
MODULE_DESCRIPTION("Aspire One temperature and fan driver");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:*:");
|
||||
MODULE_ALIAS("dmi:*:*Gateway*:*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1410*:");
|
||||
MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1810*:");
|
||||
MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:");
|
||||
MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMU*:");
|
||||
|
||||
module_init(acerhdf_init);
|
||||
module_exit(acerhdf_exit);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
#include <acpi/acpi_bus.h>
|
||||
|
@ -513,26 +514,12 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
|
|||
return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
|
||||
}
|
||||
|
||||
/*
|
||||
* We write our info in page, we begin at offset off and cannot write more
|
||||
* than count bytes. We set eof to 1 if we handle those 2 values. We return the
|
||||
* number of bytes written in page
|
||||
*/
|
||||
static int
|
||||
proc_read_info(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int asus_info_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
int len = 0;
|
||||
int temp;
|
||||
char buf[16]; /* enough for all info */
|
||||
/*
|
||||
* We use the easy way, we don't care of off and count,
|
||||
* so we don't set eof to 1
|
||||
*/
|
||||
|
||||
len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
|
||||
len += sprintf(page + len, "Model reference : %s\n",
|
||||
hotk->methods->name);
|
||||
seq_printf(m, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
|
||||
seq_printf(m, "Model reference : %s\n", hotk->methods->name);
|
||||
/*
|
||||
* The SFUN method probably allows the original driver to get the list
|
||||
* of features supported by a given model. For now, 0x0100 or 0x0800
|
||||
|
@ -540,8 +527,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
|
|||
* The significance of others is yet to be found.
|
||||
*/
|
||||
if (read_acpi_int(hotk->handle, "SFUN", &temp))
|
||||
len +=
|
||||
sprintf(page + len, "SFUN value : 0x%04x\n", temp);
|
||||
seq_printf(m, "SFUN value : 0x%04x\n", temp);
|
||||
/*
|
||||
* Another value for userspace: the ASYM method returns 0x02 for
|
||||
* battery low and 0x04 for battery critical, its readings tend to be
|
||||
|
@ -550,30 +536,34 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
|
|||
* silently ignored.
|
||||
*/
|
||||
if (read_acpi_int(hotk->handle, "ASYM", &temp))
|
||||
len +=
|
||||
sprintf(page + len, "ASYM value : 0x%04x\n", temp);
|
||||
seq_printf(m, "ASYM value : 0x%04x\n", temp);
|
||||
if (asus_info) {
|
||||
snprintf(buf, 16, "%d", asus_info->length);
|
||||
len += sprintf(page + len, "DSDT length : %s\n", buf);
|
||||
snprintf(buf, 16, "%d", asus_info->checksum);
|
||||
len += sprintf(page + len, "DSDT checksum : %s\n", buf);
|
||||
snprintf(buf, 16, "%d", asus_info->revision);
|
||||
len += sprintf(page + len, "DSDT revision : %s\n", buf);
|
||||
snprintf(buf, 7, "%s", asus_info->oem_id);
|
||||
len += sprintf(page + len, "OEM id : %s\n", buf);
|
||||
snprintf(buf, 9, "%s", asus_info->oem_table_id);
|
||||
len += sprintf(page + len, "OEM table id : %s\n", buf);
|
||||
snprintf(buf, 16, "%x", asus_info->oem_revision);
|
||||
len += sprintf(page + len, "OEM revision : 0x%s\n", buf);
|
||||
snprintf(buf, 5, "%s", asus_info->asl_compiler_id);
|
||||
len += sprintf(page + len, "ASL comp vendor id : %s\n", buf);
|
||||
snprintf(buf, 16, "%x", asus_info->asl_compiler_revision);
|
||||
len += sprintf(page + len, "ASL comp revision : 0x%s\n", buf);
|
||||
seq_printf(m, "DSDT length : %d\n", asus_info->length);
|
||||
seq_printf(m, "DSDT checksum : %d\n", asus_info->checksum);
|
||||
seq_printf(m, "DSDT revision : %d\n", asus_info->revision);
|
||||
seq_printf(m, "OEM id : %.*s\n", ACPI_OEM_ID_SIZE, asus_info->oem_id);
|
||||
seq_printf(m, "OEM table id : %.*s\n", ACPI_OEM_TABLE_ID_SIZE, asus_info->oem_table_id);
|
||||
seq_printf(m, "OEM revision : 0x%x\n", asus_info->oem_revision);
|
||||
seq_printf(m, "ASL comp vendor id : %.*s\n", ACPI_NAME_SIZE, asus_info->asl_compiler_id);
|
||||
seq_printf(m, "ASL comp revision : 0x%x\n", asus_info->asl_compiler_revision);
|
||||
}
|
||||
|
||||
return len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int asus_info_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, asus_info_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations asus_info_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = asus_info_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* /proc handlers
|
||||
* We write our info in page, we begin at offset off and cannot write more
|
||||
|
@ -639,34 +629,48 @@ write_led(const char __user *buffer, unsigned long count,
|
|||
/*
|
||||
* Proc handlers for MLED
|
||||
*/
|
||||
static int
|
||||
proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int mled_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n",
|
||||
read_led(hotk->methods->mled_status, MLED_ON));
|
||||
seq_printf(m, "%d\n", read_led(hotk->methods->mled_status, MLED_ON));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_mled(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int mled_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mled_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t mled_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
|
||||
}
|
||||
|
||||
static const struct file_operations mled_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = mled_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = mled_proc_write,
|
||||
};
|
||||
|
||||
/*
|
||||
* Proc handlers for LED display
|
||||
*/
|
||||
static int
|
||||
proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int ledd_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "0x%08x\n", hotk->ledd_status);
|
||||
seq_printf(m, "0x%08x\n", hotk->ledd_status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_ledd(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int ledd_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ledd_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t ledd_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
int rv, value;
|
||||
|
||||
|
@ -682,61 +686,104 @@ proc_write_ledd(struct file *file, const char __user *buffer,
|
|||
return rv;
|
||||
}
|
||||
|
||||
static const struct file_operations ledd_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ledd_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = ledd_proc_write,
|
||||
};
|
||||
|
||||
/*
|
||||
* Proc handlers for WLED
|
||||
*/
|
||||
static int
|
||||
proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int wled_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n",
|
||||
read_led(hotk->methods->wled_status, WLED_ON));
|
||||
seq_printf(m, "%d\n", read_led(hotk->methods->wled_status, WLED_ON));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_wled(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int wled_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, wled_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t wled_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
|
||||
}
|
||||
|
||||
static const struct file_operations wled_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = wled_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = wled_proc_write,
|
||||
};
|
||||
|
||||
/*
|
||||
* Proc handlers for Bluetooth
|
||||
*/
|
||||
static int
|
||||
proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int bluetooth_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n", read_led(hotk->methods->bt_status, BT_ON));
|
||||
seq_printf(m, "%d\n", read_led(hotk->methods->bt_status, BT_ON));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_bluetooth(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int bluetooth_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, bluetooth_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t bluetooth_proc_write(struct file *file,
|
||||
const char __user *buffer, size_t count, loff_t *pos)
|
||||
{
|
||||
/* Note: mt_bt_switch controls both internal Bluetooth adapter's
|
||||
presence and its LED */
|
||||
return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
|
||||
}
|
||||
|
||||
static const struct file_operations bluetooth_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = bluetooth_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = bluetooth_proc_write,
|
||||
};
|
||||
|
||||
/*
|
||||
* Proc handlers for TLED
|
||||
*/
|
||||
static int
|
||||
proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int tled_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n",
|
||||
read_led(hotk->methods->tled_status, TLED_ON));
|
||||
seq_printf(m, "%d\n", read_led(hotk->methods->tled_status, TLED_ON));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_tled(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int tled_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, tled_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t tled_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
|
||||
}
|
||||
|
||||
static const struct file_operations tled_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = tled_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = tled_proc_write,
|
||||
};
|
||||
|
||||
static int get_lcd_state(void)
|
||||
{
|
||||
int lcd = 0;
|
||||
|
@ -829,16 +876,19 @@ static int set_lcd_state(int value)
|
|||
|
||||
}
|
||||
|
||||
static int
|
||||
proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int lcd_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n", get_lcd_state());
|
||||
seq_printf(m, "%d\n", get_lcd_state());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_lcd(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int lcd_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, lcd_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t lcd_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
int rv, value;
|
||||
|
||||
|
@ -848,6 +898,15 @@ proc_write_lcd(struct file *file, const char __user *buffer,
|
|||
return rv;
|
||||
}
|
||||
|
||||
static const struct file_operations lcd_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = lcd_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = lcd_proc_write,
|
||||
};
|
||||
|
||||
static int read_brightness(struct backlight_device *bd)
|
||||
{
|
||||
int value;
|
||||
|
@ -907,16 +966,19 @@ static int set_brightness_status(struct backlight_device *bd)
|
|||
return set_brightness(bd->props.brightness);
|
||||
}
|
||||
|
||||
static int
|
||||
proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int brn_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return sprintf(page, "%d\n", read_brightness(NULL));
|
||||
seq_printf(m, "%d\n", read_brightness(NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
proc_write_brn(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static int brn_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, brn_proc_show, NULL);
|
||||
}
|
||||
|
||||
static ssize_t brn_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
int rv, value;
|
||||
|
||||
|
@ -929,6 +991,15 @@ proc_write_brn(struct file *file, const char __user *buffer,
|
|||
return rv;
|
||||
}
|
||||
|
||||
static const struct file_operations brn_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = brn_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = brn_proc_write,
|
||||
};
|
||||
|
||||
static void set_display(int value)
|
||||
{
|
||||
/* no sanity check needed for now */
|
||||
|
@ -942,9 +1013,7 @@ static void set_display(int value)
|
|||
* Now, *this* one could be more user-friendly, but so far, no-one has
|
||||
* complained. The significance of bits is the same as in proc_write_disp()
|
||||
*/
|
||||
static int
|
||||
proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
|
||||
void *data)
|
||||
static int disp_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
|
@ -952,7 +1021,13 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
|
|||
printk(KERN_WARNING
|
||||
"Asus ACPI: Error reading display status\n");
|
||||
value &= 0x07; /* needed for some models, shouldn't hurt others */
|
||||
return sprintf(page, "%d\n", value);
|
||||
seq_printf(m, "%d\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int disp_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, disp_proc_show, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -961,9 +1036,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
|
|||
* (bitwise) of these will suffice. I never actually tested 3 displays hooked
|
||||
* up simultaneously, so be warned. See the acpi4asus README for more info.
|
||||
*/
|
||||
static int
|
||||
proc_write_disp(struct file *file, const char __user *buffer,
|
||||
unsigned long count, void *data)
|
||||
static ssize_t disp_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
int rv, value;
|
||||
|