]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/asus-laptop.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[linux-2.6-omap-h63xx.git] / drivers / misc / asus-laptop.c
index 0846c33296bc7e1a0da8aabf21a7023667613edb..a9d5228724a6950d6e7cc42d70ab8ddfab2bdd05 100644 (file)
@@ -139,6 +139,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
            "\\_SB.PCI0.PX40.ECD0._Q10",        /* L3C */
            "\\_SB.PCI0.PX40.EC0.Q10",  /* M1A */
            "\\_SB.PCI0.LPCB.EC0._Q10", /* P30 */
+           "\\_SB.PCI0.LPCB.EC0._Q0E", /* P30/P35 */
            "\\_SB.PCI0.PX40.Q10",      /* S1x */
            "\\Q10");           /* A2x, L2D, L3D, M2E */
 
@@ -239,7 +240,7 @@ static struct workqueue_struct *led_workqueue;
        static int object##_led_wk;                                     \
        static DECLARE_WORK(object##_led_work, object##_led_update);    \
        static struct led_classdev object##_led = {                     \
-               .name           = "asus:" ledname,                      \
+               .name           = "asus::" ledname,                     \
                .brightness_set = object##_led_set,                     \
        }
 
@@ -254,7 +255,7 @@ ASUS_LED(gled, "gaming");
  * method is searched within the scope of the handle, can be NULL. The output
  * of the method is written is output, which can also be NULL
  *
- * returns 1 if write is successful, 0 else.
+ * returns 0 if write is successful, -1 else.
  */
 static int write_acpi_int(acpi_handle handle, const char *method, int val,
                          struct acpi_buffer *output)
@@ -263,18 +264,24 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
        union acpi_object in_obj;       //the only param we use
        acpi_status status;
 
+       if (!handle)
+               return 0;
+
        params.count = 1;
        params.pointer = &in_obj;
        in_obj.type = ACPI_TYPE_INTEGER;
        in_obj.integer.value = val;
 
        status = acpi_evaluate_object(handle, (char *)method, &params, output);
-       return (status == AE_OK);
+       if (status == AE_OK)
+               return 0;
+       else
+               return -1;
 }
 
 static int read_wireless_status(int mask)
 {
-       ulong status;
+       unsigned long long status;
        acpi_status rv = AE_OK;
 
        if (!wireless_status_handle)
@@ -291,7 +298,7 @@ static int read_wireless_status(int mask)
 
 static int read_gps_status(void)
 {
-       ulong status;
+       unsigned long long status;
        acpi_status rv = AE_OK;
 
        rv = acpi_evaluate_integer(gps_status_handle, NULL, NULL, &status);
@@ -321,7 +328,7 @@ static void write_status(acpi_handle handle, int out, int mask)
 
        switch (mask) {
        case MLED_ON:
-               out = !out & 0x1;
+               out = !(out & 0x1);
                break;
        case GLED_ON:
                out = (out & 0x1) + 1;
@@ -335,7 +342,7 @@ static void write_status(acpi_handle handle, int out, int mask)
                break;
        }
 
-       if (handle && !write_acpi_int(handle, NULL, out, NULL))
+       if (write_acpi_int(handle, NULL, out, NULL))
                printk(ASUS_WARNING " write failed %x\n", mask);
 }
 
@@ -344,7 +351,7 @@ static void write_status(acpi_handle handle, int out, int mask)
        static void object##_led_set(struct led_classdev *led_cdev,     \
                                     enum led_brightness value)         \
        {                                                               \
-               object##_led_wk = value;                                \
+               object##_led_wk = (value > 0) ? 1 : 0;                  \
                queue_work(led_workqueue, &object##_led_work);          \
        }                                                               \
        static void object##_led_update(struct work_struct *ignored)    \
@@ -398,7 +405,7 @@ static void lcd_blank(int blank)
 
 static int read_brightness(struct backlight_device *bd)
 {
-       ulong value;
+       unsigned long long value;
        acpi_status rv = AE_OK;
 
        rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value);
@@ -415,7 +422,7 @@ static int set_brightness(struct backlight_device *bd, int value)
        value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
        /* 0 <= value <= 15 */
 
-       if (!write_acpi_int(brightness_set_handle, NULL, value, NULL)) {
+       if (write_acpi_int(brightness_set_handle, NULL, value, NULL)) {
                printk(ASUS_WARNING "Error changing brightness\n");
                ret = -EIO;
        }
@@ -449,7 +456,7 @@ static ssize_t show_infos(struct device *dev,
                          struct device_attribute *attr, char *page)
 {
        int len = 0;
-       ulong temp;
+       unsigned long long temp;
        char buf[16];           //enough for all info
        acpi_status rv = AE_OK;
 
@@ -545,7 +552,7 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
 
        rv = parse_arg(buf, count, &value);
        if (rv > 0) {
-               if (!write_acpi_int(ledd_set_handle, NULL, value, NULL))
+               if (write_acpi_int(ledd_set_handle, NULL, value, NULL))
                        printk(ASUS_WARNING "LED display write failed\n");
                else
                        hotk->ledd_status = (u32) value;
@@ -590,14 +597,14 @@ static ssize_t store_bluetooth(struct device *dev,
 static void set_display(int value)
 {
        /* no sanity check needed for now */
-       if (!write_acpi_int(display_set_handle, NULL, value, NULL))
+       if (write_acpi_int(display_set_handle, NULL, value, NULL))
                printk(ASUS_WARNING "Error setting display\n");
        return;
 }
 
 static int read_display(void)
 {
-       ulong value = 0;
+       unsigned long long value = 0;
        acpi_status rv = AE_OK;
 
        /* In most of the case, we know how to set the display, but sometime
@@ -647,7 +654,7 @@ static ssize_t store_disp(struct device *dev, struct device_attribute *attr,
  */
 static void set_light_sens_switch(int value)
 {
-       if (!write_acpi_int(ls_switch_handle, NULL, value, NULL))
+       if (write_acpi_int(ls_switch_handle, NULL, value, NULL))
                printk(ASUS_WARNING "Error setting light sensor switch\n");
        hotk->light_switch = value;
 }
@@ -672,7 +679,7 @@ static ssize_t store_lssw(struct device *dev, struct device_attribute *attr,
 
 static void set_light_sens_level(int value)
 {
-       if (!write_acpi_int(ls_level_handle, NULL, value, NULL))
+       if (write_acpi_int(ls_level_handle, NULL, value, NULL))
                printk(ASUS_WARNING "Error setting light sensor level\n");
        hotk->light_level = value;
 }
@@ -843,7 +850,7 @@ static int asus_hotk_get_info(void)
 {
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        union acpi_object *model = NULL;
-       ulong bsts_result, hwrs_result;
+       unsigned long long bsts_result, hwrs_result;
        char *string = NULL;
        acpi_status status;
 
@@ -860,7 +867,7 @@ static int asus_hotk_get_info(void)
                printk(ASUS_WARNING "Couldn't get the DSDT table header\n");
 
        /* We have to write 0 on init this far for all ASUS models */
-       if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
+       if (write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
                printk(ASUS_ERR "Hotkey initialization failed\n");
                return -ENODEV;
        }
@@ -990,7 +997,7 @@ static int asus_hotk_add(struct acpi_device *device)
        hotk->handle = device->handle;
        strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME);
        strcpy(acpi_device_class(device), ASUS_HOTK_CLASS);
-       acpi_driver_data(device) = hotk;
+       device->driver_data = hotk;
        hotk->device = device;
 
        result = asus_hotk_check();