Skip to content

Commit

Permalink
Merge back earlier 'acpi-assorted' material
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael J. Wysocki committed Aug 14, 2013
2 parents d4e4ab8 + e73d313 commit f3ce717
Show file tree
Hide file tree
Showing 32 changed files with 60 additions and 450 deletions.
8 changes: 4 additions & 4 deletions Documentation/laptops/asus-laptop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ http://acpi4asus.sf.net/

This driver provides support for extra features of ACPI-compatible ASUS laptops.
It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or
VICTOR XP7210 for example). It makes all the extra buttons generate standard
ACPI events that go through /proc/acpi/events and input events (like keyboards).
VICTOR XP7210 for example). It makes all the extra buttons generate input
events (like keyboards).
On some models adds support for changing the display brightness and output,
switching the LCD backlight on and off, and most importantly, allows you to
blink those fancy LEDs intended for reporting mail and wireless status.
Expand Down Expand Up @@ -55,8 +55,8 @@ Usage
DSDT) to me.

That's all, now, all the events generated by the hotkeys of your laptop
should be reported in your /proc/acpi/event entry. You can check with
"acpi_listen".
should be reported via netlink events. You can check with
"acpi_genl monitor" (part of the acpica project).

Hotkeys are also reported as input keys (like keyboards) you can check
which key are supported using "xev" under X11.
Expand Down
8 changes: 4 additions & 4 deletions Documentation/laptops/sony-laptop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Fn keys (hotkeys):
------------------
Some models report hotkeys through the SNC or SPIC devices, such events are
reported both through the ACPI subsystem as acpi events and through the INPUT
subsystem. See the logs of acpid or /proc/acpi/event and
/proc/bus/input/devices to find out what those events are and which input
devices are created by the driver. Additionally, loading the driver with the
debug option will report all events in the kernel log.
subsystem. See the logs of /proc/bus/input/devices to find out what those
events are and which input devices are created by the driver.
Additionally, loading the driver with the debug option will report all events
in the kernel log.

The "scancodes" passed to the input system (that can be remapped with udev)
are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
Expand Down
73 changes: 6 additions & 67 deletions Documentation/laptops/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,6 @@ sysfs notes:

This attribute has poll()/select() support.

hotkey_report_mode:
Returns the state of the procfs ACPI event report mode
filter for hot keys. If it is set to 1 (the default),
all hot key presses are reported both through the input
layer and also as ACPI events through procfs (but not
through netlink). If it is set to 2, hot key presses
are reported only through the input layer.

This attribute is read-only in kernels 2.6.23 or later,
and read-write on earlier kernels.

May return -EPERM (write access locked out by module
parameter) or -EACCES (read-only).

wakeup_reason:
Set to 1 if the system is waking up because the user
requested a bay ejection. Set to 2 if the system is
Expand Down Expand Up @@ -518,24 +504,21 @@ SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A
Non hotkey ACPI HKEY event map:
-------------------------------

Events that are not propagated by the driver, except for legacy
compatibility purposes when hotkey_report_mode is set to 1:

0x5001 Lid closed
0x5002 Lid opened
0x5009 Tablet swivel: switched to tablet mode
0x500A Tablet swivel: switched to normal mode
0x7000 Radio Switch may have changed state

Events that are never propagated by the driver:

0x2304 System is waking up from suspend to undock
0x2305 System is waking up from suspend to eject bay
0x2404 System is waking up from hibernation to undock
0x2405 System is waking up from hibernation to eject bay
0x5001 Lid closed
0x5002 Lid opened
0x5009 Tablet swivel: switched to tablet mode
0x500A Tablet swivel: switched to normal mode
0x5010 Brightness level changed/control event
0x6000 KEYBOARD: Numlock key pressed
0x6005 KEYBOARD: Fn key pressed (TO BE VERIFIED)
0x7000 Radio Switch may have changed state


Events that are propagated by the driver to userspace:

Expand Down Expand Up @@ -574,50 +557,6 @@ operating system is to force either an immediate suspend or hibernate
cycle, or a system shutdown. Obviously, something is very wrong if this
happens.

Compatibility notes:

