@@ -30,18 +30,18 @@ static int ad5310_control_sync(struct ad5686_state *st)
3030{
3131 unsigned int pd_val = st -> pwr_down_mask & st -> pwr_down_mode ;
3232
33- return st -> write (st , AD5686_CMD_CONTROL_REG , 0 ,
34- FIELD_PREP (AD5310_PD_MSK , pd_val & AD5686_PD_MSK ) |
35- FIELD_PREP (AD5310_REF_BIT_MSK , st -> use_internal_vref ? 0 : 1 ));
33+ return ad5686_write (st , AD5686_CMD_CONTROL_REG , 0 ,
34+ FIELD_PREP (AD5310_PD_MSK , pd_val & AD5686_PD_MSK ) |
35+ FIELD_PREP (AD5310_REF_BIT_MSK , st -> use_internal_vref ? 0 : 1 ));
3636}
3737
3838static int ad5683_control_sync (struct ad5686_state * st )
3939{
4040 unsigned int pd_val = st -> pwr_down_mask & st -> pwr_down_mode ;
4141
42- return st -> write (st , AD5686_CMD_CONTROL_REG , 0 ,
43- FIELD_PREP (AD5683_PD_MSK , pd_val & AD5686_PD_MSK ) |
44- FIELD_PREP (AD5683_REF_BIT_MSK , st -> use_internal_vref ? 0 : 1 ));
42+ return ad5686_write (st , AD5686_CMD_CONTROL_REG , 0 ,
43+ FIELD_PREP (AD5683_PD_MSK , pd_val & AD5686_PD_MSK ) |
44+ FIELD_PREP (AD5683_REF_BIT_MSK , st -> use_internal_vref ? 0 : 1 ));
4545}
4646
4747static inline unsigned int ad5686_pd_mask_shift (const struct iio_chan_spec * chan )
@@ -153,7 +153,7 @@ static ssize_t ad5686_write_dac_powerdown(struct iio_dev *indio_dev,
153153 address = 0x0 ;
154154 val = lower_16_bits (val );
155155 }
156- ret = st -> write (st , AD5686_CMD_POWERDOWN_DAC , address , val );
156+ ret = ad5686_write (st , AD5686_CMD_POWERDOWN_DAC , address , val );
157157 if (ret )
158158 return ret ;
159159 break ;
@@ -176,7 +176,7 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
176176 switch (m ) {
177177 case IIO_CHAN_INFO_RAW :
178178 mutex_lock (& st -> lock );
179- ret = st -> read (st , chan -> address );
179+ ret = ad5686_read (st , chan -> address );
180180 mutex_unlock (& st -> lock );
181181 if (ret < 0 )
182182 return ret ;
@@ -206,10 +206,8 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
206206 return - EINVAL ;
207207
208208 mutex_lock (& st -> lock );
209- ret = st -> write (st ,
210- AD5686_CMD_WRITE_INPUT_N_UPDATE_N ,
211- chan -> address ,
212- val << chan -> scan_type .shift );
209+ ret = ad5686_write (st , AD5686_CMD_WRITE_INPUT_N_UPDATE_N ,
210+ chan -> address , val << chan -> scan_type .shift );
213211 mutex_unlock (& st -> lock );
214212 break ;
215213 default :
@@ -470,8 +468,7 @@ EXPORT_SYMBOL_NS_GPL(ad5679r_chip_info, "IIO_AD5686");
470468
471469int ad5686_probe (struct device * dev ,
472470 const struct ad5686_chip_info * chip_info ,
473- const char * name , ad5686_write_func write ,
474- ad5686_read_func read )
471+ const char * name , const struct ad5686_bus_ops * ops )
475472{
476473 struct ad5686_state * st ;
477474 struct iio_dev * indio_dev ;
@@ -484,8 +481,7 @@ int ad5686_probe(struct device *dev,
484481 st = iio_priv (indio_dev );
485482
486483 st -> dev = dev ;
487- st -> write = write ;
488- st -> read = read ;
484+ st -> ops = ops ;
489485 st -> chip_info = chip_info ;
490486
491487 ret = devm_regulator_get_enable_read_voltage (dev , "vcc" );
@@ -529,8 +525,8 @@ int ad5686_probe(struct device *dev,
529525 return ret ;
530526 break ;
531527 case AD5686_REGMAP :
532- ret = st -> write (st , AD5686_CMD_INTERNAL_REFER_SETUP , 0 ,
533- st -> use_internal_vref ? 0 : AD5686_REF_BIT_MSK );
528+ ret = ad5686_write (st , AD5686_CMD_INTERNAL_REFER_SETUP , 0 ,
529+ st -> use_internal_vref ? 0 : AD5686_REF_BIT_MSK );
534530 if (ret )
535531 return ret ;
536532 break ;
0 commit comments