RE: [PATCH v2 2/2] iio: adc: adding support for pac193x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, October 27, 2023 11:18 AM 
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

>On Wed, 25 Oct 2023 16:44:04 +0300
><mailto:marius.cristea@xxxxxxxxxxxxx> wrote:
>
>> From: Marius Cristea <mailto:marius.cristea@xxxxxxxxxxxxx>
>> 
>> 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@xxxxxxxxxxxxxxx
>> +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






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux