Commit 39804b20 authored by Linus Torvalds's avatar Linus Torvalds

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: (77 commits)
  ACPI: Populate /sys/firmware/acpi/tables/
  ACPI: create CONFIG_ACPI_DEBUG_FUNC_TRACE
  ACPI: update ACPI proc I/F removal schedule
  ACPI: update feature-removal-schedule.txt, /sys/firmware/acpi/namespace is gone
  ACPI: export ACPI events via acpi_mc_group multicast group
  ACPI: fix empty macros found by -Wextra
  ACPI: drivers/acpi/pci_link.c: lower printk severity
  sony-laptop: Fix event reading in sony-laptop
  sony-laptop: Add Vaio FE to the special init sequence
  sony-laptop: Make the driver use MSC_SCAN and a setkeycode and getkeycode key table.
  sony-laptop: Invoke _INI for SNC devices that provide it
  sony-laptop: Add support for recent Vaios Fn keys (C series for now)
  sony-laptop: map wireless switch events to KEY_WLAN
  sony-laptop: add new SNC handlers
  ACPI: thinkpad-acpi: add locking to brightness subdriver
  ACPI: thinkpad-acpi: bump up version to 0.15
  ACPI: thinkpad-acpi: make EC-based thermal readings non-experimental
  ACPI: thinkpad-acpi: make sure DSDT TMPx readings don't return +128
  ACPI: thinkpad-acpi: react to Lenovo ThinkPad differences in hot key
  ACPI: thinkpad-acpi: allow use of CMOS NVRAM for brightness control
  ...
