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