Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp33179img; Wed, 20 Mar 2019 13:23:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqytbc5xkEaR6E5zvEmkdeCyQT38nRjLfEtrGtNPn/8btMA+Ew9T/qss8VnKtYqIpHgUxPzR X-Received: by 2002:aa7:8005:: with SMTP id j5mr9475009pfi.211.1553113403599; Wed, 20 Mar 2019 13:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553113403; cv=none; d=google.com; s=arc-20160816; b=seeAFq8dhI9Wr5P1iZixlCootZASz2DmAfWuQWeWFsA4mjjGBptvQycGtEccimogO5 W+r38MwGsA6vzsjAWf8lmtURvSEoqIELDaqc92azLDJ9FAKr7npQAir/1fUBE8CTX5Nk Zuubdgf3g384nYv3fAiFHeufQu47O8+fWIDdXBQp94cD+bF+j10zCZ1+fvUQr5lDllJ9 OWQP0hG38n4H8uSgiXInSDwI6G2M30szykFPdEeSUt4r0BnOhyof551rrrpW7Cx6IIlc BrQIOg5RWFnUefHaTSu+c+2FbZnS1JUIwVrtV5FPlT/eWLv6xurieDtXmU6/V0DPAYpq bgfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to:dkim-signature; bh=28gJDAeYHl4IhB3qxEV8or3e+uBqMpDNryGUZGJTh0U=; b=Kocte4eWVUvVjsiCoUjh+z4l0WH5Az4eExk5nrsde9+s5/w2dazC1C2qclNAdeIpiw /FqL74JZ+uIBlJjZxr86RxgjG/9GAetZZO/MwJU/ZMUfAqcIH9bBeIetk5XGeVhDh9o/ aWLtDuYqisNN4LfGyyPzGhXSNt4MxbcTvyTbT2GgeWOLOe/lA7MrGcsi4zsFrZUnC5P8 DfkvOEdNknKfpHZ+xr2ozaB22IMmF/yY6PoQmpg/6Sf6RaPJ1nKcaXxGQ812KHxnm/Qh ZFkmbg5UsY37Q8eX7oPtNegPXepD9wUFcHiGnXuOV4kzfDntsvJ/IFr3Nytkd8IgBWR7 ctwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akkea.ca header.s=mail header.b="g0zbp/IN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si387469pgb.299.2019.03.20.13.23.08; Wed, 20 Mar 2019 13:23:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@akkea.ca header.s=mail header.b="g0zbp/IN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727522AbfCTUWB (ORCPT + 99 others); Wed, 20 Mar 2019 16:22:01 -0400 Received: from node.akkea.ca ([192.155.83.177]:39200 "EHLO node.akkea.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbfCTUWA (ORCPT ); Wed, 20 Mar 2019 16:22:00 -0400 Received: by node.akkea.ca (Postfix, from userid 33) id CB9AC4E204B; Wed, 20 Mar 2019 20:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1553113318; bh=28gJDAeYHl4IhB3qxEV8or3e+uBqMpDNryGUZGJTh0U=; h=To:Subject:Date:From:Cc:In-Reply-To:References; b=g0zbp/INYUXZ7KaF44V2ZyGF2VafHp3GOqV9DXOjNHC7ycuPdZoJGSOscxZ1KoFBG 9BhT0+lM6f+6R4ZSABVBpQW7591xvwuoy3JpcjhbiJUmTHeZPkU03eRy+XEjQIC7vC 4PBNngxWz00dCkzJMbG0BP/p+7sQR9jIWlOUBodg= To: Tomas Novotny Subject: Re: [PATCH v2 1/5] iio: light: vcnl4000 use word writes instead of byte writes X-PHP-Originating-Script: 1000:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 20 Mar 2019 13:21:58 -0700 From: Angus Ainslie Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20190320155322.3fd9f080@tomas.local.tbs-biometrics.cz> References: <20190317154802.15174-1-angus@akkea.ca> <20190317154802.15174-2-angus@akkea.ca> <20190320155322.3fd9f080@tomas.local.tbs-biometrics.cz> Message-ID: <16a2d3e86f296fac2f56fb47e1f1afac@www.akkea.ca> X-Sender: angus@akkea.ca User-Agent: Roundcube Webmail/1.1.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tomas, On 2019-03-20 07:53, Tomas Novotny wrote: > Hi Angus, > > On Sun, 17 Mar 2019 08:47:58 -0700 > "Angus Ainslie (Purism)" wrote: > >> The VCNL4200 datasheet says that word read and writes should be used >> to access the registers. >> >> Signed-off-by: Angus Ainslie (Purism) >> --- >> 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. > As far as a base address for the register that is correct based on the names in the datasheet. I suppose I could add something like: #define VCNL4200_PS_CONF VCNL4200_PS_CONF1 and change the reference here if you think that would be more clear. >> 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 > > T. Thanks for testing it Angus