aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/asus-laptop.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2007-01-26 08:04:55 -0500
committerLen Brown <len.brown@intel.com>2007-01-30 01:37:09 -0500
commit722ad97153015aaf5becba3084565e98e71a2aed (patch)
tree6f1769ee1ee2be9067a6c1112c9cff974f40497e /drivers/misc/asus-laptop.c
parent78127b4a90469d6973de2837d483f80f3709e6e0 (diff)
asus-laptop: add ledd support
Ledd is a special led ... /sys/.../asus-laptop/ledd works like /proc/acpi/asus/ledd Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r--drivers/misc/asus-laptop.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 979daa6755a7..bd963c6365c8 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -104,6 +104,9 @@ ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED");
104ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */ 104ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */
105ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */ 105ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */
106 106
107/* LEDD */
108ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM");
109
107/* Bluetooth and WLAN 110/* Bluetooth and WLAN
108 * WLED and BLED are not handled like other XLED, because in some dsdt 111 * WLED and BLED are not handled like other XLED, because in some dsdt
109 * they also control the WLAN/Bluetooth device. 112 * they also control the WLAN/Bluetooth device.
@@ -151,6 +154,7 @@ struct asus_hotk {
151 struct acpi_device *device; //the device we are in 154 struct acpi_device *device; //the device we are in
152 acpi_handle handle; //the handle of the hotk device 155 acpi_handle handle; //the handle of the hotk device
153 char status; //status of the hotk, for LEDs, ... 156 char status; //status of the hotk, for LEDs, ...
157 u32 ledd_status; //status of the LED display
154 u16 event_count[128]; //count for each event TODO make this better 158 u16 event_count[128]; //count for each event TODO make this better
155}; 159};
156 160
@@ -479,6 +483,30 @@ static ssize_t store_status(const char *buf, size_t count,
479} 483}
480 484
481/* 485/*
486 * LEDD display
487 */
488static ssize_t show_ledd(struct device *dev,
489 struct device_attribute *attr, char *buf)
490{
491 return sprintf(buf, "0x%08x\n", hotk->ledd_status);
492}
493
494static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
495 const char *buf, size_t count)
496{
497 int rv, value;
498
499 rv = parse_arg(buf, count, &value);
500 if (rv > 0) {
501 if (!write_acpi_int(ledd_set_handle, NULL, value, NULL))
502 printk(ASUS_WARNING "LED display write failed\n");
503 else
504 hotk->ledd_status = (u32) value;
505 }
506 return rv;
507}
508
509/*
482 * WLAN 510 * WLAN
483 */ 511 */
484static ssize_t show_wlan(struct device *dev, 512static ssize_t show_wlan(struct device *dev,
@@ -607,12 +635,14 @@ static ASUS_CREATE_DEVICE_ATTR(infos);
607static ASUS_CREATE_DEVICE_ATTR(wlan); 635static ASUS_CREATE_DEVICE_ATTR(wlan);
608static ASUS_CREATE_DEVICE_ATTR(bluetooth); 636static ASUS_CREATE_DEVICE_ATTR(bluetooth);
609static ASUS_CREATE_DEVICE_ATTR(display); 637static ASUS_CREATE_DEVICE_ATTR(display);
638static ASUS_CREATE_DEVICE_ATTR(ledd);
610 639
611static struct attribute *asuspf_attributes[] = { 640static struct attribute *asuspf_attributes[] = {
612 &dev_attr_infos.attr, 641 &dev_attr_infos.attr,
613 &dev_attr_wlan.attr, 642 &dev_attr_wlan.attr,
614 &dev_attr_bluetooth.attr, 643 &dev_attr_bluetooth.attr,
615 &dev_attr_display.attr, 644 &dev_attr_display.attr,
645 &dev_attr_ledd.attr,
616 NULL 646 NULL
617}; 647};
618 648
@@ -646,6 +676,9 @@ static void asus_hotk_add_fs(void)
646 else if(display_set_handle) 676 else if(display_set_handle)
647 ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp); 677 ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp);
648 678
679 if (ledd_set_handle)
680 ASUS_SET_DEVICE_ATTR(ledd, 0644, show_ledd, store_ledd);
681
649} 682}
650 683
651static int asus_handle_init(char *name, acpi_handle *handle, 684static int asus_handle_init(char *name, acpi_handle *handle,
@@ -741,6 +774,8 @@ static int asus_hotk_get_info(void)
741 ASUS_HANDLE_INIT(rled_set); 774 ASUS_HANDLE_INIT(rled_set);
742 ASUS_HANDLE_INIT(pled_set); 775 ASUS_HANDLE_INIT(pled_set);
743 776
777 ASUS_HANDLE_INIT(ledd_set);
778
744 /* 779 /*
745 * The HWRS method return informations about the hardware. 780 * The HWRS method return informations about the hardware.
746 * 0x80 bit is for WLAN, 0x100 for Bluetooth. 781 * 0x80 bit is for WLAN, 0x100 for Bluetooth.
@@ -836,6 +871,9 @@ static int asus_hotk_add(struct acpi_device *device)
836 /* LCD Backlight is on by default */ 871 /* LCD Backlight is on by default */
837 write_status(NULL, 1, LCD_ON, 0); 872 write_status(NULL, 1, LCD_ON, 0);
838 873
874 /* LED display is off by default */
875 hotk->ledd_status = 0xFFF;
876
839 end: 877 end:
840 if (result) { 878 if (result) {
841 kfree(hotk->name); 879 kfree(hotk->name);