From: H Hartley Sweeten Date: Fri, 1 May 2015 21:59:59 +0000 (-0700) Subject: staging: comedi: ni_stc.h: tidy up AO_Configuration register and bits X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b497b8da801088f380a98851a5c50ffcd7b40c86;p=linux-beck.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 64c44a1a1065..39e680e12882 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -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); diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index 14e4351b0aa8..486e6a08b8dc 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -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