Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

André Draszik and committed by
Sebastian Reichel
2288d5ea 0c5a6dc8

+5 -1
+5 -1
drivers/power/supply/max17042_battery.c
··· 925 925 /* 926 926 * Require current sense resistor value to be specified for 927 927 * current-sense functionality to be enabled at all. 928 + * maxim,rsns-microohm is the property name used by older DTs and kept 929 + * for compatibility. 928 930 */ 929 - if (of_property_read_u32(np, "maxim,rsns-microohm", &prop) == 0) { 931 + if ((of_property_read_u32(np, "shunt-resistor-micro-ohms", 932 + &prop) == 0) || 933 + (of_property_read_u32(np, "maxim,rsns-microohm", &prop) == 0)) { 930 934 pdata->r_sns = prop; 931 935 pdata->enable_current_sense = true; 932 936 }