mfd: pm8038: add ccadc cell

The 8038 has a ccadc (coulumb counter analog to digital converter) which
is used by the BMS for state of charge (SOC) reporting and is also used by
software to get instantaneous battery current. Without this cell the ccadc
is never probed and current readings and SOC are inaccurate.

CRs-Fixed: 372679
Change-Id: If323a35dda650067219f35e68395f9fd23f4d69b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2012-06-21 15:39:41 -07:00 committed by Stephen Boyd
parent b4d19cf0a5
commit 23b420290c

View file

@ -327,6 +327,17 @@ static struct mfd_cell thermal_alarm_cell __devinitdata = {
.pdata_size = sizeof(struct pm8xxx_tm_core_data),
};
static const struct resource ccadc_cell_resources[] __devinitconst = {
SINGLE_IRQ_RESOURCE("PM8921_BMS_CCADC_EOC", PM8921_BMS_CCADC_EOC),
};
static struct mfd_cell ccadc_cell __devinitdata = {
.name = PM8XXX_CCADC_DEV_NAME,
.id = -1,
.resources = ccadc_cell_resources,
.num_resources = ARRAY_SIZE(ccadc_cell_resources),
};
static struct pm8xxx_vreg regulator_data[] = {
/* name pc_name ctrl test hpm_min */
NLDO1200("8038_l1", 0x0AE, 0x0AF, LDO_1200),
@ -641,6 +652,19 @@ pm8038_add_subdevices(const struct pm8038_platform_data *pdata,
goto bail;
}
if (pdata->ccadc_pdata) {
ccadc_cell.platform_data = pdata->ccadc_pdata;
ccadc_cell.pdata_size =
sizeof(struct pm8xxx_ccadc_platform_data);
ret = mfd_add_devices(pmic->dev, 0, &ccadc_cell, 1, NULL,
irq_base);
if (ret) {
pr_err("Failed to add ccadc subdevice ret=%d\n", ret);
goto bail;
}
}
return 0;
bail:
if (pmic->irq_chip) {