Merge remote-tracking branch 'staging/staging-next'
[deliverable/linux.git] / drivers / staging / comedi / drivers / ni_daq_dio24.c
CommitLineData
d1d3cb32 1/*
26994fd5
HS
2 * Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24
3 * Copyright (C) 2002 Daniel Vecino Castel <dvecino@able.es>
4 *
5 * PCMCIA crap at end of file is adapted from dummy_cs.c 1.31
6 * 2001/08/24 12:13:13 from the pcmcia package.
7 * The initial developer of the pcmcia dummy_cs.c code is David A. Hinds
8 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
9 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 */
d1d3cb32 21
d1d3cb32 22/*
26994fd5
HS
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 */
d1d3cb32 33
ce157f80 34#include <linux/module.h>
51d5483f 35#include "../comedi_pcmcia.h"
d1d3cb32 36
89d714ce
HS
37#include "8255.h"
38
5a1daad4
HS
39static int dio24_auto_attach(struct comedi_device *dev,
40 unsigned long context)
d1d3cb32 41{
5a1daad4 42 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
34c43922 43 struct comedi_subdevice *s;
8b6c5694 44 int ret;
d1d3cb32 45
573a9648 46 link->config_flags |= CONF_AUTO_SET_IO;
a3ac9519 47 ret = comedi_pcmcia_enable(dev, NULL);
37fa328f 48 if (ret)
5a1daad4
HS
49 return ret;
50 dev->iobase = link->resource[0]->start;
d1d3cb32 51
8b6c5694
HS
52 ret = comedi_alloc_subdevices(dev, 1);
53 if (ret)
54 return ret;
d1d3cb32
DVC
55
56 /* 8255 dio */
06e915e2 57 s = &dev->subdevices[0];
ac7e6291 58 return subdev_8255_init(dev, s, NULL, 0x00);
5a1daad4 59}
d1d3cb32 60
25602bd7
HS
61static struct comedi_driver driver_dio24 = {
62 .driver_name = "ni_daq_dio24",
63 .module = THIS_MODULE,
5a1daad4 64 .auto_attach = dio24_auto_attach,
588ba6dc 65 .detach = comedi_pcmcia_disable,
25602bd7
HS
66};
67
07c5b441 68static int dio24_cs_attach(struct pcmcia_device *link)
55a19b39 69{
5a1daad4 70 return comedi_pcmcia_auto_config(link, &driver_dio24);
de46fb77 71}
d1d3cb32 72
2202a5a7 73static const struct pcmcia_device_id dio24_cs_ids[] = {
d1d3cb32
DVC
74 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c), /* daqcard-dio24 */
75 PCMCIA_DEVICE_NULL
76};
d1d3cb32
DVC
77MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids);
78
3786d4fb 79static struct pcmcia_driver dio24_cs_driver = {
7b725aae
HS
80 .name = "ni_daq_dio24",
81 .owner = THIS_MODULE,
82 .id_table = dio24_cs_ids,
83 .probe = dio24_cs_attach,
5a1daad4 84 .remove = comedi_pcmcia_auto_unconfig,
d1d3cb32 85};
cb798ccf 86module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver);
573c43f3
HS
87
88MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>");
89MODULE_DESCRIPTION(
90 "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24");
91MODULE_LICENSE("GPL");
This page took 0.764699 seconds and 5 git commands to generate.