From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Sebastian Reichel" <sre@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Andrew F. Davis" <afd@ti.com>, "Pali Rohár" <pali@kernel.org>,
"Dan Murphy" <dmurphy@ti.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/7] power: supply: bq27xxx: add separate flag for capacity inaccurate
Date: Tue, 8 Sep 2020 22:13:18 +0200 [thread overview]
Message-ID: <20200908201319.3567-6-krzk@kernel.org> (raw)
In-Reply-To: <20200908201319.3567-1-krzk@kernel.org>
bq27000, bq27010 and upcoming bq34z100 have a Capacity Inaccurate flag.
However except this similarity, bq34z100 is quite different than
bq27000/bq27010, so flag BQ27XXX_O_ZERO cannot be reused here. Add
a new bit flag describing this capability.
No functional change for bq27000 and bq27010.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/power/supply/bq27xxx_battery.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 88cdad0ecb08..cda03e1f9586 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -856,6 +856,7 @@ static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
#define BQ27XXX_O_RAM BIT(4)
#define BQ27Z561_O_BITS BIT(5)
#define BQ27XXX_O_SOC_SI BIT(6) /* SoC is single register */
+#define BQ27XXX_O_HAS_CI BIT(7) /* has Capacity Inaccurate flag */
#define BQ27XXX_DATA(ref, key, opt) { \
.opts = (opt), \
@@ -873,8 +874,8 @@ static struct {
enum power_supply_property *props;
size_t props_size;
} bq27xxx_chip_data[] = {
- [BQ27000] = BQ27XXX_DATA(bq27000, 0 , BQ27XXX_O_ZERO | BQ27XXX_O_SOC_SI),
- [BQ27010] = BQ27XXX_DATA(bq27010, 0 , BQ27XXX_O_ZERO | BQ27XXX_O_SOC_SI),
+ [BQ27000] = BQ27XXX_DATA(bq27000, 0 , BQ27XXX_O_ZERO | BQ27XXX_O_SOC_SI | BQ27XXX_O_HAS_CI),
+ [BQ27010] = BQ27XXX_DATA(bq27010, 0 , BQ27XXX_O_ZERO | BQ27XXX_O_SOC_SI | BQ27XXX_O_HAS_CI),
[BQ2750X] = BQ27XXX_DATA(bq2750x, 0 , BQ27XXX_O_OTDC),
[BQ2751X] = BQ27XXX_DATA(bq2751x, 0 , BQ27XXX_O_OTDC),
[BQ2752X] = BQ27XXX_DATA(bq2752x, 0 , BQ27XXX_O_OTDC),
@@ -1659,7 +1660,7 @@ static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di)
void bq27xxx_battery_update(struct bq27xxx_device_info *di)
{
struct bq27xxx_reg_cache cache = {0, };
- bool has_ci_flag = di->opts & BQ27XXX_O_ZERO;
+ bool has_ci_flag = di->opts & BQ27XXX_O_HAS_CI;
bool has_singe_flag = di->opts & BQ27XXX_O_ZERO;
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
--
2.17.1
next prev parent reply other threads:[~2020-09-08 20:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 20:13 [PATCH 1/7] dt-bindings: power: bq27xxx: add bq34z100 Krzysztof Kozlowski
2020-09-08 20:13 ` [PATCH 2/7] power: supply: bq27xxx: report "not charging" on all types Krzysztof Kozlowski
2020-09-08 20:54 ` Dan Murphy
2020-09-09 6:35 ` Krzysztof Kozlowski
2020-09-08 20:13 ` [PATCH 3/7] power: supply: bq27xxx: adjust whitespace Krzysztof Kozlowski
2020-09-08 20:13 ` [PATCH 4/7] power: supply: bq27xxx: use BIT() for bit flags Krzysztof Kozlowski
2020-09-08 20:53 ` Dan Murphy
2020-09-09 6:38 ` Krzysztof Kozlowski
2020-09-08 20:13 ` [PATCH 5/7] power: supply: bq27xxx: add separate flag for single SoC register Krzysztof Kozlowski
2020-09-08 20:13 ` Krzysztof Kozlowski [this message]
2020-09-08 20:13 ` [PATCH 7/7] power: supply: bq27xxx: add support for TI bq34z100 Krzysztof Kozlowski
2020-09-15 17:12 ` [PATCH 1/7] dt-bindings: power: bq27xxx: add bq34z100 Rob Herring
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=20200908201319.3567-6-krzk@kernel.org \
--to=krzk@kernel.org \
--cc=afd@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pali@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).