Revert "power: supply: sbs-battery: add PEC support"
authorSebastian Reichel <sre@kernel.org>
Tue, 2 Jun 2020 14:36:24 +0000 (16:36 +0200)
committerSebastian Reichel <sre@kernel.org>
Tue, 2 Jun 2020 14:59:08 +0000 (16:59 +0200)
This depends on the simplification of sbs_read_string_data, which
breaks booting exynos5 based chromebooks. More investigation is
required, so this patch and the simplification patch are reverted
for this merge window.

Note, that this is only a partial revert, since sbs_update_presence()
has not been removed. It is also required for the charger broadcast
disabling.

This reverts commit 79bcd5a4a66076a8a8dacd7f4a3be1952283aef4.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/sbs-battery.c

index f4f73e669460a9918946bedf78f876d9fc49ed80..00dfd9e9ac935ee7932e81628ba25b500081c764 100644 (file)
@@ -51,14 +51,6 @@ enum {
        REG_CHARGE_VOLTAGE,
 };
 
-#define REG_ADDR_SPEC_INFO             0x1A
-#define SPEC_INFO_VERSION_MASK         GENMASK(7, 4)
-#define SPEC_INFO_VERSION_SHIFT                4
-
-#define SBS_VERSION_1_0                        1
-#define SBS_VERSION_1_1                        2
-#define SBS_VERSION_1_1_WITH_PEC       3
-
 #define REG_ADDR_MANUFACTURE_DATE      0x1B
 
 /* Battery Mode defines */
@@ -232,57 +224,14 @@ exit:
 
 static int sbs_update_presence(struct sbs_info *chip, bool is_present)
 {
-       struct i2c_client *client = chip->client;
-       int retries = chip->i2c_retry_count;
-       s32 ret = 0;
-       u8 version;
-
        if (chip->is_present == is_present)
                return 0;
 
        if (!is_present) {
                chip->is_present = false;
-               /* Disable PEC when no device is present */
-               client->flags &= ~I2C_CLIENT_PEC;
                return 0;
        }
 
-       /* Check if device supports packet error checking and use it */
-       while (retries > 0) {
-               ret = i2c_smbus_read_word_data(client, REG_ADDR_SPEC_INFO);
-               if (ret >= 0)
-                       break;
-
-               /*
-                * Some batteries trigger the detection pin before the
-                * I2C bus is properly connected. This works around the
-                * issue.
-                */
-               msleep(100);
-
-               retries--;
-       }
-
-       if (ret < 0) {
-               dev_dbg(&client->dev, "failed to read spec info: %d\n", ret);
-
-               /* fallback to old behaviour */
-               client->flags &= ~I2C_CLIENT_PEC;
-               chip->is_present = true;
-
-               return ret;
-       }
-
-       version = (ret & SPEC_INFO_VERSION_MASK) >> SPEC_INFO_VERSION_SHIFT;
-
-       if (version == SBS_VERSION_1_1_WITH_PEC)
-               client->flags |= I2C_CLIENT_PEC;
-       else
-               client->flags &= ~I2C_CLIENT_PEC;
-
-       dev_dbg(&client->dev, "PEC: %s\n", (client->flags & I2C_CLIENT_PEC) ?
-               "enabled" : "disabled");
-
        if (!chip->is_present && is_present && !chip->charger_broadcasts)
                sbs_disable_charger_broadcasts(chip);