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

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

staging: comedi: ni_stc.h: tidy up AO_Configuration register and bits



Rename the CamelCase. Use the BIT() macro to define the bits.

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 d504a6ee
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -2675,27 +2675,27 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev,
	for (i = 0; i < n_chans; i++) {
		chan = CR_CHAN(chanspec[i]);
		range = CR_RANGE(chanspec[i]);
		conf = AO_Channel(chan);
		conf = NI_E_AO_DACSEL(chan);

		if (comedi_range_is_bipolar(s, range)) {
			conf |= AO_Bipolar;
			conf |= NI_E_AO_CFG_BIP;
			invert = (s->maxdata + 1) >> 1;
		} else {
			invert = 0;
		}
		if (comedi_range_is_external(s, range))
			conf |= AO_Ext_Ref;
			conf |= NI_E_AO_EXT_REF;

		/* not all boards can deglitch, but this shouldn't hurt */
		if (chanspec[i] & CR_DEGLITCH)
			conf |= AO_Deglitch;
			conf |= NI_E_AO_DEGLITCH;

		/* analog reference */
		/* AREF_OTHER connects AO ground to AI ground, i think */
		conf |= (CR_AREF(chanspec[i]) ==
			 AREF_OTHER) ? AO_Ground_Ref : 0;
		if (CR_AREF(chanspec[i]) == AREF_OTHER)
			conf |= NI_E_AO_GROUND_REF;

		ni_writew(dev, conf, AO_Configuration);
		ni_writew(dev, conf, NI_E_AO_CFG_REG);
		devpriv->ao_conf[chan] = conf;
	}
	return invert;
@@ -3698,7 +3698,7 @@ static void init_ao_67xx(struct comedi_device *dev, struct comedi_subdevice *s)
	int i;

	for (i = 0; i < s->n_chan; i++) {
		ni_ao_win_outw(dev, AO_Channel(i) | 0x0,
		ni_ao_win_outw(dev, NI_E_AO_DACSEL(i) | 0x0,
			       AO_Configuration_2_67xx);
	}
	ni_ao_win_outw(dev, 0x0, AO_Later_Single_Point_Updates);
+7 −7
Original line number Diff line number Diff line
@@ -631,17 +631,17 @@ static inline unsigned GPCT_DMA_Select_Mask(unsigned gpct_index)
#define NI_E_AI_CFG_HI_AC_COUPLE	BIT(11)
#define NI_E_AI_CFG_HI_CHAN(x)		(((x) & 0x3f) << 0)

#define NI_E_AO_CFG_REG			0x16	/* w16 */
#define NI_E_AO_DACSEL(x)		((x) << 8)
#define NI_E_AO_GROUND_REF		BIT(3)
#define NI_E_AO_EXT_REF			BIT(2)
#define NI_E_AO_DEGLITCH		BIT(1)
#define NI_E_AO_CFG_BIP			BIT(0)

#define NI_E_8255_BASE			0x19	/* rw8 */

#define NI_E_AI_FIFO_DATA_REG		0x1c	/* r16 */

#define AO_Configuration		0x16
#define AO_Bipolar		_bit0
#define AO_Deglitch		_bit1
#define AO_Ext_Ref		_bit2
#define AO_Ground_Ref		_bit3
#define AO_Channel(x)		((x) << 8)

#define DAC_FIFO_Data			0x1e
#define DAC0_Direct_Data		0x18
#define DAC1_Direct_Data		0x1a