Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp418231rdb; Mon, 15 Jan 2024 01:13:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWRUbBGs42Lc/W1AlCpDzOmqAQ2MfFfExicyWcTFameuWnr7GXQ7YtM0MpbWo5OnDYLK46 X-Received: by 2002:a05:6214:2625:b0:67f:89ae:102f with SMTP id gv5-20020a056214262500b0067f89ae102fmr6481017qvb.41.1705310036497; Mon, 15 Jan 2024 01:13:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705310036; cv=none; d=google.com; s=arc-20160816; b=w0zkeljpwPq0LgVJ1qWPPJvP5bqkniGfy3XXEw0QiZ3BNiO3d0Z8DJ/k5CQi+bC6D2 Uz8EPqBL3zd6K8uF0sZEhDWfB2M3Hkr6x2fRx7ft/P1Lvxc9uLctKs1Evm8sPrKj6Xk5 sl2R1uRg9WKZB8+LukKrMmNPojFXH92ZsyxlJRd4w8YF5OiVWIAao1Vt0o4l8Nm7pkzq tLPIWXpKazV8fNTAOPiVek/iihhFDZIwFTZz4Yj9d/W+cG/61eQLEVVVBDk9mUkRwQUV TtGLrqzUdDq2xSkH+nA/4T8fkzWUFgaWZOkzwmmKKNIMPB0ilJ5TSwLgOEQWy6/cI0tQ YEpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=cy9fwNlwVc+gx5v4xgTuuLAslWCEht9JixYFler0ihI=; fh=A5KuKNaf9QF8aG3H+PKLRK32btPFwfpMmSrEA2d6JJA=; b=HmAa4hYmGuH1e+2TGfIAAUikUOBDGjRUCPt2CAFaA3nAsH78s7mdUA0e3LIk0nyyUS JRLNFMtNSljmF4IVaZ7Os/B9VE/OBhsOLMClUtXODGvthv/GAyr50mjjPnCeDNTAJS8S kKLHn3dsUq1ClM54jnXfXdyLrr4d2XzpWwlyhBTo3MrWdGE/CSoOHmAt+Wy82PbZ7nOy jIebiEoTplVOV1fgoQZIfgbwLeCfrtOekEXzeQ1TLsOJ/JDcoUrGnx5d1/gf3d542t9D GLiGuBwGowMb74F1/8X/IrKbSdDg9zaV7bQVUTGmU9MeeptEZ37BiNpJcWIjVAGZLEEU 55Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DeFc+TNw; spf=pass (google.com: domain of linux-kernel+bounces-25774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t10-20020a0cb70a000000b0068081587ca4si7599595qvd.156.2024.01.15.01.13.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 01:13:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DeFc+TNw; spf=pass (google.com: domain of linux-kernel+bounces-25774-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 363F21C214B4 for ; Mon, 15 Jan 2024 09:13:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC265C14E; Mon, 15 Jan 2024 09:13:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DeFc+TNw" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89C29E541; Mon, 15 Jan 2024 09:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50e7b51b0ceso8490246e87.1; Mon, 15 Jan 2024 01:13:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705310026; x=1705914826; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=cy9fwNlwVc+gx5v4xgTuuLAslWCEht9JixYFler0ihI=; b=DeFc+TNw55rLVjHJi4e5acW32/YHLUk5yvxkGIhdXuUvjkK2iuhVXT7LzNlVhhuVeL 8VpYby66oTbzrMghl4xN/Mvkz2EU04H5Y/2X2YAgKaTHrvl6wDuIkLooIMNVpAIoMB1P R2VwqAuT70ZFWclJoHjzSDFfQ+xOSad5IpXNpjMFFJsW+Ahi2Fu+yO5kmmYPptqeVTnm jsJu2IbdbDopI/oLG3+Ne/u7m+/u2v7lcZfsPr3ZMELCP3GakuiXannGll9lAaCfCKVi 3bX3KzfxwBRQ3i6e4k+3kwnBUtQE7LfY/aH8vL71C6Q1RZD/RqkbcZwJTJ4qbmuwVsNp Vaig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705310026; x=1705914826; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cy9fwNlwVc+gx5v4xgTuuLAslWCEht9JixYFler0ihI=; b=IPCv8YGOktS8VAS+CaEO4YSW4Piyzl3CxSbT2z0HCrOLIr3u5wdfUwUWgLZI/SKsFe Z5UqiSmmtUFnAz+r3CjsA5gCgApgaoUYh8nmOW/qmbGp/XoF4lkpC+sJfuH2HiLUMTDp +8Un7hHqfpoJUccCjQzf6chzQJjGwO1kNkerWJVF8/Z73N3OBDotEeL9hXGilFv5Wj0a Nf4sV3whBgitSczuosahQv7kZy55K2+K0zo7HF5fnnh8ESCqNvQjJSJndQ7KJdURgm45 mZlhoEVp8iLsLMvhVb/3ETND7YooPKeZN1hM6+9CKWOegYiStihDoK64mt5+5WwhSXJ5 ycSA== X-Gm-Message-State: AOJu0Yxr6nEsl0ouoRkgfPmao8wWHYQxHh12tRpMSMpjY10Ml3D/Z/G2 MfTGLOQc2OYeGIyrnTmJIhc= X-Received: by 2002:a05:6512:60e:b0:50e:74f3:c320 with SMTP id b14-20020a056512060e00b0050e74f3c320mr3212853lfe.21.1705310026274; Mon, 15 Jan 2024 01:13:46 -0800 (PST) Received: from ?IPV6:2001:14ba:7426:df00::3? (drtxq0yyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:7426:df00::3]) by smtp.gmail.com with ESMTPSA id t24-20020ac24c18000000b0050e78aa4b30sm1422245lfq.42.2024.01.15.01.13.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 01:13:45 -0800 (PST) Message-ID: <1d735a95-e5bd-4891-bb44-335958e1f045@gmail.com> Date: Mon, 15 Jan 2024 11:13:45 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] iio: test: test gain-time-scale helpers Content-Language: en-US, en-GB To: Jonathan Cameron Cc: Matti Vaittinen , Lars-Peter Clausen , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org References: <6b839dd533fd93b75c2e6f6a8f2286233d4901fb.1704881096.git.mazziesaccount@gmail.com> <20240113161229.48d63b54@jic23-huawei> From: Matti Vaittinen In-Reply-To: <20240113161229.48d63b54@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/13/24 18:12, Jonathan Cameron wrote: > On Wed, 10 Jan 2024 12:12:55 +0200 > Matti Vaittinen wrote: > >> Some light sensors can adjust both the HW-gain and integration time. >> There are cases where adjusting the integration time has similar impact >> to the scale of the reported values as gain setting has. >> >> IIO users do typically expect to handle scale by a single writable 'scale' >> entry. Driver should then adjust the gain/time accordingly. >> >> It however is difficult for a driver to know whether it should change >> gain or integration time to meet the requested scale. Usually it is >> preferred to have longer integration time which usually improves >> accuracy, but there may be use-cases where long measurement times can be >> an issue. Thus it can be preferable to allow also changing the >> integration time - but mitigate the scale impact by also changing the gain >> underneath. Eg, if integration time change doubles the measured values, >> the driver can reduce the HW-gain to half. >> >> The theory of the computations of gain-time-scale is simple. However, >> some people (undersigned) got that implemented wrong for more than once. >> Hence some gain-time-scale helpers were introduced. >> >> Add some simple tests to verify the most hairy functions. >> >> Signed-off-by: Matti Vaittinen >> > Hi Matti, > > All seems reasonable to me. Some trivial formatting things inline > + I'm not planning to check the maths as you are the expert in all of > this so I'll just trust you! Well, all checking is always welcome. Still, I kind of understand that you won't verify everything you see... Oh, and thanks for the trust. :) > Also if this fails you get to pick up the pieces :) This sure helps to trust ;) As for things you commented - Thanks! I'll fix them and respin. Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~