Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3716434rwe; Mon, 17 Apr 2023 02:23:11 -0700 (PDT) X-Google-Smtp-Source: AKy350beAFQOQuShafHygKfSY+kX4QA9ek4sQsmSyAyB7cE3btGtkNjFU4JKcQsTOtjLO1fCvUcU X-Received: by 2002:a17:90a:f483:b0:247:af63:483 with SMTP id bx3-20020a17090af48300b00247af630483mr487079pjb.46.1681723391472; Mon, 17 Apr 2023 02:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681723391; cv=none; d=google.com; s=arc-20160816; b=yOAusvNgfv2nn0VJh0FtHmNkwTb/ar9kgYk+6M+SQd2wzVHWZaH0d5M4JHGaFisnLw abWKIs7vkeMiEEPQMVnmLDzH3P+e1TUdQAEWNm8cC36YI9pmaT/HpEYT/mX0SMPstqX3 uNczHmOzuJ10lhMrdRYxp0Nh48Wvwiv+ySvzPhT1TXbziPOg7wo4U3/K79ZYqb8WxYeC BTtnXTk0Cq+zaBWNP42CF6PSUe7bij5K6ET4RtmQp/B63utC0JMRh2dj+m+AHi1RK6/9 QiHwzoOVrYNJmur4RIxor4QquqCPfpwonz8hOHeKJVfAhZ1lzqnpk+jmtt5grnieRhNa QUZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RgrbmJtSLO84P/9uImcl/ILG4CYzql2cJa7HytOmSio=; b=fTNv7JEqVBJugOUTdhruOXN58MgPQ7hVs7XCMDnIVda7J3pGN0EPvsYZ3sIHsl0mWq kTMmxMMxuj0SZggK73f1GE5f9M9N+dCXuz1JGkWIt5fZoDJRoIcaMhHK7MgHYEBL3W2E fr5O2pza5zI8AXh2wTP5M58X2js1joJBMbO/BWHRfHhf1OgPYWE5jgvKzn9mnlA5pXdl ouD/zH7XziVpA8+gaz41uMrBQhY76zLDm5DBz5uT4TKl+n0F90qpUS54T3995FNE1ox8 fpuverptlBnucMuqBCLINy82tyXw0fF3lzU/9RjUyMGtxt5hsuAczS//IOe7fRKRF08r Ohmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EOlZMB3Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a17090b068a00b002468b82d179si10920616pjz.8.2023.04.17.02.23.00; Mon, 17 Apr 2023 02:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EOlZMB3Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbjDQJUX (ORCPT + 99 others); Mon, 17 Apr 2023 05:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbjDQJUV (ORCPT ); Mon, 17 Apr 2023 05:20:21 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8971421C; Mon, 17 Apr 2023 02:20:05 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2a8b62cfaceso11775461fa.2; Mon, 17 Apr 2023 02:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681723204; x=1684315204; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RgrbmJtSLO84P/9uImcl/ILG4CYzql2cJa7HytOmSio=; b=EOlZMB3Qua8VqDYh8UvRT26spK208uMi3/t4NKBjbTh+tGhzY0xCMaEgBBGAOek8wM UCs7XiVcnOkwTY8MhYnjdV7sT6VQlTMnk1BbDzWtTECYhe6fALnLvCX+jrTEMWc3bPl+ zwdX7oO8/swY+9HjJR8Q7f47VkKh5SUGaEOEUffLnXtQllB+u850iuAmfFgPmxNmXEdZ 0t3Z0k8QxnV5cu5EbsC0FonmoTb6C8NV/WZX8uDZ2LXL7x84BMxa1AuERDxikpXx8K+9 8aPys25Ho2rj7mnUD3tvl2vj5p9ZBpXtFRal0Atbfo1YX3JLGOfXniOE3B/emUWDndks 1A4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681723204; x=1684315204; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RgrbmJtSLO84P/9uImcl/ILG4CYzql2cJa7HytOmSio=; b=dlrcE85R5C83mbI+8oSr2jPpjTnZhV7Z7c1aTAnGDR6NFpnTqhPqk5d7uAAvha8sd0 oJCKyf1nfev1zN7Zo+/VU/+MToLPmPEPU2m8SjD0eAzGvuM/mv1q8anJs82mGx7qgq0Z EyHm9T2iuD36L3yTeXsfh83ZLRuFeLtOC5G1W464vesw/FmJ5rdg5Lqj20HC3+JpNVii PXesTBH7pCc48lBJO79V+mxJDCRjm/Nl/8oM2+kb+XLI64eNkCXL+rm4PqQVpnzwnAYH 1YN00FblRsrknt9AwQVgWu13JqHNa3anvJifX5Pdp9CxDnfd9TfwjZ9SMH+fPllDkKgW 8RRA== X-Gm-Message-State: AAQBX9eC/vPBF9lgSXYWeOX5h70kFqZBcj0pavTPufoRIgv/COMHY2W1 ROXgmMon+dZBpybsVGKtrZ4= X-Received: by 2002:a19:f702:0:b0:4a4:68b8:f4f1 with SMTP id z2-20020a19f702000000b004a468b8f4f1mr1792676lfe.55.1681723203760; Mon, 17 Apr 2023 02:20:03 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id l9-20020ac25549000000b004eb00c0d417sm1983556lfk.130.2023.04.17.02.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 02:20:03 -0700 (PDT) Date: Mon, 17 Apr 2023 12:19:57 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Matti Vaittinen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] iio: bu27034: Fix integration time Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K2MOcnigrCNm05N+" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --K2MOcnigrCNm05N+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The bu27034 uses micro seconds for integration time configuration. This is incorrect as the ABI mandates use of seconds. Change BU27034 driver to use seconds for integration time. Signed-off-by: Matti Vaittinen --- drivers/iio/light/rohm-bu27034.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/rohm-bu27034.c b/drivers/iio/light/rohm-bu27= 034.c index e486dcf35eba..25c9b79574a5 100644 --- a/drivers/iio/light/rohm-bu27034.c +++ b/drivers/iio/light/rohm-bu27034.c @@ -1167,11 +1167,12 @@ static int bu27034_read_raw(struct iio_dev *idev, =20 switch (mask) { case IIO_CHAN_INFO_INT_TIME: - *val =3D bu27034_get_int_time(data); - if (*val < 0) - return *val; + *val =3D 0; + *val2 =3D bu27034_get_int_time(data); + if (*val2 < 0) + return *val2; =20 - return IIO_VAL_INT; + return IIO_VAL_INT_PLUS_MICRO; =20 case IIO_CHAN_INFO_SCALE: return bu27034_get_scale(data, chan->channel, val, val2); @@ -1229,7 +1230,10 @@ static int bu27034_write_raw(struct iio_dev *idev, ret =3D bu27034_set_scale(data, chan->channel, val, val2); break; case IIO_CHAN_INFO_INT_TIME: - ret =3D bu27034_try_set_int_time(data, val); + if (!val) + ret =3D bu27034_try_set_int_time(data, val2); + else + ret =3D -EINVAL; break; default: ret =3D -EINVAL; --=20 2.39.2 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --K2MOcnigrCNm05N+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmQ9Dz0ACgkQeFA3/03a ocVxGwgAyjdJtfrLVu5HaZ1xGwqIJwcvqR9JJd3st/nH2bmuu846tw5Uf/9HcgKI IW8DflyVJE7o58uj/UR6KLCJSTxOJmiSgo/a+EEnO5fBigKubMQbareHc6Z6f9x7 8xhmOboIjE7U9DCX3iPcInbA8eaygh4q6G34mASp26cOvfokv0CsIaXr7KvMgat3 yVSf+ejiE6fEN+xthkjvQM5NfZ7TRn9RSNnSZi9+Yb0Cx+EGXf70YNKpYQi0Vp4l qoRArbadmy18v2M/3zQ/VNG/Kf8Q9B5b5tOizUklzCeyQImkdC3UfiC39WAHoynM vSrpV3dc6w4PviM2ml1U7vCF4Kc+Kw== =FSyV -----END PGP SIGNATURE----- --K2MOcnigrCNm05N+--