parents 83e2b5ef 17c50b41
......@@ -180,24 +180,11 @@ Who: Adrian Bunk <bunk@stusta.de>
---------------------------
What: /sys/firmware/acpi/namespace
When: 2.6.21
Why: The ACPI namespace is effectively the symbol list for
the BIOS. The device names are completely arbitrary
and have no place being exposed to user-space.
For those interested in the BIOS ACPI namespace,
the BIOS can be extracted and disassembled with acpidump
and iasl as documented in the pmtools package here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils
Who: Len Brown <len.brown@intel.com>
---------------------------
What: ACPI procfs interface
When: July 2007
Why: After ACPI sysfs conversion, ACPI attributes will be duplicated
in sysfs and the ACPI procfs interface should be removed.
When: July 2008
Why: ACPI sysfs conversion should be finished by January 2008.
ACPI procfs interface will be removed in July 2008 so that
there is enough time for the user space to catch up.
Who: Zhang Rui <rui.zhang@intel.com>
---------------------------
......
This diff is collapsed.
......@@ -225,15 +225,15 @@ T: git kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
S: Supported
ACPI BATTERY DRIVERS
P: Vladimir P. Lebedev
M: vladimir.p.lebedev@intel.com
P: Alexey Starikovskiy
M: astarikovskiy@suse.de
L: linux-acpi@vger.kernel.org
W: http://acpi.sourceforge.net/
S: Supported
ACPI EC DRIVER
P: Alexey Starikovskiy
M: alexey.y.starikovskiy@linux.intel.com
M: astarikovskiy@suse.de
L: linux-acpi@vger.kernel.org
W: http://acpi.sourceforge.net/
S: Supported
......
......@@ -984,14 +984,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
},
},
{
.callback = force_acpi_ht,
.ident = "DELL GX240",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
},
},
{
.callback = force_acpi_ht,
.ident = "HP VISUALIZE NT Workstation",
......
......@@ -665,8 +665,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
data->max_freq = perf->states[0].core_frequency * 1000;
/* table init */
for (i=0; i<perf->state_count; i++) {
if (i>0 && perf->states[i].core_frequency ==
perf->states[i-1].core_frequency)
if (i>0 && perf->states[i].core_frequency >=
data->freq_table[valid_states-1].frequency / 1000)
continue;
data->freq_table[valid_states].index = i;
......
......@@ -2,16 +2,12 @@
# ACPI Configuration
#
menu "ACPI (Advanced Configuration and Power Interface) Support"
menuconfig ACPI
bool "ACPI Support (Advanced Configuration and Power Interface) Support"
depends on !X86_NUMAQ
depends on !X86_VISWS
depends on !IA64_HP_SIM
depends on IA64 || X86
depends on PM
config ACPI
bool "ACPI Support"
depends on IA64 || X86
depends on PCI
depends on PM
select PNP
......@@ -49,7 +45,6 @@ if ACPI
config ACPI_SLEEP
bool "Sleep States"
depends on X86 && (!SMP || SUSPEND_SMP)
depends on PM
default y
---help---
This option adds support for ACPI suspend states.
......@@ -82,7 +77,6 @@ config ACPI_SLEEP_PROC_SLEEP
config ACPI_PROCFS
bool "Procfs interface (deprecated)"
depends on ACPI
default y
---help---
The Procfs interface for ACPI is made optional for backward compatibility.
......@@ -124,7 +118,7 @@ config ACPI_BUTTON
config ACPI_VIDEO
tristate "Video"
depends on X86 && BACKLIGHT_CLASS_DEVICE
depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
help
This driver implement the ACPI Extensions For Display Adapters
for integrated graphics devices on motherboard, as specified in
......@@ -280,6 +274,14 @@ config ACPI_DEBUG
of verbosity. Saying Y enables these statements. This will increase
your kernel size by around 50K.
config ACPI_DEBUG_FUNC_TRACE
bool "Additionally enable ACPI function tracing"
default n
depends on ACPI_DEBUG
help
ACPI Debug Statements slow down ACPI processing. Function trace
is about half of the penalty and is rarely useful.
config ACPI_EC
bool
default y
......@@ -330,7 +332,6 @@ config ACPI_CONTAINER
config ACPI_HOTPLUG_MEMORY
tristate "Memory Hotplug"
depends on ACPI
depends on MEMORY_HOTPLUG
default n
help
......@@ -359,5 +360,3 @@ config ACPI_SBS
to today's ACPI "Control Method" battery.
endif # ACPI
endmenu
This diff is collapsed.
......@@ -288,6 +288,11 @@ static int bay_add(acpi_handle handle, int id)
new_bay->pdev = pdev;
platform_set_drvdata(pdev, new_bay);
/*
* we want the bay driver to be able to send uevents
*/
pdev->dev.uevent_suppress = 0;
if (acpi_bay_add_fs(new_bay)) {
platform_device_unregister(new_bay->pdev);
goto bay_add_err;
......@@ -328,18 +333,12 @@ static void bay_notify(acpi_handle handle, u32 event, void *data)
{
struct bay *bay_dev = (struct bay *)data;
struct device *dev = &bay_dev->pdev->dev;
char event_string[12];
char *envp[] = { event_string, NULL };
bay_dprintk(handle, "Bay event");
switch(event) {
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
case ACPI_NOTIFY_EJECT_REQUEST:
kobject_uevent(&dev->kobj, KOBJ_CHANGE);
break;
default:
printk(KERN_ERR PREFIX "Bay: unknown event %d\n", event);
}
sprintf(event_string, "BAY_EVENT=%d\n", event);
kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
}
static acpi_status
......
......@@ -292,6 +292,10 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
if (!device)
return -EINVAL;
if (acpi_bus_generate_genetlink_event(device, type, data))
printk(KERN_WARNING PREFIX
"Failed to generate an ACPI event via genetlink!\n");
/* drop event on the floor if no one's listening */
if (!event_is_open)
return 0;
......
......@@ -40,8 +40,15 @@ MODULE_AUTHOR("Kristen Carlson Accardi");
MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_DESCRIPTION);
MODULE_LICENSE("GPL");
static int immediate_undock = 1;
module_param(immediate_undock, bool, 0644);
MODULE_PARM_DESC(immediate_undock, "1 (default) will cause the driver to "
"undock immediately when the undock button is pressed, 0 will cause"
" the driver to wait for userspace to write the undock sysfs file "
" before undocking");
static struct atomic_notifier_head dock_notifier_list;
static struct platform_device dock_device;
static struct platform_device *dock_device;
static char dock_device_name[] = "dock";
struct dock_station {
......@@ -63,6 +70,7 @@ struct dock_dependent_device {
};
#define DOCK_DOCKING 0x00000001
#define DOCK_UNDOCKING 0x00000002
#define DOCK_EVENT 3
#define UNDOCK_EVENT 2
......@@ -327,12 +335,20 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
static void dock_event(struct dock_station *ds, u32 event, int num)
{
struct device *dev = &dock_device.dev;
struct device *dev = &dock_device->dev;
char event_string[7];
char *envp[] = { event_string, NULL };
if (num == UNDOCK_EVENT)
sprintf(event_string, "UNDOCK");
else
sprintf(event_string, "DOCK");
/*
* Indicate that the status of the dock station has
* changed.
*/
kobject_uevent(&dev->kobj, KOBJ_CHANGE);
kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
}
/**
......@@ -380,12 +396,11 @@ static void handle_dock(struct dock_station *ds, int dock)
union acpi_object arg;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer);
obj = name_buffer.pointer;
printk(KERN_INFO PREFIX "%s\n", dock ? "docking" : "undocking");
printk(KERN_INFO PREFIX "%s - %s\n",
(char *)name_buffer.pointer, dock ? "docking" : "undocking");
/* _DCK method has one argument */
arg_list.count = 1;
......@@ -394,7 +409,8 @@ static void handle_dock(struct dock_station *ds, int dock)
arg.integer.value = dock;
status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer);
if (ACPI_FAILURE(status))
pr_debug("%s: failed to execute _DCK\n", obj->string.pointer);
printk(KERN_ERR PREFIX "%s - failed to execute _DCK\n",
(char *)name_buffer.pointer);
kfree(buffer.pointer);
kfree(name_buffer.pointer);
}
......@@ -420,6 +436,16 @@ static inline void complete_dock(struct dock_station *ds)
ds->last_dock_time = jiffies;
}
static inline void begin_undock(struct dock_station *ds)
{
ds->flags |= DOCK_UNDOCKING;
}
static inline void complete_undock(struct dock_station *ds)
{
ds->flags &= ~(DOCK_UNDOCKING);
}
/**
* dock_in_progress - see if we are in the middle of handling a dock event
* @ds: the dock station
......@@ -550,7 +576,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
printk(KERN_ERR PREFIX "Unable to undock!\n");
return -EBUSY;
}
complete_undock(ds);
return 0;
}
......@@ -594,7 +620,11 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
* to the driver who wish to hotplug.
*/
case ACPI_NOTIFY_EJECT_REQUEST:
handle_eject_request(ds, event);
begin_undock(ds);
if (immediate_undock)
handle_eject_request(ds, event);
else
dock_event(ds, event, UNDOCK_EVENT);
break;
default:
printk(KERN_ERR PREFIX "Unknown dock event %d\n", event);
......@@ -652,6 +682,17 @@ static ssize_t show_docked(struct device *dev,
}
DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
/*
* show_flags - read method for flags file in sysfs
*/
static ssize_t show_flags(struct device *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
}
DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL);
/*
* write_undock - write method for "undock" file in sysfs
*/
......@@ -675,16 +716,15 @@ static ssize_t show_dock_uid(struct device *dev,
struct device_attribute *attr, char *buf)
{
unsigned long lbuf;
acpi_status status = acpi_evaluate_integer(dock_station->handle, "_UID", NULL, &lbuf);
if(ACPI_FAILURE(status)) {
acpi_status status = acpi_evaluate_integer(dock_station->handle,
"_UID", NULL, &lbuf);
if (ACPI_FAILURE(status))
return 0;
}
return snprintf(buf, PAGE_SIZE, "%lx\n", lbuf);
}
DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
/**
* dock_add - add a new dock station
* @handle: the dock station handle
......@@ -711,33 +751,53 @@ static int dock_add(acpi_handle handle)
ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
/* initialize platform device stuff */
dock_device.name = dock_device_name;
ret = platform_device_register(&dock_device);
dock_device =
platform_device_register_simple(dock_device_name, 0, NULL, 0);
if (IS_ERR(dock_device)) {
kfree(dock_station);
dock_station = NULL;
return PTR_ERR(dock_device);
}
/* we want the dock device to send uevents */
dock_device->dev.uevent_suppress = 0;
ret = device_create_file(&dock_device->dev, &dev_attr_docked);
if (ret) {
printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret);
printk("Error %d adding sysfs file\n", ret);
platform_device_unregister(dock_device);
kfree(dock_station);
dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device.dev, &dev_attr_docked);
ret = device_create_file(&dock_device->dev, &dev_attr_undock);
if (ret) {
printk("Error %d adding sysfs file\n", ret);
platform_device_unregister(&dock_device);
device_remove_file(&dock_device->dev, &dev_attr_docked);
platform_device_unregister(dock_device);
kfree(dock_station);
dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device.dev, &dev_attr_undock);
ret = device_create_file(&dock_device->dev, &dev_attr_uid);
if (ret) {
printk("Error %d adding sysfs file\n", ret);
device_remove_file(&dock_device.dev, &dev_attr_docked);
platform_device_unregister(&dock_device);
device_remove_file(&dock_device->dev, &dev_attr_docked);
device_remove_file(&dock_device->dev, &dev_attr_undock);
platform_device_unregister(dock_device);
kfree(dock_station);
dock_station = NULL;
return ret;
}
ret = device_create_file(&dock_device.dev, &dev_attr_uid);
ret = device_create_file(&dock_device->dev, &dev_attr_flags);
if (ret) {
printk("Error %d adding sysfs file\n", ret);
platform_device_unregister(&dock_device);
device_remove_file(&dock_device->dev, &dev_attr_docked);
device_remove_file(&dock_device->dev, &dev_attr_undock);
device_remove_file(&dock_device->dev, &dev_attr_uid);
platform_device_unregister(dock_device);
kfree(dock_station);
dock_station = NULL;
return ret;
}
......@@ -750,6 +810,7 @@ static int dock_add(acpi_handle handle)
dd = alloc_dock_dependent_device(handle);
if (!dd) {
kfree(dock_station);
dock_station = NULL;
ret = -ENOMEM;
goto dock_add_err_unregister;
}
......@@ -773,10 +834,13 @@ static int dock_add(acpi_handle handle)
dock_add_err:
kfree(dd);
dock_add_err_unregister:
device_remove_file(&dock_device.dev, &dev_attr_docked);
device_remove_file(&dock_device.dev, &dev_attr_undock);
platform_device_unregister(&dock_device);
device_remove_file(&dock_device->dev, &dev_attr_docked);
device_remove_file(&dock_device->dev, &dev_attr_undock);
device_remove_file(&dock_device->dev, &dev_attr_uid);
device_remove_file(&dock_device->dev, &dev_attr_flags);
platform_device_unregister(dock_device);
kfree(dock_station);
dock_station = NULL;
return ret;
}
......@@ -804,12 +868,15 @@ static int dock_remove(void)
printk(KERN_ERR "Error removing notify handler\n");
/* cleanup sysfs */
device_remove_file(&dock_device.dev, &dev_attr_docked);
device_remove_file(&dock_device.dev, &dev_attr_undock);
platform_device_unregister(&dock_device);
device_remove_file(&dock_device->dev, &dev_attr_docked);
device_remove_file(&dock_device->dev, &dev_attr_undock);
device_remove_file(&dock_device->dev, &dev_attr_uid);
device_remove_file(&dock_device->dev, &dev_attr_flags);
platform_device_unregister(dock_device);
/* free dock station memory */
kfree(dock_station);
dock_station = NULL;
return 0;
}
......
This diff is collapsed.
......@@ -11,6 +11,8 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <acpi/acpi_drivers.h>
#include <net/netlink.h>
#include <net/genetlink.h>
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("event");
......@@ -48,7 +50,6 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
static int chars_remaining = 0;
static char *ptr;
if (!chars_remaining) {
memset(&event, 0, sizeof(struct acpi_bus_event));
......@@ -106,23 +107,161 @@ static const struct file_operations acpi_system_event_ops = {
.poll = acpi_system_poll_event,
};
#ifdef CONFIG_NET
unsigned int acpi_event_seqnum;
struct acpi_genl_event {
acpi_device_class device_class;
char bus_id[15];
u32 type;
u32 data;
};
/* attributes of acpi_genl_family */
enum {
ACPI_GENL_ATTR_UNSPEC,
ACPI_GENL_ATTR_EVENT, /* ACPI event info needed by user space */
__ACPI_GENL_ATTR_MAX,
};
#define ACPI_GENL_ATTR_MAX (__ACPI_GENL_ATTR_MAX - 1)
/* commands supported by the acpi_genl_family */
enum {
ACPI_GENL_CMD_UNSPEC,
ACPI_GENL_CMD_EVENT, /* kernel->user notifications for ACPI events */
__ACPI_GENL_CMD_MAX,
};
#define ACPI_GENL_CMD_MAX (__ACPI_GENL_CMD_MAX - 1)
#define ACPI_GENL_FAMILY_NAME "acpi_event"
#define ACPI_GENL_VERSION 0x01
#define ACPI_GENL_MCAST_GROUP_NAME "acpi_mc_group"
static struct genl_family acpi_event_genl_family = {
.id = GENL_ID_GENERATE,
.name = ACPI_GENL_FAMILY_NAME,
.version = ACPI_GENL_VERSION,
.maxattr = ACPI_GENL_ATTR_MAX,
};
static struct genl_multicast_group acpi_event_mcgrp = {
.name = ACPI_GENL_MCAST_GROUP_NAME,
};
int acpi_bus_generate_genetlink_event(struct acpi_device *device,
u8 type, int data)
{
struct sk_buff *skb;
struct nlattr *attr;
struct acpi_genl_event *event;
void *msg_header;
int size;
int result;
/* allocate memory */
size = nla_total_size(sizeof(struct acpi_genl_event)) +
nla_total_size(0);
skb = genlmsg_new(size, GFP_ATOMIC);
if (!skb)
return -ENOMEM;
/* add the genetlink message header */
msg_header = genlmsg_put(skb, 0, acpi_event_seqnum++,
&acpi_event_genl_family, 0,
ACPI_GENL_CMD_EVENT);
if (!msg_header) {
nlmsg_free(skb);
return -ENOMEM;
}
/* fill the data */
attr =
nla_reserve(skb, ACPI_GENL_ATTR_EVENT,
sizeof(struct acpi_genl_event));
if (!attr) {
nlmsg_free(skb);
return -EINVAL;
}
event = nla_data(attr);
if (!event) {
nlmsg_free(skb);
return -EINVAL;
}
memset(event, 0, sizeof(struct acpi_genl_event));
strcpy(event->device_class, device->pnp.device_class);
strcpy(event->bus_id, device->dev.bus_id);
event->type = type;
event->data = data;
/* send multicast genetlink message */
result = genlmsg_end(skb, msg_header);
if (result < 0) {
nlmsg_free(skb);
return result;
}
result =
genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
if (result)
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Failed to send a Genetlink message!\n"));
return 0;
}
static int acpi_event_genetlink_init(void)
{
int result;
result = genl_register_family(&acpi_event_genl_family);
if (result)
return result;
result = genl_register_mc_group(&acpi_event_genl_family,
&acpi_event_mcgrp);
if (result)
genl_unregister_family(&acpi_event_genl_family);
return result;
}
#else
int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type,
int data)
{
return 0;
}
static int acpi_event_genetlink_init(void)
{
return -ENODEV;
}
#endif
static int __init acpi_event_init(void)
{
struct proc_dir_entry *entry;
int error = 0;
if (acpi_disabled)
return 0;
/* create genetlink for acpi event */
error = acpi_event_genetlink_init();
if (error)
printk(KERN_WARNING PREFIX
"Failed to create genetlink family for ACPI event\n");
/* 'event' [R] */
entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
if (entry)
entry->proc_fops = &acpi_system_event_ops;
else {
error = -ENODEV;
}
return error;
else
return -ENODEV;
return 0;
}
subsys_initcall(acpi_event_init);
fs_initcall(acpi_event_init);
......@@ -586,6 +586,10 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
if (gpe_xrupt->previous) {
gpe_xrupt->previous->next = gpe_xrupt->next;
} else {
/* No previous, update list head */
acpi_gbl_gpe_xrupt_list_head = gpe_xrupt->next;
}
if (gpe_xrupt->next) {
......
......@@ -284,6 +284,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
}
if (!pci_device_node) {
ACPI_FREE(pci_id);
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
......
......@@ -16,7 +16,7 @@
#if ACPI_GLUE_DEBUG
#define DBG(x...) printk(PREFIX x)
#else
#define DBG(x...)
#define DBG(x...) do { } while(0)
#endif
static LIST_HEAD(bus_type_list);
static DECLARE_RWSEM(bus_type_sem);
......
......@@ -77,13 +77,7 @@ static struct workqueue_struct *kacpi_notify_wq;
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
#define OSI_LINUX_ENABLED
#ifdef OSI_LINUX_ENABLED
int osi_linux = 1; /* enable _OSI(Linux) by default */
#else
int osi_linux; /* disable _OSI(Linux) by default */
#endif
static int osi_linux; /* disable _OSI(Linux) by default */
#ifdef CONFIG_DMI
static struct __initdata dmi_system_id acpi_osl_dmi_table[];
......@@ -1183,17 +1177,10 @@ acpi_os_validate_interface (char *interface)
if (!strcmp("Linux", interface)) {
printk(KERN_WARNING PREFIX
"System BIOS is requesting _OSI(Linux)\n");
#ifdef OSI_LINUX_ENABLED
printk(KERN_WARNING PREFIX
"Please test with \"acpi_osi=!Linux\"\n"
"Please send dmidecode "
"to linux-acpi@vger.kernel.org\n");
#else
printk(KERN_WARNING PREFIX
"If \"acpi_osi=Linux\" works better,\n"
"Please send dmidecode "
"to linux-acpi@vger.kernel.org\n");
#endif
if(osi_linux)
return AE_OK;
}
......@@ -1227,36 +1214,14 @@ acpi_os_validate_address (
}
#ifdef CONFIG_DMI
#ifdef OSI_LINUX_ENABLED
static int dmi_osi_not_linux(struct dmi_system_id *d)
{
printk(KERN_NOTICE "%s detected: requires not _OSI(Linux)\n", d->ident);
enable_osi_linux(0);
return 0;
}
#else
static int dmi_osi_linux(struct dmi_system_id *d)
{
printk(KERN_NOTICE "%s detected: requires _OSI(Linux)\n", d->ident);
printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident);
enable_osi_linux(1);
return 0;
}
#endif
static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
#ifdef OSI_LINUX_ENABLED
/*
* Boxes that need NOT _OSI(Linux)
*/
{
.callback = dmi_osi_not_linux,
.ident = "Toshiba Satellite P100",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_BOARD_NAME, "Satellite P100"),
},
},
#else
/*
* Boxes that need _OSI(Linux)
*/
......@@ -1268,7 +1233,6 @@ static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"),
},
},
#endif
{}
};
#endif /* CONFIG_DMI */
......
......@@ -733,7 +733,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
/* query and set link->irq.active */
acpi_pci_link_get_current(link);
printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device),
printk(KERN_INFO PREFIX "%s [%s] (IRQs", acpi_device_name(device),
acpi_device_bid(device));
for (i = 0; i < link->irq.possible_count; i++) {
if (link->irq.active == link->irq.possible[i]) {
......
......@@ -66,6 +66,7 @@
#define ACPI_PROCESSOR_FILE_LIMIT "limit"
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
#define ACPI_PROCESSOR_LIMIT_USER 0
#define ACPI_PROCESSOR_LIMIT_THERMAL 1
......@@ -84,6 +85,8 @@ static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
static void acpi_processor_notify(acpi_handle handle, u32 event, void *data);
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
static int acpi_processor_handle_eject(struct acpi_processor *pr);
extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
static struct acpi_driver acpi_processor_driver = {
.name = "processor",
......@@ -696,6 +699,9 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
acpi_processor_cst_has_changed(pr);
acpi_bus_generate_event(device, event, 0);
break;
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
acpi_processor_tstate_has_changed(pr);
acpi_bus_generate_event(device, event, 0);
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Unsupported event [0x%x]\n", event));
......
......@@ -490,7 +490,17 @@ static void acpi_processor_idle(void)
case ACPI_STATE_C3:
if (pr->flags.bm_check) {
/*
* disable bus master
* bm_check implies we need ARB_DIS
* !bm_check implies we need cache flush
* bm_control implies whether we can do ARB_DIS
*
* That leaves a case where bm_check is set and bm_control is
* not set. In that case we cannot do much, we enter C3
* without doing anything.
*/
if (pr->flags.bm_check && pr->flags.bm_control) {
if (atomic_inc_return(&c3_cpu_count) ==
num_online_cpus()) {
/*
......@@ -499,7 +509,7 @@ static void acpi_processor_idle(void)
*/
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
}
} else {
} else if (!pr->flags.bm_check) {
/* SMP with no shared cache... Invalidate cache */
ACPI_FLUSH_CPU_CACHE();
}
......@@ -511,7 +521,7 @@ static void acpi_processor_idle(void)
acpi_cstate_enter(cx);
/* Get end time (ticks) */
t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
if (pr->flags.bm_check) {
if (pr->flags.bm_check && pr->flags.bm_control) {
/* Enable bus master arbitration */
atomic_dec(&c3_cpu_count);
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
......@@ -961,9 +971,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
if (pr->flags.bm_check) {
/* bus mastering control is necessary */
if (!pr->flags.bm_control) {
/* In this case we enter C3 without bus mastering */
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 support requires bus mastering control\n"));
return;
"C3 support without bus mastering control\n"));
}
} else {
/*
......
This diff is collapsed.
......@@ -127,7 +127,7 @@ static int acpi_sbs_resume(struct acpi_device *device);
static struct acpi_driver acpi_sbs_driver = {
.name = "sbs",
.class = ACPI_SBS_CLASS,
.ids = ACPI_SBS_HID,
.ids = "ACPI0001,ACPI0005",
.ops = {
.add = acpi_sbs_add,
.remove = acpi_sbs_remove,
......@@ -176,10 +176,8 @@ struct acpi_battery {
};
struct acpi_sbs {
acpi_handle handle;
int base;
struct acpi_device *device;
struct acpi_ec_smbus *smbus;
struct mutex mutex;
int sbsm_present;
int sbsm_batteries_supported;
......@@ -511,7 +509,7 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs)
"acpi_sbs_read_word() failed"));
goto end;
}
sbs->sbsm_present = 1;
sbs->sbsm_batteries_supported = battery_system_info & 0x000f;
end:
......@@ -1630,13 +1628,12 @@ static int acpi_sbs_add(struct acpi_device *device)
{
struct acpi_sbs *sbs = NULL;
int result = 0, remove_result = 0;
unsigned long sbs_obj;
int id;
acpi_status status = AE_OK;
unsigned long val;
status =
acpi_evaluate_integer(device->parent->handle, "_EC", NULL, &val);
acpi_evaluate_integer(device->handle, "_EC", NULL, &val);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC"));
return -EIO;
......@@ -1653,7 +1650,7 @@ static int acpi_sbs_add(struct acpi_device *device)
sbs_mutex_lock(sbs);
sbs->base = (val & 0xff00ull) >> 8;
sbs->base = 0xff & (val >> 8);
sbs->device = device;
strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME);
......@@ -1665,24 +1662,10 @@ static int acpi_sbs_add(struct acpi_device *device)
ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed"));
goto end;
}
status = acpi_evaluate_integer(device->handle, "_SBS", NULL, &sbs_obj);
if (status) {
ACPI_EXCEPTION((AE_INFO, status,
"acpi_evaluate_integer() failed"));
result = -EIO;
goto end;
}
if (sbs_obj > 0) {
result = acpi_sbsm_get_info(sbs);
if (result) {
ACPI_EXCEPTION((AE_INFO, AE_ERROR,
"acpi_sbsm_get_info() failed"));
goto end;
}
sbs->sbsm_present = 1;
}
if (sbs->sbsm_present == 0) {
acpi_sbsm_get_info(sbs);
if (!sbs->sbsm_present) {
result = acpi_battery_add(sbs, 0);
if (result) {
ACPI_EXCEPTION((AE_INFO, AE_ERROR,
......@@ -1702,8 +1685,6 @@ static int acpi_sbs_add(struct acpi_device *device)
}
}
sbs->handle = device->handle;
init_timer(&sbs->update_timer);
result = acpi_check_update_proc(sbs);
if (result)
......
......@@ -210,11 +210,6 @@ static void acpi_hibernation_finish(void)
/* reset firmware waking vector */
acpi_set_firmware_waking_vector((acpi_physical_address) 0);
if (init_8259A_after_S1) {
printk("Broken toshiba laptop -> kicking interrupts\n");
init_8259A(0);
}
}
static int acpi_hibernation_pre_restore(void)
......
......@@ -39,15 +39,12 @@ ACPI_MODULE_NAME("system");
#define ACPI_SYSTEM_CLASS "system"
#define ACPI_SYSTEM_DEVICE_NAME "System"
#define ACPI_SYSTEM_FILE_INFO "info"
#define ACPI_SYSTEM_FILE_EVENT "event"
#define ACPI_SYSTEM_FILE_DSDT "dsdt"
#define ACPI_SYSTEM_FILE_FADT "fadt"
/*
* Make ACPICA version work as module param
*/
static int param_get_acpica_version(char *buffer, struct kernel_param *kp) {
static int param_get_acpica_version(char *buffer, struct kernel_param *kp)
{
int result;
result = sprintf(buffer, "%x", ACPI_CA_VERSION);
......@@ -57,10 +54,127 @@ static int param_get_acpica_version(char *buffer, struct kernel_param *kp) {
module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444);
/* --------------------------------------------------------------------------
FS Interface (/sys)
-------------------------------------------------------------------------- */
static LIST_HEAD(acpi_table_attr_list);
static struct kobject tables_kobj;
struct acpi_table_attr {
struct bin_attribute attr;
char name[8];
int instance;
struct list_head node;
};
static ssize_t acpi_table_show(struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t offset, size_t count)
{
struct acpi_table_attr *table_attr =
container_of(bin_attr, struct acpi_table_attr, attr);
struct acpi_table_header *table_header = NULL;
acpi_status status;
ssize_t ret_count = count;
status =
acpi_get_table(table_attr->name, table_attr->instance,
&table_header);
if (ACPI_FAILURE(status))
return -ENODEV;
if (offset >= table_header->length) {
ret_count = 0;
goto end;
}
if (offset + ret_count > table_header->length)
ret_count = table_header->length - offset;
memcpy(buf, ((char *)table_header) + offset, ret_count);
end:
return ret_count;
}
static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
struct acpi_table_header *table_header)
{
struct acpi_table_header *header = NULL;
struct acpi_table_attr *attr = NULL;
memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE);
list_for_each_entry(attr, &acpi_table_attr_list, node) {
if (!memcmp(table_header->signature, attr->name,
ACPI_NAME_SIZE))
if (table_attr->instance < attr->instance)
table_attr->instance = attr->instance;
}
table_attr->instance++;
if (table_attr->instance > 1 || (table_attr->instance == 1 &&
!acpi_get_table(table_header->
signature, 2,
&header)))
sprintf(table_attr->name + 4, "%d", table_attr->instance);
table_attr->attr.size = 0;
table_attr->attr.read = acpi_table_show;
table_attr->attr.attr.name = table_attr->name;
table_attr->attr.attr.mode = 0444;
table_attr->attr.attr.owner = THIS_MODULE;
return;
}
static int acpi_system_sysfs_init(void)
{
struct acpi_table_attr *table_attr;
struct acpi_table_header *table_header = NULL;
int table_index = 0;
int result;
tables_kobj.parent = &acpi_subsys.kobj;
kobject_set_name(&tables_kobj, "tables");
result = kobject_register(&tables_kobj);
if (result)
return result;
do {
result = acpi_get_table_by_index(table_index, &table_header);
if (!result) {
table_index++;
table_attr = NULL;
table_attr =
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
if (!table_attr)
return -ENOMEM;
acpi_table_attr_init(table_attr, table_header);
result =
sysfs_create_bin_file(&tables_kobj,
&table_attr->attr);
if (result) {
kfree(table_attr);
return result;
} else
list_add_tail(&table_attr->node,
&acpi_table_attr_list);
}
} while (!result);
return 0;
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS
#define ACPI_SYSTEM_FILE_INFO "info"
#define ACPI_SYSTEM_FILE_EVENT "event"
#define ACPI_SYSTEM_FILE_DSDT "dsdt"
#define ACPI_SYSTEM_FILE_FADT "fadt"
static int acpi_system_read_info(struct seq_file *seq, void *offset)
{
......@@ -80,7 +194,6 @@ static const struct file_operations acpi_system_info_ops = {
.llseek = seq_lseek,
.release = single_release,
};
#endif
static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
loff_t *);
......@@ -97,13 +210,11 @@ acpi_system_read_dsdt(struct file *file,
struct acpi_table_header *dsdt = NULL;
ssize_t res;
status = acpi_get_table(ACPI_SIG_DSDT, 1, &dsdt);
if (ACPI_FAILURE(status))
return -ENODEV;
res = simple_read_from_buffer(buffer, count, ppos,
dsdt, dsdt->length);
res = simple_read_from_buffer(buffer, count, ppos, dsdt, dsdt->length);
return res;
}
......@@ -123,28 +234,21 @@ acpi_system_read_fadt(struct file *file,
struct acpi_table_header *fadt = NULL;
ssize_t res;
status = acpi_get_table(ACPI_SIG_FADT, 1, &fadt);
if (ACPI_FAILURE(status))
return -ENODEV;
res = simple_read_from_buffer(buffer, count, ppos,
fadt, fadt->length);
res = simple_read_from_buffer(buffer, count, ppos, fadt, fadt->length);
return res;
}
static int __init acpi_system_init(void)
static int acpi_system_procfs_init(void)
{
struct proc_dir_entry *entry;
int error = 0;
char *name;
if (acpi_disabled)
return 0;
#ifdef CONFIG_ACPI_PROCFS
/* 'info' [R] */
name = ACPI_SYSTEM_FILE_INFO;
entry = create_proc_entry(name, S_IRUGO, acpi_root_dir);
......@@ -153,7 +257,6 @@ static int __init acpi_system_init(void)
else {
entry->proc_fops = &acpi_system_info_ops;
}
#endif
/* 'dsdt' [R] */
name = ACPI_SYSTEM_FILE_DSDT;
......@@ -177,12 +280,32 @@ static int __init acpi_system_init(void)
Error:
remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir);
#endif
error = -EFAULT;
goto Done;
}
#else
static int acpi_system_procfs_init(void)
{
return 0;
}
#endif
static int __init acpi_system_init(void)
{
int result = 0;
if (acpi_disabled)
return 0;
result = acpi_system_procfs_init();
if (result)
return result;
result = acpi_system_sysfs_init();
return result;
}
subsys_initcall(acpi_system_init);
......@@ -211,14 +211,17 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)
* DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
* Performs validation on some important FADT fields.
*
* NOTE: We create a local copy of the FADT regardless of the version.
*
******************************************************************************/
void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
{
/*
* Check if the FADT is larger than what we know about (ACPI 2.0 version).
* Truncate the table, but make some noise.
* Check if the FADT is larger than the largest table that we expect
* (the ACPI 2.0/3.0 version). If so, truncate the table, and issue
* a warning.
*/
if (length > sizeof(struct acpi_table_fadt)) {
ACPI_WARNING((AE_INFO,
......@@ -227,10 +230,12 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
sizeof(struct acpi_table_fadt)));
}
/* Copy the entire FADT locally. Zero first for tb_convert_fadt */
/* Clear the entire local FADT */
ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
/* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */
ACPI_MEMCPY(&acpi_gbl_FADT, table,
ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
......@@ -251,7 +256,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
* RETURN: None
*
* DESCRIPTION: Converts all versions of the FADT to a common internal format.
* -> Expand all 32-bit addresses to 64-bit.
* Expand all 32-bit addresses to 64-bit.
*
* NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt),
* and must contain a copy of the actual FADT.
......@@ -292,8 +297,23 @@ static void acpi_tb_convert_fadt(void)
}
/*
* Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address
* structures as necessary.
* For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
* should be zero are indeed zero. This will workaround BIOSs that
* inadvertently place values in these fields.
*
* The ACPI 1.0 reserved fields that will be zeroed are the bytes located at
* offset 45, 55, 95, and the word located at offset 109, 110.
*/
if (acpi_gbl_FADT.header.revision < 3) {
acpi_gbl_FADT.preferred_profile = 0;
acpi_gbl_FADT.pstate_control = 0;
acpi_gbl_FADT.cst_control = 0;
acpi_gbl_FADT.boot_flags = 0;
}
/*
* Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X"
* generic address structures as necessary.
*/
for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
target =
......@@ -349,18 +369,6 @@ static void acpi_tb_convert_fadt(void)
acpi_gbl_FADT.xpm1a_event_block.space_id;
}
/*
* For ACPI 1.0 FADTs, ensure that reserved fields (which should be zero)
* are indeed zero. This will workaround BIOSs that inadvertently placed
* values in these fields.
*/
if (acpi_gbl_FADT.header.revision < 3) {
acpi_gbl_FADT.preferred_profile = 0;
acpi_gbl_FADT.pstate_control = 0;
acpi_gbl_FADT.cst_control = 0;
acpi_gbl_FADT.boot_flags = 0;
}
}
/******************************************************************************
......
......@@ -62,16 +62,13 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
static char *acpi_interfaces_supported[] = {
/* Operating System Vendor Strings */
"Windows 2000",
"Windows 2001",
"Windows 2001 SP0",
"Windows 2001 SP1",
"Windows 2001 SP2",
"Windows 2001 SP3",
"Windows 2001 SP4",
"Windows 2001.1",
"Windows 2001.1 SP1", /* Added 03/2006 */
"Windows 2006", /* Added 03/2006 */
"Windows 2000", /* Windows 2000 */
"Windows 2001", /* Windows XP */
"Windows 2001 SP1", /* Windows XP SP1 */
"Windows 2001 SP2", /* Windows XP SP2 */
"Windows 2001.1", /* Windows Server 2003 */
"Windows 2001.1 SP1", /* Windows Server 2003 SP1 - Added 03/2006 */
"Windows 2006", /* Windows Vista - Added 03/2006 */
/* Feature Group Strings */
......
......@@ -33,6 +33,7 @@
#include <linux/seq_file.h>
#include <linux/backlight.h>
#include <linux/video_output.h>
#include <asm/uaccess.h>
#include <acpi/acpi_bus.h>
......@@ -169,6 +170,7 @@ struct acpi_video_device {
struct acpi_device *dev;
struct acpi_video_device_brightness *brightness;
struct backlight_device *backlight;
struct output_device *output_dev;
};
/* bus */
......@@ -272,6 +274,10 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
u32 level_current, u32 event);
static void acpi_video_switch_brightness(struct acpi_video_device *device,
int event);
static int acpi_video_device_get_state(struct acpi_video_device *device,
unsigned long *state);
static int acpi_video_output_get(struct output_device *od);
static int acpi_video_device_set_state(struct acpi_video_device *device, int state);
/*backlight device sysfs support*/
static int acpi_video_get_brightness(struct backlight_device *bd)
......@@ -297,6 +303,28 @@ static struct backlight_ops acpi_backlight_ops = {
.update_status = acpi_video_set_brightness,
};
/*video output device sysfs support*/
static int acpi_video_output_get(struct output_device *od)
{
unsigned long state;
struct acpi_video_device *vd =
(struct acpi_video_device *)class_get_devdata(&od->class_dev);
acpi_video_device_get_state(vd, &state);
return (int)state;
}
static int acpi_video_output_set(struct output_device *od)
{
unsigned long state = od->request_state;
struct acpi_video_device *vd=
(struct acpi_video_device *)class_get_devdata(&od->class_dev);
return acpi_video_device_set_state(vd, state);
}
static struct output_properties acpi_output_properties = {
.set_state = acpi_video_output_set,
.get_status = acpi_video_output_get,
};
/* --------------------------------------------------------------------------
Video Management
-------------------------------------------------------------------------- */
......@@ -531,7 +559,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
static void acpi_video_device_find_cap(struct acpi_video_device *device)
{
acpi_integer status;
acpi_handle h_dummy1;
int i;
u32 max_level = 0;
......@@ -565,50 +592,55 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
device->cap._DSS = 1;
}
status = acpi_video_device_lcd_query_levels(device, &obj);
if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
int count = 0;
union acpi_object *o;
br = kzalloc(sizeof(*br), GFP_KERNEL);
if (!br) {
printk(KERN_ERR "can't allocate memory\n");
} else {
br->levels = kmalloc(obj->package.count *
sizeof *(br->levels), GFP_KERNEL);
if (!br->levels)
goto out;
for (i = 0; i < obj->package.count; i++) {
o = (union acpi_object *)&obj->package.
elements[i];
if (o->type != ACPI_TYPE_INTEGER) {
printk(KERN_ERR PREFIX "Invalid data\n");
continue;
}
br->levels[count] = (u32) o->integer.value;
if (br->levels[count] > max_level)
max_level = br->levels[count];
count++;
}
out:
if (count < 2) {
kfree(br->levels);
kfree(br);
if (ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
if (obj->package.count >= 2) {
int count = 0;
union acpi_object *o;
br = kzalloc(sizeof(*br), GFP_KERNEL);
if (!br) {
printk(KERN_ERR "can't allocate memory\n");
} else {
br->count = count;
device->brightness = br;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"found %d brightness levels\n",
count));
br->levels = kmalloc(obj->package.count *
sizeof *(br->levels), GFP_KERNEL);
if (!br->levels)
goto out;
for (i = 0; i < obj->package.count; i++) {
o = (union acpi_object *)&obj->package.
elements[i];
if (o->type != ACPI_TYPE_INTEGER) {
printk(KERN_ERR PREFIX "Invalid data\n");
continue;
}
br->levels[count] = (u32) o->integer.value;
if (br->levels[count] > max_level)
max_level = br->levels[count];
count++;
}
out:
if (count < 2) {
kfree(br->levels);
kfree(br);
} else {
br->count = count;
device->brightness = br;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"found %d brightness levels\n",
count));
}
}
}
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available LCD brightness level\n"));
}
kfree(obj);
if (device->cap._BCL && device->cap._BCM && device->cap._BQC){
if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){
unsigned long tmp;
static int count = 0;
char *name;
......@@ -626,6 +658,17 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
kfree(name);
}
if (device->cap._DCS && device->cap._DSS){
static int count = 0;
char *name;
name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
if (!name)
return;
sprintf(name, "acpi_video%d", count++);
device->output_dev = video_output_register(name,
NULL, device, &acpi_output_properties);
kfree(name);
}
return;
}
......@@ -1669,6 +1712,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
ACPI_DEVICE_NOTIFY,
acpi_video_device_notify);
backlight_device_unregister(device->backlight);
video_output_unregister(device->output_dev);
return 0;
}
......
......@@ -150,6 +150,7 @@ config THINKPAD_ACPI
depends on X86 && ACPI
select BACKLIGHT_CLASS_DEVICE
select HWMON
select NVRAM
---help---
This is a driver for the IBM and Lenovo ThinkPad laptops. It adds
support for Fn-Fx key combinations, Bluetooth control, video
......@@ -196,4 +197,17 @@ config THINKPAD_ACPI_BAY
If you are not sure, say Y here.
config THINKPAD_ACPI_INPUT_ENABLED
bool "Enable input layer support by default"
depends on THINKPAD_ACPI
default y
---help---
Enables hot key handling over the input layer by default. If unset,
the driver does not enable any hot key handling by default, and also
starts up with a mostly empty keymap.
If you are not sure, say Y here. Say N to retain the deprecated
behavior of ibm-acpi, and thinkpad-acpi for kernels up to 2.6.21.
endif # MISC_DEVICES
This diff is collapsed.
This diff is collapsed.
......@@ -32,6 +32,7 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/nvram.h>
#include <linux/proc_fs.h>
#include <linux/sysfs.h>
#include <linux/backlight.h>
......@@ -39,6 +40,7 @@
#include <linux/platform_device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/input.h>
#include <asm/uaccess.h>
#include <linux/dmi.h>
......@@ -48,6 +50,7 @@
#include <acpi/acpi_drivers.h>
#include <acpi/acnamesp.h>
#include <linux/pci_ids.h>
/****************************************************************************
* Main driver
......@@ -78,6 +81,11 @@
#define TP_CMOS_BRIGHTNESS_UP 4
#define TP_CMOS_BRIGHTNESS_DOWN 5
/* ThinkPad CMOS NVRAM constants */
#define TP_NVRAM_ADDR_BRIGHTNESS 0x5e
#define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07
#define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0
#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off")
#define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
#define strlencmp(a,b) (strncmp((a), (b), strlen(b)))
......@@ -98,9 +106,13 @@ static const char *str_supported(int is_supported);
#define vdbg_printk(a_dbg_level, format, arg...)
#endif
/* Input IDs */
#define TPACPI_HKEY_INPUT_VENDOR PCI_VENDOR_ID_IBM
#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */
#define TPACPI_HKEY_INPUT_VERSION 0x4101
/* ACPI HIDs */
#define IBM_HKEY_HID "IBM0068"
#define IBM_PCI_HID "PNP0A03"
/* ACPI helpers */
static int __must_check acpi_evalf(acpi_handle handle,
......@@ -161,6 +173,7 @@ static int parse_strtoul(const char *buf, unsigned long max,
static struct platform_device *tpacpi_pdev;
static struct class_device *tpacpi_hwmon;
static struct platform_driver tpacpi_pdriver;
static struct input_dev *tpacpi_inputdev;
static int tpacpi_create_driver_attributes(struct device_driver *drv);
static void tpacpi_remove_driver_attributes(struct device_driver *drv);
......@@ -168,9 +181,7 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv);
static int experimental;
static u32 dbg_level;
static int force_load;
static char *ibm_thinkpad_ec_found;
static char* check_dmi_for_ec(void);
static int thinkpad_acpi_module_init(void);
static void thinkpad_acpi_module_exit(void);
......@@ -197,6 +208,7 @@ struct ibm_struct {
int (*read) (char *);
int (*write) (char *);
void (*exit) (void);
void (*resume) (void);
struct list_head all_drivers;
......@@ -228,12 +240,29 @@ static struct {
u16 bluetooth:1;
u16 hotkey:1;
u16 hotkey_mask:1;
u16 hotkey_wlsw:1;
u16 light:1;
u16 light_status:1;
u16 wan:1;
u16 fan_ctrl_status_undef:1;
u16 input_device_registered:1;
} tp_features;
struct thinkpad_id_data {
unsigned int vendor; /* ThinkPad vendor:
* PCI_VENDOR_ID_IBM/PCI_VENDOR_ID_LENOVO */
char *bios_version_str; /* Something like 1ZET51WW (1.03z) */
char *ec_version_str; /* Something like 1ZHT51WW-1.04a */
u16 bios_model; /* Big Endian, TP-1Y = 0x5931, 0 = unknown */
u16 ec_model;
char *model_str;
};
static struct thinkpad_id_data thinkpad_id;
static struct list_head tpacpi_all_drivers;
static struct ibm_init_struct ibms_init[];
......@@ -300,6 +329,7 @@ static int bluetooth_write(char *buf);
static struct backlight_device *ibm_backlight_device;
static int brightness_offset = 0x31;
static int brightness_mode;
static int brightness_init(struct ibm_init_struct *iibm);
static void brightness_exit(void);
......@@ -415,14 +445,14 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc);
*/
static int hotkey_orig_status;
static int hotkey_orig_mask;
static u32 hotkey_orig_mask;
static struct mutex hotkey_mutex;
static int hotkey_init(struct ibm_init_struct *iibm);
static void hotkey_exit(void);
static int hotkey_get(int *status, int *mask);
static int hotkey_set(int status, int mask);
static int hotkey_get(int *status, u32 *mask);
static int hotkey_set(int status, u32 mask);
static void hotkey_notify(struct ibm_struct *ibm, u32 event);
static int hotkey_read(char *p);
static int hotkey_write(char *buf);
......
......@@ -12,6 +12,13 @@ config VGASTATE
tristate
default n
config VIDEO_OUTPUT_CONTROL
tristate "Lowlevel video output switch controls"
default m
help
This framework adds support for low-level control of the video
output switch.
config FB
tristate "Support for frame buffer devices"
---help---
......
......@@ -123,3 +123,6 @@ obj-$(CONFIG_FB_OF) += offb.o
# the test framebuffer is last
obj-$(CONFIG_FB_VIRTUAL) += vfb.o
#video output switch sysfs driver
obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
......@@ -486,6 +486,8 @@
#define ACPI_FUNCTION_NAME(name)
#endif
#ifdef DEBUG_FUNC_TRACE
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
......@@ -563,6 +565,27 @@
#endif /* ACPI_SIMPLE_RETURN_MACROS */
#else /* !DEBUG_FUNC_TRACE */
#define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_TRACE_PTR(a,b)
#define ACPI_FUNCTION_TRACE_U32(a,b)
#define ACPI_FUNCTION_TRACE_STR(a,b)
#define ACPI_FUNCTION_EXIT
#define ACPI_FUNCTION_STATUS_EXIT(s)
#define ACPI_FUNCTION_VALUE_EXIT(s)
#define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_ENTRY()
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_UINT8(s) return(s)
#define return_UINT32(s) return(s)
#define return_PTR(s) return(s)
#endif /* DEBUG_FUNC_TRACE */
/* Conditional execution */
#define ACPI_DEBUG_EXEC(a) a
......@@ -599,26 +622,26 @@
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
#define ACPI_DEBUG_DEFINE(a)
#define ACPI_DEBUG_ONLY_MEMBERS(a)
#define ACPI_FUNCTION_NAME(a)
#define ACPI_FUNCTION_TRACE(a)
#define ACPI_FUNCTION_TRACE_PTR(a,b)
#define ACPI_FUNCTION_TRACE_U32(a,b)
#define ACPI_FUNCTION_TRACE_STR(a,b)
#define ACPI_FUNCTION_EXIT
#define ACPI_FUNCTION_STATUS_EXIT(s)
#define ACPI_FUNCTION_VALUE_EXIT(s)
#define ACPI_FUNCTION_ENTRY()
#define ACPI_DUMP_STACK_ENTRY(a)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
#define ACPI_DUMP_ENTRY(a,b)
#define ACPI_DUMP_TABLES(a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a)
#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
#define ACPI_DEBUG_DEFINE(a) do { } while(0)
#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
#define ACPI_FUNCTION_NAME(a) do { } while(0)
#define ACPI_FUNCTION_TRACE(a) do { } while(0)
#define ACPI_FUNCTION_TRACE_PTR(a,b) do { } while(0)
#define ACPI_FUNCTION_TRACE_U32(a,b) do { } while(0)
#define ACPI_FUNCTION_TRACE_STR(a,b) do { } while(0)
#define ACPI_FUNCTION_EXIT do { } while(0)
#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
#define ACPI_FUNCTION_ENTRY() do { } while(0)
#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
#define ACPI_DUMP_OPERANDS(a,b,c,d,e) do { } while(0)
#define ACPI_DUMP_ENTRY(a,b) do { } while(0)
#define ACPI_DUMP_TABLES(a,b) do { } while(0)
#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0)
#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
#define ACPI_DUMP_BUFFER(a,b) do { } while(0)
#define ACPI_DEBUG_PRINT(pl) do { } while(0)
#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
......
......@@ -178,8 +178,8 @@
/* Defaults for debug_level, debug and normal */
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
#endif /* __ACOUTPUT_H__ */
......@@ -321,7 +321,8 @@ struct acpi_bus_event {
};
extern struct kset acpi_subsys;
extern int acpi_bus_generate_genetlink_event(struct acpi_device *device,
u8 type, int data);
/*
* External Functions
*/
......
......@@ -136,7 +136,7 @@
/*! [Begin] no source code translation */
#if defined(__linux__)
#if defined(_LINUX) || defined(__linux__)
#include "aclinux.h"
#elif defined(_AED_EFI)
......
......@@ -91,7 +91,10 @@
#define ACPI_USE_NATIVE_DIVIDE
#endif
#ifndef __cdecl
#define __cdecl
#endif
#define ACPI_FLUSH_CPU_CACHE()
#endif /* __KERNEL__ */
......
......@@ -21,6 +21,8 @@
#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
#define ACPI_PSD_REV0_ENTRIES 5
#define ACPI_TSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
#define ACPI_TSD_REV0_ENTRIES 5
/*
* Types of coordination defined in ACPI 3.0. Same macros can be used across
* P, C and T states
......@@ -125,17 +127,53 @@ struct acpi_processor_performance {
/* Throttling Control */
struct acpi_tsd_package {
acpi_integer num_entries;
acpi_integer revision;
acpi_integer domain;
acpi_integer coord_type;
acpi_integer num_processors;
} __attribute__ ((packed));
struct acpi_ptc_register {
u8 descriptor;
u16 length;
u8 space_id;
u8 bit_width;
u8 bit_offset;
u8 reserved;
u64 address;
} __attribute__ ((packed));
struct acpi_processor_tx_tss {
acpi_integer freqpercentage; /* */
acpi_integer power; /* milliWatts */
acpi_integer transition_latency; /* microseconds */
acpi_integer control; /* control value */
acpi_integer status; /* success indicator */
};
struct acpi_processor_tx {
u16 power;
u16 performance;
};
struct acpi_processor;
struct acpi_processor_throttling {
int state;
unsigned int state;
unsigned int platform_limit;
struct acpi_pct_register control_register;
struct acpi_pct_register status_register;
unsigned int state_count;
struct acpi_processor_tx_tss *states_tss;
struct acpi_tsd_package domain_info;
cpumask_t shared_cpu_map;
int (*acpi_processor_get_throttling) (struct acpi_processor * pr);
int (*acpi_processor_set_throttling) (struct acpi_processor * pr,
int state);
u32 address;
u8 duty_offset;
u8 duty_width;
int state_count;
struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
};
......@@ -169,6 +207,9 @@ struct acpi_processor {
u32 id;
u32 pblk;
int performance_platform_limit;
int throttling_platform_limit;
/* 0 - states 0..n-th state available */
struct acpi_processor_flags flags;
struct acpi_processor_power power;
struct acpi_processor_performance *performance;
......@@ -270,7 +311,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
/* in processor_throttling.c */
int acpi_processor_get_throttling_info(struct acpi_processor *pr);
int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
extern struct file_operations acpi_processor_throttling_fops;
/* in processor_idle.c */
......
......@@ -2040,6 +2040,8 @@
#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
#define PCI_VENDOR_ID_LENOVO 0x17aa
#define PCI_VENDOR_ID_ARECA 0x17d3
#define PCI_DEVICE_ID_ARECA_1110 0x1110
#define PCI_DEVICE_ID_ARECA_1120 0x1120
......
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