Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fed3c23b authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: ni_stc.h: remove 'ao_unipolar' flag from ni_board_struct



This member of the boardinfo for the NI MIO drivers is used to indicate if
the ranges for the analog output subdevice (ao_range_table in the boardinfo)
includes any unipolar ranges. If it's not set, the ao_range_table only has
bipolar ranges.

The 'ao_unipolar' flag is checked when munging the ao data values from the
user so that the values for bipolar ranges are converted to 2's complement
values before they are written to the hardware.

The flag is also used when programming the analog output configuration on
non-M series boards for bipolar/unipolar and external reference operation.

Simplify the driver a bit by removing this boardinfo flag and just using
the comedi_range_is_bipolar() and comedi_range_is_external() helpers to
check the range directly.

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 a8b677cb
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { mb88341 },
@@ -133,7 +132,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { mb88341 },
@@ -149,7 +147,6 @@ static const struct ni_board_struct ni_boards[] = {
		.n_aochan	= 2,
		.aobits		= 12,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -165,7 +162,6 @@ static const struct ni_board_struct ni_boards[] = {
		.n_aochan	= 2,
		.aobits		= 12,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -183,7 +179,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -217,7 +212,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 16,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { dac8800, dac8043, ad8522 },
+7 −11
Original line number Diff line number Diff line
@@ -2925,7 +2925,8 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,

	for (i = 0; i < length; i++) {
		range = CR_RANGE(cmd->chanlist[chan_index]);
		if (board->ao_unipolar == 0 || (range & 1) == 0)

		if (comedi_range_is_bipolar(s, range))
			array[i] -= offset;
#ifdef PCIDMA
		array[i] = cpu_to_le16(array[i]);
@@ -3028,19 +3029,14 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev,
		range = CR_RANGE(chanspec[i]);
		conf = AO_Channel(chan);

		if (board->ao_unipolar) {
			if ((range & 1) == 0) {
		if (comedi_range_is_bipolar(s, range)) {
			conf |= AO_Bipolar;
			invert = (1 << (board->aobits - 1));
		} else {
			invert = 0;
		}
			if (range & 2)
		if (comedi_range_is_external(s, range))
			conf |= AO_Ext_Ref;
		} else {
			conf |= AO_Bipolar;
			invert = (1 << (board->aobits - 1));
		}

		/* not all boards can deglitch, but this shouldn't hurt */
		if (chanspec[i] & CR_DEGLITCH)
+0 −16
Original line number Diff line number Diff line
@@ -235,7 +235,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 16,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { dac8800, dac8043, ad8522 },
@@ -267,7 +266,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 16,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { dac8800, dac8043, ad8522 },
@@ -283,7 +281,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { mb88341 },
@@ -303,7 +300,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 512,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },	/* doc says mb88341 */
@@ -319,7 +315,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 512,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { mb88341 },
@@ -336,7 +331,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 16,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { dac8800, dac8043, ad8522 },
@@ -375,7 +369,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -429,7 +422,6 @@ static const struct ni_board_struct ni_boards[] = {
		.n_aochan	= 2,
		.aobits		= 12,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 100000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },	/* manual is wrong */
@@ -471,7 +463,6 @@ static const struct ni_board_struct ni_boards[] = {
		.ai_speed	= 3000,
		.n_aochan	= 2,
		.aobits		= 16,
		.ao_unipolar	= 1,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_speed	= 3000,
@@ -653,7 +644,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -670,7 +660,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 12,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 1000,
		.num_p0_dio_channels = 8,
		.caldac		= { ad8804_debug },
@@ -685,7 +674,6 @@ static const struct ni_board_struct ni_boards[] = {
		.ai_speed	= 3000,
		.n_aochan	= 2,
		.aobits		= 16,
		.ao_unipolar	= 1,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_speed	= 3000,
@@ -704,7 +692,6 @@ static const struct ni_board_struct ni_boards[] = {
		.aobits		= 16,
		.ao_fifo_depth	= 2048,
		.ao_range_table	= &range_ni_E_ao_ext,
		.ao_unipolar	= 1,
		.ao_speed	= 10000,
		.num_p0_dio_channels = 8,
		.caldac		= { dac8800, dac8043, ad8522 },
@@ -963,7 +950,6 @@ static const struct ni_board_struct ni_boards[] = {
		.ao_fifo_depth	= 8191,
		.ao_range_table = &range_ni_M_628x_ao,
		.reg_type	= ni_reg_628x,
		.ao_unipolar	= 1,
		.ao_speed	= 350,
		.num_p0_dio_channels = 8,
		.caldac		= { caldac_none },
@@ -980,7 +966,6 @@ static const struct ni_board_struct ni_boards[] = {
		.ao_fifo_depth	= 8191,
		.ao_range_table	= &range_ni_M_628x_ao,
		.reg_type	= ni_reg_628x,
		.ao_unipolar	= 1,
		.ao_speed	= 350,
		.num_p0_dio_channels = 8,
		.caldac		= { caldac_none },
@@ -1008,7 +993,6 @@ static const struct ni_board_struct ni_boards[] = {
		.ao_fifo_depth	= 8191,
		.ao_range_table	= &range_ni_M_628x_ao,
		.reg_type	= ni_reg_628x,
		.ao_unipolar	= 1,
		.ao_speed	= 350,
		.num_p0_dio_channels = 32,
		.caldac		= { caldac_none },
+0 −1
Original line number Diff line number Diff line
@@ -1409,7 +1409,6 @@ struct ni_board_struct {
	unsigned num_p0_dio_channels;

	int reg_type;
	unsigned int ao_unipolar:1;
	unsigned int has_8255:1;
	unsigned int has_analog_trig:1;