RE: [PATCH v2 6/7] iio: adc: ad485x: add ad485x driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +static int ad485x_get_calibscale(struct ad485x_state *st, int ch, int *val, int
> *val2)
> > +{
> > +       unsigned int reg_val;
> > +       int gain;
> 
> Should be u8 gain[2] and...

As discussed in previous patch series, the bulk operations won't work for these
chips. The CS needs to be raised between each byte read/written.

Therefore using u8 gain[2]  here  and in other places will be just an extra populated
array since  regmap_read requires `unsigned int` as input.

For the set functions indeed it is feasible since you can pass u8 directly to regmap_write.

Regards,
Antoniu
> > +       int ret;
> > +
> > +       guard(mutex)(&st->lock);
> > +
> > +       ret = regmap_read(st->regmap, AD485X_REG_CHX_GAIN_MSB(ch),
> > +                         &reg_val);
> > +       if (ret)
> > +               return ret;
> > +
> > +       gain = (reg_val & 0xFF) << 8;
> > +
> > +       ret = regmap_read(st->regmap, AD485X_REG_CHX_GAIN_LSB(ch),
> > +                         &reg_val);
> > +       if (ret)
> > +               return ret;
> > +
> > +       gain |= reg_val & 0xFF;
> 
...




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux