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

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

 



On 02/03/2016 04:18 PM, Daniel Baluta wrote:
> On Wed, Feb 3, 2016 at 5:09 PM, Peter Meerwald-Stadler
> <pmeerw@xxxxxxxxxx> wrote:
>>
>>>>> +     .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 :)
> 
> Can you point a case where the code can be wrong?

It should always be correct. When using the raw I2C functions regmap does
the conversion, when the adapter only supports SMBUS and the SMBUS functions
are used those do the conversion.
--
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