[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR05MB4424FBC5CFF90F55198C4351A9A6A@BYAPR05MB4424.namprd05.prod.outlook.com>
Date: Thu, 2 Nov 2023 14:28:36 +0000
From: Robin Getz <rgetz@...hworks.com>
To: Jonathan Cameron <jic23@...nel.org>,
"marius.cristea@...rochip.com" <marius.cristea@...rochip.com>
CC: "lars@...afoo.de" <lars@...afoo.de>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>,
"conor+dt@...nel.org" <conor+dt@...nel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 2/2] iio: adc: adding support for pac193x
On Friday, October 27, 2023 11:18 AM
Jonathan Cameron <jic23@...nel.org> wrote:
>On Wed, 25 Oct 2023 16:44:04 +0300
><mailto:marius.cristea@...rochip.com> wrote:
>
>> From: Marius Cristea <mailto:marius.cristea@...rochip.com>
>>
>> This is the iio driver for Microchip
>> PAC193X series of Power Monitor with Accumulator chip family.
>> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1934 b/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1934
>> new file mode 100644
>> index 000000000000..ea43df292b9c
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-pac1934
>> @@ -0,0 +1,15 @@
>> +What: /sys/bus/iio/devices/iio:deviceX/in_shunt_resistor_X
>> +KernelVersion: 6.6
>> +Contact: mailto:linux-iio@...r.kernel.org
>> +Description:
>> + The value of the shunt resistor may be known only at runtime and set
>> + by a client application.
What? End users (people with access to userspace) don't whip out their soldering iron to add/change shunt resistors.
OEMs do this during PCB design. This is fixed per board in the wild (apart from device evaluation boards)
and is typically managed via device tree. (Allowing it to be changed by OEMs, but not end users).
>> This attribute allows to set its value
>> + in micro-ohms. X is the IIO index of the device. The value is
>> + used to calculate current, power and accumulated energy.
>
>How common is it that this isn't known?
I would say zero.
The ADM1177 (which is different, but also requires a shunt resistor),
hwmon driver:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/hwmon/adm1177.c
iio driver:
https://github.com/analogdevicesinc/linux/blob/master/drivers/iio/adc/adm1177.c
uses device tree to manage the value of the shunt resistor.
> I'm not sure we've found it necessary to
> support userspace control of this for any other device and there are quite a few
> where this could in theory be known only at runtime...
Not run time, but at PCB manufacturing time, when the device tree is compiled by the OEM.
The assumption is - who ever controls the BOM - controls the device tree. This has been pretty true in my history.
It allows OEMs (who manage the hardware) to change it as they want, but keeps the complexity away from end users.
- Robin
Powered by blists - more mailing lists