Skip to content

Commit cf1eb32

Browse files
committed
Revert "power: supply: sbs-battery: add PEC support"
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 79bcd5a. Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 805f64e commit cf1eb32

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

drivers/power/supply/sbs-battery.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ enum {
5151
REG_CHARGE_VOLTAGE,
5252
};
5353

54-
#define REG_ADDR_SPEC_INFO 0x1A
55-
#define SPEC_INFO_VERSION_MASK GENMASK(7, 4)
56-
#define SPEC_INFO_VERSION_SHIFT 4
57-
58-
#define SBS_VERSION_1_0 1
59-
#define SBS_VERSION_1_1 2
60-
#define SBS_VERSION_1_1_WITH_PEC 3
61-
6254
#define REG_ADDR_MANUFACTURE_DATE 0x1B
6355

6456
/* Battery Mode defines */
@@ -232,57 +224,14 @@ static void sbs_disable_charger_broadcasts(struct sbs_info *chip)
232224

233225
static int sbs_update_presence(struct sbs_info *chip, bool is_present)
234226
{
235-
struct i2c_client *client = chip->client;
236-
int retries = chip->i2c_retry_count;
237-
s32 ret = 0;
238-
u8 version;
239-
240227
if (chip->is_present == is_present)
241228
return 0;
242229

243230
if (!is_present) {
244231
chip->is_present = false;
245-
/* Disable PEC when no device is present */
246-
client->flags &= ~I2C_CLIENT_PEC;
247232
return 0;
248233
}
249234

250-
/* Check if device supports packet error checking and use it */
251-
while (retries > 0) {
252-
ret = i2c_smbus_read_word_data(client, REG_ADDR_SPEC_INFO);
253-
if (ret >= 0)
254-
break;
255-
256-
/*
257-
* Some batteries trigger the detection pin before the
258-
* I2C bus is properly connected. This works around the
259-
* issue.
260-
*/
261-
msleep(100);
262-
263-
retries--;
264-
}
265-
266-
if (ret < 0) {
267-
dev_dbg(&client->dev, "failed to read spec info: %d\n", ret);
268-
269-
/* fallback to old behaviour */
270-
client->flags &= ~I2C_CLIENT_PEC;
271-
chip->is_present = true;
272-
273-
return ret;
274-
}
275-
276-
version = (ret & SPEC_INFO_VERSION_MASK) >> SPEC_INFO_VERSION_SHIFT;
277-
278-
if (version == SBS_VERSION_1_1_WITH_PEC)
279-
client->flags |= I2C_CLIENT_PEC;
280-
else
281-
client->flags &= ~I2C_CLIENT_PEC;
282-
283-
dev_dbg(&client->dev, "PEC: %s\n", (client->flags & I2C_CLIENT_PEC) ?
284-
"enabled" : "disabled");
285-
286235
if (!chip->is_present && is_present && !chip->charger_broadcasts)
287236
sbs_disable_charger_broadcasts(chip);
288237

0 commit comments

Comments
 (0)