power: pm8921-charger: don't apply kickstart unless it is 8921 pmic

The current driver applies the kickstart routine in probe regardless of
the pmic variant. The kickstart is only required for 8921 pmic.
Fix this.

Change-Id: Ibe48766663e60f0a4febef983d97bb6e5370ea1a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Uma Maheshwari Bhiram <ubhira@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2013-01-30 21:51:37 -08:00 committed by Iliyan Malchev
parent 11e349fac2
commit e93af8fe40

View file

@ -2206,45 +2206,38 @@ int pm8921_batt_temperature(void)
return get_prop_batt_temp(the_chip);
}
static int pm8921_apply_19p2mhz_kickstart(struct pm8921_chg_chip *chip)
static int __pm8921_apply_19p2mhz_kickstart(struct pm8921_chg_chip *chip)
{
int err;
u8 temp;
unsigned long flags = 0;
spin_lock_irqsave(&lpm_lock, flags);
err = pm8921_chg_set_lpm(chip, 0);
if (err) {
pr_err("Error settig LPM rc=%d\n", err);
goto kick_err;
}
temp = 0xD1;
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
temp = 0xD3;
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
temp = 0xD1;
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
temp = 0xD5;
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
/* Wait a few clock cycles before re-enabling hw clock switching */
@ -2254,19 +2247,36 @@ static int pm8921_apply_19p2mhz_kickstart(struct pm8921_chg_chip *chip)
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
temp = 0xD0;
err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
if (err) {
pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
goto kick_err;
return err;
}
/* Wait for few clock cycles before re-enabling LPM */
udelay(32);
return 0;
}
static int pm8921_apply_19p2mhz_kickstart(struct pm8921_chg_chip *chip)
{
int err;
unsigned long flags = 0;
spin_lock_irqsave(&lpm_lock, flags);
err = pm8921_chg_set_lpm(chip, 0);
if (err) {
pr_err("Error settig LPM rc=%d\n", err);
goto kick_err;
}
__pm8921_apply_19p2mhz_kickstart(chip);
kick_err:
err = pm8921_chg_set_lpm(chip, 1);
if (err)
@ -4007,10 +4017,13 @@ static int __devinit pm8921_chg_hw_init(struct pm8921_chg_chip *chip)
int rc, vdd_safe, fcc_uah, safety_time = DEFAULT_SAFETY_MINUTES;
spin_lock_init(&lpm_lock);
rc = pm8921_apply_19p2mhz_kickstart(chip);
if (rc) {
pr_err("Failed to apply kickstart rc=%d\n", rc);
return rc;
if (pm8xxx_get_version(chip->dev->parent) == PM8XXX_VERSION_8921) {
rc = __pm8921_apply_19p2mhz_kickstart(chip);
if (rc) {
pr_err("Failed to apply kickstart rc=%d\n", rc);
return rc;
}
}
detect_battery_removal(chip);