diff options
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 33 | ||||
-rw-r--r-- | drivers/platform/x86/asus-wmi.h | 2 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-wmi.c | 15 |
3 files changed, 34 insertions, 16 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index eb114f8d39e..c4ad76ee7b5 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -1076,7 +1076,12 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus) | |||
1076 | */ | 1076 | */ |
1077 | static int read_backlight_power(struct asus_wmi *asus) | 1077 | static int read_backlight_power(struct asus_wmi *asus) |
1078 | { | 1078 | { |
1079 | int ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_BACKLIGHT); | 1079 | int ret; |
1080 | if (asus->driver->quirks->store_backlight_power) | ||
1081 | ret = !asus->driver->panel_power; | ||
1082 | else | ||
1083 | ret = asus_wmi_get_devstate_simple(asus, | ||
1084 | ASUS_WMI_DEVID_BACKLIGHT); | ||
1080 | 1085 | ||
1081 | if (ret < 0) | 1086 | if (ret < 0) |
1082 | return ret; | 1087 | return ret; |
@@ -1138,24 +1143,23 @@ static int update_bl_status(struct backlight_device *bd) | |||
1138 | { | 1143 | { |
1139 | struct asus_wmi *asus = bl_get_data(bd); | 1144 | struct asus_wmi *asus = bl_get_data(bd); |
1140 | u32 ctrl_param; | 1145 | u32 ctrl_param; |
1141 | int power, err; | 1146 | int power, err = 0; |
1142 | |||
1143 | if (asus->driver->quirks->scalar_panel_brightness) | ||
1144 | ctrl_param = get_scalar_command(bd); | ||
1145 | else | ||
1146 | ctrl_param = bd->props.brightness; | ||
1147 | |||
1148 | err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS, | ||
1149 | ctrl_param, NULL); | ||
1150 | |||
1151 | if (err < 0) | ||
1152 | return err; | ||
1153 | 1147 | ||
1154 | power = read_backlight_power(asus); | 1148 | power = read_backlight_power(asus); |
1155 | if (power != -ENODEV && bd->props.power != power) { | 1149 | if (power != -ENODEV && bd->props.power != power) { |
1156 | ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK); | 1150 | ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK); |
1157 | err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, | 1151 | err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, |
1158 | ctrl_param, NULL); | 1152 | ctrl_param, NULL); |
1153 | if (asus->driver->quirks->store_backlight_power) | ||
1154 | asus->driver->panel_power = bd->props.power; | ||
1155 | } else { | ||
1156 | if (asus->driver->quirks->scalar_panel_brightness) | ||
1157 | ctrl_param = get_scalar_command(bd); | ||
1158 | else | ||
1159 | ctrl_param = bd->props.brightness; | ||
1160 | |||
1161 | err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS, | ||
1162 | ctrl_param, NULL); | ||
1159 | } | 1163 | } |
1160 | return err; | 1164 | return err; |
1161 | } | 1165 | } |
@@ -1217,6 +1221,9 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus) | |||
1217 | 1221 | ||
1218 | asus->backlight_device = bd; | 1222 | asus->backlight_device = bd; |
1219 | 1223 | ||
1224 | if (asus->driver->quirks->store_backlight_power) | ||
1225 | asus->driver->panel_power = power; | ||
1226 | |||
1220 | bd->props.brightness = read_brightness(bd); | 1227 | bd->props.brightness = read_brightness(bd); |
1221 | bd->props.power = power; | 1228 | bd->props.power = power; |
1222 | backlight_update_status(bd); | 1229 | backlight_update_status(bd); |
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h index ac7dd4eaebd..35003e4f131 100644 --- a/drivers/platform/x86/asus-wmi.h +++ b/drivers/platform/x86/asus-wmi.h | |||
@@ -38,11 +38,13 @@ struct asus_wmi; | |||
38 | struct quirk_entry { | 38 | struct quirk_entry { |
39 | bool hotplug_wireless; | 39 | bool hotplug_wireless; |
40 | bool scalar_panel_brightness; | 40 | bool scalar_panel_brightness; |
41 | bool store_backlight_power; | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | struct asus_wmi_driver { | 44 | struct asus_wmi_driver { |
44 | int wapf; | 45 | int wapf; |
45 | int brightness; | 46 | int brightness; |
47 | int panel_power; | ||
46 | 48 | ||
47 | const char *name; | 49 | const char *name; |
48 | struct module *owner; | 50 | struct module *owner; |
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index 67186e6ca28..9f8ccf9f590 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/input.h> | 32 | #include <linux/input.h> |
33 | #include <linux/input/sparse-keymap.h> | 33 | #include <linux/input/sparse-keymap.h> |
34 | #include <linux/dmi.h> | 34 | #include <linux/dmi.h> |
35 | #include <linux/fb.h> | ||
35 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
36 | 37 | ||
37 | #include "asus-wmi.h" | 38 | #include "asus-wmi.h" |
@@ -98,8 +99,13 @@ static struct quirk_entry quirk_asus_1000h = { | |||
98 | .hotplug_wireless = true, | 99 | .hotplug_wireless = true, |
99 | }; | 100 | }; |
100 | 101 | ||
102 | static struct quirk_entry quirk_asus_et2012_type1 = { | ||
103 | .store_backlight_power = true, | ||
104 | }; | ||
105 | |||
101 | static struct quirk_entry quirk_asus_et2012_type3 = { | 106 | static struct quirk_entry quirk_asus_et2012_type3 = { |
102 | .scalar_panel_brightness = true, | 107 | .scalar_panel_brightness = true, |
108 | .store_backlight_power = true, | ||
103 | }; | 109 | }; |
104 | 110 | ||
105 | static int dmi_matched(const struct dmi_system_id *dmi) | 111 | static int dmi_matched(const struct dmi_system_id *dmi) |
@@ -111,10 +117,12 @@ static int dmi_matched(const struct dmi_system_id *dmi) | |||
111 | if (unlikely(strncmp(model, "ET2012", 6) == 0)) { | 117 | if (unlikely(strncmp(model, "ET2012", 6) == 0)) { |
112 | const struct dmi_device *dev = NULL; | 118 | const struct dmi_device *dev = NULL; |
113 | char oemstring[30]; | 119 | char oemstring[30]; |
114 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, | 120 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, |
115 | dev))) { | 121 | NULL, dev))) { |
116 | if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) { | 122 | if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) { |
117 | if (oemstring[18] == '3') | 123 | if (oemstring[18] == '1') |
124 | quirks = &quirk_asus_et2012_type1; | ||
125 | else if (oemstring[18] == '3') | ||
118 | quirks = &quirk_asus_et2012_type3; | 126 | quirks = &quirk_asus_et2012_type3; |
119 | break; | 127 | break; |
120 | } | 128 | } |
@@ -202,6 +210,7 @@ static int eeepc_wmi_probe(struct platform_device *pdev) | |||
202 | static void eeepc_wmi_quirks(struct asus_wmi_driver *driver) | 210 | static void eeepc_wmi_quirks(struct asus_wmi_driver *driver) |
203 | { | 211 | { |
204 | driver->wapf = -1; | 212 | driver->wapf = -1; |
213 | driver->panel_power = FB_BLANK_UNBLANK; | ||
205 | driver->quirks = &quirk_asus_unknown; | 214 | driver->quirks = &quirk_asus_unknown; |
206 | driver->quirks->hotplug_wireless = hotplug_wireless; | 215 | driver->quirks->hotplug_wireless = hotplug_wireless; |
207 | dmi_check_system(asus_quirks); | 216 | dmi_check_system(asus_quirks); |