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

staging: comedi: me4000: comedi_handle_events() will stop conversions

The irq handler does not need to manually stop conversions and disable
interrupts when "end-of-acquisition", "error", or "overflow" events are
detected. The comedi_handle_events() will call the subdevice (*cancel)
when these are detected and stop the acquisition.
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 b36e4fa7
...@@ -939,41 +939,17 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -939,41 +939,17 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
if (!(tmp & ME4000_AI_STATUS_FF_DATA) && if (!(tmp & ME4000_AI_STATUS_FF_DATA) &&
!(tmp & ME4000_AI_STATUS_HF_DATA) && !(tmp & ME4000_AI_STATUS_HF_DATA) &&
(tmp & ME4000_AI_STATUS_EF_DATA)) { (tmp & ME4000_AI_STATUS_EF_DATA)) {
c = ME4000_AI_FIFO_COUNT;
/*
* FIFO overflow, so stop conversion
* and disable all interrupts
*/
tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP;
tmp &= ~(ME4000_AI_CTRL_HF_IRQ |
ME4000_AI_CTRL_SC_IRQ);
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
s->async->events |= COMEDI_CB_ERROR;
dev_err(dev->class_dev, "FIFO overflow\n"); dev_err(dev->class_dev, "FIFO overflow\n");
s->async->events |= COMEDI_CB_ERROR;
c = ME4000_AI_FIFO_COUNT;
} else if ((tmp & ME4000_AI_STATUS_FF_DATA) && } else if ((tmp & ME4000_AI_STATUS_FF_DATA) &&
!(tmp & ME4000_AI_STATUS_HF_DATA) && !(tmp & ME4000_AI_STATUS_HF_DATA) &&
(tmp & ME4000_AI_STATUS_EF_DATA)) { (tmp & ME4000_AI_STATUS_EF_DATA)) {
c = ME4000_AI_FIFO_COUNT / 2; c = ME4000_AI_FIFO_COUNT / 2;
} else { } else {
dev_err(dev->class_dev,
"Can't determine state of fifo\n");
c = 0;
/*
* Undefined state, so stop conversion
* and disable all interrupts
*/
tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP;
tmp &= ~(ME4000_AI_CTRL_HF_IRQ |
ME4000_AI_CTRL_SC_IRQ);
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
s->async->events |= COMEDI_CB_ERROR;
dev_err(dev->class_dev, "Undefined FIFO state\n"); dev_err(dev->class_dev, "Undefined FIFO state\n");
s->async->events |= COMEDI_CB_ERROR;
c = 0;
} }
for (i = 0; i < c; i++) { for (i = 0; i < c; i++) {
...@@ -981,18 +957,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -981,18 +957,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF;
lval ^= 0x8000; lval ^= 0x8000;
if (!comedi_buf_write_samples(s, &lval, 1)) { if (!comedi_buf_write_samples(s, &lval, 1))
/*
* Buffer overflow, so stop conversion
* and disable all interrupts
*/
tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP;
tmp &= ~(ME4000_AI_CTRL_HF_IRQ |
ME4000_AI_CTRL_SC_IRQ);
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
break; break;
} }
}
/* Work is done, so reset the interrupt */ /* Work is done, so reset the interrupt */
tmp |= ME4000_AI_CTRL_HF_IRQ_RESET; tmp |= ME4000_AI_CTRL_HF_IRQ_RESET;
...@@ -1003,17 +970,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1003,17 +970,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) &
ME4000_IRQ_STATUS_SC) { ME4000_IRQ_STATUS_SC) {
/* Acquisition is complete */
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
/*
* Acquisition is complete, so stop
* conversion and disable all interrupts
*/
tmp = inl(dev->iobase + ME4000_AI_CTRL_REG);
tmp |= ME4000_AI_CTRL_IMMEDIATE_STOP;
tmp &= ~(ME4000_AI_CTRL_HF_IRQ | ME4000_AI_CTRL_SC_IRQ);
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
/* Poll data until fifo empty */ /* Poll data until fifo empty */
while (inl(dev->iobase + ME4000_AI_STATUS_REG) & while (inl(dev->iobase + ME4000_AI_STATUS_REG) &
ME4000_AI_STATUS_EF_DATA) { ME4000_AI_STATUS_EF_DATA) {
...@@ -1026,6 +985,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1026,6 +985,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
} }
/* Work is done, so reset the interrupt */ /* Work is done, so reset the interrupt */
tmp = inl(dev->iobase + ME4000_AI_CTRL_REG);
tmp |= ME4000_AI_CTRL_SC_IRQ_RESET; tmp |= ME4000_AI_CTRL_SC_IRQ_RESET;
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
tmp &= ~ME4000_AI_CTRL_SC_IRQ_RESET; tmp &= ~ME4000_AI_CTRL_SC_IRQ_RESET;
......
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