Commit e875132a authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_at_a2150: convert driver to use the comedi_8254 module

The hardware supported by this driver includes an 8254 timer. For aesthetics,
convert it to use the comedi_8254 module to provide support for the 8254 timer.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent af5a9734
...@@ -469,6 +469,7 @@ config COMEDI_ADQ12B ...@@ -469,6 +469,7 @@ config COMEDI_ADQ12B
config COMEDI_NI_AT_A2150 config COMEDI_NI_AT_A2150
tristate "NI AT-A2150 ISA card support" tristate "NI AT-A2150 ISA card support"
select COMEDI_ISADMA if ISA_DMA_API select COMEDI_ISADMA if ISA_DMA_API
select COMEDI_8254
---help--- ---help---
Enable support for National Instruments AT-A2150 cards Enable support for National Instruments AT-A2150 cards
......
...@@ -68,7 +68,7 @@ TRIG_WAKE_EOS ...@@ -68,7 +68,7 @@ TRIG_WAKE_EOS
#include "comedi_isadma.h" #include "comedi_isadma.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#include "8253.h" #include "comedi_8254.h"
#define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */ #define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */
...@@ -110,8 +110,6 @@ TRIG_WAKE_EOS ...@@ -110,8 +110,6 @@ TRIG_WAKE_EOS
#define DMA_INTR_EN_BIT 0x800 /* enable interrupt on dma terminal count */ #define DMA_INTR_EN_BIT 0x800 /* enable interrupt on dma terminal count */
#define DMA_DEM_EN_BIT 0x1000 /* enables demand mode dma */ #define DMA_DEM_EN_BIT 0x1000 /* enables demand mode dma */
#define I8253_BASE_REG 0x14 #define I8253_BASE_REG 0x14
#define I8253_MODE_REG 0x17
#define HW_COUNT_DISABLE 0x30 /* disable hardware counting of conversions */
struct a2150_board { struct a2150_board {
const char *name; const char *name;
...@@ -488,7 +486,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -488,7 +486,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
struct comedi_isadma_desc *desc = &dma->desc[0]; struct comedi_isadma_desc *desc = &dma->desc[0];
struct comedi_async *async = s->async; struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd; struct comedi_cmd *cmd = &async->cmd;
unsigned long timer_base = dev->iobase + I8253_BASE_REG;
unsigned int old_config_bits = devpriv->config_bits; unsigned int old_config_bits = devpriv->config_bits;
unsigned int trigger_bits; unsigned int trigger_bits;
...@@ -547,8 +544,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -547,8 +544,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG);
/* may need to wait 72 sampling periods if timing was changed */ /* may need to wait 72 sampling periods if timing was changed */
i8254_set_mode(timer_base, 0, 2, I8254_MODE0 | I8254_BINARY); comedi_8254_load(dev->pacer, 2, 72, I8254_MODE0 | I8254_BINARY);
i8254_write(timer_base, 0, 2, 72);
/* setup start triggering */ /* setup start triggering */
trigger_bits = 0; trigger_bits = 0;
...@@ -726,6 +722,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -726,6 +722,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* an IRQ and DMA are required to support async commands */ /* an IRQ and DMA are required to support async commands */
a2150_alloc_irq_and_dma(dev, it); a2150_alloc_irq_and_dma(dev, it);
dev->pacer = comedi_8254_init(dev->iobase + I8253_BASE_REG,
0, I8254_IO8, 0);
if (!dev->pacer)
return -ENOMEM;
ret = comedi_alloc_subdevices(dev, 1); ret = comedi_alloc_subdevices(dev, 1);
if (ret) if (ret)
return ret; return ret;
...@@ -747,10 +748,6 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -747,10 +748,6 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->cancel = a2150_cancel; s->cancel = a2150_cancel;
} }
/* need to do this for software counting of completed conversions, to
* prevent hardware count from stopping acquisition */
outw(HW_COUNT_DISABLE, dev->iobase + I8253_MODE_REG);
/* set card's irq and dma levels */ /* set card's irq and dma levels */
outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment