linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: "Sebastian Reichel" <sre@kernel.org>,
	"Antoni Aloy Torrens" <aaloytorrens@gmail.com>,
	"Nikola Milosavljević" <mnidza@outlook.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/2] power: supply: sbs-battery: Fall back to Li-ion battery type for bq20z75
Date: Tue, 11 May 2021 01:08:27 +0300	[thread overview]
Message-ID: <20210510220827.11595-2-digetx@gmail.com> (raw)
In-Reply-To: <20210510220827.11595-1-digetx@gmail.com>

The older bq20z75 controller doesn't support reporting the battery type
and the type is Li-ion in this case.

Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com> # TF101
Tested-by: Nikola Milosavljević <mnidza@outlook.com> # TF101
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/power/supply/sbs-battery.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index b71fbf543428..fec6c139d4ff 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -813,9 +813,17 @@ static int sbs_get_chemistry(struct i2c_client *client,
 	else
 		val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
 
-	if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN)
+	if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN) {
+		struct sbs_info *chip = i2c_get_clientdata(client);
+
 		dev_warn_once(&client->dev, "Unknown chemistry: %s\n", chemistry);
 
+		if (chip->flags & SBS_FLAGS_TI_BQ20ZX5) {
+			dev_warn_once(&client->dev, "Falling back to Li-ion\n");
+			val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.30.2


  reply	other threads:[~2021-05-10 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 22:08 [PATCH v1 1/2] power: supply: sbs-battery: Silence warning about unknown chemistry Dmitry Osipenko
2021-05-10 22:08 ` Dmitry Osipenko [this message]
2021-05-13 15:31   ` [PATCH v1 2/2] power: supply: sbs-battery: Fall back to Li-ion battery type for bq20z75 Sebastian Reichel
2021-05-14 13:16     ` Dmitry Osipenko
2021-05-13 15:11 ` [PATCH v1 1/2] power: supply: sbs-battery: Silence warning about unknown chemistry Sebastian Reichel
2021-05-14 13:13   ` Dmitry Osipenko

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=20210510220827.11595-2-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=aaloytorrens@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mnidza@outlook.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;
as well as URLs for NNTP newsgroup(s).