mfd: pm8921-core: add mfd cell for pm8921 battery alarm device
Add an mfd cell for the PMIC 8921 battery alarm into the pm8921-core. Change-Id: Ia856c88050aa99822e6541311f40417ec63964d4 Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
66cc83fb29
commit
319e59cdc0
@@ -31,6 +31,11 @@
|
||||
#define REG_TEMP_ALARM_CTRL 0x1B
|
||||
#define REG_TEMP_ALARM_PWM 0x9B
|
||||
|
||||
#define REG_BATT_ALARM_THRESH 0x023
|
||||
#define REG_BATT_ALARM_CTRL1 0x024
|
||||
#define REG_BATT_ALARM_CTRL2 0x0AA
|
||||
#define REG_BATT_ALARM_PWM_CTRL 0x0A3
|
||||
|
||||
#define PM8921_VERSION_MASK 0xFFF0
|
||||
#define PM8921_VERSION_VALUE 0x06F0
|
||||
#define PM8921_REVISION_MASK 0x000F
|
||||
@@ -312,6 +317,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", PM8921_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 int __devinit
|
||||
pm8921_add_subdevices(const struct pm8921_platform_data *pdata,
|
||||
struct pm8921 *pmic)
|
||||
@@ -511,6 +537,14 @@ pm8921_add_subdevices(const struct pm8921_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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
bail:
|
||||
if (pmic->irq_chip) {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/mfd/pm8xxx/pwm.h>
|
||||
#include <linux/mfd/pm8xxx/misc.h>
|
||||
#include <linux/mfd/pm8xxx/tm.h>
|
||||
#include <linux/mfd/pm8xxx/batt-alarm.h>
|
||||
#include <linux/input/pmic8xxx-pwrkey.h>
|
||||
#include <linux/input/pmic8xxx-keypad.h>
|
||||
#include <linux/regulator/pm8921-regulator.h>
|
||||
@@ -51,6 +52,7 @@
|
||||
|
||||
/* PMIC Interrupts */
|
||||
#define PM8921_RTC_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(4, 7)
|
||||
#define PM8921_BATT_ALARM_IRQ PM8921_IRQ_BLOCK_BIT(5, 6)
|
||||
#define PM8921_PWRKEY_REL_IRQ PM8921_IRQ_BLOCK_BIT(6, 2)
|
||||
#define PM8921_PWRKEY_PRESS_IRQ PM8921_IRQ_BLOCK_BIT(6, 3)
|
||||
#define PM8921_KEYPAD_IRQ PM8921_IRQ_BLOCK_BIT(9, 2)
|
||||
|
||||
Reference in New Issue
Block a user