diff options
author | Corentin Chary <corentincj@iksaif.net> | 2010-01-13 16:10:39 -0500 |
---|---|---|
committer | Corentin Chary <corentincj@iksaif.net> | 2010-02-28 13:35:11 -0500 |
commit | 3e68ae7c2a9076a694e46f49ec26323a7757eaad (patch) | |
tree | 975b9a9e062e667c5532e25d07e1ed37c55bc801 /drivers/platform | |
parent | 6358bf2c4c309efc7c3cbc36466c32108c12c456 (diff) |
asus-laptop: stop using read_status for lcd
(anyway lcd code is scheduled for removal)
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index ea51d7e4df21..d726db380e47 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -241,6 +241,7 @@ struct asus_laptop { | |||
241 | 241 | ||
242 | int wireless_status; | 242 | int wireless_status; |
243 | bool have_rsts; | 243 | bool have_rsts; |
244 | int lcd_state; | ||
244 | 245 | ||
245 | acpi_handle handle; /* the handle of the hotk device */ | 246 | acpi_handle handle; /* the handle of the hotk device */ |
246 | char status; /* status of the hotk, for LEDs, ... */ | 247 | char status; /* status of the hotk, for LEDs, ... */ |
@@ -538,30 +539,33 @@ error: | |||
538 | /* | 539 | /* |
539 | * Backlight device | 540 | * Backlight device |
540 | */ | 541 | */ |
541 | static int get_lcd_state(struct asus_laptop *asus) | 542 | static int asus_lcd_status(struct asus_laptop *asus) |
542 | { | 543 | { |
543 | return read_status(asus, LCD_ON); | 544 | return asus->lcd_state; |
544 | } | 545 | } |
545 | 546 | ||
546 | static int set_lcd_state(struct asus_laptop *asus, int value) | 547 | static int asus_lcd_set(struct asus_laptop *asus, int value) |
547 | { | 548 | { |
548 | int lcd = 0; | 549 | int lcd = 0; |
549 | acpi_status status = 0; | 550 | acpi_status status = 0; |
550 | 551 | ||
551 | lcd = value ? 1 : 0; | 552 | lcd = !!value; |
552 | 553 | ||
553 | if (lcd == get_lcd_state(asus)) | 554 | if (lcd == asus_lcd_status(asus)) |
554 | return 0; | 555 | return 0; |
555 | 556 | ||
556 | if (lcd_switch_handle) { | 557 | if (!lcd_switch_handle) |
557 | status = acpi_evaluate_object(lcd_switch_handle, | 558 | return -ENODEV; |
558 | NULL, NULL, NULL); | 559 | |
560 | status = acpi_evaluate_object(lcd_switch_handle, | ||
561 | NULL, NULL, NULL); | ||
559 | 562 | ||
560 | if (ACPI_FAILURE(status)) | 563 | if (ACPI_FAILURE(status)) { |
561 | pr_warning("Error switching LCD\n"); | 564 | pr_warning("Error switching LCD\n"); |
565 | return -ENODEV; | ||
562 | } | 566 | } |
563 | 567 | ||
564 | write_status(asus, NULL, lcd, LCD_ON); | 568 | asus->lcd_state = lcd; |
565 | return 0; | 569 | return 0; |
566 | } | 570 | } |
567 | 571 | ||
@@ -569,6 +573,8 @@ static void lcd_blank(struct asus_laptop *asus, int blank) | |||
569 | { | 573 | { |
570 | struct backlight_device *bd = asus->backlight_device; | 574 | struct backlight_device *bd = asus->backlight_device; |
571 | 575 | ||
576 | asus->lcd_state = (blank == FB_BLANK_UNBLANK); | ||
577 | |||
572 | if (bd) { | 578 | if (bd) { |
573 | bd->props.power = blank; | 579 | bd->props.power = blank; |
574 | backlight_update_status(bd); | 580 | backlight_update_status(bd); |
@@ -607,7 +613,7 @@ static int update_bl_status(struct backlight_device *bd) | |||
607 | return rv; | 613 | return rv; |
608 | 614 | ||
609 | value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; | 615 | value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; |
610 | return set_lcd_state(asus, value); | 616 | return asus_lcd_set(asus, value); |
611 | } | 617 | } |
612 | 618 | ||
613 | static struct backlight_ops asusbl_ops = { | 619 | static struct backlight_ops asusbl_ops = { |
@@ -1144,13 +1150,10 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event) | |||
1144 | * We need to tell the backlight device when the backlight power is | 1150 | * We need to tell the backlight device when the backlight power is |
1145 | * switched | 1151 | * switched |
1146 | */ | 1152 | */ |
1147 | if (event == ATKD_LCD_ON) { | 1153 | if (event == ATKD_LCD_ON) |
1148 | write_status(asus, NULL, 1, LCD_ON); | ||
1149 | lcd_blank(asus, FB_BLANK_UNBLANK); | 1154 | lcd_blank(asus, FB_BLANK_UNBLANK); |
1150 | } else if (event == ATKD_LCD_OFF) { | 1155 | else if (event == ATKD_LCD_OFF) |
1151 | write_status(asus, NULL, 0, LCD_ON); | ||
1152 | lcd_blank(asus, FB_BLANK_POWERDOWN); | 1156 | lcd_blank(asus, FB_BLANK_POWERDOWN); |
1153 | } | ||
1154 | 1157 | ||
1155 | /* TODO Find a better way to handle events count. */ | 1158 | /* TODO Find a better way to handle events count. */ |
1156 | count = asus->event_count[event % 128]++; | 1159 | count = asus->event_count[event % 128]++; |