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

staging: comedi: ni_mio_common: remove INSN_CONFIG_ANALOG_TRIG support code

None of the boardinfo that uses this code sets the 'has_analog_trig' flag so
ni_ai_config_analog_trig() always returns -EINVAL.

Also, the private data 'atrig_low', 'atrig_high', and 'atrig_mode' values
that are set by ni_ai_config_analog_trig() are never used.

Remove the incomplete INSN_CONFIG_ANALOG_TRIG support along with the unused
boardinfo and private data members.
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 a10817d6
......@@ -2732,106 +2732,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}
static int ni_ai_config_analog_trig(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv = dev->private;
unsigned int a, b, modebits;
int err = 0;
/* data[1] is flags
* data[2] is analog line
* data[3] is set level
* data[4] is reset level */
if (!board->has_analog_trig)
return -EINVAL;
if ((data[1] & 0xffff0000) != COMEDI_EV_SCAN_BEGIN) {
data[1] &= (COMEDI_EV_SCAN_BEGIN | 0xffff);
err++;
}
if (data[2] >= board->n_adchan) {
data[2] = board->n_adchan - 1;
err++;
}
if (data[3] > 255) { /* a */
data[3] = 255;
err++;
}
if (data[4] > 255) { /* b */
data[4] = 255;
err++;
}
/*
* 00 ignore
* 01 set
* 10 reset
*
* modes:
* 1 level: +b- +a-
* high mode 00 00 01 10
* low mode 00 00 10 01
* 2 level: (a<b)
* hysteresis low mode 10 00 00 01
* hysteresis high mode 01 00 00 10
* middle mode 10 01 01 10
*/
a = data[3];
b = data[4];
modebits = data[1] & 0xff;
if (modebits & 0xf0) {
/* two level mode */
if (b < a) {
/* swap order */
a = data[4];
b = data[3];
modebits =
((data[1] & 0xf) << 4) | ((data[1] & 0xf0) >> 4);
}
devpriv->atrig_low = a;
devpriv->atrig_high = b;
switch (modebits) {
case 0x81: /* low hysteresis mode */
devpriv->atrig_mode = 6;
break;
case 0x42: /* high hysteresis mode */
devpriv->atrig_mode = 3;
break;
case 0x96: /* middle window mode */
devpriv->atrig_mode = 2;
break;
default:
data[1] &= ~0xff;
err++;
}
} else {
/* one level mode */
if (b != 0) {
data[4] = 0;
err++;
}
switch (modebits) {
case 0x06: /* high window mode */
devpriv->atrig_high = a;
devpriv->atrig_mode = 0;
break;
case 0x09: /* low window mode */
devpriv->atrig_low = a;
devpriv->atrig_mode = 1;
break;
default:
data[1] &= ~0xff;
err++;
}
}
if (err)
return -EAGAIN;
return 5;
}
static int ni_ai_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
......@@ -2842,8 +2742,6 @@ static int ni_ai_insn_config(struct comedi_device *dev,
return -EINVAL;
switch (data[0]) {
case INSN_CONFIG_ANALOG_TRIG:
return ni_ai_config_analog_trig(dev, s, insn, data);
case INSN_CONFIG_ALT_SOURCE:
if (devpriv->is_m_series) {
if (data[1] & ~(MSeries_AI_Bypass_Cal_Sel_Pos_Mask |
......
......@@ -1410,7 +1410,6 @@ struct ni_board_struct {
int reg_type;
unsigned int has_8255:1;
unsigned int has_analog_trig:1;
enum caldac_enum caldac[3];
};
......@@ -1471,10 +1470,6 @@ struct ni_private {
unsigned clock_ns;
unsigned clock_source;
unsigned short atrig_mode;
unsigned short atrig_high;
unsigned short atrig_low;
unsigned short pwm_up_count;
unsigned short pwm_down_count;
......
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