Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10798703ybl; Fri, 27 Dec 2019 02:23:52 -0800 (PST) X-Google-Smtp-Source: APXvYqy7DwvEHA0a962oblnudqBoi69/VkkCtD78jz7t8hxLHunMav1iJMmTRDhucZMKK50mcyuJ X-Received: by 2002:a9d:402:: with SMTP id 2mr42715163otc.357.1577442231810; Fri, 27 Dec 2019 02:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577442231; cv=none; d=google.com; s=arc-20160816; b=vkFGIzfbUec7ATfZzT7RF9tBgte7BGdwhEufGL3LmFuzpi24UBO+A5sg6DcFAUNHEL SW2ZSspLOFWRX+xHOJC0ytM/ScsuGcoh70pDEVuWNcyw6U3EV2kU8enuYv0+M+Gn/5k1 jRsLCy2AaK+rIh2C5qI1zMCGcOcijyJGCVgKWLECHnaixcoHdAvTTiFOg3HC/b7X/ZHV UnAvjn9N152p3nKA1D1q/f0ZvlJlZHJM0yaKGo2nfm3larR4h/KlIHcbDXRX2675edsF ydOqeVijj4wMWYS2Q/Mr+wlfNemGmGp7DUXyXZB1cn7OiRWBWrIo6gSMdpyeV6GkjT50 sivQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=VV1/a3BpygBXoH3zRXfYMDlLyz28kqVygZYu2x7F3bw=; b=jNambkVw5GRn+cJWhwFz1MFA4DkqcwSzImxBkP+6FGbSRW/bhGYMI4mMdkwb/fqJ2g +qFDlr+uEFKrJmoKhcGTItBZaJLPve5t2Rb+CbZ8YLkWsBQcLYgHu3GbzcO8Wqegt8+N qw+0o26lnqy2cQuJMTi+klDvLL9O8vy3WrpSJsFkYhKY9Cr/5OQnR26imp9p2aNlwCD2 nfS1IqqDk9hK1R5fKwOR9hh7vhW7g7uwRtET4extgpveqO0nmcMaZaMScJqJzL0eODSJ fVOcfCdeZjSy1fP8w9xzsSo6bjTEl3VRu/YSqSduKL3tCdpJYZSfOSqZgfTJx03TVS1G ie8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 p14si17812811ota.71.2019.12.27.02.23.39; Fri, 27 Dec 2019 02:23:51 -0800 (PST) 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; 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 S1726550AbfL0KW6 (ORCPT + 99 others); Fri, 27 Dec 2019 05:22:58 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:58892 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfL0KW6 (ORCPT ); Fri, 27 Dec 2019 05:22:58 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 2FAE3FB03; Fri, 27 Dec 2019 11:22:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YkqsQVLSeAKP; Fri, 27 Dec 2019 11:22:55 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id BE50549799; Fri, 27 Dec 2019 11:22:54 +0100 (CET) From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , "Angus Ainslie (Purism)" , Marco Felsch , Allison Randal , Thomas Gleixner , =?UTF-8?q?Guido=20G=C3=BCnther?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] iio: light: vcnl4000: Fix scale for vcnl4040 Date: Fri, 27 Dec 2019 11:22:54 +0100 Message-Id: <6adc62445cac7d16e4688aea905dc1c9cc128488.1577442112.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the data sheet the ambient sensor's scale is 0.12 lux/step (not 0.024 lux/step as used by vcnl4200) when the integration time is 80ms. The integration time is currently hardcoded in the driver to that value. See p. 8 in https://www.vishay.com/docs/84307/designingvcnl4040.pdf Fixes: 5a441aade5b3 ("light: vcnl4000 add support for the VCNL4040 proximity and light sensor") Signed-off-by: Guido Günther Reviewed-by: Marco Felsch --- drivers/iio/light/vcnl4000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 16dacea9eadf..b0e241aaefb4 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data) if (ret < 0) return ret; - data->al_scale = 24000; data->vcnl4200_al.reg = VCNL4200_AL_DATA; data->vcnl4200_ps.reg = VCNL4200_PS_DATA; switch (id) { @@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data) /* show 54ms in total. */ data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); + data->al_scale = 24000; break; case VCNL4040_PROD_ID: /* Integration time is 80ms, add 10ms. */ data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); + data->al_scale = 120000; break; } data->vcnl4200_al.last_measurement = ktime_set(0, 0); -- 2.23.0