From e3f2396b7570751a7ddba996812fb608134fd63c Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Mon, 5 Oct 2020 00:46:01 +0200 Subject: power: supply: sbs-battery: chromebook workaround for PEC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Note, that some Chromebooks actually have been reported to have working PEC support (with I2C tunnel). Since the problem has not yet been fully understood this simply reverts all Chromebooks to not use PEC for now. Reported-by: "Milan P. Stanić" Reported-by: Vicente Bergas CC: Enric Balletbo i Serra Fixes: 7222bd603dd2 ("power: supply: sbs-battery: add PEC support") Tested-by: Vicente Bergas Tested-by: "Milan P. Stanić" Signed-off-by: Sebastian Reichel --- 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 49c3508a6b79..7439753fac87 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -280,6 +280,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"); -- cgit