Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp291355rdb; Sat, 27 Jan 2024 06:49:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNGw6SNEir0ktHnHcQZ6G3OFmT26o35eMS2+UhDGxvUoRSF0I0LVVg44mBbkVxxqhiB4l8 X-Received: by 2002:a05:6214:1bca:b0:681:7d2f:cdb5 with SMTP id m10-20020a0562141bca00b006817d2fcdb5mr2120255qvc.127.1706366984777; Sat, 27 Jan 2024 06:49:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706366984; cv=pass; d=google.com; s=arc-20160816; b=o+zaBxTcNVWzsG3ykvKWmohJhzN1kBCQitJW/We+My2f1VSwZhMFo449MVRZl/crZ2 ejy59CI6tSKesdzdhMpt1nQ1haPUZIgvr174tPW4Ow3TyXFngdE44adf40v8J/aiqd7E RINrmDH7tbNnBFzqJqx+3Y6v833vNZwul5bcoKWkzHRHwnUtx+tmW5Q05Q8LsvXZwvLH GBZ6DxV1Jjwgrp89LNYfkNetVZyKX1YGLfmCgiNFNhOMYb+rrKSE8I5EmRfOKYlKdKfJ LXplkQsC3Vk2Ai+gr8R0yKFztXp12bfucpak8JZ+ictxfUCdYB2gw2V50GM2LTtQFVXc /msw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=IKCOSWZ1eYxW1I2TrX51XnwKg1X4tKwyVC9uJbhPIAs=; fh=jvxCNTrw9mEz8eO8SI0NT9pnogK6G6Ud6s8FSnZ6wsg=; b=KmT3ayV7jhgVEJKb0i2IlxfufqA4iFRHTzdQHWyC49YSzDOnWZFF4t015DqW9ZjMkG 2Z2d4aUaslkTSh386NCWcVHVaWo6U14fW56VpGafmT76IhFLkE3EJZEsWWmXWfn1/+DX 5ihvdC4tp1jPCWeb8N/IxdioAgcNGBMHmNd3HAcqiRfk2oqHgktOOEp8Ep6S4sHgpxfZ igh8Mf/TD9zJ9FTDtQ6pVeimHxQGw5xeuS6rgCyR21QPGUAomn3aM0PXb85gFt3bGfaI L9gzxjeigfUQfoR2kbOEscm+IEuIwIk+eglcZqxb7NjBSB1Hj23Xv8r7kcUicVfAfKXZ XHGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UK2sryzt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41229-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41229-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ge12-20020a05621427cc00b0068c3d9567b3si1073878qvb.336.2024.01.27.06.49.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 06:49:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41229-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UK2sryzt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41229-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41229-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 70AE61C2114C for ; Sat, 27 Jan 2024 14:49:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE1EA28DBD; Sat, 27 Jan 2024 14:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UK2sryzt" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10B482030B; Sat, 27 Jan 2024 14:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706366976; cv=none; b=Xj6g9KGJ6G/2aclP8vCbwDIOsm/q62yNYY3ma7jaVzAqE4rDUEN42MBA19sXQ+9D8+3KTfL6fdk5ZB6KEV3G+FyC7fiF/q7X4HG/IRH36+bn1hmUTdc7C7S3wG4sPihF6qAFhGnjaqDZ/dpobq7kKlJlULfcpuM5ySRJX9nEnTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706366976; c=relaxed/simple; bh=AuqsP3vAOKyVmdLsexssS1XtsE4VPIfUnFnDDujaPgI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b+kClfYIVBGIZLLM1J0322RxDYfiemjjvxYgY5aN1n/c/AV5QEwE07pipCjLhNsiIpUxznuUwMAIP1aB0+VjCMoELJYFdbp9sXk7eCPUqeAxcRpU2f/yBhHsE3ZJsbiiCMAVJmBeIUkb82em534NW7egvzd+HBXOY3Z59rzY7vU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UK2sryzt; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A0DCC433F1; Sat, 27 Jan 2024 14:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706366975; bh=AuqsP3vAOKyVmdLsexssS1XtsE4VPIfUnFnDDujaPgI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UK2sryzt9slcXtfmGdfUs7U5HJ0qEARPzusZ+817F5QCVuf9nTHcKO2TqABOBqaOO 9bmxM/POaiJAtBRJwuZAAS1GhlhFrZfHI9w/UX+tsWdjQLGfD9cX32VASudHlxCzmI I7JnUX1uVuZBrv1QDOoFaujglta6vqCdF7o/FgsLXhGy8VB51XzAf8EyncCtZW3ZsB dXgtLQ/fWFT39O8oahi76KVUpPLKbPqbuCeTnt+i33BpZGPItwh9+dI98nuIdEHvL5 ySnZvWsLkJMF7IwlHJODQgZ9JgQI4NQ2ovdvAPTMBlvOcSRtees5OUftVT8PXxH5yN RTFfQCeeS7gWw== Date: Sat, 27 Jan 2024 14:49:20 +0000 From: Jonathan Cameron To: Conor Dooley Cc: Peter Rosin , Naresh Solanki , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , mazziesaccount@gmail.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dt-bindings: iio: afe: voltage-divider: Add io-channel-cells Message-ID: <20240127144920.455b6f0c@jic23-huawei> In-Reply-To: <20240127-hunting-wick-fc1eed1af6b1@spud> References: <20240126115509.1459425-1-naresh.solanki@9elements.com> <20240126-cinnamon-flatware-e042b5773f17@spud> <20240126-scale-serrated-33686467d91b@spud> <20240126-blaspheme-calculate-a4134dc1ed68@spud> <536971eb-51f0-40e5-d025-7c4c1d683d49@axentia.se> <20240127-hunting-wick-fc1eed1af6b1@spud> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.40; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 27 Jan 2024 11:03:14 +0000 Conor Dooley wrote: > On Sat, Jan 27, 2024 at 10:40:31AM +0100, Peter Rosin wrote: > > > > > > 2024-01-26 at 23:14, Conor Dooley wrote: > > > On Fri, Jan 26, 2024 at 11:10:36PM +0530, Naresh Solanki wrote: > > > > > I did look at what you have there and I think your dts is wrong. > > > > > > The iio-hwmon binding says: > > > | description: > > > > | Bindings for hardware monitoring devices connected to ADC controllers > > > | supporting the Industrial I/O bindings. > > > | > > > | io-channels: > > > | minItems: 1 > > > | maxItems: 51 # Should be enough > > > | description: > > > > | List of phandles to ADC channels to read the monitoring values > > > > > > And then you have: > > > | iio-hwmon { > > > | compatible = "iio-hwmon"; > > > | // Voltage sensors top to down > > > | io-channels = <&p12v_vd 0>, <&p5v_aux_vd 0>, <&p5v_bmc_aux_vd 0>, <&p3v3_aux_vd 0>, > > > | <&p3v3_bmc_aux_vd 0>, <&p1v8_bmc_aux_vd 0>, <&adc1 4>, <&adc0 2>, <&adc1 0>, > > > | <&p2V5_aux_vd 0>, <&p3v3_rtc_vd 0>; > > > | }; > > > | > > > | p12v_vd: voltage_divider1 { > > > | compatible = "voltage-divider"; > > > | io-channels = <&adc1 3>; > > > | #io-channel-cells = <1>; > > > | > > > | /* Scale the system voltage by 1127/127 to fit the ADC range. > > > | * Use small nominator to prevent integer overflow. > > > | */ > > > | output-ohms = <15>; > > > | full-ohms = <133>; > > > | }; > > > > > > A voltage divider is _not_ an ADC channel, so I don't know why you are > > > treating it as one in the iio-hwmon entry. Can you explain this please? > > > > This is the exact intent of the voltage divider (and the other bindings > > handled by the iio-rescaler). The raw ADC reports the voltage at its input, > > which is fine, but if there is an analog frontend in front of the ADC > > such as a voltage divider the voltage at the ADC is not the interesting > > property. You are likely to want the "real" voltage before the voltage > > divider to better understand the value. > > > > In this case it's much more interesting to see values such as 12.050V > > which is presumably close to the nominal voltage (12V? guessing from > > the node name) rather than some unscaled raw ADC voltage (in this > > example it would be ~1.359V, which tells you rather little w/o rescaling > > it first). > > Thanks for explaining it. Naresh, can you respin please with an > explanation of why the property belongs in the binding please? Agreed - the explanation of 'why' is needed. As discussed, in this case the end consumer is iio-hwmon (reflecting that the thing we are ultimately 'measuring' as a voltage of a wire that needs monitoring for hwmon usecases) and that is measured via a voltage divider (hence that's providing the measurement service) which in turn needs to consume the reading from and ADC and hence the middle device is here acting as a provider to iio-hwmon and a consumer of the ADC channel. p.s. No one really likes the iio-hwmon binding because it is reflecting a usecase rather than hardware, but meh, it's been around a long time and we never figured out a better option. Things are much cleaner for circuits like the voltage divider. > > > It's all in the description of the binding... > > Obviously it was not sufficiently clear, it's not as if I didn't look at > it... Given this device fits in both categories, perhaps a tiny bit of additional documentation would help? '#io-channels-cells': description: In addition to consuming the measurement services of an ADC, the voltage divider can act as an provider of measurement services to other devices. const: 1 > > Cheers, > Conor.