ibm-acpi and thinkpad-acpi 0.15 (mainline kernels before 2.6.23) never
supported the input layer, and sent events over the procfs ACPI event
interface.

To avoid sending duplicate events over the input layer and the ACPI
event interface, thinkpad-acpi 0.16 implements a module parameter
(hotkey_report_mode), and also a sysfs device attribute with the same
name.

Make no mistake here: userspace is expected to switch to using the input
layer interface of thinkpad-acpi, together with the ACPI netlink event
interface in kernels 2.6.23 and later, or with the ACPI procfs event
interface in kernels 2.6.22 and earlier.

If no hotkey_report_mode module parameter is specified (or it is set to
zero), the driver defaults to mode 1 (see below), and on kernels 2.6.22
and earlier, also allows one to change the hotkey_report_mode through
sysfs. In kernels 2.6.23 and later, where the netlink ACPI event
interface is available, hotkey_report_mode cannot be changed through
sysfs (it is read-only).

If the hotkey_report_mode module parameter is set to 1 or 2, it cannot
be changed later through sysfs (any writes will return -EPERM to signal
that hotkey_report_mode was locked. On 2.6.23 and later, where
hotkey_report_mode cannot be changed at all, writes will return -EACCES).

hotkey_report_mode set to 1 makes the driver export through the procfs
ACPI event interface all hot key presses (which are *also* sent to the
input layer). This is a legacy compatibility behaviour, and it is also
the default mode of operation for the driver.

hotkey_report_mode set to 2 makes the driver filter out the hot key
presses from the procfs ACPI event interface, so these events will only
be sent through the input layer. Userspace that has been updated to use
the thinkpad-acpi input layer interface should set hotkey_report_mode to
2.

Hot key press events are never sent to the ACPI netlink event interface.
Really up-to-date userspace under kernel 2.6.23 and later is to use the
netlink interface and the input layer interface, and don't bother at all
with hotkey_report_mode.


Brightness hotkey notes:

Expand Down
18 changes: 0 additions & 18 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ config ACPI_EC_DEBUGFS
Thus this option is a debug option that helps to write ACPI drivers
and can be used to identify ACPI code or EC firmware bugs.

config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support"
depends on PROC_FS
default y
help
A user-space daemon, acpid, typically reads /proc/acpi/event
and handles all ACPI-generated events.

These events are now delivered to user-space either
via the input layer or as netlink events.

This build option enables the old code for legacy
user-space implementation. After some time, this will
be moved under CONFIG_ACPI_PROCFS, and then deleted.

Say Y here to retain the old behaviour. Say N if your
user-space is newer than kernel 2.6.23 (September 2007).

config ACPI_AC
tristate "AC Adapter"
depends on X86
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
msleep(ac_sleep_before_get_state_ms);

acpi_ac_get_state(ac);
acpi_bus_generate_proc_event(device, event, (u32) ac->state);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
(u32) ac->state);
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/acpi_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
switch (event) {
case ACPI_PROCESSOR_AGGREGATOR_NOTIFY:
acpi_pad_handle_notify(handle);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
Expand Down
24 changes: 13 additions & 11 deletions drivers/acpi/acpi_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
struct platform_device_info pdevinfo;
struct resource_list_entry *rentry;
struct list_head resource_list;
struct resource *resources;
struct resource *resources = NULL;
int count;

/* If the ACPI node already has a physical device attached, skip it. */
Expand All @@ -61,20 +61,22 @@ int acpi_create_platform_device(struct acpi_device *adev,

INIT_LIST_HEAD(&resource_list);
count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
if (count <= 0)
if (count < 0) {
return 0;
} else if (count > 0) {
resources = kmalloc(count * sizeof(struct resource),
GFP_KERNEL);
if (!resources) {
dev_err(&adev->dev, "No memory for resources\n");
acpi_dev_free_resource_list(&resource_list);
return -ENOMEM;
}
count = 0;
list_for_each_entry(rentry, &resource_list, node)
resources[count++] = rentry->res;

resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL);
if (!resources) {
dev_err(&adev->dev, "No memory for resources\n");
acpi_dev_free_resource_list(&resource_list);
return -ENOMEM;
}
count = 0;
list_for_each_entry(rentry, &resource_list, node)
resources[count++] = rentry->res;

acpi_dev_free_resource_list(&resource_list);

memset(&pdevinfo, 0, sizeof(pdevinfo));
/*
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,6 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
if (event == ACPI_BATTERY_NOTIFY_INFO)
acpi_battery_refresh(battery);
acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
acpi_battery_present(battery));
Expand Down
120 changes: 0 additions & 120 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,6 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = {
Device Management
-------------------------------------------------------------------------- */

int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
{
acpi_status status;

if (!device)
return -EINVAL;

/* TBD: Support fixed-feature devices */

status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
if (ACPI_FAILURE(status) || !*device) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
handle));
return -ENODEV;
}

