David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 1 | /* |
H Hartley Sweeten | b4a7c74 | 2016-06-20 11:39:28 -0700 | [diff] [blame] | 2 | * Comedi driver for DAS008 PCMCIA boards |
| 3 | * |
| 4 | * COMEDI - Linux Control and Measurement Device Interface |
| 5 | * Copyright (C) 2000 David A. Schleef <ds@schleef.org> |
| 6 | * Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> |
| 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 | * PCMCIA support code for this driver is adapted from the dummy_cs.c |
| 19 | * driver of the Linux PCMCIA Card Services package. |
| 20 | * |
| 21 | * The initial developer of the original code is David A. Hinds |
| 22 | * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds |
| 23 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. |
| 24 | */ |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 25 | |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 26 | /* |
H Hartley Sweeten | b4a7c74 | 2016-06-20 11:39:28 -0700 | [diff] [blame] | 27 | * Driver: das08_cs |
| 28 | * Description: DAS-08 PCMCIA boards |
| 29 | * Author: Warren Jasper, ds, Frank Hess |
| 30 | * Devices: [ComputerBoards] PCM-DAS08 (pcm-das08) |
| 31 | * Status: works |
| 32 | * |
| 33 | * This is the PCMCIA-specific support split off from the |
| 34 | * das08 driver. |
| 35 | * |
| 36 | * Configuration Options: none, uses PCMCIA auto config |
| 37 | * |
| 38 | * Command support does not exist, but could be added for this board. |
| 39 | */ |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 40 | |
H Hartley Sweeten | ce157f8 | 2013-06-24 17:04:43 -0700 | [diff] [blame] | 41 | #include <linux/module.h> |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 42 | |
Ian Abbott | 0519c8f | 2015-01-30 09:57:20 +0000 | [diff] [blame] | 43 | #include "../comedi_pcmcia.h" |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 44 | |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 45 | #include "das08.h" |
| 46 | |
Ian Abbott | 383ecb8 | 2012-08-31 20:41:36 +0100 | [diff] [blame] | 47 | static const struct das08_board_struct das08_cs_boards[] = { |
| 48 | { |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 49 | .name = "pcm-das08", |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 50 | .ai_nbits = 12, |
| 51 | .ai_pg = das08_bipolar5, |
| 52 | .ai_encoding = das08_pcm_encode12, |
| 53 | .di_nchan = 3, |
| 54 | .do_nchan = 3, |
| 55 | .iosize = 16, |
Ian Abbott | 383ecb8 | 2012-08-31 20:41:36 +0100 | [diff] [blame] | 56 | }, |
H Hartley Sweeten | 6b7de35 | 2012-07-02 15:48:26 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 59 | static int das08_cs_auto_attach(struct comedi_device *dev, |
| 60 | unsigned long context) |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 61 | { |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 62 | struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); |
| 63 | struct das08_private_struct *devpriv; |
| 64 | unsigned long iobase; |
Dominik Brodowski | 55a19b3 | 2009-10-29 00:54:49 +0100 | [diff] [blame] | 65 | int ret; |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 66 | |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 67 | /* The das08 driver needs the board_ptr */ |
| 68 | dev->board_ptr = &das08_cs_boards[0]; |
| 69 | |
H Hartley Sweeten | 95f932c | 2013-02-04 14:21:31 -0700 | [diff] [blame] | 70 | link->config_flags |= CONF_AUTO_SET_IO; |
H Hartley Sweeten | a3ac951 | 2013-02-05 18:16:07 -0700 | [diff] [blame] | 71 | ret = comedi_pcmcia_enable(dev, NULL); |
Dominik Brodowski | 55a19b3 | 2009-10-29 00:54:49 +0100 | [diff] [blame] | 72 | if (ret) |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 73 | return ret; |
| 74 | iobase = link->resource[0]->start; |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 75 | |
H Hartley Sweeten | 0bdab50 | 2013-06-24 16:55:44 -0700 | [diff] [blame] | 76 | devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 77 | if (!devpriv) |
| 78 | return -ENOMEM; |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 79 | |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 80 | return das08_common_attach(dev, iobase); |
H Hartley Sweeten | fb79574 | 2012-07-02 15:45:34 -0700 | [diff] [blame] | 81 | } |
| 82 | |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 83 | static struct comedi_driver driver_das08_cs = { |
| 84 | .driver_name = "das08_cs", |
| 85 | .module = THIS_MODULE, |
| 86 | .auto_attach = das08_cs_auto_attach, |
H Hartley Sweeten | 588ba6d | 2013-06-11 11:32:29 -0700 | [diff] [blame] | 87 | .detach = comedi_pcmcia_disable, |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | static int das08_pcmcia_attach(struct pcmcia_device *link) |
| 91 | { |
| 92 | return comedi_pcmcia_auto_config(link, &driver_das08_cs); |
H Hartley Sweeten | c332d96 | 2012-07-02 15:45:03 -0700 | [diff] [blame] | 93 | } |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 94 | |
Joe Perches | 2202a5a | 2011-05-03 19:29:02 -0700 | [diff] [blame] | 95 | static const struct pcmcia_device_id das08_cs_id_table[] = { |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 96 | PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), |
| 97 | PCMCIA_DEVICE_NULL |
| 98 | }; |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 99 | MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); |
| 100 | |
H Hartley Sweeten | 27fa05b | 2012-07-02 15:44:30 -0700 | [diff] [blame] | 101 | static struct pcmcia_driver das08_cs_driver = { |
| 102 | .name = "pcm-das08", |
| 103 | .owner = THIS_MODULE, |
H Hartley Sweeten | 27fa05b | 2012-07-02 15:44:30 -0700 | [diff] [blame] | 104 | .id_table = das08_cs_id_table, |
H Hartley Sweeten | 8cd98c8 | 2013-01-30 15:23:50 -0700 | [diff] [blame] | 105 | .probe = das08_pcmcia_attach, |
| 106 | .remove = comedi_pcmcia_auto_unconfig, |
David Schleef | 0882eaa | 2009-02-12 16:09:00 -0800 | [diff] [blame] | 107 | }; |
Peter Huewe | 7915ce0 | 2013-01-14 22:00:53 +0100 | [diff] [blame] | 108 | module_comedi_pcmcia_driver(driver_das08_cs, das08_cs_driver); |
H Hartley Sweeten | 3a36ad1 | 2012-07-02 15:42:41 -0700 | [diff] [blame] | 109 | |
Luis de Bethencourt | 55ff2c6 | 2015-06-22 14:14:35 +0200 | [diff] [blame] | 110 | MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); |
| 111 | MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>"); |
H Hartley Sweeten | 3a36ad1 | 2012-07-02 15:42:41 -0700 | [diff] [blame] | 112 | MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); |
| 113 | MODULE_LICENSE("GPL"); |