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