summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@linaro.org>2026-03-02 16:32:07 +0300
committerSebastian Reichel <sebastian.reichel@collabora.com>2026-03-04 01:58:07 +0300
commit2288d5eaca2249b1b8a80af063808cfc42e2a834 (patch)
tree960962d56bd05f33dbc4121ece4bf6366f471d24
parent0c5a6dc85d739c41f5240fd149f42f26f0665aab (diff)
downloadlinux-2288d5eaca2249b1b8a80af063808cfc42e2a834.tar.xz
power: supply: max17042: support standard shunt-resistor-micro-ohms DT property
shunt-resistor-micro-ohms is a standard property used to describe the value of a shunt resistor required when measuring currents. Standard properties should be used instead of vendor-specific ones of similar intention when possible. Try to read it from DT, and fall back to the vendor-specific property maxim,rsns-microohm if unsuccessful for compatibility with existing DTs. Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://patch.msgid.link/20260302-max77759-fg-v3-8-3c5f01dbda23@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/max17042_battery.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 0a6960bbf3a2..e21d2bd7e231 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -925,8 +925,12 @@ max17042_get_of_pdata(struct max17042_chip *chip)
/*
* Require current sense resistor value to be specified for
* current-sense functionality to be enabled at all.
+ * maxim,rsns-microohm is the property name used by older DTs and kept
+ * for compatibility.
*/
- if (of_property_read_u32(np, "maxim,rsns-microohm", &prop) == 0) {
+ if ((of_property_read_u32(np, "shunt-resistor-micro-ohms",
+ &prop) == 0) ||
+ (of_property_read_u32(np, "maxim,rsns-microohm", &prop) == 0)) {
pdata->r_sns = prop;
pdata->enable_current_sense = true;
}