blob: fc301f6722e1bf4d2e9788f01e702cee6e711ddd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Probe module for 8250/16550-type ISAPNP serial ports.
3 *
4 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
5 *
6 * Copyright (C) 2001 Russell King, All Rights Reserved.
7 *
8 * Ported to the Linux PnP Layer - (C) Adam Belay.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/pci.h>
17#include <linux/pnp.h>
18#include <linux/string.h>
19#include <linux/kernel.h>
20#include <linux/serial_core.h>
21#include <linux/bitops.h>
22
23#include <asm/byteorder.h>
24
25#include "8250.h"
26
27#define UNKNOWN_DEV 0x3000
28
29
30static const struct pnp_device_id pnp_dev_table[] = {
31 /* Archtek America Corp. */
32 /* Archtek SmartLink Modem 3334BT Plug & Play */
33 { "AAC000F", 0 },
34 /* Anchor Datacomm BV */
35 /* SXPro 144 External Data Fax Modem Plug & Play */
36 { "ADC0001", 0 },
37 /* SXPro 288 External Data Fax Modem Plug & Play */
38 { "ADC0002", 0 },
39 /* PROLiNK 1456VH ISA PnP K56flex Fax Modem */
40 { "AEI0250", 0 },
41 /* Actiontec ISA PNP 56K X2 Fax Modem */
42 { "AEI1240", 0 },
43 /* Rockwell 56K ACF II Fax+Data+Voice Modem */
44 { "AKY1021", 0 /*SPCI_FL_NO_SHIRQ*/ },
45 /* AZT3005 PnP SOUND DEVICE */
46 { "AZT4001", 0 },
47 /* Best Data Products Inc. Smart One 336F PnP Modem */
48 { "BDP3336", 0 },
49 /* Boca Research */
50 /* Boca Complete Ofc Communicator 14.4 Data-FAX */
51 { "BRI0A49", 0 },
52 /* Boca Research 33,600 ACF Modem */
53 { "BRI1400", 0 },
54 /* Boca 33.6 Kbps Internal FD34FSVD */
55 { "BRI3400", 0 },
56 /* Boca 33.6 Kbps Internal FD34FSVD */
57 { "BRI0A49", 0 },
58 /* Best Data Products Inc. Smart One 336F PnP Modem */
59 { "BDP3336", 0 },
60 /* Computer Peripherals Inc */
61 /* EuroViVa CommCenter-33.6 SP PnP */
62 { "CPI4050", 0 },
63 /* Creative Labs */
64 /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
65 { "CTL3001", 0 },
66 /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
67 { "CTL3011", 0 },
Bjorn Helgaasdbd0cf42007-11-14 16:58:36 -080068 /* Davicom ISA 33.6K Modem */
69 { "DAV0336", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /* Creative */
71 /* Creative Modem Blaster Flash56 DI5601-1 */
72 { "DMB1032", 0 },
73 /* Creative Modem Blaster V.90 DI5660 */
74 { "DMB2001", 0 },
75 /* E-Tech */
76 /* E-Tech CyberBULLET PC56RVP */
77 { "ETT0002", 0 },
78 /* FUJITSU */
79 /* Fujitsu 33600 PnP-I2 R Plug & Play */
80 { "FUJ0202", 0 },
81 /* Fujitsu FMV-FX431 Plug & Play */
82 { "FUJ0205", 0 },
83 /* Fujitsu 33600 PnP-I4 R Plug & Play */
84 { "FUJ0206", 0 },
85 /* Fujitsu Fax Voice 33600 PNP-I5 R Plug & Play */
86 { "FUJ0209", 0 },
87 /* Archtek America Corp. */
88 /* Archtek SmartLink Modem 3334BT Plug & Play */
89 { "GVC000F", 0 },
Bjorn Helgaas51587cb2008-03-04 14:28:21 -080090 /* Archtek SmartLink Modem 3334BRV 33.6K Data Fax Voice */
91 { "GVC0303", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 /* Hayes */
93 /* Hayes Optima 288 V.34-V.FC + FAX + Voice Plug & Play */
94 { "HAY0001", 0 },
95 /* Hayes Optima 336 V.34 + FAX + Voice PnP */
96 { "HAY000C", 0 },
97 /* Hayes Optima 336B V.34 + FAX + Voice PnP */
98 { "HAY000D", 0 },
99 /* Hayes Accura 56K Ext Fax Modem PnP */
100 { "HAY5670", 0 },
101 /* Hayes Accura 56K Ext Fax Modem PnP */
102 { "HAY5674", 0 },
103 /* Hayes Accura 56K Fax Modem PnP */
104 { "HAY5675", 0 },
105 /* Hayes 288, V.34 + FAX */
106 { "HAYF000", 0 },
107 /* Hayes Optima 288 V.34 + FAX + Voice, Plug & Play */
108 { "HAYF001", 0 },
109 /* IBM */
110 /* IBM Thinkpad 701 Internal Modem Voice */
111 { "IBM0033", 0 },
112 /* Intertex */
113 /* Intertex 28k8 33k6 Voice EXT PnP */
114 { "IXDC801", 0 },
115 /* Intertex 33k6 56k Voice EXT PnP */
116 { "IXDC901", 0 },
117 /* Intertex 28k8 33k6 Voice SP EXT PnP */
118 { "IXDD801", 0 },
119 /* Intertex 33k6 56k Voice SP EXT PnP */
120 { "IXDD901", 0 },
121 /* Intertex 28k8 33k6 Voice SP INT PnP */
122 { "IXDF401", 0 },
123 /* Intertex 28k8 33k6 Voice SP EXT PnP */
124 { "IXDF801", 0 },
125 /* Intertex 33k6 56k Voice SP EXT PnP */
126 { "IXDF901", 0 },
127 /* Kortex International */
128 /* KORTEX 28800 Externe PnP */
129 { "KOR4522", 0 },
130 /* KXPro 33.6 Vocal ASVD PnP */
131 { "KORF661", 0 },
132 /* Lasat */
133 /* LASAT Internet 33600 PnP */
134 { "LAS4040", 0 },
135 /* Lasat Safire 560 PnP */
136 { "LAS4540", 0 },
137 /* Lasat Safire 336 PnP */
138 { "LAS5440", 0 },
139 /* Microcom, Inc. */
140 /* Microcom TravelPorte FAST V.34 Plug & Play */
141 { "MNP0281", 0 },
142 /* Microcom DeskPorte V.34 FAST or FAST+ Plug & Play */
143 { "MNP0336", 0 },
144 /* Microcom DeskPorte FAST EP 28.8 Plug & Play */
145 { "MNP0339", 0 },
146 /* Microcom DeskPorte 28.8P Plug & Play */
147 { "MNP0342", 0 },
148 /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
149 { "MNP0500", 0 },
150 /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
151 { "MNP0501", 0 },
152 /* Microcom DeskPorte 28.8S Internal Plug & Play */
153 { "MNP0502", 0 },
154 /* Motorola */
155 /* Motorola BitSURFR Plug & Play */
156 { "MOT1105", 0 },
157 /* Motorola TA210 Plug & Play */
158 { "MOT1111", 0 },
159 /* Motorola HMTA 200 (ISDN) Plug & Play */
160 { "MOT1114", 0 },
161 /* Motorola BitSURFR Plug & Play */
162 { "MOT1115", 0 },
163 /* Motorola Lifestyle 28.8 Internal */
164 { "MOT1190", 0 },
165 /* Motorola V.3400 Plug & Play */
166 { "MOT1501", 0 },
167 /* Motorola Lifestyle 28.8 V.34 Plug & Play */
168 { "MOT1502", 0 },
169 /* Motorola Power 28.8 V.34 Plug & Play */
170 { "MOT1505", 0 },
171 /* Motorola ModemSURFR External 28.8 Plug & Play */
172 { "MOT1509", 0 },
173 /* Motorola Premier 33.6 Desktop Plug & Play */
174 { "MOT150A", 0 },
175 /* Motorola VoiceSURFR 56K External PnP */
176 { "MOT150F", 0 },
177 /* Motorola ModemSURFR 56K External PnP */
178 { "MOT1510", 0 },
179 /* Motorola ModemSURFR 56K Internal PnP */
180 { "MOT1550", 0 },
181 /* Motorola ModemSURFR Internal 28.8 Plug & Play */
182 { "MOT1560", 0 },
183 /* Motorola Premier 33.6 Internal Plug & Play */
184 { "MOT1580", 0 },
185 /* Motorola OnlineSURFR 28.8 Internal Plug & Play */
186 { "MOT15B0", 0 },
187 /* Motorola VoiceSURFR 56K Internal PnP */
188 { "MOT15F0", 0 },
189 /* Com 1 */
190 /* Deskline K56 Phone System PnP */
191 { "MVX00A1", 0 },
192 /* PC Rider K56 Phone System PnP */
193 { "MVX00F2", 0 },
194 /* NEC 98NOTE SPEAKER PHONE FAX MODEM(33600bps) */
195 { "nEC8241", 0 },
196 /* Pace 56 Voice Internal Plug & Play Modem */
197 { "PMC2430", 0 },
198 /* Generic */
199 /* Generic standard PC COM port */
200 { "PNP0500", 0 },
201 /* Generic 16550A-compatible COM port */
202 { "PNP0501", 0 },
203 /* Compaq 14400 Modem */
204 { "PNPC000", 0 },
205 /* Compaq 2400/9600 Modem */
206 { "PNPC001", 0 },
207 /* Dial-Up Networking Serial Cable between 2 PCs */
208 { "PNPC031", 0 },
209 /* Dial-Up Networking Parallel Cable between 2 PCs */
210 { "PNPC032", 0 },
211 /* Standard 9600 bps Modem */
212 { "PNPC100", 0 },
213 /* Standard 14400 bps Modem */
214 { "PNPC101", 0 },
215 /* Standard 28800 bps Modem*/
216 { "PNPC102", 0 },
217 /* Standard Modem*/
218 { "PNPC103", 0 },
219 /* Standard 9600 bps Modem*/
220 { "PNPC104", 0 },
221 /* Standard 14400 bps Modem*/
222 { "PNPC105", 0 },
223 /* Standard 28800 bps Modem*/
224 { "PNPC106", 0 },
225 /* Standard Modem */
226 { "PNPC107", 0 },
227 /* Standard 9600 bps Modem */
228 { "PNPC108", 0 },
229 /* Standard 14400 bps Modem */
230 { "PNPC109", 0 },
231 /* Standard 28800 bps Modem */
232 { "PNPC10A", 0 },
233 /* Standard Modem */
234 { "PNPC10B", 0 },
235 /* Standard 9600 bps Modem */
236 { "PNPC10C", 0 },
237 /* Standard 14400 bps Modem */
238 { "PNPC10D", 0 },
239 /* Standard 28800 bps Modem */
240 { "PNPC10E", 0 },
241 /* Standard Modem */
242 { "PNPC10F", 0 },
243 /* Standard PCMCIA Card Modem */
244 { "PNP2000", 0 },
245 /* Rockwell */
246 /* Modular Technology */
247 /* Rockwell 33.6 DPF Internal PnP */
248 /* Modular Technology 33.6 Internal PnP */
249 { "ROK0030", 0 },
250 /* Kortex International */
251 /* KORTEX 14400 Externe PnP */
252 { "ROK0100", 0 },
253 /* Rockwell 28.8 */
254 { "ROK4120", 0 },
255 /* Viking Components, Inc */
256 /* Viking 28.8 INTERNAL Fax+Data+Voice PnP */
257 { "ROK4920", 0 },
258 /* Rockwell */
259 /* British Telecom */
260 /* Modular Technology */
261 /* Rockwell 33.6 DPF External PnP */
262 /* BT Prologue 33.6 External PnP */
263 /* Modular Technology 33.6 External PnP */
264 { "RSS00A0", 0 },
265 /* Viking 56K FAX INT */
266 { "RSS0262", 0 },
267 /* K56 par,VV,Voice,Speakphone,AudioSpan,PnP */
268 { "RSS0250", 0 },
269 /* SupraExpress 28.8 Data/Fax PnP modem */
270 { "SUP1310", 0 },
Daniel Gagnon7fdd4f72009-01-15 13:30:45 +0000271 /* SupraExpress 336i PnP Voice Modem */
272 { "SUP1381", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 /* SupraExpress 33.6 Data/Fax PnP modem */
274 { "SUP1421", 0 },
275 /* SupraExpress 33.6 Data/Fax PnP modem */
276 { "SUP1590", 0 },
Baris Cicek04f03bf2005-10-14 14:32:40 +0100277 /* SupraExpress 336i Sp ASVD */
278 { "SUP1620", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 /* SupraExpress 33.6 Data/Fax PnP modem */
280 { "SUP1760", 0 },
maximilian attemsc1542cb2005-10-15 10:43:35 +0100281 /* SupraExpress 56i Sp Intl */
282 { "SUP2171", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 /* Phoebe Micro */
284 /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
285 { "TEX0011", 0 },
286 /* Archtek America Corp. */
287 /* Archtek SmartLink Modem 3334BT Plug & Play */
288 { "UAC000F", 0 },
289 /* 3Com Corp. */
290 /* Gateway Telepath IIvi 33.6 */
291 { "USR0000", 0 },
292 /* U.S. Robotics Sporster 33.6K Fax INT PnP */
293 { "USR0002", 0 },
294 /* Sportster Vi 14.4 PnP FAX Voicemail */
295 { "USR0004", 0 },
296 /* U.S. Robotics 33.6K Voice INT PnP */
297 { "USR0006", 0 },
298 /* U.S. Robotics 33.6K Voice EXT PnP */
299 { "USR0007", 0 },
300 /* U.S. Robotics Courier V.Everything INT PnP */
301 { "USR0009", 0 },
302 /* U.S. Robotics 33.6K Voice INT PnP */
303 { "USR2002", 0 },
304 /* U.S. Robotics 56K Voice INT PnP */
305 { "USR2070", 0 },
306 /* U.S. Robotics 56K Voice EXT PnP */
307 { "USR2080", 0 },
308 /* U.S. Robotics 56K FAX INT */
309 { "USR3031", 0 },
310 /* U.S. Robotics 56K FAX INT */
311 { "USR3050", 0 },
312 /* U.S. Robotics 56K Voice INT PnP */
313 { "USR3070", 0 },
314 /* U.S. Robotics 56K Voice EXT PnP */
315 { "USR3080", 0 },
316 /* U.S. Robotics 56K Voice INT PnP */
317 { "USR3090", 0 },
318 /* U.S. Robotics 56K Message */
319 { "USR9100", 0 },
320 /* U.S. Robotics 56K FAX EXT PnP*/
321 { "USR9160", 0 },
322 /* U.S. Robotics 56K FAX INT PnP*/
323 { "USR9170", 0 },
324 /* U.S. Robotics 56K Voice EXT PnP*/
325 { "USR9180", 0 },
326 /* U.S. Robotics 56K Voice INT PnP*/
327 { "USR9190", 0 },
Ben Collinsb07076e2006-06-26 15:24:36 +0100328 /* Wacom tablets */
Matthew Garrett6d348552009-12-09 12:31:37 -0800329 { "WACFXXX", 0 },
Matthew Garrett75fde2e2006-10-01 19:27:38 +0100330 /* Compaq touchscreen */
331 { "FPI2002", 0 },
332 /* Fujitsu Stylistic touchscreens */
333 { "FUJ02B2", 0 },
334 { "FUJ02B3", 0 },
335 /* Fujitsu Stylistic LT touchscreens */
336 { "FUJ02B4", 0 },
337 /* Passive Fujitsu Stylistic touchscreens */
338 { "FUJ02B6", 0 },
339 { "FUJ02B7", 0 },
340 { "FUJ02B8", 0 },
341 { "FUJ02B9", 0 },
342 { "FUJ02BC", 0 },
Matthew Garrett97ea33f2009-04-06 17:32:01 +0100343 /* Fujitsu Wacom Tablet PC device */
Danny Kukawka6149dd52007-03-23 00:10:01 -0700344 { "FUJ02E5", 0 },
Matthew Garrett97ea33f2009-04-06 17:32:01 +0100345 /* Fujitsu P-series tablet PC device */
Danny Kukawka6149dd52007-03-23 00:10:01 -0700346 { "FUJ02E6", 0 },
Ping3018aa42010-01-15 17:01:07 -0800347 /* Fujitsu Wacom 2FGT Tablet PC device */
348 { "FUJ02E7", 0 },
Ping Chengd9901662010-03-22 13:40:29 -0700349 /* Fujitsu Wacom 1FGT Tablet PC device */
350 { "FUJ02E9", 0 },
Damian Jurd71054582007-11-14 16:59:04 -0800351 /*
352 * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
353 * disguise)
354 */
355 { "LTS0001", 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 /* Rockwell's (PORALiNK) 33600 INT PNP */
357 { "WCI0003", 0 },
André Goddard Rosaaf901ca2009-11-14 13:09:05 -0200358 /* Unknown PnP modems */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 { "PNPCXXX", UNKNOWN_DEV },
André Goddard Rosaaf901ca2009-11-14 13:09:05 -0200360 /* More unknown PnP modems */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 { "PNPDXXX", UNKNOWN_DEV },
362 { "", 0 }
363};
364
365MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
366
367static char *modem_names[] __devinitdata = {
368 "MODEM", "Modem", "modem", "FAX", "Fax", "fax",
369 "56K", "56k", "K56", "33.6", "28.8", "14.4",
370 "33,600", "28,800", "14,400", "33.600", "28.800", "14.400",
371 "33600", "28800", "14400", "V.90", "V.34", "V.32", NULL
372};
373
374static int __devinit check_name(char *name)
375{
376 char **tmp;
377
378 for (tmp = modem_names; *tmp; tmp++)
379 if (strstr(name, *tmp))
380 return 1;
381
382 return 0;
383}
384
Bjorn Helgaas57fd51a2008-06-27 16:57:01 -0600385static int __devinit check_resources(struct pnp_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386{
Bjorn Helgaas57fd51a2008-06-27 16:57:01 -0600387 resource_size_t base[] = {0x2f8, 0x3f8, 0x2e8, 0x3e8};
388 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
Bjorn Helgaas57fd51a2008-06-27 16:57:01 -0600390 for (i = 0; i < ARRAY_SIZE(base); i++) {
391 if (pnp_possible_config(dev, IORESOURCE_IO, base[i], 8))
392 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 }
394
395 return 0;
396}
397
398/*
399 * Given a complete unknown PnP device, try to use some heuristics to
400 * detect modems. Currently use such heuristic set:
401 * - dev->name or dev->bus->name must contain "modem" substring;
402 * - device must have only one IO region (8 byte long) with base address
403 * 0x2e8, 0x3e8, 0x2f8 or 0x3f8.
404 *
405 * Such detection looks very ugly, but can detect at least some of numerous
406 * PnP modems, alternatively we must hardcode all modems in pnp_devices[]
407 * table.
408 */
409static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
410{
Alan Cox3e8d4e22008-02-04 22:27:53 -0800411 if (!(check_name(pnp_dev_name(dev)) ||
412 (dev->card && check_name(dev->card->name))))
413 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414
Bjorn Helgaas57fd51a2008-06-27 16:57:01 -0600415 if (check_resources(dev))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 return 0;
417
418 return -ENODEV;
419}
420
421static int __devinit
Bjorn Helgaas655a0a72005-07-29 14:03:30 -0700422serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423{
424 struct uart_port port;
425 int ret, line, flags = dev_id->driver_data;
426
427 if (flags & UNKNOWN_DEV) {
428 ret = serial_pnp_guess_board(dev, &flags);
429 if (ret < 0)
430 return ret;
431 }
432
433 memset(&port, 0, sizeof(struct uart_port));
Bjorn Helgaase02f5f52007-11-14 16:59:59 -0800434 if (pnp_irq_valid(dev, 0))
435 port.irq = pnp_irq(dev, 0);
Bjorn Helgaas655a0a72005-07-29 14:03:30 -0700436 if (pnp_port_valid(dev, 0)) {
437 port.iobase = pnp_port_start(dev, 0);
438 port.iotype = UPIO_PORT;
439 } else if (pnp_mem_valid(dev, 0)) {
440 port.mapbase = pnp_mem_start(dev, 0);
441 port.iotype = UPIO_MEM;
442 port.flags = UPF_IOREMAP;
443 } else
444 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445
446#ifdef SERIAL_DEBUG_PNP
Alan Cox3e8d4e22008-02-04 22:27:53 -0800447 printk(KERN_DEBUG
448 "Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
449 port.iobase, port.mapbase, port.irq, port.iotype);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450#endif
451
Bjorn Helgaas655a0a72005-07-29 14:03:30 -0700452 port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
Bjorn Helgaascb6358e2006-07-03 00:24:12 -0700453 if (pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE)
454 port.flags |= UPF_SHARE_IRQ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 port.uartclk = 1843200;
456 port.dev = &dev->dev;
457
458 line = serial8250_register_port(&port);
Bjorn Helgaas9b222712007-02-14 00:33:05 -0800459 if (line < 0)
460 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461
Bjorn Helgaas9b222712007-02-14 00:33:05 -0800462 pnp_set_drvdata(dev, (void *)((long)line + 1));
463 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464}
465
Bjorn Helgaas655a0a72005-07-29 14:03:30 -0700466static void __devexit serial_pnp_remove(struct pnp_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467{
468 long line = (long)pnp_get_drvdata(dev);
469 if (line)
470 serial8250_unregister_port(line - 1);
471}
472
Mike Galbraithf29219f2006-12-06 20:39:35 -0800473#ifdef CONFIG_PM
474static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
475{
476 long line = (long)pnp_get_drvdata(dev);
477
478 if (!line)
479 return -ENODEV;
480 serial8250_suspend_port(line - 1);
481 return 0;
482}
483
484static int serial_pnp_resume(struct pnp_dev *dev)
485{
486 long line = (long)pnp_get_drvdata(dev);
487
488 if (!line)
489 return -ENODEV;
490 serial8250_resume_port(line - 1);
491 return 0;
492}
493#else
494#define serial_pnp_suspend NULL
495#define serial_pnp_resume NULL
496#endif /* CONFIG_PM */
497
Linus Torvalds1da177e2005-04-16 15:20:36 -0700498static struct pnp_driver serial_pnp_driver = {
499 .name = "serial",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 .probe = serial_pnp_probe,
501 .remove = __devexit_p(serial_pnp_remove),
Mike Galbraithf29219f2006-12-06 20:39:35 -0800502 .suspend = serial_pnp_suspend,
503 .resume = serial_pnp_resume,
504 .id_table = pnp_dev_table,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505};
506
507static int __init serial8250_pnp_init(void)
508{
509 return pnp_register_driver(&serial_pnp_driver);
510}
511
512static void __exit serial8250_pnp_exit(void)
513{
514 pnp_unregister_driver(&serial_pnp_driver);
515}
516
517module_init(serial8250_pnp_init);
518module_exit(serial8250_pnp_exit);
519
520MODULE_LICENSE("GPL");
521MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");