aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/dt2817.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-14 10:58:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-15 09:26:25 +0200
commit8ffdff6a8cfbdc174a3a390b6f825a277b5bb895 (patch)
tree10d8b8e9a98ca6dbcff017ef9ab0767ddcf30214 /drivers/staging/comedi/drivers/dt2817.c
parentstaging: rtl8723bs: remove sdio_drv_priv structure (diff)
downloadlinux-dev-8ffdff6a8cfbdc174a3a390b6f825a277b5bb895.tar.xz
linux-dev-8ffdff6a8cfbdc174a3a390b6f825a277b5bb895.zip
staging: comedi: move out of staging directory
The comedi code came into the kernel back in 2008, but traces its lifetime to much much earlier. It's been polished and buffed and there's really nothing preventing it from being part of the "real" portion of the kernel. So move it to drivers/comedi/ as it belongs there. Many thanks to the hundreds of developers who did the work to make this happen. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Link: https://lore.kernel.org/r/YHauop4u3sP6lz8j@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/dt2817.c')
-rw-r--r--drivers/staging/comedi/drivers/dt2817.c140
1 files changed, 0 insertions, 140 deletions
diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c
deleted file mode 100644
index 7c1463e835d3..000000000000
--- a/drivers/staging/comedi/drivers/dt2817.c
+++ /dev/null
@@ -1,140 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * comedi/drivers/dt2817.c
- * Hardware driver for Data Translation DT2817
- *
- * COMEDI - Linux Control and Measurement Device Interface
- * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
- */
-/*
- * Driver: dt2817
- * Description: Data Translation DT2817
- * Author: ds
- * Status: complete
- * Devices: [Data Translation] DT2817 (dt2817)
- *
- * A very simple digital I/O card. Four banks of 8 lines, each bank
- * is configurable for input or output. One wonders why it takes a
- * 50 page manual to describe this thing.
- *
- * The driver (which, btw, is much less than 50 pages) has 1 subdevice
- * with 32 channels, configurable in groups of 8.
- *
- * Configuration options:
- * [0] - I/O port base base address
- */
-
-#include <linux/module.h>
-#include "../comedidev.h"
-
-#define DT2817_CR 0
-#define DT2817_DATA 1
-
-static int dt2817_dio_insn_config(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
- unsigned int chan = CR_CHAN(insn->chanspec);
- unsigned int oe = 0;
- unsigned int mask;
- int ret;
-
- if (chan < 8)
- mask = 0x000000ff;
- else if (chan < 16)
- mask = 0x0000ff00;
- else if (chan < 24)
- mask = 0x00ff0000;
- else
- mask = 0xff000000;
-
- ret = comedi_dio_insn_config(dev, s, insn, data, mask);
- if (ret)
- return ret;
-
- if (s->io_bits & 0x000000ff)
- oe |= 0x1;
- if (s->io_bits & 0x0000ff00)
- oe |= 0x2;
- if (s->io_bits & 0x00ff0000)
- oe |= 0x4;
- if (s->io_bits & 0xff000000)
- oe |= 0x8;
-
- outb(oe, dev->iobase + DT2817_CR);
-
- return insn->n;
-}
-
-static int dt2817_dio_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
- unsigned long iobase = dev->iobase + DT2817_DATA;
- unsigned int mask;
- unsigned int val;
-
- mask = comedi_dio_update_state(s, data);
- if (mask) {
- if (mask & 0x000000ff)
- outb(s->state & 0xff, iobase + 0);
- if (mask & 0x0000ff00)
- outb((s->state >> 8) & 0xff, iobase + 1);
- if (mask & 0x00ff0000)
- outb((s->state >> 16) & 0xff, iobase + 2);
- if (mask & 0xff000000)
- outb((s->state >> 24) & 0xff, iobase + 3);
- }
-
- val = inb(iobase + 0);
- val |= (inb(iobase + 1) << 8);
- val |= (inb(iobase + 2) << 16);
- val |= (inb(iobase + 3) << 24);
-
- data[1] = val;
-
- return insn->n;
-}
-
-static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it)
-{
- int ret;
- struct comedi_subdevice *s;
-
- ret = comedi_request_region(dev, it->options[0], 0x5);
- if (ret)
- return ret;
-
- ret = comedi_alloc_subdevices(dev, 1);
- if (ret)
- return ret;
-
- s = &dev->subdevices[0];
-
- s->n_chan = 32;
- s->type = COMEDI_SUBD_DIO;
- s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
- s->range_table = &range_digital;
- s->maxdata = 1;
- s->insn_bits = dt2817_dio_insn_bits;
- s->insn_config = dt2817_dio_insn_config;
-
- s->state = 0;
- outb(0, dev->iobase + DT2817_CR);
-
- return 0;
-}
-
-static struct comedi_driver dt2817_driver = {
- .driver_name = "dt2817",
- .module = THIS_MODULE,
- .attach = dt2817_attach,
- .detach = comedi_legacy_detach,
-};
-module_comedi_driver(dt2817_driver);
-
-MODULE_AUTHOR("Comedi https://www.comedi.org");
-MODULE_DESCRIPTION("Comedi low-level driver");
-MODULE_LICENSE("GPL");