summaryrefslogtreecommitdiff
path: root/rust/helpers/helpers.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2025-08-28 17:44:17 -0700
committerGuenter Roeck <linux@roeck-us.net>2025-09-07 16:34:23 -0700
commit4a4fcd611295af96af51574b31f9e19e7505f965 (patch)
treece6430dceae94e079033dbb12aa465597005fce6 /rust/helpers/helpers.c
parent40a5da1ec101476dd6abb9cfa181f1b50dc24ad0 (diff)
hwmon: (ina238) Pre-calculate current, power, and energy LSB
Current, power, and energy LSB do not change during runtime, so we can pre-calculate the respective values. The power LSB can be derived from the current LSB using the equation in the datasheets. Similar, the energy LSB can be derived from the power LSB. Also add support for chips with built-in shunt resistor by providing a chip specific configuration parameter for the current LSB. The relationship of current -> power -> energy LSB values in those chips is the same as in chips with external shunt resistor, so configuration parameters for power and energy LSB are not needed. Use ROUND_CLOSEST functions instead of divide operations to reduce rounding errors. Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # INA780 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions