mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "André Draszik" <andre.draszik@linaro.org>
To: Hans de Goede <hansg@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	 Marek Szyprowski <m.szyprowski@samsung.com>,
	 Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
	 Purism Kernel Team <kernel@puri.sm>,
	Sebastian Reichel <sre@kernel.org>,
	 Rob Herring <robh@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: "Peter Griffin" <peter.griffin@linaro.org>,
	"Tudor Ambarus" <tudor.ambarus@linaro.org>,
	"Juan Yescas" <jyescas@google.com>,
	"Amit Sunil Dhamne" <amitsd@google.com>,
	kernel-team@android.com, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"André Draszik" <andre.draszik@linaro.org>
Subject: [PATCH v2 08/11] power: supply: max17042: support standard shunt-resistor-micro-ohms DT property
Date: Fri, 27 Feb 2026 07:15:13 +0000	[thread overview]
Message-ID: <20260227-max77759-fg-v2-8-e50be5f191f0@linaro.org> (raw)
In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org>

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.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/power/supply/max17042_battery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index bae0670e2496..823533ea5a17 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -929,8 +929,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;
 	}

-- 
2.53.0.473.g4a7958ca14-goog


  parent reply	other threads:[~2026-02-27  7:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27  7:15 [PATCH v2 00/11] power: supply: max17042: support Maxim MAX77759 fuel gauge André Draszik
2026-02-27  7:15 ` [PATCH v2 01/11] dt-bindings: power: supply: max17042: add support for max77759 André Draszik
2026-02-27  7:15 ` [PATCH v2 02/11] dt-bindings: power: supply: max17042: support shunt-resistor-micro-ohms André Draszik
2026-02-27  7:15 ` [PATCH v2 03/11] dt-bindings: power: supply: max17042: drop formatting specifier | André Draszik
2026-02-27  7:15 ` [PATCH v2 04/11] power: supply: max17042: fix a comment typo (then -> than) André Draszik
2026-02-27  7:15 ` [PATCH v2 05/11] power: supply: max17042: use dev_err_probe() where appropriate André Draszik
2026-02-27  7:15 ` [PATCH v2 06/11] power: supply: max17042: avoid overflow when determining health André Draszik
2026-02-27  7:15 ` [PATCH v2 07/11] power: supply: max17042: time to empty is meaningless when charging André Draszik
2026-02-27 16:47   ` Peter Griffin
2026-02-27  7:15 ` André Draszik [this message]
2026-02-27 16:07   ` [PATCH v2 08/11] power: supply: max17042: support standard shunt-resistor-micro-ohms DT property Peter Griffin
2026-02-27  7:15 ` [PATCH v2 09/11] power: supply: max17042: initial support for Maxim MAX77759 André Draszik
2026-02-27 17:00   ` Peter Griffin
2026-02-27  7:15 ` [PATCH v2 10/11] power: supply: max17042: consider task period (max77759) André Draszik
2026-02-27 17:01   ` Peter Griffin
2026-02-27  7:15 ` [PATCH v2 11/11] power: supply: max17042: report time to full (max17055 & max77759) André Draszik
2026-02-27 16:53   ` Peter Griffin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260227-max77759-fg-v2-8-e50be5f191f0@linaro.org \
    --to=andre.draszik@linaro.org \
    --cc=amitsd@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hansg@kernel.org \
    --cc=jyescas@google.com \
    --cc=kernel-team@android.com \
    --cc=kernel@puri.sm \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=peter.griffin@linaro.org \
    --cc=robh@kernel.org \
    --cc=sebastian.krzyszkowiak@puri.sm \
    --cc=sre@kernel.org \
    --cc=tudor.ambarus@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®