diff options
author | Stelian Pop <stelian@popies.net> | 2007-01-13 17:04:37 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-13 03:06:03 -0500 |
commit | c561162f10b9f35c9aa5c25eb8dbeb446f0c5201 (patch) | |
tree | 6704bf74bfcd47f05e7c2168d3af6fb995f7f492 /drivers/acpi/sony_acpi.c | |
parent | 82c47731f77e7615f5a952c662d873b55e71f3b9 (diff) |
sony_acpi: Add acpi_bus_generate event
Added acpi_bus_generate event for forwarding Fn-keys pressed to acpi subsystem,
and made correspondent necessary changes for this to work.
Signed-off-by: Nilton Volpato <nilton.volpato@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sony_acpi.c')
-rw-r--r-- | drivers/acpi/sony_acpi.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c index 195895ca4346..138f2b6184d3 100644 --- a/drivers/acpi/sony_acpi.c +++ b/drivers/acpi/sony_acpi.c | |||
@@ -54,6 +54,7 @@ MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help " | |||
54 | 54 | ||
55 | static acpi_handle sony_acpi_handle; | 55 | static acpi_handle sony_acpi_handle; |
56 | static struct proc_dir_entry *sony_acpi_dir; | 56 | static struct proc_dir_entry *sony_acpi_dir; |
57 | static struct acpi_device *sony_acpi_acpi_device = NULL; | ||
57 | 58 | ||
58 | static int sony_backlight_update_status(struct backlight_device *bd); | 59 | static int sony_backlight_update_status(struct backlight_device *bd); |
59 | static int sony_backlight_get_brightness(struct backlight_device *bd); | 60 | static int sony_backlight_get_brightness(struct backlight_device *bd); |
@@ -270,7 +271,9 @@ static int sony_acpi_resume(struct acpi_device *device) | |||
270 | 271 | ||
271 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | 272 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) |
272 | { | 273 | { |
273 | printk(LOG_PFX "sony_acpi_notify\n"); | 274 | if (debug) |
275 | printk(LOG_PFX "sony_acpi_notify, event: %d\n", event); | ||
276 | acpi_bus_generate_event(sony_acpi_acpi_device, 1, event); | ||
274 | } | 277 | } |
275 | 278 | ||
276 | static acpi_status sony_walk_callback(acpi_handle handle, u32 level, | 279 | static acpi_status sony_walk_callback(acpi_handle handle, u32 level, |
@@ -295,6 +298,8 @@ static int sony_acpi_add(struct acpi_device *device) | |||
295 | acpi_handle handle; | 298 | acpi_handle handle; |
296 | struct sony_acpi_value *item; | 299 | struct sony_acpi_value *item; |
297 | 300 | ||
301 | sony_acpi_acpi_device = device; | ||
302 | |||
298 | sony_acpi_handle = device->handle; | 303 | sony_acpi_handle = device->handle; |
299 | 304 | ||
300 | acpi_driver_data(device) = NULL; | 305 | acpi_driver_data(device) = NULL; |
@@ -308,16 +313,16 @@ static int sony_acpi_add(struct acpi_device *device) | |||
308 | result = -ENODEV; | 313 | result = -ENODEV; |
309 | goto outwalk; | 314 | goto outwalk; |
310 | } | 315 | } |
316 | } | ||
311 | 317 | ||
312 | status = acpi_install_notify_handler(sony_acpi_handle, | 318 | status = acpi_install_notify_handler(sony_acpi_handle, |
313 | ACPI_DEVICE_NOTIFY, | 319 | ACPI_DEVICE_NOTIFY, |
314 | sony_acpi_notify, | 320 | sony_acpi_notify, |
315 | NULL); | 321 | NULL); |
316 | if (ACPI_FAILURE(status)) { | 322 | if (ACPI_FAILURE(status)) { |
317 | printk(LOG_PFX "unable to install notify handler\n"); | 323 | printk(LOG_PFX "unable to install notify handler\n"); |
318 | result = -ENODEV; | 324 | result = -ENODEV; |
319 | goto outnotify; | 325 | goto outnotify; |
320 | } | ||
321 | } | 326 | } |
322 | 327 | ||
323 | if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) { | 328 | if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) { |
@@ -342,7 +347,7 @@ static int sony_acpi_add(struct acpi_device *device) | |||
342 | item->acpiset, &handle))) | 347 | item->acpiset, &handle))) |
343 | continue; | 348 | continue; |
344 | 349 | ||
345 | item->proc = create_proc_entry(item->name, 0600, | 350 | item->proc = create_proc_entry(item->name, 0666, |
346 | acpi_device_dir(device)); | 351 | acpi_device_dir(device)); |
347 | if (!item->proc) { | 352 | if (!item->proc) { |
348 | printk(LOG_PFX "unable to create proc entry\n"); | 353 | printk(LOG_PFX "unable to create proc entry\n"); |
@@ -361,13 +366,11 @@ static int sony_acpi_add(struct acpi_device *device) | |||
361 | return 0; | 366 | return 0; |
362 | 367 | ||
363 | outproc: | 368 | outproc: |
364 | if (debug) { | 369 | status = acpi_remove_notify_handler(sony_acpi_handle, |
365 | status = acpi_remove_notify_handler(sony_acpi_handle, | 370 | ACPI_DEVICE_NOTIFY, |
366 | ACPI_DEVICE_NOTIFY, | 371 | sony_acpi_notify); |
367 | sony_acpi_notify); | 372 | if (ACPI_FAILURE(status)) |
368 | if (ACPI_FAILURE(status)) | 373 | printk(LOG_PFX "unable to remove notify handler\n"); |
369 | printk(LOG_PFX "unable to remove notify handler\n"); | ||
370 | } | ||
371 | outnotify: | 374 | outnotify: |
372 | for (item = sony_acpi_values; item->name; ++item) | 375 | for (item = sony_acpi_values; item->name; ++item) |
373 | if (item->proc) | 376 | if (item->proc) |
@@ -384,13 +387,13 @@ static int sony_acpi_remove(struct acpi_device *device, int type) | |||
384 | if (sony_backlight_device) | 387 | if (sony_backlight_device) |
385 | backlight_device_unregister(sony_backlight_device); | 388 | backlight_device_unregister(sony_backlight_device); |
386 | 389 | ||
387 | if (debug) { | 390 | sony_acpi_acpi_device = NULL; |
388 | status = acpi_remove_notify_handler(sony_acpi_handle, | 391 | |
389 | ACPI_DEVICE_NOTIFY, | 392 | status = acpi_remove_notify_handler(sony_acpi_handle, |
390 | sony_acpi_notify); | 393 | ACPI_DEVICE_NOTIFY, |
391 | if (ACPI_FAILURE(status)) | 394 | sony_acpi_notify); |
392 | printk(LOG_PFX "unable to remove notify handler\n"); | 395 | if (ACPI_FAILURE(status)) |
393 | } | 396 | printk(LOG_PFX "unable to remove notify handler\n"); |
394 | 397 | ||
395 | for (item = sony_acpi_values; item->name; ++item) | 398 | for (item = sony_acpi_values; item->name; ++item) |
396 | if (item->proc) | 399 | if (item->proc) |