public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yauhen Kharuzhy <jekhor@gmail.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans de Goede <hdegoede@redhat.com>,
	Yauhen Kharuzhy <jekhor@gmail.com>
Subject: [PATCH 2/4] bq25890: Add max input current limit property
Date: Sun,  7 Nov 2021 23:19:59 +0300	[thread overview]
Message-ID: <20211107202001.54579-2-jekhor@gmail.com> (raw)
In-Reply-To: <20211107202001.54579-1-jekhor@gmail.com>

Add property 'ti,input-max-current' to define input current limit if
needed. It will be applied if automatic charger type detection is
disabled and using of ILIM pin is disabled or such pin defines greater
limit than IINLIM field.

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
 drivers/power/supply/bq25890_charger.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 34467bfb9537..1c43555d5bd8 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -85,6 +85,7 @@ struct bq25890_init_data {
 	u8 treg;	/* thermal regulation threshold */
 	u8 rbatcomp;	/* IBAT sense resistor value    */
 	u8 vclamp;	/* IBAT compensation voltage limit */
+	u8 iinlim_max;	/* maximum input current limit allowed */
 };
 
 struct bq25890_state {
@@ -657,6 +658,7 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 		{F_TREG,	 bq->init_data.treg},
 		{F_BATCMP,	 bq->init_data.rbatcomp},
 		{F_VCLAMP,	 bq->init_data.vclamp},
+		{F_IINLIM,	 bq->init_data.iinlim_max},
 	};
 
 	ret = bq25890_chip_reset(bq);
@@ -870,11 +872,13 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
 		{"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg},
 		{"ti,ibatcomp-micro-ohms", true, TBL_RBATCOMP, &init->rbatcomp},
 		{"ti,ibatcomp-clamp-microvolt", true, TBL_VBATCOMP, &init->vclamp},
+		{"ti,input-max-current", true, TBL_IINLIM, &init->iinlim_max},
 	};
 
 	/* initialize data for optional properties */
 	init->treg = 3; /* 120 degrees Celsius */
 	init->rbatcomp = init->vclamp = 0; /* IBAT compensation disabled */
+	init->iinlim_max = 0x3f;
 
 	for (i = 0; i < ARRAY_SIZE(props); i++) {
 		ret = device_property_read_u32(bq->dev, props[i].name,
-- 
2.33.1


  reply	other threads:[~2021-11-07 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07 20:19 [PATCH 1/4] bq25890_charger: Rename IILIM field to IINLIM Yauhen Kharuzhy
2021-11-07 20:19 ` Yauhen Kharuzhy [this message]
2021-11-07 20:41   ` [PATCH 2/4] bq25890: Add max input current limit property Hans de Goede
2021-11-07 21:08     ` Yauhen Kharuzhy
2021-11-07 22:05       ` Hans de Goede
2021-11-07 20:20 ` [PATCH 3/4] power supply bq25890-charger: Handle temperature faults Yauhen Kharuzhy
2021-11-07 20:46   ` Hans de Goede
2021-11-07 20:20 ` [PATCH 4/4] bq25890_charger: Enable continuous conversion for ADC at charging Yauhen Kharuzhy
2021-11-07 20:48   ` Hans de Goede
2021-11-15 15:23     ` Sebastian Reichel
2021-11-15 15:40       ` Hans de Goede
2021-11-07 20:29 ` [PATCH 1/4] bq25890_charger: Rename IILIM field to IINLIM Hans de Goede

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=20211107202001.54579-2-jekhor@gmail.com \
    --to=jekhor@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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