Skip to content

Commit

Permalink
eeepc-laptop: add a getter for touchpad led
Browse files Browse the repository at this point in the history
Allow te get the current led state in a more accurate way.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Corentin Chary authored and Matthew Garrett committed Jan 7, 2011
1 parent dfed65d commit 62a75d8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/platform/x86/eeepc-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ static void tpd_led_set(struct led_classdev *led_cdev,
queue_work(eeepc->led_workqueue, &eeepc->tpd_led_work);
}

static enum led_brightness tpd_led_get(struct led_classdev *led_cdev)
{
struct eeepc_laptop *eeepc;

eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led);

return get_acpi(eeepc, CM_ASL_TPD);
}

static int eeepc_led_init(struct eeepc_laptop *eeepc)
{
int rv;
Expand All @@ -543,6 +552,8 @@ static int eeepc_led_init(struct eeepc_laptop *eeepc)

eeepc->tpd_led.name = "eeepc::touchpad";
eeepc->tpd_led.brightness_set = tpd_led_set;
if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */
eeepc->tpd_led.brightness_get = tpd_led_get;
eeepc->tpd_led.max_brightness = 1;

rv = led_classdev_register(&eeepc->platform_device->dev,
Expand Down

0 comments on commit 62a75d8

Please sign in to comment.