linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Novotny <tomas@novotny.cz>
To: "Angus Ainslie (Purism)" <angus@akkea.ca>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/5] iio: light: vcnl4000 use word writes instead of byte writes
Date: Wed, 20 Mar 2019 15:53:22 +0100	[thread overview]
Message-ID: <20190320155322.3fd9f080@tomas.local.tbs-biometrics.cz> (raw)
In-Reply-To: <20190317154802.15174-2-angus@akkea.ca>

Hi Angus,

On Sun, 17 Mar 2019 08:47:58 -0700
"Angus Ainslie (Purism)" <angus@akkea.ca> wrote:

> The VCNL4200 datasheet says that word read and writes should be used
> to access the registers.
> 
> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
> ---
>  drivers/iio/light/vcnl4000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 04fd0d4b6f19..5295330b65e2 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -140,10 +140,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
>  	data->rev = (ret >> 8) & 0xf;
>  
>  	/* Set defaults and enable both channels */
> -	ret = i2c_smbus_write_byte_data(data->client, VCNL4200_AL_CONF, 0x00);
> +	ret = i2c_smbus_write_word_data(data->client, VCNL4200_AL_CONF, 0x00);

minor note: the 0x00 looks like a byte. 0 or 0x0000 would be slightly better?
The same below.

>  	if (ret < 0)
>  		return ret;
> -	ret = i2c_smbus_write_byte_data(data->client, VCNL4200_PS_CONF1, 0x00);
> +	ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, 0x00);

The VCNL4200_PS_CONF1 definition is a bit misleading with word write. Because
PS_CONF1 is only a low byte of command code 0x03. The high byte of 0x03 is
PS_CONF2. I would rename it.

>  	if (ret < 0)
>  		return ret;

Anyway, the main point is that I've tested this patch on VCNL4200 and it
works, so:
Tested-by: Tomas Novotny <tomas@novotny.cz>

T.

  reply	other threads:[~2019-03-20 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-17 15:47 [PATCH v2 0/5] Add a VCNL4040 light and proximity driver Angus Ainslie (Purism)
2019-03-17 15:47 ` [PATCH v2 1/5] iio: light: vcnl4000 use word writes instead of byte writes Angus Ainslie (Purism)
2019-03-20 14:53   ` Tomas Novotny [this message]
2019-03-20 20:21     ` Angus Ainslie
2019-03-21 14:28       ` Tomas Novotny
2019-03-17 15:47 ` [PATCH v2 2/5] iio: light: vcnl4000 add devicetree hooks Angus Ainslie (Purism)
2019-03-17 15:48 ` [PATCH v2 3/5] dt-bindings: iio: light: add vcnl4000 devicetree bindings Angus Ainslie (Purism)
2019-03-17 15:48 ` [PATCH v2 4/5] iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor Angus Ainslie (Purism)
2019-03-17 15:48 ` [PATCH v2 5/5] dt-bindings: iio: light: add vcnl4040 devicetree bindings Angus Ainslie (Purism)

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=20190320155322.3fd9f080@tomas.local.tbs-biometrics.cz \
    --to=tomas@novotny.cz \
    --cc=angus@akkea.ca \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    /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).