mfd: pm8038: Enable the battery alarm module
The battery alarm module provides interrupts when the battery falls below or rises above a programmed threshold. This feature is useful to wakeup the device when the battery is in low voltage situations. (cherry picked from commit 6d538144cb02933cf27f425ad721541d80377b43) Change-Id: I5d17bacf363cab165156b62730ccf9c23c633b3c CRs-Fixed: 372690 Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> (cherry picked from commit 16f56979ee6876ce64f6dba8928a782825ff1275)
This commit is contained in:
committed by
Stephen Boyd
parent
3288119c79
commit
092d7c8abb
@@ -33,6 +33,11 @@
|
||||
#define REG_RTC_BASE 0x11D
|
||||
#define REG_IRQ_BASE 0x1BB
|
||||
|
||||
#define REG_BATT_ALARM_THRESH 0x023
|
||||
#define REG_BATT_ALARM_CTRL1 0x024
|
||||
#define REG_BATT_ALARM_CTRL2 0x021
|
||||
#define REG_BATT_ALARM_PWM_CTRL 0x020
|
||||
|
||||
#define REG_SPK_BASE 0x253
|
||||
#define REG_SPK_REGISTERS 6
|
||||
|
||||
@@ -336,6 +341,27 @@ static struct mfd_cell thermal_alarm_cell __devinitdata = {
|
||||
.pdata_size = sizeof(struct pm8xxx_tm_core_data),
|
||||
};
|
||||
|
||||
static const struct resource batt_alarm_cell_resources[] __devinitconst = {
|
||||
SINGLE_IRQ_RESOURCE("pm8921_batt_alarm_irq", PM8038_BATT_ALARM_IRQ),
|
||||
};
|
||||
|
||||
static struct pm8xxx_batt_alarm_core_data batt_alarm_cdata = {
|
||||
.irq_name = "pm8921_batt_alarm_irq",
|
||||
.reg_addr_threshold = REG_BATT_ALARM_THRESH,
|
||||
.reg_addr_ctrl1 = REG_BATT_ALARM_CTRL1,
|
||||
.reg_addr_ctrl2 = REG_BATT_ALARM_CTRL2,
|
||||
.reg_addr_pwm_ctrl = REG_BATT_ALARM_PWM_CTRL,
|
||||
};
|
||||
|
||||
static struct mfd_cell batt_alarm_cell __devinitdata = {
|
||||
.name = PM8XXX_BATT_ALARM_DEV_NAME,
|
||||
.id = -1,
|
||||
.resources = batt_alarm_cell_resources,
|
||||
.num_resources = ARRAY_SIZE(batt_alarm_cell_resources),
|
||||
.platform_data = &batt_alarm_cdata,
|
||||
.pdata_size = sizeof(struct pm8xxx_batt_alarm_core_data),
|
||||
};
|
||||
|
||||
static const struct resource ccadc_cell_resources[] __devinitconst = {
|
||||
SINGLE_IRQ_RESOURCE("PM8921_BMS_CCADC_EOC", PM8921_BMS_CCADC_EOC),
|
||||
};
|
||||
@@ -661,6 +687,13 @@ pm8038_add_subdevices(const struct pm8038_platform_data *pdata,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
ret = mfd_add_devices(pmic->dev, 0, &batt_alarm_cell, 1, NULL,
|
||||
irq_base);
|
||||
if (ret) {
|
||||
pr_err("Failed to add battery alarm subdevice ret=%d\n", ret);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (pdata->ccadc_pdata) {
|
||||
ccadc_cell.platform_data = pdata->ccadc_pdata;
|
||||
ccadc_cell.pdata_size =
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
/* PMIC Interrupts */
|
||||
#define PM8038_RTC_ALARM_IRQ PM8038_IRQ_BLOCK_BIT(4, 7)
|
||||
#define PM8038_BATT_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(5, 6)
|
||||
#define PM8038_PWRKEY_REL_IRQ PM8038_IRQ_BLOCK_BIT(6, 2)
|
||||
#define PM8038_PWRKEY_PRESS_IRQ PM8038_IRQ_BLOCK_BIT(6, 3)
|
||||
#define PM8038_KEYPAD_IRQ PM8038_IRQ_BLOCK_BIT(9, 2)
|
||||
|
||||
Reference in New Issue
Block a user