mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
power: pm8921-charger: distinguish between PMIC 3.0.1 and 3.0
Some workarounds that are required for PMIC die version 3.0 differ slightly for die version 3.0.1. Fix this by checking the PMIC subversion register to distinguish between 3.0 and 3.0.1. CRs-Fixed: 403150 Signed-off-by: David Keitel <dkeitel@codeaurora.org> (cherry picked from commit 913c55e2706c36132fd42f90c05530b8e55a26ed) Conflicts: drivers/power/pm8921-charger.c Change-Id: I11155d6180de09e1b9e0137f7943603d44102d07 Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org> Signed-off-by: Iliyan Malchev <malchev@google.com>
This commit is contained in:
parent
37c59c5e44
commit
dd8dd68b32
1 changed files with 17 additions and 2 deletions
|
@ -3914,10 +3914,12 @@ static void detect_battery_removal(struct pm8921_chg_chip *chip)
|
|||
#define CHG_VCP_EN BIT(0)
|
||||
#define CHG_BAT_TEMP_DIS_BIT BIT(2)
|
||||
#define SAFE_CURRENT_MA 1500
|
||||
#define PM_SUB_REV 0x001
|
||||
static int __devinit pm8921_chg_hw_init(struct pm8921_chg_chip *chip)
|
||||
{
|
||||
int rc;
|
||||
int vdd_safe;
|
||||
u8 subrev;
|
||||
|
||||
/* forcing 19p2mhz before accessing any charger registers */
|
||||
pm8921_chg_force_19p2mhz_clk(chip);
|
||||
|
@ -4105,8 +4107,21 @@ static int __devinit pm8921_chg_hw_init(struct pm8921_chg_chip *chip)
|
|||
}
|
||||
|
||||
/* Workarounds for die 3.0 */
|
||||
if (pm8xxx_get_revision(chip->dev->parent) == PM8XXX_REVISION_8921_3p0)
|
||||
pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0xAC);
|
||||
if (pm8xxx_get_revision(chip->dev->parent) == PM8XXX_REVISION_8921_3p0) {
|
||||
rc = pm8xxx_readb(chip->dev->parent, PM_SUB_REV, &subrev);
|
||||
if (rc) {
|
||||
pr_err("read failed: addr=%03X, rc=%d\n",
|
||||
PM_SUB_REV, rc);
|
||||
return rc;
|
||||
}
|
||||
/* Check if die 3.0.1 is present */
|
||||
if (subrev == 0x1)
|
||||
pm8xxx_writeb(chip->dev->parent,
|
||||
CHG_BUCK_CTRL_TEST3, 0xA4);
|
||||
else
|
||||
pm8xxx_writeb(chip->dev->parent,
|
||||
CHG_BUCK_CTRL_TEST3, 0xAC);
|
||||
}
|
||||
|
||||
/* Enable isub_fine resolution AICL for PM8917 */
|
||||
if (pm8xxx_get_version(chip->dev->parent) == PM8XXX_VERSION_8917) {
|
||||
|
|
Loading…
Reference in a new issue