提交 3e68ae7c 编写于 作者: C Corentin Chary

asus-laptop: stop using read_status for lcd

(anyway lcd code is scheduled for removal)
Signed-off-by: NCorentin Chary <corentincj@iksaif.net>
上级 6358bf2c
...@@ -241,6 +241,7 @@ struct asus_laptop { ...@@ -241,6 +241,7 @@ struct asus_laptop {
int wireless_status; int wireless_status;
bool have_rsts; bool have_rsts;
int lcd_state;
acpi_handle handle; /* the handle of the hotk device */ acpi_handle handle; /* the handle of the hotk device */
char status; /* status of the hotk, for LEDs, ... */ char status; /* status of the hotk, for LEDs, ... */
...@@ -538,30 +539,33 @@ static int asus_led_init(struct asus_laptop *asus) ...@@ -538,30 +539,33 @@ static int asus_led_init(struct asus_laptop *asus)
/* /*
* Backlight device * Backlight device
*/ */
static int get_lcd_state(struct asus_laptop *asus) static int asus_lcd_status(struct asus_laptop *asus)
{ {
return read_status(asus, LCD_ON); return asus->lcd_state;
} }
static int set_lcd_state(struct asus_laptop *asus, int value) static int asus_lcd_set(struct asus_laptop *asus, int value)
{ {
int lcd = 0; int lcd = 0;
acpi_status status = 0; acpi_status status = 0;
lcd = value ? 1 : 0; lcd = !!value;
if (lcd == get_lcd_state(asus)) if (lcd == asus_lcd_status(asus))
return 0; return 0;
if (lcd_switch_handle) { if (!lcd_switch_handle)
return -ENODEV;
status = acpi_evaluate_object(lcd_switch_handle, status = acpi_evaluate_object(lcd_switch_handle,
NULL, NULL, NULL); NULL, NULL, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status)) {
pr_warning("Error switching LCD\n"); pr_warning("Error switching LCD\n");
return -ENODEV;
} }
write_status(asus, NULL, lcd, LCD_ON); asus->lcd_state = lcd;
return 0; return 0;
} }
...@@ -569,6 +573,8 @@ static void lcd_blank(struct asus_laptop *asus, int blank) ...@@ -569,6 +573,8 @@ static void lcd_blank(struct asus_laptop *asus, int blank)
{ {
struct backlight_device *bd = asus->backlight_device; struct backlight_device *bd = asus->backlight_device;
asus->lcd_state = (blank == FB_BLANK_UNBLANK);
if (bd) { if (bd) {
bd->props.power = blank; bd->props.power = blank;
backlight_update_status(bd); backlight_update_status(bd);
...@@ -607,7 +613,7 @@ static int update_bl_status(struct backlight_device *bd) ...@@ -607,7 +613,7 @@ static int update_bl_status(struct backlight_device *bd)
return rv; return rv;
value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0;
return set_lcd_state(asus, value); return asus_lcd_set(asus, value);
} }
static struct backlight_ops asusbl_ops = { static struct backlight_ops asusbl_ops = {
...@@ -1144,13 +1150,10 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event) ...@@ -1144,13 +1150,10 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event)
* We need to tell the backlight device when the backlight power is * We need to tell the backlight device when the backlight power is
* switched * switched
*/ */
if (event == ATKD_LCD_ON) { if (event == ATKD_LCD_ON)
write_status(asus, NULL, 1, LCD_ON);
lcd_blank(asus, FB_BLANK_UNBLANK); lcd_blank(asus, FB_BLANK_UNBLANK);
} else if (event == ATKD_LCD_OFF) { else if (event == ATKD_LCD_OFF)
write_status(asus, NULL, 0, LCD_ON);
lcd_blank(asus, FB_BLANK_POWERDOWN); lcd_blank(asus, FB_BLANK_POWERDOWN);
}
/* TODO Find a better way to handle events count. */ /* TODO Find a better way to handle events count. */
count = asus->event_count[event % 128]++; count = asus->event_count[event % 128]++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册