Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1449152lqh; Mon, 6 May 2024 08:04:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwrbqfiDfVQbOEG5/HzshyoAF5NBBOO4x9aw2KXtt60lEKFFDledFRUsZs1s/NTd4MrlL2BVNXfCDm70lT3HG/FzqU/4nX44JG44pZfg== X-Google-Smtp-Source: AGHT+IEeS5W7lz9W/RSuUJqfJtfkx7TNRzV3Ao7QdJ5phnxwDXDxo100IfqIXX+0NPdlfQlKrKNG X-Received: by 2002:a17:906:65a:b0:a59:91a0:df46 with SMTP id t26-20020a170906065a00b00a5991a0df46mr6631971ejb.31.1715007873841; Mon, 06 May 2024 08:04:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715007873; cv=pass; d=google.com; s=arc-20160816; b=KX7HVj1CQ5EjWa33+j5poJzylhpgvA1BDD5IMfXfuUDV117sedRQuJfpolo+HGOt7r x/Bnze96RoL6nKceVDUDLeDghkK1z17hJo8H0N18DdF+/Tj2BE/2HaSB8TFut+ZsdxWk jO58jvBK8zAL2UC4naSOLIke5hgWlk/NERaaPCpF2DIczwz11iSwrBwpPI05WMbosGaB um9PODudXSiUoCl3aLLkr7lzt5qE9a/EPJevhxqovjgNnPpPw/L+IjNMKJdGVBqu87Zf cbtwqGigUs6gVTwMbFccBJ7AT42OPzEfCOV2qhSmNPog8bUxWMpsuEukfDpeX4WI3apB KLCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=BFec+QhZVtPI2j0gseBfhUAnbpkhg51VBLT9XPfNp7Y=; fh=Lwu3E+kUE1rzPo1K/sy3snnYoUCp46seMBgC/50KH8k=; b=ZyzP9mmImjwUZzjwWNRkrp79+SyUJzRQ2+G+fvS/QH2FW/SHvsBmySMPurwfuSLoSD vBEI6SC4Lqiui3xIoN8S1duNIUya8HRN76+t1AmivIjk6ZRItWz27w+/jJqn4T60qY+b A4Lu/yzT4jH+i+Wma6xRWqbxgbTXlqllZbkn7SmT6VF2m309uXgJbgJJJkSVtLdGHGQW RQKvj0T4edtVrFDIpviJ6JPXJ6BzPJt2OKZx+zbvi8UVbFfnQKaiRoGUpRFU0nd/5bXq MPBXZPpj4fSQVlUpzCxb/dsfgZ903B4Sgt24YQNmdFoSfMdlCXnr0JqRU4IvvMv4W4qi ygAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=av4sU+M2; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-170040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170040-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hh17-20020a170906a95100b00a59c31a9acesi1932470ejb.407.2024.05.06.08.04.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 08:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=av4sU+M2; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-170040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170040-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 910B91F21C10 for ; Mon, 6 May 2024 15:04:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 065A4154448; Mon, 6 May 2024 15:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="av4sU+M2" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 3C6291534E5 for ; Mon, 6 May 2024 15:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715007865; cv=none; b=PjhZ+EZeuOe43S0L7C5DbHAfmPPnVZ5N87GxpNzcZoQBBTtN03dF5GkaNgbkENt0hS3VNf5DOaQ1xKzQQk8KGbL8+MJz9AKSaLhDQ/vTlarkmLjpsWVPJsacOO0lFIWTO5nZHd/L5fC0MvnOKO2co++ExZJ6/Qa6IbPJcKF0LuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715007865; c=relaxed/simple; bh=43qt58Cc+4V7oWJGTmVtsNFw1630vbmzXiVtgfxHZ9s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UtIXzb6glH1u/7kAtFDWZnCcD80oMnTDdlMyRt6FzMljkiXApxOWDnaH+fKbeGaWw5uLZ1FQ6x+z3wRCurU0As8/Kpd/LBTMVw5T/U7QCGW/SbV+49KaflH6DXuwtT0jV1VBHa7ZHdhhPQYyupP9iDD8DVkMzrIrOhM+f9IAFcs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=av4sU+M2; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e1fa2ff499so35215021fa.0 for ; Mon, 06 May 2024 08:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1715007861; x=1715612661; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BFec+QhZVtPI2j0gseBfhUAnbpkhg51VBLT9XPfNp7Y=; b=av4sU+M2cwLP1+ctSZeFcJ24IEbNCcZhTbr6ujAlMcrSLsr8WSpVSIU+5jnpZE0ziD e7Lkpsg2qMHkfKZYQ1dsCfgLEJw4K0i2qU6rJiCjT27S9aBuKT599LKQaVgcaWhtyEIL bIHXCkfSPao2fLQ95+2LNfB9loFxEjf8teduUxcsVzIPxRhMOChJnXJHXb3W9AsQH6fy LgQvSoGnAcFSSqv/jkdBPKzpZFhP8otH+yDK/KHAHveFgRWHoaDKYMtU41sJA1rTTxVm fKnBbh43TVl0zG/GjFppT8JlRkfEnkjpn6p+Do+dyCORsLjmca9actAmQX6zcKzVs6Me nqMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715007861; x=1715612661; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BFec+QhZVtPI2j0gseBfhUAnbpkhg51VBLT9XPfNp7Y=; b=mO9YNm64WNpy+BFIjuLoYEao1C3S5xW0R+4pPDsA3ZGM6YQ9ygEHSj3GpQPmZ7wBBk npWayhm/W9u3XOwJW13QsvQju303uloTvMOeNOQ76eh9C0xvHOa/ioqzn5wqgjmKyCQB nTLFnSzyuh2rvN2B9RvtvVoAqIsEBibvxYaYCIEIknWATl9JGVyWOYiEo5suYWFaGiGW wqSsKAtl0fu3Ve1SlrolBQn6K2cwv9WcSUdkTDY8nCycl3q578iV2YiEXsTTQJ4V6rVK /PdpEU13DszYfhEIzwxmiqehex+E9vJ7QOqO2tlbyMhuqHli1jaagXMh0Otr5d/LS89J sP7Q== X-Forwarded-Encrypted: i=1; AJvYcCX7/NlfvTjDG5krEM4e16wf6WYO+1sMtsrgVceLqQsvDhLiyY40ghvlDd3BKfa9mHYG2pmmRw2oO7sg7y9Zdi/mCWd6T9srcqJgNWH1 X-Gm-Message-State: AOJu0YwsZoUQljMNS2v5BO8TvH0kWX8JpSJ21l7DPDJCkqXgvkD+N1TJ 3z8/yCPlDPojXAd3WlSL2L47I3b/1mVVYAqdTstE8DQg5uqfChXCCRb00holKtB61bmh420kx8O okvggZpdAog4D89t+vDtFLuTv0On1ucarnWJzYA== X-Received: by 2002:a2e:9a8b:0:b0:2e3:331e:e33d with SMTP id p11-20020a2e9a8b000000b002e3331ee33dmr1247843lji.11.1715007861327; Mon, 06 May 2024 08:04:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240501-adding-new-ad738x-driver-v6-0-3c0741154728@baylibre.com> <20240501-adding-new-ad738x-driver-v6-9-3c0741154728@baylibre.com> <20240506151725.10cf025e@jic23-huawei> In-Reply-To: <20240506151725.10cf025e@jic23-huawei> From: David Lechner Date: Mon, 6 May 2024 10:04:10 -0500 Message-ID: Subject: Re: [PATCH RFC v6 09/10] iio: adc: ad7380: add support for rolling average oversampling mode To: Jonathan Cameron Cc: Julien Stephan , Lars-Peter Clausen , Michael Hennerich , =?UTF-8?B?TnVubyBTw6E=?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , kernel test robot , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 6, 2024 at 9:17=E2=80=AFAM Jonathan Cameron = wrote: > > On Wed, 01 May 2024 16:55:42 +0200 > Julien Stephan wrote: > > > Adds support for rolling average oversampling mode. > > > > Rolling oversampling mode uses a first in, first out (FIFO) buffer of > > the most recent samples in the averaging calculation, allowing the ADC > > throughput rate and output data rate to stay the same, since we only ne= ed > > to take only one sample for each new conversion. > > > > The FIFO length is 8, thus the available oversampling ratios are 1, 2, = 4, 8 > > in this mode (vs 1, 2, 4, 8, 16, 32 for the normal average) > > Ah. I should have read on! > > > > > In order to be able to change the averaging mode, this commit also adds > > the new "oversampling_mode" and "oversampling_mode_available" custom > > attributes along with the according documentation file in > > Documentation/ABI/testing/sysfs-bus-iio-adc-ad7380 since no standard > > attributes correspond to this use case. > > This comes to the comment I stuck in the previous patch. > > To most people this is not a form of oversampling because the data rate > remains unchanged. It's a cheap low pass filter (boxcar) Google pointed m= e at: > https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequenc= y-of-a-moving-average-filter > > in_voltage_low_pass_3db_frequency would be the most appropriate standard > ABI for this if we do treat it as a low pass filter control. > > I'm not necessarily saying we don't want new ABI for this, but I would > like to consider the pros and cons of just using the 3db frequency. > > So would that work for this part or am I missing something? > I like the idea. But from the link, it looks like the 3dB frequency depends on the sampling frequency which is unknown (e.g. could come from hrtimer trigger). Would it be reasonable to calculate the 3db frequency at the max sample rate that the chip allows and just use those numbers?