]> git.baikalelectronics.ru Git - kernel.git/commitdiff
power: supply: sbs-battery: chromebook workaround for PEC
authorSebastian Reichel <sebastian.reichel@collabora.com>
Sun, 4 Oct 2020 22:46:01 +0000 (00:46 +0200)
committerSebastian Reichel <sre@kernel.org>
Thu, 8 Oct 2020 23:09:37 +0000 (01:09 +0200)
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ć" <mps@arvanta.net>
Reported-by: Vicente Bergas <vicencb@gmail.com>
CC: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Fixes: 4b4f31aa14de ("power: supply: sbs-battery: add PEC support")
Tested-by: Vicente Bergas <vicencb@gmail.com>
Tested-by: "Milan P. Stanić" <mps@arvanta.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/sbs-battery.c

index 49c3508a6b799bb4cf2fadc9fad62329ba965660..7439753fac87838fa09cad5f987c37e1eeba2256 100644 (file)
@@ -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");