linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, quad@symbo1ics.com
Subject: Re: [PATCH] iio: si7020: Fix endianness for I2C reads
Date: Fri, 13 Mar 2015 11:45:20 +0100	[thread overview]
Message-ID: <5502BFC0.6050706@metafoo.de> (raw)
In-Reply-To: <1426215198-28630-1-git-send-email-andrew.smirnov@gmail.com>

On 03/13/2015 03:53 AM, Andrey Smirnov wrote:
> Si7020 outputs most significant byte of the measurement result first
> and least significant byte last. As a result the data returned by
> i2c_smbus_read_word_data appears as big endian. Fix this by making a
> call to an approbriate byte conversion routine.

i2c_smbus_read_word_data() returns data in native endianess. But it 
interprets the word on the bus as little-endian (As specified by the SMBus 
spec). If your chip returns data in big-endian use 
i2c_smbus_read_word_data_swapped().

- Lars

  reply	other threads:[~2015-03-13 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13  2:53 [PATCH] iio: si7020: Fix endianness for I2C reads Andrey Smirnov
2015-03-13 10:45 ` Lars-Peter Clausen [this message]
2015-03-14 19:48   ` Andrey Smirnov

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=5502BFC0.6050706@metafoo.de \
    --to=lars@metafoo.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quad@symbo1ics.com \
    /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;
as well as URLs for NNTP newsgroup(s).