From: Richard Tresidder <rtresidd@electromag.com.au>
To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
rtresidd@electromag.com.au, kstewart@linuxfoundation.org,
gregkh@linuxfoundation.org, tglx@linutronix.de,
rfontana@redhat.com, allison@lohutok.net,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree
Date: Tue, 30 Jul 2019 18:10:04 +0800 [thread overview]
Message-ID: <1564481404-39505-3-git-send-email-rtresidd@electromag.com.au> (raw)
In-Reply-To: <1564481404-39505-1-git-send-email-rtresidd@electromag.com.au>
Add the ability to force load a hot pluggable battery during boot where
there is no gpio detect method available and the module is statically
built. Normal polling will then occur on that battery when it is inserted.
Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
---
drivers/power/supply/sbs-battery.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 048d205..b55721d 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -816,6 +816,7 @@ static int sbs_probe(struct i2c_client *client,
struct power_supply_config psy_cfg = {};
int rc;
int irq;
+ bool dt_force_load;
sbs_desc = devm_kmemdup(&client->dev, &sbs_default_desc,
sizeof(*sbs_desc), GFP_KERNEL);
@@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
if (rc)
chip->poll_retry_count = 0;
+ dt_force_load = of_property_read_bool(client->dev.of_node,
+ "sbs,force-load");
+
if (pdata) {
chip->poll_retry_count = pdata->poll_retry_count;
chip->i2c_retry_count = pdata->i2c_retry_count;
@@ -890,7 +894,7 @@ static int sbs_probe(struct i2c_client *client,
* Before we register, we might need to make sure we can actually talk
* to the battery.
*/
- if (!(force_load || chip->gpio_detect)) {
+ if (!(force_load || chip->gpio_detect || dt_force_load)) {
rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
if (rc < 0) {
--
1.8.3.1
prev parent reply other threads:[~2019-07-30 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 10:10 [RESEND v2 0/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
2019-07-30 10:10 ` [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Richard Tresidder
2019-09-02 18:23 ` Sebastian Reichel
2019-07-30 10:10 ` Richard Tresidder [this message]
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=1564481404-39505-3-git-send-email-rtresidd@electromag.com.au \
--to=rtresidd@electromag.com.au \
--cc=allison@lohutok.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rfontana@redhat.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=tglx@linutronix.de \
/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).