Linux IIO development
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Daniel Baluta <daniel.baluta@intel.com>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v2] iio: adc: Add TI ADS1015 ADC driver support
Date: Wed, 3 Feb 2016 16:44:36 +0100	[thread overview]
Message-ID: <56B22064.5030706@metafoo.de> (raw)
In-Reply-To: <CAEnQRZBDfb_2F=UafL9Dx+6s8Q4Si7JCdrgSb5D0xq_nT2BipQ@mail.gmail.com>

On 02/03/2016 04:18 PM, Daniel Baluta wrote:
> On Wed, Feb 3, 2016 at 5:09 PM, Peter Meerwald-Stadler
> <pmeerw@pmeerw.net> 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.

  reply	other threads:[~2016-02-03 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 10:22 [PATCH v2] iio: adc: Add TI ADS1015 ADC driver support Daniel Baluta
2016-02-03 10:34 ` Peter Meerwald-Stadler
2016-02-03 14:20   ` Daniel Baluta
2016-02-03 15:09     ` Peter Meerwald-Stadler
2016-02-03 15:18       ` Daniel Baluta
2016-02-03 15:44         ` Lars-Peter Clausen [this message]
2016-02-03 15:53         ` Peter Meerwald-Stadler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B22064.5030706@metafoo.de \
    --to=lars@metafoo.de \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox