Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6540967ybl; Mon, 23 Dec 2019 07:31:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwGGvQkPc3TctLm5rmj2cUZ0JY356icPa8S01Sw3uWh+I8Auj6bbNkSWWzI9E7Cvsuovocy X-Received: by 2002:aca:503:: with SMTP id 3mr4757186oif.106.1577115106129; Mon, 23 Dec 2019 07:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577115106; cv=none; d=google.com; s=arc-20160816; b=C6cMWYzGRC8GiS5oZiUllFRsrheJHp+7N9GssqpJXlKbNNJ0PylwZkfVAlCOi0Yrve uclcob4pXUK5Sy+yGIPDDKQdLivV3mr29EMDsflltkwDJ+qOMGf6t5GUjtTjMrf91rW2 nETDM+Zk8wAPjdKLIVCWrUVO017fKJFhncwirv6xi422frIamugTqjujbQaqGcGcmal5 0kyEQnG7hoQyCmgIlUolT3PoMIR+lvGLQaXu8qvRLY5QF4DDz/4uV2p2MZNsPsgGpwC5 xMUb1amTQzxxiSf0Y3QOKbTu2LDngA1MSECEZnULNOyWN6JZ1JwHgLJMq0XOHDPcerO3 7PXw== 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=jv/hGE2Wn0ImdrnAxWYMllx93SCSwP+2AVHbAUlgJzA=; b=Nuc2TITDattxGgS5vmRklJIUmcXo9uKkl99j9q+DkBUJxKR8Oq7+ZaYGnP8TsvWEH6 OQZpjtRT+7HbIf0ckinigfESM/+uVgqWDiAQU8iAQJYYOcmfPW+yD4bLFpjl4dgNJwFH rBgQWUKOgqdk7nvqKGBJT7S1tTISlSP4ckm5Ph4DiVOxuImEBFpH5tpUMcgYyXYk4PcT mmbcxbyudOehLRJI8iTrp+EYuCOS0p4Fu/LDZvMkw7EZjxSM6TwlLKG2mo7fz+bQFxdK lN/LWJHy/OcjzkkOvN66Utvf5JWNSeGp5iUStzXxpmiFViUFYrhbuxeX2+uk7wgh7xCm wqAA== 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 z1si10290745otp.70.2019.12.23.07.31.32; Mon, 23 Dec 2019 07:31:46 -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 S1726882AbfLWPaw (ORCPT + 99 others); Mon, 23 Dec 2019 10:30:52 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:48242 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfLWPaw (ORCPT ); Mon, 23 Dec 2019 10:30:52 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id C76F8FB03; Mon, 23 Dec 2019 16:30:48 +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 TOR_-5L4iWBj; Mon, 23 Dec 2019 16:30:47 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 089D749B53; Mon, 23 Dec 2019 16:30:46 +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] iio: light: vcnl4000: Fix scale for vcnl4040 Date: Mon, 23 Dec 2019 16:30:46 +0100 Message-Id: <4f2a980d87a7d5ae27d61ed1d35c4f310bfc607c.1577114947.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 sensors's scale is 0.12 lux/step, not 0.024 lux/step as used by vcnl4200. 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 --- 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