diff options
Diffstat (limited to 'drivers/platform/x86/eeepc-wmi.c')
-rw-r--r-- | drivers/platform/x86/eeepc-wmi.c | 85 |
1 files changed, 60 insertions, 25 deletions
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index 1d91eb2ace0a..67186e6ca28d 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c | |||
@@ -48,6 +48,7 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID); | 49 | MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID); |
50 | 50 | ||
51 | static struct quirk_entry *quirks; | ||
51 | static bool hotplug_wireless; | 52 | static bool hotplug_wireless; |
52 | 53 | ||
53 | module_param(hotplug_wireless, bool, 0444); | 54 | module_param(hotplug_wireless, bool, 0444); |
@@ -90,6 +91,60 @@ static const struct key_entry eeepc_wmi_keymap[] = { | |||
90 | { KE_END, 0}, | 91 | { KE_END, 0}, |
91 | }; | 92 | }; |
92 | 93 | ||
94 | static struct quirk_entry quirk_asus_unknown = { | ||
95 | }; | ||
96 | |||
97 | static struct quirk_entry quirk_asus_1000h = { | ||
98 | .hotplug_wireless = true, | ||
99 | }; | ||
100 | |||
101 | static struct quirk_entry quirk_asus_et2012_type3 = { | ||
102 | .scalar_panel_brightness = true, | ||
103 | }; | ||
104 | |||
105 | static int dmi_matched(const struct dmi_system_id *dmi) | ||
106 | { | ||
107 | char *model; | ||
108 | quirks = dmi->driver_data; | ||
109 | |||
110 | model = (char *)dmi->matches[1].substr; | ||
111 | if (unlikely(strncmp(model, "ET2012", 6) == 0)) { | ||
112 | const struct dmi_device *dev = NULL; | ||
113 | char oemstring[30]; | ||
114 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, | ||
115 | dev))) { | ||
116 | if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) { | ||
117 | if (oemstring[18] == '3') | ||
118 | quirks = &quirk_asus_et2012_type3; | ||
119 | break; | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | return 1; | ||
124 | } | ||
125 | |||
126 | static struct dmi_system_id asus_quirks[] = { | ||
127 | { | ||
128 | .callback = dmi_matched, | ||
129 | .ident = "ASUSTeK Computer INC. 1000H", | ||
130 | .matches = { | ||
131 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), | ||
132 | DMI_MATCH(DMI_PRODUCT_NAME, "1000H"), | ||
133 | }, | ||
134 | .driver_data = &quirk_asus_1000h, | ||
135 | }, | ||
136 | { | ||
137 | .callback = dmi_matched, | ||
138 | .ident = "ASUSTeK Computer INC. ET2012E/I", | ||
139 | .matches = { | ||
140 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), | ||
141 | DMI_MATCH(DMI_PRODUCT_NAME, "ET2012"), | ||
142 | }, | ||
143 | .driver_data = &quirk_asus_unknown, | ||
144 | }, | ||
145 | {}, | ||
146 | }; | ||
147 | |||
93 | static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code, | 148 | static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code, |
94 | unsigned int *value, bool *autorelease) | 149 | unsigned int *value, bool *autorelease) |
95 | { | 150 | { |
@@ -144,33 +199,13 @@ static int eeepc_wmi_probe(struct platform_device *pdev) | |||
144 | return 0; | 199 | return 0; |
145 | } | 200 | } |
146 | 201 | ||
147 | static void eeepc_dmi_check(struct asus_wmi_driver *driver) | ||
148 | { | ||
149 | const char *model; | ||
150 | |||
151 | model = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
152 | if (!model) | ||
153 | return; | ||
154 | |||
155 | /* | ||
156 | * Whitelist for wlan hotplug | ||
157 | * | ||
158 | * Asus 1000H needs the current hotplug code to handle | ||
159 | * Fn+F2 correctly. We may add other Asus here later, but | ||
160 | * it seems that most of the laptops supported by asus-wmi | ||
161 | * don't need to be on this list | ||
162 | */ | ||
163 | if (strcmp(model, "1000H") == 0) { | ||
164 | driver->hotplug_wireless = true; | ||
165 | pr_info("wlan hotplug enabled\n"); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | static void eeepc_wmi_quirks(struct asus_wmi_driver *driver) | 202 | static void eeepc_wmi_quirks(struct asus_wmi_driver *driver) |
170 | { | 203 | { |
171 | driver->hotplug_wireless = hotplug_wireless; | ||
172 | driver->wapf = -1; | 204 | driver->wapf = -1; |
173 | eeepc_dmi_check(driver); | 205 | driver->quirks = &quirk_asus_unknown; |
206 | driver->quirks->hotplug_wireless = hotplug_wireless; | ||
207 | dmi_check_system(asus_quirks); | ||
208 | driver->quirks = quirks; | ||
174 | } | 209 | } |
175 | 210 | ||
176 | static struct asus_wmi_driver asus_wmi_driver = { | 211 | static struct asus_wmi_driver asus_wmi_driver = { |
@@ -182,7 +217,7 @@ static struct asus_wmi_driver asus_wmi_driver = { | |||
182 | .input_phys = EEEPC_WMI_FILE "/input0", | 217 | .input_phys = EEEPC_WMI_FILE "/input0", |
183 | .key_filter = eeepc_wmi_key_filter, | 218 | .key_filter = eeepc_wmi_key_filter, |
184 | .probe = eeepc_wmi_probe, | 219 | .probe = eeepc_wmi_probe, |
185 | .quirks = eeepc_wmi_quirks, | 220 | .detect_quirks = eeepc_wmi_quirks, |
186 | }; | 221 | }; |
187 | 222 | ||
188 | 223 | ||