public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Charkov <alchark@flipper.net>
To: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Chris Morgan <macromorgan@hotmail.com>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	 Sebastian Reichel <sre@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Sebastian Reichel <sebastian.reichel@collabora.com>,
	 linux-pm@vger.kernel.org, Alexey Charkov <alchark@flipper.net>
Subject: [PATCH v6 06/11] power: supply: bq257xx: Make the default current limit a per-chip attribute
Date: Tue, 31 Mar 2026 19:43:43 +0400	[thread overview]
Message-ID: <20260331-bq25792-v6-6-0278fba33eb9@flipper.net> (raw)
In-Reply-To: <20260331-bq25792-v6-0-0278fba33eb9@flipper.net>

Add a field for the default current limit to the bq257xx_info structure and
use it instead of the hardcoded value in the probe function.

This prepares the driver for allowing different electrical constraints for
different chip variants.

Tested-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
 drivers/power/supply/bq257xx_charger.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq257xx_charger.c b/drivers/power/supply/bq257xx_charger.c
index 7ca4ae610902..39718223c3f9 100644
--- a/drivers/power/supply/bq257xx_charger.c
+++ b/drivers/power/supply/bq257xx_charger.c
@@ -18,6 +18,7 @@ struct bq257xx_chg;
 
 /**
  * struct bq257xx_chip_info - chip specific routines
+ * @default_iindpm_uA: default input current limit in microamps
  * @bq257xx_hw_init: init function for hw
  * @bq257xx_hw_shutdown: shutdown function for hw
  * @bq257xx_get_state: get and update state of hardware
@@ -26,6 +27,7 @@ struct bq257xx_chg;
  * @bq257xx_set_iindpm: set maximum input current (in uA)
  */
 struct bq257xx_chip_info {
+	int default_iindpm_uA;
 	int (*bq257xx_hw_init)(struct bq257xx_chg *pdata);
 	void (*bq257xx_hw_shutdown)(struct bq257xx_chg *pdata);
 	int (*bq257xx_get_state)(struct bq257xx_chg *pdata);
@@ -627,6 +629,7 @@ static const struct power_supply_desc bq257xx_power_supply_desc = {
 };
 
 static const struct bq257xx_chip_info bq25703_chip_info = {
+		.default_iindpm_uA = BQ25703_IINDPM_DEFAULT_UA,
 		.bq257xx_hw_init = &bq25703_hw_init,
 		.bq257xx_hw_shutdown = &bq25703_hw_shutdown,
 		.bq257xx_get_state = &bq25703_get_state,
@@ -675,7 +678,7 @@ static int bq257xx_parse_dt(struct bq257xx_chg *pdata,
 				       "input-current-limit-microamp",
 				       &pdata->iindpm_max);
 	if (ret)
-		pdata->iindpm_max = BQ25703_IINDPM_DEFAULT_UA;
+		pdata->iindpm_max = pdata->chip->default_iindpm_uA;
 
 	return 0;
 }

-- 
2.52.0


  parent reply	other threads:[~2026-03-31 15:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 15:43 [PATCH v6 00/11] Add support for the TI BQ25792 battery charger Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 01/11] dt-bindings: mfd: ti,bq25703a: Expand to include BQ25792 Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 02/11] regulator: bq257xx: Remove reference to the parent MFD's dev Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 03/11] regulator: bq257xx: Drop the regulator_dev from the driver data Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 04/11] regulator: bq257xx: Make OTG enable GPIO really optional Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 05/11] power: supply: bq257xx: Fix VSYSMIN clamping logic Alexey Charkov
2026-03-31 15:43 ` Alexey Charkov [this message]
2026-03-31 15:43 ` [PATCH v6 07/11] power: supply: bq257xx: Consistently use indirect get/set helpers Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 08/11] power: supply: bq257xx: Add fields for 'charging' and 'overvoltage' states Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 09/11] mfd: bq257xx: Add BQ25792 support Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 10/11] regulator: bq257xx: Add support for BQ25792 Alexey Charkov
2026-03-31 15:43 ` [PATCH v6 11/11] power: supply: " Alexey Charkov
2026-04-10 10:52 ` (subset) [PATCH v6 00/11] Add support for the TI BQ25792 battery charger Mark Brown

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=20260331-bq25792-v6-6-0278fba33eb9@flipper.net \
    --to=alchark@flipper.net \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=macromorgan@hotmail.com \
    --cc=robh@kernel.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=sre@kernel.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