From: "Angus Ainslie (Purism)" <angus@akkea.ca>
To: angus.ainslie@puri.sm
Cc: Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Eric Kuzmenko <eric.kuzmenko@puri.sm>,
Angus Ainslie <angus@akkea.ca>
Subject: [PATCH 1/2] power: supply: bq25890: Add support for setting bq25890 and bq25896's VINDPM
Date: Mon, 20 May 2019 11:07:11 -0700 [thread overview]
Message-ID: <20190520180712.32405-2-angus@akkea.ca> (raw)
In-Reply-To: <20190520180712.32405-1-angus@akkea.ca>
From: Eric Kuzmenko <eric.kuzmenko@puri.sm>
The bq25890 has low voltage protection on VIN. Allow the register
to be set from the device tree.
Signed-off-by: Eric Kuzmenko <eric.kuzmenko@puri.sm>
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
---
drivers/power/supply/bq25890_charger.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 66991e6f75d9..34fc89776994 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -75,6 +75,8 @@ struct bq25890_init_data {
u8 boosti; /* boost current limit */
u8 boostf; /* boost frequency */
u8 ilim_en; /* enable ILIM pin */
+ u8 force_vindpm;/* force vinmin threshold */
+ u8 vindpm; /* vinmin threshold */
u8 treg; /* thermal regulation threshold */
};
@@ -250,6 +252,7 @@ enum bq25890_table_ids {
TBL_VREG,
TBL_BOOSTV,
TBL_SYSVMIN,
+ TBL_VINDPM,
/* lookup tables */
TBL_TREG,
@@ -289,6 +292,7 @@ static const union {
[TBL_VREG] = { .rt = {3840000, 4608000, 16000} }, /* uV */
[TBL_BOOSTV] = { .rt = {4550000, 5510000, 64000} }, /* uV */
[TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} }, /* uV */
+ [TBL_VINDPM] = { .rt = {2600000, 15300000, 100000} }, /* uV */
/* lookup tables */
[TBL_TREG] = { .lt = {bq25890_treg_tbl, BQ25890_TREG_TBL_SIZE} },
@@ -621,6 +625,8 @@ static int bq25890_hw_init(struct bq25890_device *bq)
{F_BOOSTI, bq->init_data.boosti},
{F_BOOSTF, bq->init_data.boostf},
{F_EN_ILIM, bq->init_data.ilim_en},
+ {F_FORCE_VINDPM, bq->init_data.force_vindpm},
+ {F_VINDPM, bq->init_data.vindpm},
{F_TREG, bq->init_data.treg}
};
@@ -783,11 +789,14 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
{"ti,boost-max-current", false, TBL_BOOSTI, &init->boosti},
/* optional properties */
- {"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg}
+ {"ti,thermal-regulation-threshold",
+ true, TBL_TREG, &init->treg},
+ {"ti,vinmin-threshold", true, TBL_VINDPM, &init->vindpm}
};
/* initialize data for optional properties */
init->treg = 3; /* 120 degrees Celsius */
+ init->vindpm = 0x12; /* 4.4V */
for (i = 0; i < ARRAY_SIZE(props); i++) {
ret = device_property_read_u32(bq->dev, props[i].name,
@@ -820,6 +829,8 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
init->ilim_en = device_property_read_bool(bq->dev, "ti,use-ilim-pin");
init->boostf = device_property_read_bool(bq->dev, "ti,boost-low-freq");
+ init->force_vindpm =
+ device_property_read_bool(bq->dev, "ti,use-vinmin-threshold");
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2019-05-20 18:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 18:07 [PATCH 0/2] Allow VINDPM to be set in the device tree Angus Ainslie (Purism)
2019-05-20 18:07 ` Angus Ainslie (Purism) [this message]
2019-05-20 18:07 ` [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties Angus Ainslie (Purism)
2019-06-13 23:09 ` Rob Herring
2019-06-25 22:13 ` Sebastian Reichel
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=20190520180712.32405-2-angus@akkea.ca \
--to=angus@akkea.ca \
--cc=angus.ainslie@puri.sm \
--cc=devicetree@vger.kernel.org \
--cc=eric.kuzmenko@puri.sm \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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).