return 0;
}

EXPORT_SYMBOL(acpi_bus_get_device);

acpi_status acpi_bus_get_status_handle(acpi_handle handle,
unsigned long long *sta)
{
Expand Down Expand Up @@ -345,104 +324,6 @@ static void acpi_bus_osc_support(void)
/* do we need to check other returned cap? Sounds no */
}

/* --------------------------------------------------------------------------
Event Management
-------------------------------------------------------------------------- */

#ifdef CONFIG_ACPI_PROC_EVENT
static DEFINE_SPINLOCK(acpi_bus_event_lock);

LIST_HEAD(acpi_bus_event_list);
DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);

extern int event_is_open;

int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id, u8 type, int data)
{
struct acpi_bus_event *event;
unsigned long flags;

/* drop event on the floor if no one's listening */
if (!event_is_open)
return 0;

event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
if (!event)
return -ENOMEM;

strcpy(event->device_class, device_class);
strcpy(event->bus_id, bus_id);
event->type = type;
event->data = data;

spin_lock_irqsave(&acpi_bus_event_lock, flags);
list_add_tail(&event->node, &acpi_bus_event_list);
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);

wake_up_interruptible(&acpi_bus_event_queue);

return 0;

}

EXPORT_SYMBOL_GPL(acpi_bus_generate_proc_event4);

int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
{
if (!device)
return -EINVAL;
return acpi_bus_generate_proc_event4(device->pnp.device_class,
device->pnp.bus_id, type, data);
}

EXPORT_SYMBOL(acpi_bus_generate_proc_event);

int acpi_bus_receive_event(struct acpi_bus_event *event)
{
unsigned long flags;
struct acpi_bus_event *entry = NULL;

DECLARE_WAITQUEUE(wait, current);


if (!event)
return -EINVAL;

if (list_empty(&acpi_bus_event_list)) {

set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&acpi_bus_event_queue, &wait);

if (list_empty(&acpi_bus_event_list))
schedule();

remove_wait_queue(&acpi_bus_event_queue, &wait);
set_current_state(TASK_RUNNING);

if (signal_pending(current))
return -ERESTARTSYS;
}

spin_lock_irqsave(&acpi_bus_event_lock, flags);
if (!list_empty(&acpi_bus_event_list)) {
entry = list_entry(acpi_bus_event_list.next,
struct acpi_bus_event, node);
list_del(&entry->node);
}
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);

if (!entry)
return -ENODEV;

memcpy(event, entry, sizeof(struct acpi_bus_event));

kfree(entry);

return 0;
}

#endif /* CONFIG_ACPI_PROC_EVENT */

/* --------------------------------------------------------------------------
Notification Handling
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -715,7 +596,6 @@ static int __init acpi_bus_init(void)
{
int result;
acpi_status status;
extern acpi_status acpi_os_initialize1(void);

acpi_os_initialize1();

Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)

pm_wakeup_event(&device->dev, 0);
}

acpi_bus_generate_proc_event(device, event, ++button->pushed);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ static int __init dock_add(acpi_handle handle)
*
* This is called by acpi_walk_namespace to look for dock stations and bays.
*/
static __init acpi_status
static acpi_status __init
find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
{
if (is_dock(handle) || is_ejectable_bay(handle))
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
return 0;
}

static struct dmi_system_id __initdata ec_dmi_table[] = {
static struct dmi_system_id ec_dmi_table[] __initdata = {
{
ec_skip_dsdt_scan, "Compal JFL92", {
DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
Expand Down
Loading

0 comments on commit f3ce717

Please sign in to comment.