linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: sbs-battery: chromebook workaround for PEC
@ 2020-10-04 22:46 Sebastian Reichel
  2020-10-05 17:53 ` Vicente Bergas
  2020-10-08 19:07 ` Milan P. Stanić
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Reichel @ 2020-10-04 22:46 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-pm, kernel, Sebastian Reichel, Milan P. Stanić,
	Vicente Bergas, Enric Balletbo i Serra

Looks like the I2C tunnel implementation from Chromebook's
embedded controller does not handle PEC correctly. Fix this
by disabling PEC for batteries behind those I2C tunnels as
a workaround.

Reported-by: "Milan P. Stanić" <mps@arvanta.net>
Reported-by: Vicente Bergas <vicencb@gmail.com>
CC: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Fixes: 7222bd603dd2 ("power: supply: sbs-battery: add PEC support")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
Hi,

This is compile-tested only, since I do not have a chromebook at
hand. Please test if this fixes your issue.

-- Sebastian
---
 drivers/power/supply/sbs-battery.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 13192cbcce71..b6a538ebb378 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -279,6 +279,12 @@ static int sbs_update_presence(struct sbs_info *chip, bool is_present)
 	else
 		client->flags &= ~I2C_CLIENT_PEC;
 
+	if (of_device_is_compatible(client->dev.parent->of_node, "google,cros-ec-i2c-tunnel")
+	    && client->flags & I2C_CLIENT_PEC) {
+		dev_info(&client->dev, "Disabling PEC because of broken Cros-EC implementation\n");
+		client->flags &= ~I2C_CLIENT_PEC;
+	}
+
 	dev_dbg(&client->dev, "PEC: %s\n", (client->flags & I2C_CLIENT_PEC) ?
 		"enabled" : "disabled");
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-10 22:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-04 22:46 [PATCH] power: supply: sbs-battery: chromebook workaround for PEC Sebastian Reichel
2020-10-05 17:53 ` Vicente Bergas
2020-10-05 18:47   ` Milan P. Stanić
2020-10-05 20:33     ` Milan P. Stanić
2020-10-08 19:07 ` Milan P. Stanić
2020-10-10 11:09   ` Sebastian Reichel

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).