From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Angus Ainslie <angus@akkea.ca>, Rob Herring <robh+dt@kernel.org>,
Sebastian Reichel <sre@kernel.org>,
Yauhen Kharuzhy <jekhor@gmail.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: [PATCH v3 6/8] power: bq25890: implement INPUT_CURRENT_LIMIT property
Date: Mon, 04 May 2020 21:47:47 +0200 [thread overview]
Message-ID: <f9bee8d1f65bf1f880752dc17cc390e5d566a93d.1588621247.git.mirq-linux@rere.qmqm.pl> (raw)
In-Reply-To: <cover.1588621247.git.mirq-linux@rere.qmqm.pl>
Report REG00.IINLIM value as INPUT_CURRENT_LIMIT property.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/power/supply/bq25890_charger.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index dfd7bf9a3a55..cb57125ea988 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -254,6 +254,7 @@ enum bq25890_table_ids {
/* range tables */
TBL_ICHG,
TBL_ITERM,
+ TBL_IILIM,
TBL_VREG,
TBL_BOOSTV,
TBL_SYSVMIN,
@@ -294,6 +295,7 @@ static const union {
/* TODO: BQ25896 has max ICHG 3008 mA */
[TBL_ICHG] = { .rt = {0, 5056000, 64000} }, /* uA */
[TBL_ITERM] = { .rt = {64000, 1024000, 64000} }, /* uA */
+ [TBL_IILIM] = { .rt = {50000, 3200000, 50000} }, /* uA */
[TBL_VREG] = { .rt = {3840000, 4608000, 16000} }, /* uV */
[TBL_BOOSTV] = { .rt = {4550000, 5510000, 64000} }, /* uV */
[TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} }, /* uV */
@@ -494,6 +496,14 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
val->intval = bq25890_find_val(bq->init_data.iterm, TBL_ITERM);
break;
+ case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+ ret = bq25890_field_read(bq, F_IILIM);
+ if (ret < 0)
+ return ret;
+
+ val->intval = bq25890_find_val(ret, TBL_IILIM);
+ break;
+
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
if (ret < 0)
@@ -692,6 +702,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
+ POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW,
};
--
2.20.1
next prev parent reply other threads:[~2020-05-04 19:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 19:47 [PATCH v3 0/8] power: supply: bq25890: fix and extend Michał Mirosław
2020-05-04 19:47 ` [PATCH v3 1/8] power: bq25890: use proper CURRENT_NOW property for I_BAT Michał Mirosław
2020-05-04 19:47 ` [PATCH v3 3/8] power: bq25890: update state on property read Michał Mirosław
2020-05-04 19:47 ` [PATCH v3 2/8] power: bq25890: fix ADC mode configuration Michał Mirosław
2020-05-04 19:47 ` [PATCH v3 4/8] power: bq25890: implement CHARGE_TYPE property Michał Mirosław
2020-05-04 19:47 ` [PATCH v3 5/8] power: bq25890: implement PRECHARGE_CURRENT property Michał Mirosław
2020-05-04 19:47 ` Michał Mirosław [this message]
2020-05-04 19:47 ` [PATCH v3 8/8] power: bq25890: document IBAT compensation DT properties Michał Mirosław
2020-05-12 22:59 ` Rob Herring
2020-05-04 19:47 ` [PATCH v3 7/8] power: bq25890: support IBAT compensation Michał Mirosław
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=f9bee8d1f65bf1f880752dc17cc390e5d566a93d.1588621247.git.mirq-linux@rere.qmqm.pl \
--to=mirq-linux@rere.qmqm.pl \
--cc=angus@akkea.ca \
--cc=devicetree@vger.kernel.org \
--cc=jekhor@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).