blob: d9de83ab026712792a61a6cb806326316573cddb [file] [log] [blame]
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -08001/*
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
Matei Opreaa1000322014-03-11 14:39:12 +02006 PCMCIA crap at end of file is adapted from dummy_cs.c 1.31
7 2001/08/24 12:13:13 from the pcmcia package.
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -08008 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.
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080021*/
22/*
23Driver: ni_daq_dio24
24Description: National Instruments PCMCIA DAQ-Card DIO-24
25Author: Daniel Vecino Castel <dvecino@able.es>
26Devices: [National Instruments] PCMCIA DAQ-Card DIO-24 (ni_daq_dio24)
27Status: ?
28Updated: Thu, 07 Nov 2002 21:53:06 -0800
29
30This is just a wrapper around the 8255.o driver to properly handle
31the PCMCIA interface.
32*/
33
H Hartley Sweetence157f82013-06-24 17:04:43 -070034#include <linux/module.h>
Ian Abbott51d54832015-01-30 09:57:22 +000035#include "../comedi_pcmcia.h"
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080036
H Hartley Sweeten89d714c2013-01-30 16:48:15 -070037#include "8255.h"
38
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070039static int dio24_auto_attach(struct comedi_device *dev,
40 unsigned long context)
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080041{
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070042 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
43 struct comedi_subdevice *s;
Dominik Brodowski55a19b32009-10-29 00:54:49 +010044 int ret;
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080045
H Hartley Sweeten573a9642013-02-05 18:15:20 -070046 link->config_flags |= CONF_AUTO_SET_IO;
H Hartley Sweetena3ac9512013-02-05 18:16:07 -070047 ret = comedi_pcmcia_enable(dev, NULL);
H Hartley Sweeten37fa3282013-02-07 13:27:10 -070048 if (ret)
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070049 return ret;
50 dev->iobase = link->resource[0]->start;
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080051
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070052 ret = comedi_alloc_subdevices(dev, 1);
53 if (ret)
54 return ret;
55
56 /* 8255 dio */
57 s = &dev->subdevices[0];
Abdul Hussainac7e6292015-06-22 06:11:09 +000058 return subdev_8255_init(dev, s, NULL, 0x00);
H Hartley Sweeten07c5b442013-01-30 16:43:48 -070059}
60
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070061static struct comedi_driver driver_dio24 = {
62 .driver_name = "ni_daq_dio24",
63 .module = THIS_MODULE,
64 .auto_attach = dio24_auto_attach,
H Hartley Sweeten588ba6d2013-06-11 11:32:29 -070065 .detach = comedi_pcmcia_disable,
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070066};
67
68static int dio24_cs_attach(struct pcmcia_device *link)
69{
70 return comedi_pcmcia_auto_config(link, &driver_dio24);
H Hartley Sweetende46fb72013-01-30 16:42:06 -070071}
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080072
Joe Perches2202a5a2011-05-03 19:29:02 -070073static const struct pcmcia_device_id dio24_cs_ids[] = {
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080074 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c), /* daqcard-dio24 */
75 PCMCIA_DEVICE_NULL
76};
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080077MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids);
78
H Hartley Sweeten3786d4f2012-09-17 13:14:59 -070079static struct pcmcia_driver dio24_cs_driver = {
H Hartley Sweeten7b725aa2013-01-30 16:41:45 -070080 .name = "ni_daq_dio24",
81 .owner = THIS_MODULE,
82 .id_table = dio24_cs_ids,
83 .probe = dio24_cs_attach,
H Hartley Sweeten5a1daad2013-01-30 16:47:01 -070084 .remove = comedi_pcmcia_auto_unconfig,
Daniel Vecino Casteld1d3cb32009-02-19 10:05:52 -080085};
Peter Huewecb798cc2013-01-14 22:00:49 +010086module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver);
H Hartley Sweeten573c43f2013-01-30 16:41:21 -070087
88MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>");
89MODULE_DESCRIPTION(
90 "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24");
91MODULE_LICENSE("GPL");