blob: 4ddb0dca56f6c441ccb30029109d3671b45d456f [file] [log] [blame]
Zhang Ruieec15ed2014-05-30 04:23:01 +02001/*
2 * ACPI support for PNP bus type
3 *
4 * Copyright (C) 2014, Intel Corporation
5 * Authors: Zhang Rui <rui.zhang@intel.com>
6 * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/acpi.h>
14#include <linux/module.h>
15
16static const struct acpi_device_id acpi_pnp_device_ids[] = {
Zhang Ruic128c772014-07-09 14:31:04 +020017 /* soc_button_array */
18 {"PNP0C40"},
Zhang Ruieec15ed2014-05-30 04:23:01 +020019 /* pata_isapnp */
20 {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
21 /* floppy */
22 {"PNP0700"},
23 /* ipmi_si */
24 {"IPI0001"},
25 /* tpm_inf_pnp */
26 {"IFX0101"}, /* Infineon TPMs */
27 {"IFX0102"}, /* Infineon TPMs */
28 /*tpm_tis */
29 {"PNP0C31"}, /* TPM */
30 {"ATM1200"}, /* Atmel */
31 {"IFX0102"}, /* Infineon */
32 {"BCM0101"}, /* Broadcom */
33 {"BCM0102"}, /* Broadcom */
34 {"NSC1200"}, /* National */
35 {"ICO0102"}, /* Intel */
36 /* ide */
37 {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
38 /* ns558 */
Zhang Ruieec15ed2014-05-30 04:23:01 +020039 {"ASB16fd"}, /* AdLib NSC16 */
40 {"AZT3001"}, /* AZT1008 */
41 {"CDC0001"}, /* Opl3-SAx */
42 {"CSC0001"}, /* CS4232 */
43 {"CSC000f"}, /* CS4236 */
44 {"CSC0101"}, /* CS4327 */
45 {"CTL7001"}, /* SB16 */
46 {"CTL7002"}, /* AWE64 */
47 {"CTL7005"}, /* Vibra16 */
48 {"ENS2020"}, /* SoundscapeVIVO */
49 {"ESS0001"}, /* ES1869 */
50 {"ESS0005"}, /* ES1878 */
51 {"ESS6880"}, /* ES688 */
52 {"IBM0012"}, /* CS4232 */
53 {"OPT0001"}, /* OPTi Audio16 */
54 {"YMH0006"}, /* Opl3-SA */
55 {"YMH0022"}, /* Opl3-SAx */
56 {"PNPb02f"}, /* Generic */
57 /* i8042 kbd */
58 {"PNP0300"},
59 {"PNP0301"},
60 {"PNP0302"},
61 {"PNP0303"},
62 {"PNP0304"},
63 {"PNP0305"},
64 {"PNP0306"},
65 {"PNP0309"},
66 {"PNP030a"},
67 {"PNP030b"},
68 {"PNP0320"},
69 {"PNP0343"},
70 {"PNP0344"},
71 {"PNP0345"},
72 {"CPQA0D7"},
73 /* i8042 aux */
74 {"AUI0200"},
75 {"FJC6000"},
76 {"FJC6001"},
77 {"PNP0f03"},
78 {"PNP0f0b"},
79 {"PNP0f0e"},
80 {"PNP0f12"},
81 {"PNP0f13"},
82 {"PNP0f19"},
83 {"PNP0f1c"},
84 {"SYN0801"},
85 /* fcpnp */
86 {"AVM0900"},
87 /* radio-cadet */
88 {"MSM0c24"}, /* ADS Cadet AM/FM Radio Card */
89 /* radio-gemtek */
90 {"ADS7183"}, /* AOpen FX-3D/Pro Radio */
91 /* radio-sf16fmr2 */
92 {"MFRad13"}, /* tuner subdevice of SF16-FMD2 */
93 /* ene_ir */
94 {"ENE0100"},
95 {"ENE0200"},
96 {"ENE0201"},
97 {"ENE0202"},
98 /* fintek-cir */
99 {"FIT0002"}, /* CIR */
100 /* ite-cir */
101 {"ITE8704"}, /* Default model */
102 {"ITE8713"}, /* CIR found in EEEBox 1501U */
103 {"ITE8708"}, /* Bridged IT8512 */
104 {"ITE8709"}, /* SRAM-Bridged IT8512 */
105 /* nuvoton-cir */
106 {"WEC0530"}, /* CIR */
107 {"NTN0530"}, /* CIR for new chip's pnp id */
108 /* Winbond CIR */
109 {"WEC1022"},
110 /* wbsd */
111 {"WEC0517"},
112 {"WEC0518"},
113 /* Winbond CIR */
114 {"TCM5090"}, /* 3Com Etherlink III (TP) */
115 {"TCM5091"}, /* 3Com Etherlink III */
116 {"TCM5094"}, /* 3Com Etherlink III (combo) */
117 {"TCM5095"}, /* 3Com Etherlink III (TPO) */
118 {"TCM5098"}, /* 3Com Etherlink III (TPC) */
119 {"PNP80f7"}, /* 3Com Etherlink III compatible */
120 {"PNP80f8"}, /* 3Com Etherlink III compatible */
121 /* nsc-ircc */
122 {"NSC6001"},
123 {"HWPC224"},
124 {"IBM0071"},
125 /* smsc-ircc2 */
126 {"SMCf010"},
127 /* sb1000 */
128 {"GIC1000"},
129 /* parport_pc */
130 {"PNP0400"}, /* Standard LPT Printer Port */
131 {"PNP0401"}, /* ECP Printer Port */
132 /* apple-gmux */
133 {"APP000B"},
134 /* fujitsu-laptop.c */
135 {"FUJ02bf"},
136 {"FUJ02B1"},
137 {"FUJ02E3"},
138 /* system */
139 {"PNP0c02"}, /* General ID for reserving resources */
140 {"PNP0c01"}, /* memory controller */
141 /* rtc_cmos */
142 {"PNP0b00"},
143 {"PNP0b01"},
144 {"PNP0b02"},
145 /* c6xdigio */
146 {"PNP0400"}, /* Standard LPT Printer Port */
147 {"PNP0401"}, /* ECP Printer Port */
148 /* ni_atmio.c */
149 {"NIC1900"},
150 {"NIC2400"},
151 {"NIC2500"},
152 {"NIC2600"},
153 {"NIC2700"},
154 /* serial */
155 {"AAC000F"}, /* Archtek America Corp. Archtek SmartLink Modem 3334BT Plug & Play */
156 {"ADC0001"}, /* Anchor Datacomm BV. SXPro 144 External Data Fax Modem Plug & Play */
157 {"ADC0002"}, /* SXPro 288 External Data Fax Modem Plug & Play */
158 {"AEI0250"}, /* PROLiNK 1456VH ISA PnP K56flex Fax Modem */
159 {"AEI1240"}, /* Actiontec ISA PNP 56K X2 Fax Modem */
160 {"AKY1021"}, /* Rockwell 56K ACF II Fax+Data+Voice Modem */
161 {"AZT4001"}, /* AZT3005 PnP SOUND DEVICE */
162 {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
163 {"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */
164 {"BRI1400"}, /* Boca Research 33,600 ACF Modem */
165 {"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */
166 {"BRI0A49"}, /* Boca 33.6 Kbps Internal FD34FSVD */
167 {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
168 {"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */
169 {"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
170 {"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
171 {"DAV0336"}, /* Davicom ISA 33.6K Modem */
172 {"DMB1032"}, /* Creative Modem Blaster Flash56 DI5601-1 */
173 {"DMB2001"}, /* Creative Modem Blaster V.90 DI5660 */
174 {"ETT0002"}, /* E-Tech CyberBULLET PC56RVP */
175 {"FUJ0202"}, /* Fujitsu 33600 PnP-I2 R Plug & Play */
176 {"FUJ0205"}, /* Fujitsu FMV-FX431 Plug & Play */
177 {"FUJ0206"}, /* Fujitsu 33600 PnP-I4 R Plug & Play */
178 {"FUJ0209"}, /* Fujitsu Fax Voice 33600 PNP-I5 R Plug & Play */
179 {"GVC000F"}, /* Archtek SmartLink Modem 3334BT Plug & Play */
180 {"GVC0303"}, /* Archtek SmartLink Modem 3334BRV 33.6K Data Fax Voice */
181 {"HAY0001"}, /* Hayes Optima 288 V.34-V.FC + FAX + Voice Plug & Play */
182 {"HAY000C"}, /* Hayes Optima 336 V.34 + FAX + Voice PnP */
183 {"HAY000D"}, /* Hayes Optima 336B V.34 + FAX + Voice PnP */
184 {"HAY5670"}, /* Hayes Accura 56K Ext Fax Modem PnP */
185 {"HAY5674"}, /* Hayes Accura 56K Ext Fax Modem PnP */
186 {"HAY5675"}, /* Hayes Accura 56K Fax Modem PnP */
187 {"HAYF000"}, /* Hayes 288, V.34 + FAX */
188 {"HAYF001"}, /* Hayes Optima 288 V.34 + FAX + Voice, Plug & Play */
189 {"IBM0033"}, /* IBM Thinkpad 701 Internal Modem Voice */
190 {"PNP4972"}, /* Intermec CV60 touchscreen port */
191 {"IXDC801"}, /* Intertex 28k8 33k6 Voice EXT PnP */
192 {"IXDC901"}, /* Intertex 33k6 56k Voice EXT PnP */
193 {"IXDD801"}, /* Intertex 28k8 33k6 Voice SP EXT PnP */
194 {"IXDD901"}, /* Intertex 33k6 56k Voice SP EXT PnP */
195 {"IXDF401"}, /* Intertex 28k8 33k6 Voice SP INT PnP */
196 {"IXDF801"}, /* Intertex 28k8 33k6 Voice SP EXT PnP */
197 {"IXDF901"}, /* Intertex 33k6 56k Voice SP EXT PnP */
198 {"KOR4522"}, /* KORTEX 28800 Externe PnP */
199 {"KORF661"}, /* KXPro 33.6 Vocal ASVD PnP */
200 {"LAS4040"}, /* LASAT Internet 33600 PnP */
201 {"LAS4540"}, /* Lasat Safire 560 PnP */
202 {"LAS5440"}, /* Lasat Safire 336 PnP */
203 {"MNP0281"}, /* Microcom TravelPorte FAST V.34 Plug & Play */
204 {"MNP0336"}, /* Microcom DeskPorte V.34 FAST or FAST+ Plug & Play */
205 {"MNP0339"}, /* Microcom DeskPorte FAST EP 28.8 Plug & Play */
206 {"MNP0342"}, /* Microcom DeskPorte 28.8P Plug & Play */
207 {"MNP0500"}, /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
208 {"MNP0501"}, /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
209 {"MNP0502"}, /* Microcom DeskPorte 28.8S Internal Plug & Play */
210 {"MOT1105"}, /* Motorola BitSURFR Plug & Play */
211 {"MOT1111"}, /* Motorola TA210 Plug & Play */
212 {"MOT1114"}, /* Motorola HMTA 200 (ISDN) Plug & Play */
213 {"MOT1115"}, /* Motorola BitSURFR Plug & Play */
214 {"MOT1190"}, /* Motorola Lifestyle 28.8 Internal */
215 {"MOT1501"}, /* Motorola V.3400 Plug & Play */
216 {"MOT1502"}, /* Motorola Lifestyle 28.8 V.34 Plug & Play */
217 {"MOT1505"}, /* Motorola Power 28.8 V.34 Plug & Play */
218 {"MOT1509"}, /* Motorola ModemSURFR External 28.8 Plug & Play */
219 {"MOT150A"}, /* Motorola Premier 33.6 Desktop Plug & Play */
220 {"MOT150F"}, /* Motorola VoiceSURFR 56K External PnP */
221 {"MOT1510"}, /* Motorola ModemSURFR 56K External PnP */
222 {"MOT1550"}, /* Motorola ModemSURFR 56K Internal PnP */
223 {"MOT1560"}, /* Motorola ModemSURFR Internal 28.8 Plug & Play */
224 {"MOT1580"}, /* Motorola Premier 33.6 Internal Plug & Play */
225 {"MOT15B0"}, /* Motorola OnlineSURFR 28.8 Internal Plug & Play */
226 {"MOT15F0"}, /* Motorola VoiceSURFR 56K Internal PnP */
227 {"MVX00A1"}, /* Deskline K56 Phone System PnP */
228 {"MVX00F2"}, /* PC Rider K56 Phone System PnP */
229 {"nEC8241"}, /* NEC 98NOTE SPEAKER PHONE FAX MODEM(33600bps) */
230 {"PMC2430"}, /* Pace 56 Voice Internal Plug & Play Modem */
231 {"PNP0500"}, /* Generic standard PC COM port */
232 {"PNP0501"}, /* Generic 16550A-compatible COM port */
233 {"PNPC000"}, /* Compaq 14400 Modem */
234 {"PNPC001"}, /* Compaq 2400/9600 Modem */
235 {"PNPC031"}, /* Dial-Up Networking Serial Cable between 2 PCs */
236 {"PNPC032"}, /* Dial-Up Networking Parallel Cable between 2 PCs */
237 {"PNPC100"}, /* Standard 9600 bps Modem */
238 {"PNPC101"}, /* Standard 14400 bps Modem */
239 {"PNPC102"}, /* Standard 28800 bps Modem */
240 {"PNPC103"}, /* Standard Modem */
241 {"PNPC104"}, /* Standard 9600 bps Modem */
242 {"PNPC105"}, /* Standard 14400 bps Modem */
243 {"PNPC106"}, /* Standard 28800 bps Modem */
244 {"PNPC107"}, /* Standard Modem */
245 {"PNPC108"}, /* Standard 9600 bps Modem */
246 {"PNPC109"}, /* Standard 14400 bps Modem */
247 {"PNPC10A"}, /* Standard 28800 bps Modem */
248 {"PNPC10B"}, /* Standard Modem */
249 {"PNPC10C"}, /* Standard 9600 bps Modem */
250 {"PNPC10D"}, /* Standard 14400 bps Modem */
251 {"PNPC10E"}, /* Standard 28800 bps Modem */
252 {"PNPC10F"}, /* Standard Modem */
253 {"PNP2000"}, /* Standard PCMCIA Card Modem */
254 {"ROK0030"}, /* Rockwell 33.6 DPF Internal PnP, Modular Technology 33.6 Internal PnP */
255 {"ROK0100"}, /* KORTEX 14400 Externe PnP */
256 {"ROK4120"}, /* Rockwell 28.8 */
257 {"ROK4920"}, /* Viking 28.8 INTERNAL Fax+Data+Voice PnP */
258 {"RSS00A0"}, /* Rockwell 33.6 DPF External PnP, BT Prologue 33.6 External PnP, Modular Technology 33.6 External PnP */
259 {"RSS0262"}, /* Viking 56K FAX INT */
260 {"RSS0250"}, /* K56 par,VV,Voice,Speakphone,AudioSpan,PnP */
261 {"SUP1310"}, /* SupraExpress 28.8 Data/Fax PnP modem */
262 {"SUP1381"}, /* SupraExpress 336i PnP Voice Modem */
263 {"SUP1421"}, /* SupraExpress 33.6 Data/Fax PnP modem */
264 {"SUP1590"}, /* SupraExpress 33.6 Data/Fax PnP modem */
265 {"SUP1620"}, /* SupraExpress 336i Sp ASVD */
266 {"SUP1760"}, /* SupraExpress 33.6 Data/Fax PnP modem */
267 {"SUP2171"}, /* SupraExpress 56i Sp Intl */
268 {"TEX0011"}, /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
269 {"UAC000F"}, /* Archtek SmartLink Modem 3334BT Plug & Play */
270 {"USR0000"}, /* 3Com Corp. Gateway Telepath IIvi 33.6 */
271 {"USR0002"}, /* U.S. Robotics Sporster 33.6K Fax INT PnP */
272 {"USR0004"}, /* Sportster Vi 14.4 PnP FAX Voicemail */
273 {"USR0006"}, /* U.S. Robotics 33.6K Voice INT PnP */
274 {"USR0007"}, /* U.S. Robotics 33.6K Voice EXT PnP */
275 {"USR0009"}, /* U.S. Robotics Courier V.Everything INT PnP */
276 {"USR2002"}, /* U.S. Robotics 33.6K Voice INT PnP */
277 {"USR2070"}, /* U.S. Robotics 56K Voice INT PnP */
278 {"USR2080"}, /* U.S. Robotics 56K Voice EXT PnP */
279 {"USR3031"}, /* U.S. Robotics 56K FAX INT */
280 {"USR3050"}, /* U.S. Robotics 56K FAX INT */
281 {"USR3070"}, /* U.S. Robotics 56K Voice INT PnP */
282 {"USR3080"}, /* U.S. Robotics 56K Voice EXT PnP */
283 {"USR3090"}, /* U.S. Robotics 56K Voice INT PnP */
284 {"USR9100"}, /* U.S. Robotics 56K Message */
285 {"USR9160"}, /* U.S. Robotics 56K FAX EXT PnP */
286 {"USR9170"}, /* U.S. Robotics 56K FAX INT PnP */
287 {"USR9180"}, /* U.S. Robotics 56K Voice EXT PnP */
288 {"USR9190"}, /* U.S. Robotics 56K Voice INT PnP */
289 {"WACFXXX"}, /* Wacom tablets */
290 {"FPI2002"}, /* Compaq touchscreen */
291 {"FUJ02B2"}, /* Fujitsu Stylistic touchscreens */
292 {"FUJ02B3"},
293 {"FUJ02B4"}, /* Fujitsu Stylistic LT touchscreens */
294 {"FUJ02B6"}, /* Passive Fujitsu Stylistic touchscreens */
295 {"FUJ02B7"},
296 {"FUJ02B8"},
297 {"FUJ02B9"},
298 {"FUJ02BC"},
299 {"FUJ02E5"}, /* Fujitsu Wacom Tablet PC device */
300 {"FUJ02E6"}, /* Fujitsu P-series tablet PC device */
301 {"FUJ02E7"}, /* Fujitsu Wacom 2FGT Tablet PC device */
302 {"FUJ02E9"}, /* Fujitsu Wacom 1FGT Tablet PC device */
303 {"LTS0001"}, /* LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in disguise) */
304 {"WCI0003"}, /* Rockwell's (PORALiNK) 33600 INT PNP */
305 {"WEC1022"}, /* Winbond CIR port, should not be probed. We should keep track of it to prevent the legacy serial driver from probing it */
Zhang Ruieec15ed2014-05-30 04:23:01 +0200306 /* scl200wdt */
307 {"NSC0800"}, /* National Semiconductor PC87307/PC97307 watchdog component */
308 /* mpu401 */
309 {"PNPb006"},
310 /* cs423x-pnpbios */
311 {"CSC0100"},
312 {"CSC0000"},
313 {"GIM0100"}, /* Guillemot Turtlebeach something appears to be cs4232 compatible */
314 /* es18xx-pnpbios */
315 {"ESS1869"},
316 {"ESS1879"},
317 /* snd-opl3sa2-pnpbios */
318 {"YMH0021"},
319 {"NMX2210"}, /* Gateway Solo 2500 */
320 {""},
321};
322
323static bool is_hex_digit(char c)
324{
325 return (c >= 0 && c <= '9') || (c >= 'A' && c <= 'F');
326}
327
328static bool matching_id(char *idstr, char *list_id)
329{
330 int i;
331
332 if (memcmp(idstr, list_id, 3))
333 return false;
334
335 for (i = 3; i < 7; i++) {
336 char c = toupper(idstr[i]);
337
338 if (!is_hex_digit(c)
339 || (list_id[i] != 'X' && c != toupper(list_id[i])))
340 return false;
341 }
342 return true;
343}
344
345static bool acpi_pnp_match(char *idstr, const struct acpi_device_id **matchid)
346{
347 const struct acpi_device_id *devid;
348
349 for (devid = acpi_pnp_device_ids; devid->id[0]; devid++)
350 if (matching_id(idstr, (char *)devid->id)) {
351 if (matchid)
352 *matchid = devid;
353
354 return true;
355 }
356
357 return false;
358}
359
360static int acpi_pnp_attach(struct acpi_device *adev,
361 const struct acpi_device_id *id)
362{
363 return 1;
364}
365
366static struct acpi_scan_handler acpi_pnp_handler = {
367 .ids = acpi_pnp_device_ids,
368 .match = acpi_pnp_match,
369 .attach = acpi_pnp_attach,
370};
371
372/*
373 * For CMOS RTC devices, the PNP ACPI scan handler does not work, because
374 * there is a CMOS RTC ACPI scan handler installed already, so we need to
375 * check those devices and enumerate them to the PNP bus directly.
376 */
377static int is_cmos_rtc_device(struct acpi_device *adev)
378{
379 struct acpi_device_id ids[] = {
380 { "PNP0B00" },
381 { "PNP0B01" },
382 { "PNP0B02" },
383 {""},
384 };
385 return !acpi_match_device_ids(adev, ids);
386}
387
388bool acpi_is_pnp_device(struct acpi_device *adev)
389{
390 return adev->handler == &acpi_pnp_handler || is_cmos_rtc_device(adev);
391}
392EXPORT_SYMBOL_GPL(acpi_is_pnp_device);
393
394void __init acpi_pnp_init(void)
395{
396 acpi_scan_add_handler(&acpi_pnp_handler);
397}