From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (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 6C1C73FD943 for ; Tue, 21 Jul 2026 01:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784597976; cv=none; b=APOCf7O2DPBiu9jNsRW36URw4M2HhEjAUqW2st+yHZ3x7C+XlKA7hVK7Cwak3+kJOB2ob5fIzNYIwK5Rbrom7Qb13GYNiVGYT2Nm04x9UsZ92FoUUUjwvat3n8Lpx1DFNle0Ba8T8rQf8ws0VhVZRU6Y0Nt7+lkMvl4aWU6IwQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784597976; c=relaxed/simple; bh=hPnnSWEXjlKB3FA+RvOH82WyYdS/53hCpV5pLhgGvPo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MlVFtjAb7QE8fj/RD0k+KkQNIYyBZpLvHBDlwl7zhhcNbbviWgKuNL/IGZvRJlkvAKBm6dPV1rtTWYcD5s6vepJguaEyKvD8bTkSN1xcyE5g93OG9+FrAUqwpuZKkRGK/OuPaOuYRDZ+x7Gro6gqPkqjGjrMooFgNUqn43EUZtg= 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 header.i=@baylibre.com header.b=IADpnpBr; arc=none smtp.client-ip=209.85.167.174 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="IADpnpBr" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-49c38a4f110so5043240b6e.1 for ; Mon, 20 Jul 2026 18:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1784597972; x=1785202772; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=81HdYIHWL+Qkrx66ggqaBZ1N7F6EaLfANnJd23r1MXw=; b=IADpnpBrfqUMGBwCuPGl3tLJ980Aib1DOcraPa/bIzlHFaN24DGigO5ryccxwBOQQC CeaPChM2qsxCyYB36vCMBjNvfM9/VnawV/DII9UGnzkLnueVjTYKKc2MzHr4SkRCIv6u ZR0LswrfbRP4mCnaAjjG8YW8b0on7h0chC4qqRAJ5zbhyAQ/Ah6JlUcraSauJ6evWuT6 5YKh+4vJwMxiNnFkf/9zZnwRCTwhyMFa2DbPoHzvw9jcmfq1kVjRxI4SXwYmb3xvMFBH BRbzbN7T5KjYmfhXDlxfUQ/LsvY01zpmZaQBR/7yXBh1pqzgtPXG85unP1cKZto61s+c os/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784597972; x=1785202772; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=81HdYIHWL+Qkrx66ggqaBZ1N7F6EaLfANnJd23r1MXw=; b=A6OCBCAmwe7CVgXsmN1fAsJ7QTUPkCZzOCOeP/xVizq+7YW1Ha76DdScQe3p4tAjaL ZgPG+Y5s40A3/oYcwiNCj0K+6DB28JKg5FaoF9Wzg9S4324k6AViKWtXxPENfyKLlbj2 SuyqkgqgghM2aL2Eq3KsXw2RrtlfCrpvDr7G9phNGkliRMaarIYPFnYGOzJqGedNtWnb di6WIGZ333iXWR1UMhiN8wfQQTk1J+j+kzWVPH+/xSKVk93PlE08cDI98PXk2fhjpKxK 8lfM4Fx+fB6lP4gK0//LBB6iUa2cl3uYBX3LzPws6nyWHdhFh69rQZmiRcKatNrVZ+81 1hOQ== X-Forwarded-Encrypted: i=1; AHgh+RrL4GmveZzjKmgqWnAufeghcDrGqiogCb6BEL+mqa4Ezu60mk/h/mVPfPGGNncLXJG9nXkuk8oC2C10G0E=@vger.kernel.org X-Gm-Message-State: AOJu0Yzi3hdlLLZ83dp6YSrnCnJx1JLV6S/8pf9ny3Ss7e5ft62Ut2up CBItemIr5C2874cXK1G47yAPUMWDqoEKU9u+oWxt0mz8PmZV2CHBDYf+gxeo3Kp7U9c= X-Gm-Gg: AfdE7cnYk0pVb+xtQIFuvs9iGal/GegIfWVYT9Paqj/w1BQ4FbNCbGQOQzyN8QYBAR8 ua3HyMtTxcnwGe3w3EGajjyfz0FerrcWOwYoKG0G8eDL7GSFvdZdD0w4Hoj4DhL8HzAkkkwF//j HbBw4+2rI1UPBJ8z9DXWzV+L0UWwQ54YDZ3PJmeqtR50YTKVp86ponD0BsdG0EnqhJMJkuKqqoX gMFldS3s2pFOvOlEjv73LmYYtfnh85SKMYsIEjBp9ZNjC5V5txOcT0XhkJL1n0Q4lU+rc60U6Lh jj5A0ipexmm/JnFvgpNNanZyxQxof8SdCGZi7cjBtIgDn1mT0wORKyxfK7zhvf1hH0SAQBGYdBw IK/5mPx6qtn0irTFgANyQ7H5Ai3o2ZqsHZWUOGpNEOV4f+aWNuuFa6uLuLcL3P10yWlp/NZ3lnI cGMfiPRNEVJLyT+0VqT2vTNNwrBZxkoFnTGZfhhy4daOnxaulMddNL X-Received: by 2002:a05:6808:3209:b0:4a4:a05:dc1 with SMTP id 5614622812f47-4a4d051d9d7mr10860219b6e.22.1784597972241; Mon, 20 Jul 2026 18:39:32 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:8ce6:b98e:1126:f7f0? ([2600:8803:e7e4:500:8ce6:b98e:1126:f7f0]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4a4d3a57b04sm8639931b6e.3.2026.07.20.18.39.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jul 2026 18:39:30 -0700 (PDT) Message-ID: Date: Mon, 20 Jul 2026 20:39:28 -0500 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 1/6] dt-bindings: iio: adc: Add AD7768 To: Janani Sunil , Janani Sunil , =?UTF-8?Q?Nuno_S=C3=A1?= , Michael Hennerich , Jonathan Cameron , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Olivier Moysan , Philipp Zabel , Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Shuah Khan Cc: linux@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org References: <20260709-ad7768-driver-v1-0-44e1194fd96a@analog.com> <20260709-ad7768-driver-v1-1-44e1194fd96a@analog.com> <36df7c4f-82ea-4ed5-a4f9-3a29c75dc99a@baylibre.com> <9dd16bb5-7a30-4024-88a7-4a4bf47c35e8@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <9dd16bb5-7a30-4024-88a7-4a4bf47c35e8@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 7/20/26 9:00 AM, Janani Sunil wrote: > > On 7/9/26 17:43, David Lechner wrote: >> On 7/9/26 3:50 AM, Janani Sunil wrote: >>> Devicetree Bindings for AD7768-4 (4 channel) and AD7768 (8 channel) >>> simultaneous sampling ADC >>> >>> Signed-off-by: Janani Sunil >>> --- >>>   >>> + >>> +  adi,power-mode: >>> +    $ref: /schemas/types.yaml#/definitions/string >>> +    enum: >>> +      - low >>> +      - median >>> +      - fast >>> +    description: >>> +      Power mode selection. >> Unless there are pins that control this, it seems like it should be >> left up to the driver to decide how to set this. >> >> In this case, it looks like the power mode also influences sample rate >> which is normally something controlled at runtime. Looking at this again, there is also an MCLK divider that influences sample rate, so sampling_frequency to power mode is not straight-forward anyway. > > Hi David, > > The reason we'd like to retain power mode control is that certain ODRs are supported across all three power modes (low/median/fast), and the RMS noise and power consumption differ significantly between them at the same ODR. > > The higher the power mode, the better the noise performance, but power consumption nearly doubles for every ~3 dB improvement in dynamic range. Silently selecting one power mode in the driver would remove a meaningful hardware tradeoff from the user. > > We'd like to propose the following instead: > - Remove adi,power-mode from the DT as suggested. > - Expose power mode as a per-device sysfs attribute. > - in_voltage_sampling_frequency_available dynamically reflects only the ODRs valid for the currently selected power mode. > > This keeps the DT clean while still giving the user explicit control over the noise versus power trade off. Would this approach be acceptable? > > Thanks, > Jan > > Jonathan usually pushes back against userspace power controls. We do have this for accelerometers, but not ADCs currently. If we can't think of anything better, maybe we could use this. It only has low_noise and low_power options though, so the driver would still need to chose the best power mode of the 3 based on the other requested parameters. E.g. always make all sampling_frequency available and just pick the highest power or lowest power mode that can provide that rate based on the power_mode attribute. I wanted to suggest maybe adding some kind of noise attribute instead, but I'm not sure how we could do that in a way using SI units since the value would depend on so many things (at least V_REF voltage, filter type, temperature and even the physical input).