Skip to content
Commit 4bca559a authored by Ninad Malwade's avatar Ninad Malwade Committed by Rajeshkumar Ramasamy
Browse files

hwmon: ina3221: Add support for channel summation disable



commit 72a7e6f0042ee6288dd63b9c2434f93423a2fefa from
https://nv-tegra.nvidia.com/r/3rdparty/canonical/linux-jammy.git jetson_36.3

BugLink: https://bugs.launchpad.net/bugs/2042935

The INA3221 allows the Critical alert pin to be controlled by the
summation control function. This function adds the single
shunt-voltage conversions for the desired channels in order to compare
the combined sum to the programmed limit. The Shunt-Voltage Sum Limit
register contains the programmed value that is compared to the value in
the Shunt-Voltage Sum register in order to determine if the total summed
limit is exceeded. If the shunt-voltage sum limit value is exceeded, the
Critical alert pin pulls low.

For the summation limit to have a meaningful value, we have to use the
same shunt-resistor value on all included channels. Unless equal
shunt-resistor values are used for each channel, the summation control
function cannot be used and it is not enabled by the driver.

To address this, add support to disable the summation of specific
channels via device tree property "ti,summation-disable". The channel
which has this property would be excluded from the calculation of
summation control function.

For example, summation control function calculates Shunt-Voltage Sum as:

- input_shunt_voltage_summation = input_shunt_voltage_channel1
                                + input_shunt_voltage_channel2
                                + input_shunt_voltage_channel3

If we want the summation to only use channel1 and channel3, we can add
'ti,summation-disable' property in device tree node for channel2. Then
the calculation will skip channel2.

- input_shunt_voltage_summation = input_shunt_voltage_channel1
                                + input_shunt_voltage_channel3

Note that we only want the channel to be skipped for summation control
function rather than completely disabled. Therefore, even if we add the
property 'ti,summation-disable', the channel is still enabled and
functional.

Finally, create debugfs entries that display if summation is disabled
for each of the channels.

http://nvbugs/3851858

Signed-off-by: default avatarNinad Malwade <nmalwade@nvidia.com>
Signed-off-by: default avatarRajkumar Kasirajan <rkasirajan@nvidia.com>
Co-developed-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Acked-by: default avatarJacob Martin <jacob.martin@canonical.com>
Acked-by: default avatarNoah Wager <noah.wager@canonical.com>
Signed-off-by: default avatarJacob Martin <jacob.martin@canonical.com>
Signed-off-by: default avatarRajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com>
parent 92d86611
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment