]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/comedi/drivers/ni_daq_dio24.c
Merge tag 'ecryptfs-3.11-rc1-cleanup' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / drivers / staging / comedi / drivers / ni_daq_dio24.c
1 /*
2     comedi/drivers/ni_daq_dio24.c
3     Driver for National Instruments PCMCIA DAQ-Card DIO-24
4     Copyright (C) 2002 Daniel Vecino Castel <dvecino@able.es>
5
6     PCMCIA crap at end of file is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13
7     from the pcmcia package.
8     The initial developer of the pcmcia dummy_cs.c code is David A. Hinds
9     <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
10     are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
11
12     This program is free software; you can redistribute it and/or modify
13     it under the terms of the GNU General Public License as published by
14     the Free Software Foundation; either version 2 of the License, or
15     (at your option) any later version.
16
17     This program is distributed in the hope that it will be useful,
18     but WITHOUT ANY WARRANTY; without even the implied warranty of
19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20     GNU General Public License for more details.
21 */
22 /*
23 Driver: ni_daq_dio24
24 Description: National Instruments PCMCIA DAQ-Card DIO-24
25 Author: Daniel Vecino Castel <dvecino@able.es>
26 Devices: [National Instruments] PCMCIA DAQ-Card DIO-24 (ni_daq_dio24)
27 Status: ?
28 Updated: Thu, 07 Nov 2002 21:53:06 -0800
29
30 This is just a wrapper around the 8255.o driver to properly handle
31 the PCMCIA interface.
32 */
33
34 #include "../comedidev.h"
35
36 #include <pcmcia/cistpl.h>
37 #include <pcmcia/cisreg.h>
38 #include <pcmcia/ds.h>
39
40 #include "8255.h"
41
42 static int dio24_auto_attach(struct comedi_device *dev,
43                              unsigned long context)
44 {
45         struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
46         struct comedi_subdevice *s;
47         int ret;
48
49         link->config_flags |= CONF_AUTO_SET_IO;
50         ret = comedi_pcmcia_enable(dev, NULL);
51         if (ret)
52                 return ret;
53         dev->iobase = link->resource[0]->start;
54
55         ret = comedi_alloc_subdevices(dev, 1);
56         if (ret)
57                 return ret;
58
59         /* 8255 dio */
60         s = &dev->subdevices[0];
61         ret = subdev_8255_init(dev, s, NULL, dev->iobase);
62         if (ret)
63                 return ret;
64
65         return 0;
66 }
67
68 static struct comedi_driver driver_dio24 = {
69         .driver_name    = "ni_daq_dio24",
70         .module         = THIS_MODULE,
71         .auto_attach    = dio24_auto_attach,
72         .detach         = comedi_pcmcia_disable,
73 };
74
75 static int dio24_cs_attach(struct pcmcia_device *link)
76 {
77         return comedi_pcmcia_auto_config(link, &driver_dio24);
78 }
79
80 static const struct pcmcia_device_id dio24_cs_ids[] = {
81         PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c),        /* daqcard-dio24 */
82         PCMCIA_DEVICE_NULL
83 };
84 MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids);
85
86 static struct pcmcia_driver dio24_cs_driver = {
87         .name           = "ni_daq_dio24",
88         .owner          = THIS_MODULE,
89         .id_table       = dio24_cs_ids,
90         .probe          = dio24_cs_attach,
91         .remove         = comedi_pcmcia_auto_unconfig,
92 };
93 module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver);
94
95 MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>");
96 MODULE_DESCRIPTION(
97         "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24");
98 MODULE_LICENSE("GPL");