power: smb135x: fix parallel mode i2c errors from incorrect check

Currently the smb135x-charger driver checks for the presence of the
smb135x chip in the smb135x_parallel_set_chg_present function regardless
of whether or not the primary charger is calling it to notify of
presence or removal. This is incorrect, as the check will always fail
upon removal if the VDDCAP pin on the primary charger falls fast enough
and puts the smb135x parallel charger in suspend. This causes subsequent
parallel charging enablements to fail to run the setup routines, and
thus fail enabling parallel charger altogether.

Fix this by only checking for smb135x chip presence upon the primary
charger notifying the driver of presence, and not upon removal.

CRs-Fixed: 877809
Change-Id: Ie9e2cf2979d41951fce53a213d077299f519fc6f
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
This commit is contained in:
Xiaozhe Shi 2015-08-06 17:43:48 -07:00 committed by Gerrit - the friendly Code Review server
parent 6ca9a27466
commit 2edc19156f
1 changed files with 7 additions and 7 deletions

View File

@ -1731,13 +1731,6 @@ static int smb135x_parallel_set_chg_present(struct smb135x_chg *chip,
u8 val;
int rc;
/* Check if SMB135x is present */
rc = smb135x_read(chip, VERSION1_REG, &val);
if (rc) {
pr_debug("Failed to detect smb135x-parallel charger may be absent\n");
return -ENODEV;
}
if (present == chip->parallel_charger_present) {
pr_debug("present %d -> %d, skipping\n",
chip->parallel_charger_present, present);
@ -1745,6 +1738,13 @@ static int smb135x_parallel_set_chg_present(struct smb135x_chg *chip,
}
if (present) {
/* Check if SMB135x is present */
rc = smb135x_read(chip, VERSION1_REG, &val);
if (rc) {
pr_debug("Failed to detect smb135x-parallel charger may be absent\n");
return -ENODEV;
}
rc = smb135x_enable_volatile_writes(chip);
if (rc < 0) {
dev_err(chip->dev,