Merge tag 'metag-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan...
[cascardo/linux.git] / drivers / staging / comedi / drivers / skel.c
1 /*
2     comedi/drivers/skel.c
3     Skeleton code for a Comedi driver
4
5     COMEDI - Linux Control and Measurement Device Interface
6     Copyright (C) 2000 David A. Schleef <ds@schleef.org>
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 as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 */
18 /*
19 Driver: skel
20 Description: Skeleton driver, an example for driver writers
21 Devices:
22 Author: ds
23 Updated: Mon, 18 Mar 2002 15:34:01 -0800
24 Status: works
25
26 This driver is a documented example on how Comedi drivers are
27 written.
28
29 Configuration Options:
30   none
31 */
32
33 /*
34  * The previous block comment is used to automatically generate
35  * documentation in Comedi and Comedilib.  The fields:
36  *
37  *  Driver: the name of the driver
38  *  Description: a short phrase describing the driver.  Don't list boards.
39  *  Devices: a full list of the boards that attempt to be supported by
40  *    the driver.  Format is "(manufacturer) board name [comedi name]",
41  *    where comedi_name is the name that is used to configure the board.
42  *    See the comment near board_name: in the struct comedi_driver structure
43  *    below.  If (manufacturer) or [comedi name] is missing, the previous
44  *    value is used.
45  *  Author: you
46  *  Updated: date when the _documentation_ was last updated.  Use 'date -R'
47  *    to get a value for this.
48  *  Status: a one-word description of the status.  Valid values are:
49  *    works - driver works correctly on most boards supported, and
50  *      passes comedi_test.
51  *    unknown - unknown.  Usually put there by ds.
52  *    experimental - may not work in any particular release.  Author
53  *      probably wants assistance testing it.
54  *    bitrotten - driver has not been update in a long time, probably
55  *      doesn't work, and probably is missing support for significant
56  *      Comedi interface features.
57  *    untested - author probably wrote it "blind", and is believed to
58  *      work, but no confirmation.
59  *
60  * These headers should be followed by a blank line, and any comments
61  * you wish to say about the driver.  The comment area is the place
62  * to put any known bugs, limitations, unsupported features, supported
63  * command triggers, whether or not commands are supported on particular
64  * subdevices, etc.
65  *
66  * Somewhere in the comment should be information about configuration
67  * options that are used with comedi_config.
68  */
69
70 #include <linux/module.h>
71 #include <linux/pci.h>
72
73 #include "../comedidev.h"
74
75 #include "comedi_fc.h"
76
77 /* Imaginary registers for the imaginary board */
78
79 #define SKEL_SIZE 0
80
81 #define SKEL_START_AI_CONV      0
82 #define SKEL_AI_READ            0
83
84 /*
85  * Board descriptions for two imaginary boards.  Describing the
86  * boards in this way is optional, and completely driver-dependent.
87  * Some drivers use arrays such as this, other do not.
88  */
89 enum skel_boardid {
90         BOARD_SKEL100,
91         BOARD_SKEL200,
92 };
93
94 struct skel_board {
95         const char *name;
96         int ai_chans;
97         int ai_bits;
98         int have_dio;
99 };
100
101 static const struct skel_board skel_boards[] = {
102         [BOARD_SKEL100] = {
103                 .name           = "skel-100",
104                 .ai_chans       = 16,
105                 .ai_bits        = 12,
106                 .have_dio       = 1,
107         },
108         [BOARD_SKEL200] = {
109                 .name           = "skel-200",
110                 .ai_chans       = 8,
111                 .ai_bits        = 16,
112         },
113 };
114
115 /* this structure is for data unique to this hardware driver.  If
116    several hardware drivers keep similar information in this structure,
117    feel free to suggest moving the variable to the struct comedi_device struct.
118  */
119 struct skel_private {
120
121         int data;
122
123         /* Used for AO readback */
124         unsigned int ao_readback[2];
125 };
126
127 /* This function doesn't require a particular form, this is just
128  * what happens to be used in some of the drivers.  It should
129  * convert ns nanoseconds to a counter value suitable for programming
130  * the device.  Also, it should adjust ns so that it cooresponds to
131  * the actual time that the device will use. */
132 static int skel_ns_to_timer(unsigned int *ns, int round)
133 {
134         /* trivial timer */
135         /* if your timing is done through two cascaded timers, the
136          * i8253_cascade_ns_to_timer() function in 8253.h can be
137          * very helpful.  There are also i8254_load() and i8254_mm_load()
138          * which can be used to load values into the ubiquitous 8254 counters
139          */
140
141         return *ns;
142 }
143
144 /*
145  * "instructions" read/write data in "one-shot" or "software-triggered"
146  * mode.
147  */
148 static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
149                          struct comedi_insn *insn, unsigned int *data)
150 {
151         const struct skel_board *thisboard = comedi_board(dev);
152         int n, i;
153         unsigned int d;
154         unsigned int status;
155
156         /* a typical programming sequence */
157
158         /* write channel to multiplexer */
159         /* outw(chan,dev->iobase + SKEL_MUX); */
160
161         /* don't wait for mux to settle */
162
163         /* convert n samples */
164         for (n = 0; n < insn->n; n++) {
165                 /* trigger conversion */
166                 /* outw(0,dev->iobase + SKEL_CONVERT); */
167
168 #define TIMEOUT 100
169                 /* wait for conversion to end */
170                 for (i = 0; i < TIMEOUT; i++) {
171                         status = 1;
172                         /* status = inb(dev->iobase + SKEL_STATUS); */
173                         if (status)
174                                 break;
175                 }
176                 if (i == TIMEOUT) {
177                         dev_warn(dev->class_dev, "ai timeout\n");
178                         return -ETIMEDOUT;
179                 }
180
181                 /* read data */
182                 /* d = inw(dev->iobase + SKEL_AI_DATA); */
183                 d = 0;
184
185                 /* mangle the data as necessary */
186                 d ^= 1 << (thisboard->ai_bits - 1);
187
188                 data[n] = d;
189         }
190
191         /* return the number of samples read/written */
192         return n;
193 }
194
195 /*
196  * cmdtest tests a particular command to see if it is valid.
197  * Using the cmdtest ioctl, a user can create a valid cmd
198  * and then have it executes by the cmd ioctl.
199  *
200  * cmdtest returns 1,2,3,4 or 0, depending on which tests
201  * the command passes.
202  */
203 static int skel_ai_cmdtest(struct comedi_device *dev,
204                            struct comedi_subdevice *s,
205                            struct comedi_cmd *cmd)
206 {
207         int err = 0;
208         int tmp;
209
210         /* Step 1 : check if triggers are trivially valid */
211
212         err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
213         err |= cfc_check_trigger_src(&cmd->scan_begin_src,
214                                         TRIG_TIMER | TRIG_EXT);
215         err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT);
216         err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
217         err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
218
219         if (err)
220                 return 1;
221
222         /* Step 2a : make sure trigger sources are unique */
223
224         err |= cfc_check_trigger_is_unique(cmd->scan_begin_src);
225         err |= cfc_check_trigger_is_unique(cmd->convert_src);
226         err |= cfc_check_trigger_is_unique(cmd->stop_src);
227
228         /* Step 2b : and mutually compatible */
229
230         if (err)
231                 return 2;
232
233         /* Step 3: check if arguments are trivially valid */
234
235         err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
236
237 #define MAX_SPEED       10000   /* in nanoseconds */
238 #define MIN_SPEED       1000000000      /* in nanoseconds */
239
240         if (cmd->scan_begin_src == TRIG_TIMER) {
241                 err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
242                                                  MAX_SPEED);
243                 err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg,
244                                                  MIN_SPEED);
245         } else {
246                 /* external trigger */
247                 /* should be level/edge, hi/lo specification here */
248                 /* should specify multiple external triggers */
249                 err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 9);
250         }
251
252         if (cmd->convert_src == TRIG_TIMER) {
253                 err |= cfc_check_trigger_arg_min(&cmd->convert_arg, MAX_SPEED);
254                 err |= cfc_check_trigger_arg_max(&cmd->convert_arg, MIN_SPEED);
255         } else {
256                 /* external trigger */
257                 /* see above */
258                 err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg, 9);
259         }
260
261         err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);
262
263         if (cmd->stop_src == TRIG_COUNT)
264                 err |= cfc_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff);
265         else    /* TRIG_NONE */
266                 err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
267
268         if (err)
269                 return 3;
270
271         /* step 4: fix up any arguments */
272
273         if (cmd->scan_begin_src == TRIG_TIMER) {
274                 tmp = cmd->scan_begin_arg;
275                 skel_ns_to_timer(&cmd->scan_begin_arg,
276                                  cmd->flags & TRIG_ROUND_MASK);
277                 if (tmp != cmd->scan_begin_arg)
278                         err++;
279         }
280         if (cmd->convert_src == TRIG_TIMER) {
281                 tmp = cmd->convert_arg;
282                 skel_ns_to_timer(&cmd->convert_arg,
283                                  cmd->flags & TRIG_ROUND_MASK);
284                 if (tmp != cmd->convert_arg)
285                         err++;
286                 if (cmd->scan_begin_src == TRIG_TIMER &&
287                     cmd->scan_begin_arg <
288                     cmd->convert_arg * cmd->scan_end_arg) {
289                         cmd->scan_begin_arg =
290                             cmd->convert_arg * cmd->scan_end_arg;
291                         err++;
292                 }
293         }
294
295         if (err)
296                 return 4;
297
298         return 0;
299 }
300
301 static int skel_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
302                          struct comedi_insn *insn, unsigned int *data)
303 {
304         struct skel_private *devpriv = dev->private;
305         int i;
306         int chan = CR_CHAN(insn->chanspec);
307
308         /* Writing a list of values to an AO channel is probably not
309          * very useful, but that's how the interface is defined. */
310         for (i = 0; i < insn->n; i++) {
311                 /* a typical programming sequence */
312                 /* outw(data[i],dev->iobase + SKEL_DA0 + chan); */
313                 devpriv->ao_readback[chan] = data[i];
314         }
315
316         /* return the number of samples read/written */
317         return i;
318 }
319
320 /* AO subdevices should have a read insn as well as a write insn.
321  * Usually this means copying a value stored in devpriv. */
322 static int skel_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
323                          struct comedi_insn *insn, unsigned int *data)
324 {
325         struct skel_private *devpriv = dev->private;
326         int i;
327         int chan = CR_CHAN(insn->chanspec);
328
329         for (i = 0; i < insn->n; i++)
330                 data[i] = devpriv->ao_readback[chan];
331
332         return i;
333 }
334
335 /*
336  * DIO devices are slightly special. Although it is possible to
337  * implement the insn_read/insn_write interface, it is much more
338  * useful to applications if you implement the insn_bits interface.
339  * This allows packed reading/writing of the DIO channels. The
340  * comedi core can convert between insn_bits and insn_read/write.
341  */
342 static int skel_dio_insn_bits(struct comedi_device *dev,
343                               struct comedi_subdevice *s,
344                               struct comedi_insn *insn,
345                               unsigned int *data)
346 {
347         /*
348          * The insn data is a mask in data[0] and the new data
349          * in data[1], each channel cooresponding to a bit.
350          *
351          * The core provided comedi_dio_update_state() function can
352          * be used to handle the internal state update to DIO subdevices
353          * with <= 32 channels. This function will return '0' if the
354          * state does not change or the mask of the channels that need
355          * to be updated.
356          */
357         if (comedi_dio_update_state(s, data)) {
358                 /* Write out the new digital output lines */
359                 /* outw(s->state, dev->iobase + SKEL_DIO); */
360         }
361
362         /*
363          * On return, data[1] contains the value of the digital
364          * input and output lines.
365          */
366         /* data[1] = inw(dev->iobase + SKEL_DIO); */
367
368         /*
369          * Or we could just return the software copy of the output
370          * values if it was a purely digital output subdevice.
371          */
372         /* data[1] = s->state; */
373
374         return insn->n;
375 }
376
377 static int skel_dio_insn_config(struct comedi_device *dev,
378                                 struct comedi_subdevice *s,
379                                 struct comedi_insn *insn,
380                                 unsigned int *data)
381 {
382         int ret;
383
384         /*
385          * The input or output configuration of each digital line is
386          * configured by special insn_config instructions.
387          *
388          * chanspec contains the channel to be changed
389          * data[0] contains the instruction to perform on the channel
390          *
391          * Normally the core provided comedi_dio_insn_config() function
392          * can be used to handle the boilerplpate.
393          */
394         ret = comedi_dio_insn_config(dev, s, insn, data, 0);
395         if (ret)
396                 return ret;
397
398         /* Update the hardware to the new configuration */
399         /* outw(s->io_bits, dev->iobase + SKEL_DIO_CONFIG); */
400
401         return insn->n;
402 }
403
404 /*
405  * Handle common part of skel_attach() and skel_auto_attach().
406  */
407 static int skel_common_attach(struct comedi_device *dev)
408 {
409         const struct skel_board *thisboard = comedi_board(dev);
410         struct comedi_subdevice *s;
411         int ret;
412
413         ret = comedi_alloc_subdevices(dev, 3);
414         if (ret)
415                 return ret;
416
417         s = &dev->subdevices[0];
418         /* dev->read_subdev=s; */
419         /* analog input subdevice */
420         s->type = COMEDI_SUBD_AI;
421         /* we support single-ended (ground) and differential */
422         s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
423         s->n_chan = thisboard->ai_chans;
424         s->maxdata = (1 << thisboard->ai_bits) - 1;
425         s->range_table = &range_bipolar10;
426         s->len_chanlist = 16;   /* This is the maximum chanlist length that
427                                    the board can handle */
428         s->insn_read = skel_ai_rinsn;
429 /*
430 *       s->subdev_flags |= SDF_CMD_READ;
431 *       s->do_cmd = skel_ai_cmd;
432 */
433         s->do_cmdtest = skel_ai_cmdtest;
434
435         s = &dev->subdevices[1];
436         /* analog output subdevice */
437         s->type = COMEDI_SUBD_AO;
438         s->subdev_flags = SDF_WRITABLE;
439         s->n_chan = 1;
440         s->maxdata = 0xffff;
441         s->range_table = &range_bipolar5;
442         s->insn_write = skel_ao_winsn;
443         s->insn_read = skel_ao_rinsn;
444
445         s = &dev->subdevices[2];
446         /* digital i/o subdevice */
447         if (thisboard->have_dio) {
448                 s->type = COMEDI_SUBD_DIO;
449                 s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
450                 s->n_chan = 16;
451                 s->maxdata = 1;
452                 s->range_table = &range_digital;
453                 s->insn_bits = skel_dio_insn_bits;
454                 s->insn_config = skel_dio_insn_config;
455         } else {
456                 s->type = COMEDI_SUBD_UNUSED;
457         }
458
459         dev_info(dev->class_dev, "skel: attached\n");
460
461         return 0;
462 }
463
464 /*
465  * _attach is called by the Comedi core to configure the driver
466  * for a particular board in response to the COMEDI_DEVCONFIG ioctl for
467  * a matching board or driver name.  If you specified a board_name array
468  * in the driver structure, dev->board_ptr contains that address.
469  *
470  * Drivers that handle only PCI or USB devices do not usually support
471  * manual attachment of those devices via the COMEDI_DEVCONFIG ioctl, so
472  * those drivers do not have an _attach function; they just have an
473  * _auto_attach function instead.  (See skel_auto_attach() for an example
474  * of such a function.)
475  */
476 static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it)
477 {
478         const struct skel_board *thisboard;
479         struct skel_private *devpriv;
480
481 /*
482  * If you can probe the device to determine what device in a series
483  * it is, this is the place to do it.  Otherwise, dev->board_ptr
484  * should already be initialized.
485  */
486         /* dev->board_ptr = skel_probe(dev, it); */
487
488         thisboard = comedi_board(dev);
489
490         /*
491          * The dev->board_name is initialized by the comedi core before
492          * calling the (*attach) function. It can be optionally set by
493          * the driver if additional probing has been done.
494          */
495         /* dev->board_name = thisboard->name; */
496
497         /* Allocate the private data */
498         devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
499         if (!devpriv)
500                 return -ENOMEM;
501
502 /*
503  * Supported boards are usually either auto-attached via the
504  * Comedi driver's _auto_attach routine, or manually attached via the
505  * Comedi driver's _attach routine.  In most cases, attempts to
506  * manual attach boards that are usually auto-attached should be
507  * rejected by this function.
508  */
509 /*
510  *      if (thisboard->bustype == pci_bustype) {
511  *              dev_err(dev->class_dev,
512  *                      "Manual attachment of PCI board '%s' not supported\n",
513  *                      thisboard->name);
514  *      }
515  */
516
517 /*
518  * For ISA boards, get the i/o base address from it->options[],
519  * request the i/o region and set dev->iobase * from it->options[].
520  * If using interrupts, get the IRQ number from it->options[].
521  */
522
523         /*
524          * Call a common function to handle the remaining things to do for
525          * attaching ISA or PCI boards.  (Extra parameters could be added
526          * to pass additional information such as IRQ number.)
527          */
528         return skel_common_attach(dev);
529 }
530
531 /*
532  * _auto_attach is called via comedi_pci_auto_config() (or
533  * comedi_usb_auto_config(), etc.) to handle devices that can be attached
534  * to the Comedi core automatically without the COMEDI_DEVCONFIG ioctl.
535  *
536  * The context parameter is driver dependent.
537  */
538 static int skel_auto_attach(struct comedi_device *dev,
539                             unsigned long context)
540 {
541         struct pci_dev *pcidev = comedi_to_pci_dev(dev);
542         const struct skel_board *thisboard = NULL;
543         struct skel_private *devpriv;
544         int ret;
545
546         /* Hack to allow unused code to be optimized out. */
547         if (!IS_ENABLED(CONFIG_COMEDI_PCI_DRIVERS))
548                 return -EINVAL;
549
550         /*
551          * In this example, the _auto_attach is for a PCI device.
552          *
553          * The 'context' passed to this function is the id->driver_data
554          * associated with the PCI device found in the id_table during
555          * the modprobe. This 'context' is the index of the entry in
556          * skel_boards[i] that contains the boardinfo for the PCI device.
557          */
558         if (context < ARRAY_SIZE(skel_boards))
559                 thisboard = &skel_boards[context];
560         if (!thisboard)
561                 return -ENODEV;
562
563         /*
564          * Point the struct comedi_device to the matching board info
565          * and set the board name.
566          */
567         dev->board_ptr = thisboard;
568         dev->board_name = thisboard->name;
569
570         /* Allocate the private data */
571         devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
572         if (!devpriv)
573                 return -ENOMEM;
574
575         /* Enable the PCI device. */
576         ret = comedi_pci_enable(dev);
577         if (ret)
578                 return ret;
579
580         /*
581          * Record the fact that the PCI device is enabled so that it can
582          * be disabled during _detach().
583          *
584          * For this example driver, we assume PCI BAR 0 is the main I/O
585          * region for the board registers and use dev->iobase to hold the
586          * I/O base address and to indicate that the PCI device has been
587          * enabled.
588          *
589          * (For boards with memory-mapped registers, dev->iobase is not
590          * usually needed for register access, so can just be set to 1
591          * to indicate that the PCI device has been enabled.)
592          */
593         dev->iobase = pci_resource_start(pcidev, 0);
594
595         /*
596          * Call a common function to handle the remaining things to do for
597          * attaching ISA or PCI boards.  (Extra parameters could be added
598          * to pass additional information such as IRQ number.)
599          */
600         return skel_common_attach(dev);
601 }
602
603 /*
604  * _detach is called to deconfigure a device.  It should deallocate
605  * resources.
606  * This function is also called when _attach() fails, so it should be
607  * careful not to release resources that were not necessarily
608  * allocated by _attach().  dev->private and dev->subdevices are
609  * deallocated automatically by the core.
610  */
611 static void skel_detach(struct comedi_device *dev)
612 {
613         const struct skel_board *thisboard = comedi_board(dev);
614         struct skel_private *devpriv = dev->private;
615
616         if (!thisboard || !devpriv)
617                 return;
618
619 /*
620  * Do common stuff such as freeing IRQ, unmapping remapped memory
621  * regions, etc., being careful to check that the stuff is valid given
622  * that _detach() is called even when _attach() or _auto_attach() return
623  * an error.
624  */
625
626         if (IS_ENABLED(CONFIG_COMEDI_PCI_DRIVERS) /* &&
627             thisboard->bustype == pci_bustype */) {
628                 /*
629                  * PCI board
630                  *
631                  * If PCI device enabled by _auto_attach() (or _attach()),
632                  * disable it here.
633                  */
634                 comedi_pci_disable(dev);
635         } else {
636                 /*
637                  * ISA board
638                  *
639                  * Release the first I/O region requested during the
640                  * _attach(). This is safe to call even if the request
641                  * failed. If any additional I/O regions are requested
642                  * they need to be released by the driver.
643                  */
644                 comedi_legacy_detach(dev);
645         }
646 }
647
648 /*
649  * The struct comedi_driver structure tells the Comedi core module
650  * which functions to call to configure/deconfigure (attach/detach)
651  * the board, and also about the kernel module that contains
652  * the device code.
653  */
654 static struct comedi_driver skel_driver = {
655         .driver_name = "dummy",
656         .module = THIS_MODULE,
657         .attach = skel_attach,
658         .auto_attach = skel_auto_attach,
659         .detach = skel_detach,
660 /* It is not necessary to implement the following members if you are
661  * writing a driver for a ISA PnP or PCI card */
662         /* Most drivers will support multiple types of boards by
663          * having an array of board structures.  These were defined
664          * in skel_boards[] above.  Note that the element 'name'
665          * was first in the structure -- Comedi uses this fact to
666          * extract the name of the board without knowing any details
667          * about the structure except for its length.
668          * When a device is attached (by comedi_config), the name
669          * of the device is given to Comedi, and Comedi tries to
670          * match it by going through the list of board names.  If
671          * there is a match, the address of the pointer is put
672          * into dev->board_ptr and driver->attach() is called.
673          *
674          * Note that these are not necessary if you can determine
675          * the type of board in software.  ISA PnP, PCI, and PCMCIA
676          * devices are such boards.
677          */
678         .board_name = &skel_boards[0].name,
679         .offset = sizeof(struct skel_board),
680         .num_names = ARRAY_SIZE(skel_boards),
681 };
682
683 #ifdef CONFIG_COMEDI_PCI_DRIVERS
684
685 static int skel_pci_probe(struct pci_dev *dev,
686                           const struct pci_device_id *id)
687 {
688         return comedi_pci_auto_config(dev, &skel_driver, id->driver_data);
689 }
690
691 /*
692  * Please add your PCI vendor ID to comedidev.h, and it will
693  * be forwarded upstream.
694  */
695 #define PCI_VENDOR_ID_SKEL      0xdafe
696
697 /*
698  * This is used by modprobe to translate PCI IDs to drivers.
699  * Should only be used for PCI and ISA-PnP devices
700  */
701 static DEFINE_PCI_DEVICE_TABLE(skel_pci_table) = {
702         { PCI_VDEVICE(SKEL, 0x0100), BOARD_SKEL100 },
703         { PCI_VDEVICE(SKEL, 0x0200), BOARD_SKEL200 },
704         { 0 }
705 };
706 MODULE_DEVICE_TABLE(pci, skel_pci_table);
707
708 static struct pci_driver skel_pci_driver = {
709         .name           = "dummy",
710         .id_table       = skel_pci_table,
711         .probe          = skel_pci_probe,
712         .remove         = comedi_pci_auto_unconfig,
713 };
714 module_comedi_pci_driver(skel_driver, skel_pci_driver);
715 #else
716 module_comedi_driver(skel_driver);
717 #endif
718
719 MODULE_AUTHOR("Comedi http://www.comedi.org");
720 MODULE_DESCRIPTION("Comedi low-level driver");
721 MODULE_LICENSE("GPL");