Re: [PATCH v2] iio: adc: Add TI ADS1015 ADC driver support

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

 



> >> >> +     .scan_index = _addr,                                    \
> >> >> +     .scan_type = {                                          \
> >> >> +             .sign = 's',                                    \
> >> >> +             .realbits = 12,                                 \
> >> >> +             .storagebits = 16,                              \
> >> >> +             .shift = 4,                                     \
> >> >> +             .endianness = IIO_CPU,                          \
> >> >
> >> > I don't see the code for endianness conversion, I guess it should be _BE
> >> > (also below)
> >>
> >> Conversion register is _BE but I think here is better to use IIO_CPU.
> >> regmap_read() encapsulates a lot of magic, it actually does the endianness
> >> conversion.
> >
> > indeed, this is super complicated
> >
> >> converts the value read from reg endianess to cpu endianness (in our case
> >> there is a transparent call  to b16_to_cpu).
> >
> > kind of, depending on what i2c capabilities you have :)
> >
> > anyway, your code *might* be correct :)

I was looking at regmap_get_i2c_bus() which handles i2c capabilities;
there are 4 different handlers for reading word data...
 
> Can you point a case where the code can be wrong? 
> AFAICS the regmap_read shouldn't depend on i2c capabilities. Or at
> least will return
> an error code if something goes bad.

thanks for pointing to this regmap feature; I don't see a problem this 
your code

p.

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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