Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp663655rwl; Thu, 23 Mar 2023 23:36:49 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtDQarOtyqXuGYwRSW20/xsPHwb4TkXEXgGIuqaFUS0aAVDEt/uwm1fR2yrC/AcmBSkH/k X-Received: by 2002:a17:906:6a2a:b0:879:bff:55c with SMTP id qw42-20020a1709066a2a00b008790bff055cmr2956937ejc.1.1679639809485; Thu, 23 Mar 2023 23:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679639809; cv=none; d=google.com; s=arc-20160816; b=TwQVA8zXxfoQiIyOC5O7+YNfKALUPC6Cm9rJVxUDFiVUV/IGn1DGo1F/n3EKSmfs+l 8/qW8+GjCaqPNjqGIFCj9jmWaz9faAPOo8jjKPcpdPRHQb0ag06hyzFqwnIjSEkemvCg ewskvk8Q9nC06GdPOdIdfGFPLxz6fXvrqaS603NDSvglYaCoPVSA2bVM9jfPhgph9TsB 6/hOhCxz8WGoS1Er1gaNUtT3X6cUL5AavpgnF3WowStcazqteMKmQbcLpbmxIXhU8yn3 idfqxggYLYfTnOJTpxQ2sQn1QAK4ZvgBRjOn/PRe8JorV85FeADsUm6QpgiktkE9M2r2 oS/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=hH9ReKrWmbRFTyiuvOPNN8/j0VR2qXnASEVkCT8MBz0=; b=fYRQ4jMwdYrTuhCUV3KxIEW7JHqc7M+VMIaHQN50DMjvkF3d2Otx1FTcRxiKcMDefL rW0kRN/yut0HCEXU9EkTrYG/S2cjk0IOTLPcz21oysCPc5riqknl0FyTqAHZKB11BBDF kfSFvv3zAqHU/9W48wvK0/szkatbTuiWS9DRNJz2fEakV4AppRGgbYK4F5CTZrvh2WXT FeQ/VfiI/6FuKeZ6SsNgIK4f8d/Q1Unf7hgHF29D3pH81hoq0rQjjmUWpSXiFqPy4mdg amUqWyZiiKNX19xaPP+fHt5Mx0E2c99q5BIPcgf3hbgTzvLP4b/GwfYxwsdx8TO0ME7G yG/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FpNALg9q; 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 f4-20020a170906138400b0093151c078f0si15732206ejc.467.2023.03.23.23.36.24; Thu, 23 Mar 2023 23:36:49 -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=20210112 header.b=FpNALg9q; 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 S230357AbjCXG3t (ORCPT + 99 others); Fri, 24 Mar 2023 02:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjCXG3s (ORCPT ); Fri, 24 Mar 2023 02:29:48 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4732C17CC2; Thu, 23 Mar 2023 23:29:47 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id s20so653999ljp.1; Thu, 23 Mar 2023 23:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679639385; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=hH9ReKrWmbRFTyiuvOPNN8/j0VR2qXnASEVkCT8MBz0=; b=FpNALg9qwHuQnFF6J29CLFRlezY4BIbry7EjaUkYzplmC8BhbUcPPDiElZUd78UfvW SSj4DEN+WoFvgVBtuCj7hYjUwPDPWsQmB+vf078/gDH4EbwFnltToix8gJZiPx7xzSGE feS2WjyQhoSZhlpvwO8wjL4sH7ZafMjMWuWNPr+VRjaaSY9QweUZ4PE66TdLJVY/3dlJ EYJC/w/4vyNLzQ9NRI2T0E+yozSUf237ByL/7nrlQBiQ/qKey0VJiMwBUl6NLSDwIR6k KK5xOb2hPsBK4iuRhrHxxTArtdc7TR3BV1MXjHs4b8hlK6tcx6z6JTbIQVFzrOFPFDH2 7Lvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679639385; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hH9ReKrWmbRFTyiuvOPNN8/j0VR2qXnASEVkCT8MBz0=; b=bfKXUs8GypJHZaSJVqrxyObIr7EM4XN18iXOgxKgPtG8Shq4FfCB/+2kBSbXAdVeRo 8mnguAxSvRSkw16BHNgpp0og7P0a44v3FerA+CuKf6wUVLchRj5PyAsW0poQTIv9dBy3 h5RWBiGgDzyQGVn8bLzsxhoigZAdcLS5wvxfNqpUMb5pDs6JtUnkLrxcUCuIzdTkegNT Y9EpeQw50cC4/74Y916nPbk9aoz0a88rayNouhGqV5BHf5c8cj+XHzguugvtyvSwqgPg FhYOSm6Ea/aWqokNPoEbjADDP7WTUwwQeKjSe0GCUOXc2zbusB5pzy9nJ5x6f6AEYyrv Gnzw== X-Gm-Message-State: AAQBX9fxwgBFEE0BWl1q8cWtlw9S0Udle6kVlfGtZ3ax5LM5r95a1XSg N2u3c581BG4ZwiTpIaV5dIg= X-Received: by 2002:a2e:904b:0:b0:299:ac61:dedd with SMTP id n11-20020a2e904b000000b00299ac61deddmr609653ljg.40.1679639385190; Thu, 23 Mar 2023 23:29:45 -0700 (PDT) Received: from ?IPV6:2001:14ba:16f3:4a00::1? (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id b8-20020a2e9888000000b00295a583a20bsm3256731ljj.74.2023.03.23.23.29.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Mar 2023 23:29:44 -0700 (PDT) Message-ID: <21a888a1-95e3-cdf9-2a1d-1bb8b3d27a16@gmail.com> Date: Fri, 24 Mar 2023 08:29:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US, en-GB To: Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Liam Beguin , Randy Dunlap , Masahiro Yamada , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Stephen Boyd , Maxime Ripard References: <3f33fc551c0698b4cddb0d39911dddf7599c6317.1679474247.git.mazziesaccount@gmail.com> From: Matti Vaittinen Subject: Re: [PATCH v5 5/8] iio: test: test gain-time-scale helpers In-Reply-To: <3f33fc551c0698b4cddb0d39911dddf7599c6317.1679474247.git.mazziesaccount@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 3/22/23 11:07, 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 > > --- > Changes: > v4 => v5: > - remove empty lines from Kconfig > - adapt to drop of the non devm iio_init I think you may want to skip reviewing this specific patch. After having a chat with Greg, David, and Maxime it seems this will be changed quite a bit for v6. Most notably, I am planning to drop the generic helpers and struct gts_test. I'll also simplify the signatures of __test_init_iio_gain_scale() and test_init_iio_gain_scale(). Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~