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