Merge branch 'bjorn-notify' into release
Conflicts: drivers/platform/x86/eeepc-laptop.c Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -61,6 +61,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
|
|||||||
static int acpi_ac_add(struct acpi_device *device);
|
static int acpi_ac_add(struct acpi_device *device);
|
||||||
static int acpi_ac_remove(struct acpi_device *device, int type);
|
static int acpi_ac_remove(struct acpi_device *device, int type);
|
||||||
static int acpi_ac_resume(struct acpi_device *device);
|
static int acpi_ac_resume(struct acpi_device *device);
|
||||||
|
static void acpi_ac_notify(struct acpi_device *device, u32 event);
|
||||||
|
|
||||||
static const struct acpi_device_id ac_device_ids[] = {
|
static const struct acpi_device_id ac_device_ids[] = {
|
||||||
{"ACPI0003", 0},
|
{"ACPI0003", 0},
|
||||||
@@ -72,10 +73,12 @@ static struct acpi_driver acpi_ac_driver = {
|
|||||||
.name = "ac",
|
.name = "ac",
|
||||||
.class = ACPI_AC_CLASS,
|
.class = ACPI_AC_CLASS,
|
||||||
.ids = ac_device_ids,
|
.ids = ac_device_ids,
|
||||||
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_ac_add,
|
.add = acpi_ac_add,
|
||||||
.remove = acpi_ac_remove,
|
.remove = acpi_ac_remove,
|
||||||
.resume = acpi_ac_resume,
|
.resume = acpi_ac_resume,
|
||||||
|
.notify = acpi_ac_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,16 +223,14 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
|
|||||||
Driver Model
|
Driver Model
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
|
static void acpi_ac_notify(struct acpi_device *device, u32 event)
|
||||||
{
|
{
|
||||||
struct acpi_ac *ac = data;
|
struct acpi_ac *ac = acpi_driver_data(device);
|
||||||
struct acpi_device *device = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
if (!ac)
|
if (!ac)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
device = ac->device;
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
@@ -253,7 +254,6 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
static int acpi_ac_add(struct acpi_device *device)
|
static int acpi_ac_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
|
||||||
struct acpi_ac *ac = NULL;
|
struct acpi_ac *ac = NULL;
|
||||||
|
|
||||||
|
|
||||||
@@ -286,13 +286,6 @@ static int acpi_ac_add(struct acpi_device *device)
|
|||||||
ac->charger.get_property = get_ac_property;
|
ac->charger.get_property = get_ac_property;
|
||||||
power_supply_register(&ac->device->dev, &ac->charger);
|
power_supply_register(&ac->device->dev, &ac->charger);
|
||||||
#endif
|
#endif
|
||||||
status = acpi_install_notify_handler(device->handle,
|
|
||||||
ACPI_ALL_NOTIFY, acpi_ac_notify,
|
|
||||||
ac);
|
|
||||||
if (ACPI_FAILURE(status)) {
|
|
||||||
result = -ENODEV;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
||||||
acpi_device_name(device), acpi_device_bid(device),
|
acpi_device_name(device), acpi_device_bid(device),
|
||||||
@@ -328,7 +321,6 @@ static int acpi_ac_resume(struct acpi_device *device)
|
|||||||
|
|
||||||
static int acpi_ac_remove(struct acpi_device *device, int type)
|
static int acpi_ac_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
|
||||||
struct acpi_ac *ac = NULL;
|
struct acpi_ac *ac = NULL;
|
||||||
|
|
||||||
|
|
||||||
@@ -337,8 +329,6 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
|
|||||||
|
|
||||||
ac = acpi_driver_data(device);
|
ac = acpi_driver_data(device);
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(device->handle,
|
|
||||||
ACPI_ALL_NOTIFY, acpi_ac_notify);
|
|
||||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||||
if (ac->charger.dev)
|
if (ac->charger.dev)
|
||||||
power_supply_unregister(&ac->charger);
|
power_supply_unregister(&ac->charger);
|
||||||
|
|||||||
@@ -796,13 +796,12 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
|
|||||||
Driver Interface
|
Driver Interface
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
|
static void acpi_battery_notify(struct acpi_device *device, u32 event)
|
||||||
{
|
{
|
||||||
struct acpi_battery *battery = data;
|
struct acpi_battery *battery = acpi_driver_data(device);
|
||||||
struct acpi_device *device;
|
|
||||||
if (!battery)
|
if (!battery)
|
||||||
return;
|
return;
|
||||||
device = battery->device;
|
|
||||||
acpi_battery_update(battery);
|
acpi_battery_update(battery);
|
||||||
acpi_bus_generate_proc_event(device, event,
|
acpi_bus_generate_proc_event(device, event,
|
||||||
acpi_battery_present(battery));
|
acpi_battery_present(battery));
|
||||||
@@ -819,7 +818,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
static int acpi_battery_add(struct acpi_device *device)
|
static int acpi_battery_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = 0;
|
|
||||||
struct acpi_battery *battery = NULL;
|
struct acpi_battery *battery = NULL;
|
||||||
if (!device)
|
if (!device)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -834,22 +832,12 @@ static int acpi_battery_add(struct acpi_device *device)
|
|||||||
acpi_battery_update(battery);
|
acpi_battery_update(battery);
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
result = acpi_battery_add_fs(device);
|
result = acpi_battery_add_fs(device);
|
||||||
if (result)
|
|
||||||
goto end;
|
|
||||||
#endif
|
#endif
|
||||||
status = acpi_install_notify_handler(device->handle,
|
if (!result) {
|
||||||
ACPI_ALL_NOTIFY,
|
|
||||||
acpi_battery_notify, battery);
|
|
||||||
if (ACPI_FAILURE(status)) {
|
|
||||||
ACPI_EXCEPTION((AE_INFO, status, "Installing notify handler"));
|
|
||||||
result = -ENODEV;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
||||||
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
||||||
device->status.battery_present ? "present" : "absent");
|
device->status.battery_present ? "present" : "absent");
|
||||||
end:
|
} else {
|
||||||
if (result) {
|
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
acpi_battery_remove_fs(device);
|
acpi_battery_remove_fs(device);
|
||||||
#endif
|
#endif
|
||||||
@@ -860,15 +848,11 @@ static int acpi_battery_add(struct acpi_device *device)
|
|||||||
|
|
||||||
static int acpi_battery_remove(struct acpi_device *device, int type)
|
static int acpi_battery_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
|
||||||
struct acpi_battery *battery = NULL;
|
struct acpi_battery *battery = NULL;
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
battery = acpi_driver_data(device);
|
battery = acpi_driver_data(device);
|
||||||
status = acpi_remove_notify_handler(device->handle,
|
|
||||||
ACPI_ALL_NOTIFY,
|
|
||||||
acpi_battery_notify);
|
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
acpi_battery_remove_fs(device);
|
acpi_battery_remove_fs(device);
|
||||||
#endif
|
#endif
|
||||||
@@ -896,10 +880,12 @@ static struct acpi_driver acpi_battery_driver = {
|
|||||||
.name = "battery",
|
.name = "battery",
|
||||||
.class = ACPI_BATTERY_CLASS,
|
.class = ACPI_BATTERY_CLASS,
|
||||||
.ids = battery_device_ids,
|
.ids = battery_device_ids,
|
||||||
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_battery_add,
|
.add = acpi_battery_add,
|
||||||
.resume = acpi_battery_resume,
|
.resume = acpi_battery_resume,
|
||||||
.remove = acpi_battery_remove,
|
.remove = acpi_battery_remove,
|
||||||
|
.notify = acpi_battery_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -450,18 +450,16 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
|
|||||||
Notification Handling
|
Notification Handling
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static void acpi_bus_check_device(acpi_handle handle)
|
||||||
acpi_bus_check_device(struct acpi_device *device, int *status_changed)
|
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
struct acpi_device *device;
|
||||||
|
acpi_status status;
|
||||||
struct acpi_device_status old_status;
|
struct acpi_device_status old_status;
|
||||||
|
|
||||||
|
if (acpi_bus_get_device(handle, &device))
|
||||||
|
return;
|
||||||
if (!device)
|
if (!device)
|
||||||
return -EINVAL;
|
return;
|
||||||
|
|
||||||
if (status_changed)
|
|
||||||
*status_changed = 0;
|
|
||||||
|
|
||||||
old_status = device->status;
|
old_status = device->status;
|
||||||
|
|
||||||
@@ -471,22 +469,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
|
|||||||
*/
|
*/
|
||||||
if (device->parent && !device->parent->status.present) {
|
if (device->parent && !device->parent->status.present) {
|
||||||
device->status = device->parent->status;
|
device->status = device->parent->status;
|
||||||
if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) {
|
return;
|
||||||
if (status_changed)
|
|
||||||
*status_changed = 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_bus_get_status(device);
|
status = acpi_bus_get_status(device);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return -ENODEV;
|
return;
|
||||||
|
|
||||||
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
|
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
if (status_changed)
|
|
||||||
*status_changed = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device Insertion/Removal
|
* Device Insertion/Removal
|
||||||
@@ -498,33 +489,17 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
|
|||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
|
||||||
/* TBD: Handle device removal */
|
/* TBD: Handle device removal */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_bus_check_scope(struct acpi_device *device)
|
static void acpi_bus_check_scope(acpi_handle handle)
|
||||||
{
|
{
|
||||||
int result = 0;
|
|
||||||
int status_changed = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if (!device)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* Status Change? */
|
/* Status Change? */
|
||||||
result = acpi_bus_check_device(device, &status_changed);
|
acpi_bus_check_device(handle);
|
||||||
if (result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
if (!status_changed)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TBD: Enumerate child devices within this device's scope and
|
* TBD: Enumerate child devices within this device's scope and
|
||||||
* run acpi_bus_check_device()'s on them.
|
* run acpi_bus_check_device()'s on them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list);
|
static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list);
|
||||||
@@ -547,22 +522,19 @@ EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier);
|
|||||||
*/
|
*/
|
||||||
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
||||||
{
|
{
|
||||||
int result = 0;
|
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
|
struct acpi_driver *driver;
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n",
|
||||||
|
type, handle));
|
||||||
|
|
||||||
blocking_notifier_call_chain(&acpi_bus_notify_list,
|
blocking_notifier_call_chain(&acpi_bus_notify_list,
|
||||||
type, (void *)handle);
|
type, (void *)handle);
|
||||||
|
|
||||||
if (acpi_bus_get_device(handle, &device))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
case ACPI_NOTIFY_BUS_CHECK:
|
case ACPI_NOTIFY_BUS_CHECK:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
acpi_bus_check_scope(handle);
|
||||||
"Received BUS CHECK notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
result = acpi_bus_check_scope(device);
|
|
||||||
/*
|
/*
|
||||||
* TBD: We'll need to outsource certain events to non-ACPI
|
* TBD: We'll need to outsource certain events to non-ACPI
|
||||||
* drivers via the device manager (device.c).
|
* drivers via the device manager (device.c).
|
||||||
@@ -570,10 +542,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
acpi_bus_check_device(handle);
|
||||||
"Received DEVICE CHECK notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
result = acpi_bus_check_device(device, NULL);
|
|
||||||
/*
|
/*
|
||||||
* TBD: We'll need to outsource certain events to non-ACPI
|
* TBD: We'll need to outsource certain events to non-ACPI
|
||||||
* drivers via the device manager (device.c).
|
* drivers via the device manager (device.c).
|
||||||
@@ -581,44 +550,26 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_WAKE:
|
case ACPI_NOTIFY_DEVICE_WAKE:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received DEVICE WAKE notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_EJECT_REQUEST:
|
case ACPI_NOTIFY_EJECT_REQUEST:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received EJECT REQUEST notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
|
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received DEVICE CHECK LIGHT notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD: Exactly what does 'light' mean? */
|
/* TBD: Exactly what does 'light' mean? */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
|
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received FREQUENCY MISMATCH notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
|
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received BUS MODE MISMATCH notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_POWER_FAULT:
|
case ACPI_NOTIFY_POWER_FAULT:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Received POWER FAULT notification for device [%s]\n",
|
|
||||||
device->pnp.bus_id));
|
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -629,7 +580,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
acpi_bus_get_device(handle, &device);
|
||||||
|
if (device) {
|
||||||
|
driver = device->driver;
|
||||||
|
if (driver && driver->ops.notify &&
|
||||||
|
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
|
||||||
|
driver->ops.notify(device, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -207,13 +207,17 @@ MODULE_DEVICE_TABLE(acpi, asus_device_ids);
|
|||||||
|
|
||||||
static int asus_hotk_add(struct acpi_device *device);
|
static int asus_hotk_add(struct acpi_device *device);
|
||||||
static int asus_hotk_remove(struct acpi_device *device, int type);
|
static int asus_hotk_remove(struct acpi_device *device, int type);
|
||||||
|
static void asus_hotk_notify(struct acpi_device *device, u32 event);
|
||||||
|
|
||||||
static struct acpi_driver asus_hotk_driver = {
|
static struct acpi_driver asus_hotk_driver = {
|
||||||
.name = ASUS_HOTK_NAME,
|
.name = ASUS_HOTK_NAME,
|
||||||
.class = ASUS_HOTK_CLASS,
|
.class = ASUS_HOTK_CLASS,
|
||||||
.ids = asus_device_ids,
|
.ids = asus_device_ids,
|
||||||
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = asus_hotk_add,
|
.add = asus_hotk_add,
|
||||||
.remove = asus_hotk_remove,
|
.remove = asus_hotk_remove,
|
||||||
|
.notify = asus_hotk_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -812,7 +816,7 @@ static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
|
static void asus_hotk_notify(struct acpi_device *device, u32 event)
|
||||||
{
|
{
|
||||||
static struct key_entry *key;
|
static struct key_entry *key;
|
||||||
u16 count;
|
u16 count;
|
||||||
@@ -1124,7 +1128,6 @@ static int asus_hotk_found;
|
|||||||
|
|
||||||
static int asus_hotk_add(struct acpi_device *device)
|
static int asus_hotk_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
@@ -1149,15 +1152,6 @@ static int asus_hotk_add(struct acpi_device *device)
|
|||||||
|
|
||||||
asus_hotk_add_fs();
|
asus_hotk_add_fs();
|
||||||
|
|
||||||
/*
|
|
||||||
* We install the handler, it will receive the hotk in parameter, so, we
|
|
||||||
* could add other data to the hotk struct
|
|
||||||
*/
|
|
||||||
status = acpi_install_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
|
|
||||||
asus_hotk_notify, hotk);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(ASUS_ERR "Error installing notify handler\n");
|
|
||||||
|
|
||||||
asus_hotk_found = 1;
|
asus_hotk_found = 1;
|
||||||
|
|
||||||
/* WLED and BLED are on by default */
|
/* WLED and BLED are on by default */
|
||||||
@@ -1198,16 +1192,9 @@ end:
|
|||||||
|
|
||||||
static int asus_hotk_remove(struct acpi_device *device, int type)
|
static int asus_hotk_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
|
|
||||||
asus_hotk_notify);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(ASUS_ERR "Error removing notify handler\n");
|
|
||||||
|
|
||||||
kfree(hotk->name);
|
kfree(hotk->name);
|
||||||
kfree(hotk);
|
kfree(hotk);
|
||||||
|
|
||||||
|
|||||||
@@ -455,6 +455,8 @@ static struct asus_hotk *hotk;
|
|||||||
*/
|
*/
|
||||||
static int asus_hotk_add(struct acpi_device *device);
|
static int asus_hotk_add(struct acpi_device *device);
|
||||||
static int asus_hotk_remove(struct acpi_device *device, int type);
|
static int asus_hotk_remove(struct acpi_device *device, int type);
|
||||||
|
static void asus_hotk_notify(struct acpi_device *device, u32 event);
|
||||||
|
|
||||||
static const struct acpi_device_id asus_device_ids[] = {
|
static const struct acpi_device_id asus_device_ids[] = {
|
||||||
{"ATK0100", 0},
|
{"ATK0100", 0},
|
||||||
{"", 0},
|
{"", 0},
|
||||||
@@ -465,9 +467,11 @@ static struct acpi_driver asus_hotk_driver = {
|
|||||||
.name = "asus_acpi",
|
.name = "asus_acpi",
|
||||||
.class = ACPI_HOTK_CLASS,
|
.class = ACPI_HOTK_CLASS,
|
||||||
.ids = asus_device_ids,
|
.ids = asus_device_ids,
|
||||||
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = asus_hotk_add,
|
.add = asus_hotk_add,
|
||||||
.remove = asus_hotk_remove,
|
.remove = asus_hotk_remove,
|
||||||
|
.notify = asus_hotk_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1101,12 +1105,20 @@ static int asus_hotk_remove_fs(struct acpi_device *device)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
|
static void asus_hotk_notify(struct acpi_device *device, u32 event)
|
||||||
{
|
{
|
||||||
/* TODO Find a better way to handle events count. */
|
/* TODO Find a better way to handle events count. */
|
||||||
if (!hotk)
|
if (!hotk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The BIOS *should* be sending us device events, but apparently
|
||||||
|
* Asus uses system events instead, so just ignore any device
|
||||||
|
* events we get.
|
||||||
|
*/
|
||||||
|
if (event > ACPI_MAX_SYS_NOTIFY)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((event & ~((u32) BR_UP)) < 16)
|
if ((event & ~((u32) BR_UP)) < 16)
|
||||||
hotk->brightness = (event & ~((u32) BR_UP));
|
hotk->brightness = (event & ~((u32) BR_UP));
|
||||||
else if ((event & ~((u32) BR_DOWN)) < 16)
|
else if ((event & ~((u32) BR_DOWN)) < 16)
|
||||||
@@ -1346,15 +1358,6 @@ static int asus_hotk_add(struct acpi_device *device)
|
|||||||
if (result)
|
if (result)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/*
|
|
||||||
* We install the handler, it will receive the hotk in parameter, so, we
|
|
||||||
* could add other data to the hotk struct
|
|
||||||
*/
|
|
||||||
status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
|
|
||||||
asus_hotk_notify, hotk);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(KERN_ERR " Error installing notify handler\n");
|
|
||||||
|
|
||||||
/* For laptops without GPLV: init the hotk->brightness value */
|
/* For laptops without GPLV: init the hotk->brightness value */
|
||||||
if ((!hotk->methods->brightness_get)
|
if ((!hotk->methods->brightness_get)
|
||||||
&& (!hotk->methods->brightness_status)
|
&& (!hotk->methods->brightness_status)
|
||||||
@@ -1389,16 +1392,9 @@ end:
|
|||||||
|
|
||||||
static int asus_hotk_remove(struct acpi_device *device, int type)
|
static int asus_hotk_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
|
|
||||||
asus_hotk_notify);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
|
|
||||||
|
|
||||||
asus_hotk_remove_fs(device);
|
asus_hotk_remove_fs(device);
|
||||||
|
|
||||||
kfree(hotk);
|
kfree(hotk);
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ static struct key_entry eeepc_keymap[] = {
|
|||||||
static int eeepc_hotk_add(struct acpi_device *device);
|
static int eeepc_hotk_add(struct acpi_device *device);
|
||||||
static int eeepc_hotk_remove(struct acpi_device *device, int type);
|
static int eeepc_hotk_remove(struct acpi_device *device, int type);
|
||||||
static int eeepc_hotk_resume(struct acpi_device *device);
|
static int eeepc_hotk_resume(struct acpi_device *device);
|
||||||
|
static void eeepc_hotk_notify(struct acpi_device *device, u32 event);
|
||||||
|
|
||||||
static const struct acpi_device_id eeepc_device_ids[] = {
|
static const struct acpi_device_id eeepc_device_ids[] = {
|
||||||
{EEEPC_HOTK_HID, 0},
|
{EEEPC_HOTK_HID, 0},
|
||||||
@@ -192,10 +193,12 @@ static struct acpi_driver eeepc_hotk_driver = {
|
|||||||
.name = EEEPC_HOTK_NAME,
|
.name = EEEPC_HOTK_NAME,
|
||||||
.class = EEEPC_HOTK_CLASS,
|
.class = EEEPC_HOTK_CLASS,
|
||||||
.ids = eeepc_device_ids,
|
.ids = eeepc_device_ids,
|
||||||
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = eeepc_hotk_add,
|
.add = eeepc_hotk_add,
|
||||||
.remove = eeepc_hotk_remove,
|
.remove = eeepc_hotk_remove,
|
||||||
.resume = eeepc_hotk_resume,
|
.resume = eeepc_hotk_resume,
|
||||||
|
.notify = eeepc_hotk_notify,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -558,7 +561,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
eeepc_rfkill_hotplug();
|
eeepc_rfkill_hotplug();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
|
static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
|
||||||
{
|
{
|
||||||
static struct key_entry *key;
|
static struct key_entry *key;
|
||||||
u16 count;
|
u16 count;
|
||||||
@@ -566,6 +569,8 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
|
|
||||||
if (!ehotk)
|
if (!ehotk)
|
||||||
return;
|
return;
|
||||||
|
if (event > ACPI_MAX_SYS_NOTIFY)
|
||||||
|
return;
|
||||||
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
|
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
|
||||||
brn = notify_brn();
|
brn = notify_brn();
|
||||||
count = ehotk->event_count[event % 128]++;
|
count = ehotk->event_count[event % 128]++;
|
||||||
@@ -646,7 +651,6 @@ static void eeepc_unregister_rfkill_notifier(char *node)
|
|||||||
|
|
||||||
static int eeepc_hotk_add(struct acpi_device *device)
|
static int eeepc_hotk_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
@@ -664,10 +668,6 @@ static int eeepc_hotk_add(struct acpi_device *device)
|
|||||||
result = eeepc_hotk_check();
|
result = eeepc_hotk_check();
|
||||||
if (result)
|
if (result)
|
||||||
goto ehotk_fail;
|
goto ehotk_fail;
|
||||||
status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
|
|
||||||
eeepc_hotk_notify, ehotk);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(EEEPC_ERR "Error installing notify handler\n");
|
|
||||||
|
|
||||||
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
|
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
|
||||||
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
|
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
|
||||||
@@ -725,14 +725,8 @@ static int eeepc_hotk_add(struct acpi_device *device)
|
|||||||
|
|
||||||
static int eeepc_hotk_remove(struct acpi_device *device, int type)
|
static int eeepc_hotk_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
|
|
||||||
eeepc_hotk_notify);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
printk(EEEPC_ERR "Error removing notify handler\n");
|
|
||||||
|
|
||||||
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
|
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
|
||||||
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
|
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
|
||||||
|
|||||||
@@ -114,10 +114,13 @@ struct acpi_device_ops {
|
|||||||
acpi_op_notify notify;
|
acpi_op_notify notify;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */
|
||||||
|
|
||||||
struct acpi_driver {
|
struct acpi_driver {
|
||||||
char name[80];
|
char name[80];
|
||||||
char class[80];
|
char class[80];
|
||||||
const struct acpi_device_id *ids; /* Supported Hardware IDs */
|
const struct acpi_device_id *ids; /* Supported Hardware IDs */
|
||||||
|
unsigned int flags;
|
||||||
struct acpi_device_ops ops;
|
struct acpi_device_ops ops;
|
||||||
struct device_driver drv;
|
struct device_driver drv;
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
|
|||||||
Reference in New Issue
Block a user