forked from Minki/linux
Merge branch 'tb-power-2' of git://git.linaro.org/people/ljones/linux-3.0-ux500
Pull a huge ab8500/pm2301 pile of changes from Lee Jones. Lee did an awesome job cleaning this stuff up and thus brought ab8500 Stericsson's development tree much closer to the mainline. Even more changes to come, though. Conflicts: drivers/power/Kconfig
This commit is contained in:
commit
58a1c154d4
@ -749,6 +749,12 @@ static struct resource ab8500_charger_resources[] = {
|
||||
.end = AB8500_INT_CH_WD_EXP,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
{
|
||||
.name = "VBUS_CH_DROP_END",
|
||||
.start = AB8500_INT_VBUS_CH_DROP_END,
|
||||
.end = AB8500_INT_VBUS_CH_DROP_END,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource ab8500_btemp_resources[] = {
|
||||
|
@ -352,6 +352,13 @@ config BATTERY_GOLDFISH
|
||||
Say Y to enable support for the battery and AC power in the
|
||||
Goldfish emulator.
|
||||
|
||||
config CHARGER_PM2301
|
||||
bool "PM2301 Battery Charger Driver"
|
||||
depends on AB8500_BM
|
||||
help
|
||||
Say Y to include support for PM2301 charger driver.
|
||||
Depends on AB8500 battery management core.
|
||||
|
||||
source "drivers/power/reset/Kconfig"
|
||||
|
||||
endif # POWER_SUPPLY
|
||||
|
@ -47,6 +47,7 @@ obj-$(CONFIG_CHARGER_LP8727) += lp8727_charger.o
|
||||
obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o
|
||||
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
|
||||
obj-$(CONFIG_CHARGER_MANAGER) += charger-manager.o
|
||||
obj-$(CONFIG_CHARGER_PM2301) += pm2301_charger.o
|
||||
obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
|
||||
obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o
|
||||
obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o
|
||||
|
@ -39,6 +39,9 @@
|
||||
#define BTEMP_BATCTRL_CURR_SRC_7UA 7
|
||||
#define BTEMP_BATCTRL_CURR_SRC_20UA 20
|
||||
|
||||
#define BTEMP_BATCTRL_CURR_SRC_16UA 16
|
||||
#define BTEMP_BATCTRL_CURR_SRC_18UA 18
|
||||
|
||||
#define to_ab8500_btemp_device_info(x) container_of((x), \
|
||||
struct ab8500_btemp, btemp_psy);
|
||||
|
||||
@ -212,10 +215,18 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
|
||||
|
||||
/* Only do this for batteries with internal NTC */
|
||||
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
|
||||
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
|
||||
curr = BAT_CTRL_7U_ENA;
|
||||
else
|
||||
curr = BAT_CTRL_20U_ENA;
|
||||
|
||||
if (is_ab9540(di->parent) || is_ab8505(di->parent)) {
|
||||
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_16UA)
|
||||
curr = BAT_CTRL_16U_ENA;
|
||||
else
|
||||
curr = BAT_CTRL_18U_ENA;
|
||||
} else {
|
||||
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
|
||||
curr = BAT_CTRL_7U_ENA;
|
||||
else
|
||||
curr = BAT_CTRL_20U_ENA;
|
||||
}
|
||||
|
||||
dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source);
|
||||
|
||||
@ -246,11 +257,22 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
|
||||
} else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
|
||||
dev_dbg(di->dev, "Disable BATCTRL curr source\n");
|
||||
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(di->dev,
|
||||
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
|
||||
BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA,
|
||||
~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA));
|
||||
if (is_ab9540(di->parent) || is_ab8505(di->parent)) {
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(
|
||||
di->dev,
|
||||
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
|
||||
BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA,
|
||||
~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA));
|
||||
} else {
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(
|
||||
di->dev,
|
||||
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
|
||||
BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA,
|
||||
~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA));
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
dev_err(di->dev, "%s failed disabling current source\n",
|
||||
__func__);
|
||||
@ -292,11 +314,20 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
|
||||
* if we got an error above
|
||||
*/
|
||||
disable_curr_source:
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(di->dev,
|
||||
if (is_ab9540(di->parent) || is_ab8505(di->parent)) {
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(di->dev,
|
||||
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
|
||||
BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA,
|
||||
~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA));
|
||||
} else {
|
||||
/* Write 0 to the curr bits */
|
||||
ret = abx500_mask_and_set_register_interruptible(di->dev,
|
||||
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
|
||||
BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA,
|
||||
~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA));
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
dev_err(di->dev, "%s failed disabling current source\n",
|
||||
__func__);
|
||||
@ -510,8 +541,11 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
|
||||
{
|
||||
int res;
|
||||
u8 i;
|
||||
if (is_ab9540(di->parent) || is_ab8505(di->parent))
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA;
|
||||
else
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
|
||||
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
|
||||
di->bm->batt_id = BATTERY_UNKNOWN;
|
||||
|
||||
res = ab8500_btemp_get_batctrl_res(di);
|
||||
@ -549,8 +583,13 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
|
||||
*/
|
||||
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL &&
|
||||
di->bm->batt_id == 1) {
|
||||
dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
|
||||
if (is_ab9540(di->parent) || is_ab8505(di->parent)) {
|
||||
dev_dbg(di->dev, "Set BATCTRL current source to 16uA\n");
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA;
|
||||
} else {
|
||||
dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
|
||||
di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
|
||||
}
|
||||
}
|
||||
|
||||
return di->bm->batt_id;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@
|
||||
|
||||
#define NBR_AVG_SAMPLES 20
|
||||
|
||||
#define LOW_BAT_CHECK_INTERVAL (2 * HZ)
|
||||
#define LOW_BAT_CHECK_INTERVAL (HZ / 16) /* 62.5 ms */
|
||||
|
||||
#define VALID_CAPACITY_SEC (45 * 60) /* 45 minutes */
|
||||
#define BATT_OK_MIN 2360 /* mV */
|
||||
@ -169,6 +169,7 @@ struct inst_curr_result_list {
|
||||
* @recovery_cnt: Counter for recovery mode
|
||||
* @high_curr_cnt: Counter for high current mode
|
||||
* @init_cnt: Counter for init mode
|
||||
* @low_bat_cnt Counter for number of consecutive low battery measures
|
||||
* @nbr_cceoc_irq_cnt Counter for number of CCEOC irqs received since enabled
|
||||
* @recovery_needed: Indicate if recovery is needed
|
||||
* @high_curr_mode: Indicate if we're in high current mode
|
||||
@ -210,6 +211,7 @@ struct ab8500_fg {
|
||||
int recovery_cnt;
|
||||
int high_curr_cnt;
|
||||
int init_cnt;
|
||||
int low_bat_cnt;
|
||||
int nbr_cceoc_irq_cnt;
|
||||
bool recovery_needed;
|
||||
bool high_curr_mode;
|
||||
@ -1639,7 +1641,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di)
|
||||
|
||||
if (di->recovery_needed) {
|
||||
ab8500_fg_discharge_state_to(di,
|
||||
AB8500_FG_DISCHARGE_RECOVERY);
|
||||
AB8500_FG_DISCHARGE_INIT_RECOVERY);
|
||||
|
||||
queue_delayed_work(di->fg_wq,
|
||||
&di->fg_periodic_work, 0);
|
||||
@ -1879,25 +1881,29 @@ static void ab8500_fg_low_bat_work(struct work_struct *work)
|
||||
|
||||
/* Check if LOW_BAT still fulfilled */
|
||||
if (vbat < di->bm->fg_params->lowbat_threshold) {
|
||||
di->flags.low_bat = true;
|
||||
dev_warn(di->dev, "Battery voltage still LOW\n");
|
||||
|
||||
/*
|
||||
* We need to re-schedule this check to be able to detect
|
||||
* if the voltage increases again during charging
|
||||
*/
|
||||
queue_delayed_work(di->fg_wq, &di->fg_low_bat_work,
|
||||
round_jiffies(LOW_BAT_CHECK_INTERVAL));
|
||||
/* Is it time to shut down? */
|
||||
if (di->low_bat_cnt < 1) {
|
||||
di->flags.low_bat = true;
|
||||
dev_warn(di->dev, "Shut down pending...\n");
|
||||
} else {
|
||||
/*
|
||||
* Else we need to re-schedule this check to be able to detect
|
||||
* if the voltage increases again during charging or
|
||||
* due to decreasing load.
|
||||
*/
|
||||
di->low_bat_cnt--;
|
||||
dev_warn(di->dev, "Battery voltage still LOW\n");
|
||||
queue_delayed_work(di->fg_wq, &di->fg_low_bat_work,
|
||||
round_jiffies(LOW_BAT_CHECK_INTERVAL));
|
||||
}
|
||||
} else {
|
||||
di->flags.low_bat = false;
|
||||
di->flags.low_bat_delay = false;
|
||||
di->low_bat_cnt = 10;
|
||||
dev_warn(di->dev, "Battery voltage OK again\n");
|
||||
}
|
||||
|
||||
/* This is needed to dispatch LOW_BAT */
|
||||
ab8500_fg_check_capacity_limits(di, false);
|
||||
|
||||
/* Set this flag to check if LOW_BAT IRQ still occurs */
|
||||
di->flags.low_bat_delay = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2056,6 +2062,7 @@ static irqreturn_t ab8500_fg_lowbatf_handler(int irq, void *_di)
|
||||
{
|
||||
struct ab8500_fg *di = _di;
|
||||
|
||||
/* Initiate handling in ab8500_fg_low_bat_work() if not already initiated. */
|
||||
if (!di->flags.low_bat_delay) {
|
||||
dev_warn(di->dev, "Battery voltage is below LOW threshold\n");
|
||||
di->flags.low_bat_delay = true;
|
||||
@ -2243,7 +2250,8 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
|
||||
case POWER_SUPPLY_PROP_TECHNOLOGY:
|
||||
switch (ext->type) {
|
||||
case POWER_SUPPLY_TYPE_BATTERY:
|
||||
if (!di->flags.batt_id_received) {
|
||||
if (!di->flags.batt_id_received &&
|
||||
di->bm->batt_id != BATTERY_UNKNOWN) {
|
||||
const struct abx500_battery_type *b;
|
||||
|
||||
b = &(di->bm->bat_type[di->bm->batt_id]);
|
||||
@ -2563,6 +2571,11 @@ static int ab8500_fg_suspend(struct platform_device *pdev,
|
||||
struct ab8500_fg *di = platform_get_drvdata(pdev);
|
||||
|
||||
flush_delayed_work(&di->fg_periodic_work);
|
||||
flush_work(&di->fg_work);
|
||||
flush_work(&di->fg_acc_cur_work);
|
||||
flush_delayed_work(&di->fg_reinit_work);
|
||||
flush_delayed_work(&di->fg_low_bat_work);
|
||||
flush_delayed_work(&di->fg_check_hw_failure_work);
|
||||
|
||||
/*
|
||||
* If the FG is enabled we will disable it before going to suspend
|
||||
@ -2698,6 +2711,12 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||
INIT_DEFERRABLE_WORK(&di->fg_check_hw_failure_work,
|
||||
ab8500_fg_check_hw_failure_work);
|
||||
|
||||
/* Reset battery low voltage flag */
|
||||
di->flags.low_bat = false;
|
||||
|
||||
/* Initialize low battery counter */
|
||||
di->low_bat_cnt = 10;
|
||||
|
||||
/* Initialize OVV, and other registers */
|
||||
ret = ab8500_fg_init_hw_registers(di);
|
||||
if (ret) {
|
||||
|
@ -445,8 +445,18 @@ static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di)
|
||||
{
|
||||
/* Check if charger exists and kick watchdog if charging */
|
||||
if (di->ac_chg && di->ac_chg->ops.kick_wd &&
|
||||
di->chg_info.online_chg & AC_CHG)
|
||||
di->chg_info.online_chg & AC_CHG) {
|
||||
/*
|
||||
* If AB charger watchdog expired, pm2xxx charging
|
||||
* gets disabled. To be safe, kick both AB charger watchdog
|
||||
* and pm2xxx watchdog.
|
||||
*/
|
||||
if (di->ac_chg->external &&
|
||||
di->usb_chg && di->usb_chg->ops.kick_wd)
|
||||
di->usb_chg->ops.kick_wd(di->usb_chg);
|
||||
|
||||
return di->ac_chg->ops.kick_wd(di->ac_chg);
|
||||
}
|
||||
else if (di->usb_chg && di->usb_chg->ops.kick_wd &&
|
||||
di->chg_info.online_chg & USB_CHG)
|
||||
return di->usb_chg->ops.kick_wd(di->usb_chg);
|
||||
@ -603,6 +613,8 @@ static void abx500_chargalg_hold_charging(struct abx500_chargalg *di)
|
||||
static void abx500_chargalg_start_charging(struct abx500_chargalg *di,
|
||||
int vset, int iset)
|
||||
{
|
||||
bool start_chargalg_wd = true;
|
||||
|
||||
switch (di->chg_info.charger_type) {
|
||||
case AC_CHG:
|
||||
dev_dbg(di->dev,
|
||||
@ -620,8 +632,12 @@ static void abx500_chargalg_start_charging(struct abx500_chargalg *di,
|
||||
|
||||
default:
|
||||
dev_err(di->dev, "Unknown charger to charge from\n");
|
||||
start_chargalg_wd = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (start_chargalg_wd && !delayed_work_pending(&di->chargalg_wd_work))
|
||||
queue_delayed_work(di->chargalg_wq, &di->chargalg_wd_work, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1622,6 +1638,9 @@ static int abx500_chargalg_get_property(struct power_supply *psy,
|
||||
val->intval = POWER_SUPPLY_HEALTH_COLD;
|
||||
else
|
||||
val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
|
||||
} else if (di->charge_state == STATE_SAFETY_TIMER_EXPIRED ||
|
||||
di->charge_state == STATE_SAFETY_TIMER_EXPIRED_INIT) {
|
||||
val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
|
||||
} else {
|
||||
val->intval = POWER_SUPPLY_HEALTH_GOOD;
|
||||
}
|
||||
@ -1634,6 +1653,25 @@ static int abx500_chargalg_get_property(struct power_supply *psy,
|
||||
|
||||
/* Exposure to the sysfs interface */
|
||||
|
||||
/**
|
||||
* abx500_chargalg_sysfs_show() - sysfs show operations
|
||||
* @kobj: pointer to the struct kobject
|
||||
* @attr: pointer to the struct attribute
|
||||
* @buf: buffer that holds the parameter to send to userspace
|
||||
*
|
||||
* Returns a buffer to be displayed in user space
|
||||
*/
|
||||
static ssize_t abx500_chargalg_sysfs_show(struct kobject *kobj,
|
||||
struct attribute *attr, char *buf)
|
||||
{
|
||||
struct abx500_chargalg *di = container_of(kobj,
|
||||
struct abx500_chargalg, chargalg_kobject);
|
||||
|
||||
return sprintf(buf, "%d\n",
|
||||
di->susp_status.ac_suspended &&
|
||||
di->susp_status.usb_suspended);
|
||||
}
|
||||
|
||||
/**
|
||||
* abx500_chargalg_sysfs_charger() - sysfs store operations
|
||||
* @kobj: pointer to the struct kobject
|
||||
@ -1702,7 +1740,7 @@ static ssize_t abx500_chargalg_sysfs_charger(struct kobject *kobj,
|
||||
static struct attribute abx500_chargalg_en_charger = \
|
||||
{
|
||||
.name = "chargalg",
|
||||
.mode = S_IWUGO,
|
||||
.mode = S_IRUGO | S_IWUSR,
|
||||
};
|
||||
|
||||
static struct attribute *abx500_chargalg_chg[] = {
|
||||
@ -1711,6 +1749,7 @@ static struct attribute *abx500_chargalg_chg[] = {
|
||||
};
|
||||
|
||||
static const struct sysfs_ops abx500_chargalg_sysfs_ops = {
|
||||
.show = abx500_chargalg_sysfs_show,
|
||||
.store = abx500_chargalg_sysfs_charger,
|
||||
};
|
||||
|
||||
|
1088
drivers/power/pm2301_charger.c
Normal file
1088
drivers/power/pm2301_charger.c
Normal file
File diff suppressed because it is too large
Load Diff
513
drivers/power/pm2301_charger.h
Normal file
513
drivers/power/pm2301_charger.h
Normal file
@ -0,0 +1,513 @@
|
||||
/*
|
||||
* Copyright (C) ST-Ericsson SA 2012
|
||||
*
|
||||
* PM2301 power supply interface
|
||||
*
|
||||
* License terms: GNU General Public License (GPL), version 2
|
||||
*/
|
||||
|
||||
#ifndef PM2301_CHARGER_H
|
||||
#define PM2301_CHARGER_H
|
||||
|
||||
#define MAIN_WDOG_ENA 0x01
|
||||
#define MAIN_WDOG_KICK 0x02
|
||||
#define MAIN_WDOG_DIS 0x00
|
||||
#define CHARG_WD_KICK 0x01
|
||||
#define MAIN_CH_ENA 0x01
|
||||
#define MAIN_CH_NO_OVERSHOOT_ENA_N 0x02
|
||||
#define MAIN_CH_DET 0x01
|
||||
#define MAIN_CH_CV_ON 0x04
|
||||
#define OTP_ENABLE_WD 0x01
|
||||
|
||||
#define MAIN_CH_INPUT_CURR_SHIFT 4
|
||||
|
||||
#define LED_INDICATOR_PWM_ENA 0x01
|
||||
#define LED_INDICATOR_PWM_DIS 0x00
|
||||
#define LED_IND_CUR_5MA 0x04
|
||||
#define LED_INDICATOR_PWM_DUTY_252_256 0xBF
|
||||
|
||||
/* HW failure constants */
|
||||
#define MAIN_CH_TH_PROT 0x02
|
||||
#define MAIN_CH_NOK 0x01
|
||||
|
||||
/* Watchdog timeout constant */
|
||||
#define WD_TIMER 0x30 /* 4min */
|
||||
#define WD_KICK_INTERVAL (30 * HZ)
|
||||
|
||||
#define PM2XXX_NUM_INT_REG 0x6
|
||||
|
||||
/* Constant voltage/current */
|
||||
#define PM2XXX_CONST_CURR 0x0
|
||||
#define PM2XXX_CONST_VOLT 0x1
|
||||
|
||||
/* Lowest charger voltage is 3.39V -> 0x4E */
|
||||
#define LOW_VOLT_REG 0x4E
|
||||
|
||||
#define PM2XXX_BATT_CTRL_REG1 0x00
|
||||
#define PM2XXX_BATT_CTRL_REG2 0x01
|
||||
#define PM2XXX_BATT_CTRL_REG3 0x02
|
||||
#define PM2XXX_BATT_CTRL_REG4 0x03
|
||||
#define PM2XXX_BATT_CTRL_REG5 0x04
|
||||
#define PM2XXX_BATT_CTRL_REG6 0x05
|
||||
#define PM2XXX_BATT_CTRL_REG7 0x06
|
||||
#define PM2XXX_BATT_CTRL_REG8 0x07
|
||||
#define PM2XXX_NTC_CTRL_REG1 0x08
|
||||
#define PM2XXX_NTC_CTRL_REG2 0x09
|
||||
#define PM2XXX_BATT_CTRL_REG9 0x0A
|
||||
#define PM2XXX_BATT_STAT_REG1 0x0B
|
||||
#define PM2XXX_INP_VOLT_VPWR2 0x11
|
||||
#define PM2XXX_INP_DROP_VPWR2 0x13
|
||||
#define PM2XXX_INP_VOLT_VPWR1 0x15
|
||||
#define PM2XXX_INP_DROP_VPWR1 0x17
|
||||
#define PM2XXX_INP_MODE_VPWR 0x18
|
||||
#define PM2XXX_BATT_WD_KICK 0x70
|
||||
#define PM2XXX_DEV_VER_STAT 0x0C
|
||||
#define PM2XXX_THERM_WARN_CTRL_REG 0x20
|
||||
#define PM2XXX_BATT_DISC_REG 0x21
|
||||
#define PM2XXX_BATT_LOW_LEV_COMP_REG 0x22
|
||||
#define PM2XXX_BATT_LOW_LEV_VAL_REG 0x23
|
||||
#define PM2XXX_I2C_PAD_CTRL_REG 0x24
|
||||
#define PM2XXX_SW_CTRL_REG 0x26
|
||||
#define PM2XXX_LED_CTRL_REG 0x28
|
||||
|
||||
#define PM2XXX_REG_INT1 0x40
|
||||
#define PM2XXX_MASK_REG_INT1 0x50
|
||||
#define PM2XXX_SRCE_REG_INT1 0x60
|
||||
#define PM2XXX_REG_INT2 0x41
|
||||
#define PM2XXX_MASK_REG_INT2 0x51
|
||||
#define PM2XXX_SRCE_REG_INT2 0x61
|
||||
#define PM2XXX_REG_INT3 0x42
|
||||
#define PM2XXX_MASK_REG_INT3 0x52
|
||||
#define PM2XXX_SRCE_REG_INT3 0x62
|
||||
#define PM2XXX_REG_INT4 0x43
|
||||
#define PM2XXX_MASK_REG_INT4 0x53
|
||||
#define PM2XXX_SRCE_REG_INT4 0x63
|
||||
#define PM2XXX_REG_INT5 0x44
|
||||
#define PM2XXX_MASK_REG_INT5 0x54
|
||||
#define PM2XXX_SRCE_REG_INT5 0x64
|
||||
#define PM2XXX_REG_INT6 0x45
|
||||
#define PM2XXX_MASK_REG_INT6 0x55
|
||||
#define PM2XXX_SRCE_REG_INT6 0x65
|
||||
|
||||
#define VPWR_OVV 0x0
|
||||
#define VSYSTEM_OVV 0x1
|
||||
|
||||
/* control Reg 1 */
|
||||
#define PM2XXX_CH_RESUME_EN 0x1
|
||||
#define PM2XXX_CH_RESUME_DIS 0x0
|
||||
|
||||
/* control Reg 2 */
|
||||
#define PM2XXX_CH_AUTO_RESUME_EN 0X2
|
||||
#define PM2XXX_CH_AUTO_RESUME_DIS 0X0
|
||||
#define PM2XXX_CHARGER_ENA 0x4
|
||||
#define PM2XXX_CHARGER_DIS 0x0
|
||||
|
||||
/* control Reg 3 */
|
||||
#define PM2XXX_CH_WD_CC_PHASE_OFF 0x0
|
||||
#define PM2XXX_CH_WD_CC_PHASE_5MIN 0x1
|
||||
#define PM2XXX_CH_WD_CC_PHASE_10MIN 0x2
|
||||
#define PM2XXX_CH_WD_CC_PHASE_30MIN 0x3
|
||||
#define PM2XXX_CH_WD_CC_PHASE_60MIN 0x4
|
||||
#define PM2XXX_CH_WD_CC_PHASE_120MIN 0x5
|
||||
#define PM2XXX_CH_WD_CC_PHASE_240MIN 0x6
|
||||
#define PM2XXX_CH_WD_CC_PHASE_360MIN 0x7
|
||||
|
||||
#define PM2XXX_CH_WD_CV_PHASE_OFF (0x0<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_5MIN (0x1<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_10MIN (0x2<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_30MIN (0x3<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_60MIN (0x4<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_120MIN (0x5<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_240MIN (0x6<<3)
|
||||
#define PM2XXX_CH_WD_CV_PHASE_360MIN (0x7<<3)
|
||||
|
||||
/* control Reg 4 */
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_OFF 0x0
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_1MIN 0x1
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_5MIN 0x2
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_10MIN 0x3
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_30MIN 0x4
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_60MIN 0x5
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_120MIN 0x6
|
||||
#define PM2XXX_CH_WD_PRECH_PHASE_240MIN 0x7
|
||||
|
||||
/* control Reg 5 */
|
||||
#define PM2XXX_CH_WD_AUTO_TIMEOUT_NONE 0x0
|
||||
#define PM2XXX_CH_WD_AUTO_TIMEOUT_20MIN 0x1
|
||||
|
||||
/* control Reg 6 */
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_MASK 0x0F
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_200MA 0x0
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_400MA 0x2
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_600MA 0x3
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_800MA 0x4
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_1000MA 0x5
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_1200MA 0x6
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_1400MA 0x7
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_1600MA 0x8
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_1800MA 0x9
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_2000MA 0xA
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_2200MA 0xB
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_2400MA 0xC
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_2600MA 0xD
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_2800MA 0xE
|
||||
#define PM2XXX_DIR_CH_CC_CURRENT_3000MA 0xF
|
||||
|
||||
#define PM2XXX_CH_PRECH_CURRENT_MASK 0x30
|
||||
#define PM2XXX_CH_PRECH_CURRENT_25MA (0x0<<4)
|
||||
#define PM2XXX_CH_PRECH_CURRENT_50MA (0x1<<4)
|
||||
#define PM2XXX_CH_PRECH_CURRENT_75MA (0x2<<4)
|
||||
#define PM2XXX_CH_PRECH_CURRENT_100MA (0x3<<4)
|
||||
|
||||
#define PM2XXX_CH_EOC_CURRENT_MASK 0xC0
|
||||
#define PM2XXX_CH_EOC_CURRENT_100MA (0x0<<6)
|
||||
#define PM2XXX_CH_EOC_CURRENT_150MA (0x1<<6)
|
||||
#define PM2XXX_CH_EOC_CURRENT_300MA (0x2<<6)
|
||||
#define PM2XXX_CH_EOC_CURRENT_400MA (0x3<<6)
|
||||
|
||||
/* control Reg 7 */
|
||||
#define PM2XXX_CH_PRECH_VOL_2_5 0x0
|
||||
#define PM2XXX_CH_PRECH_VOL_2_7 0x1
|
||||
#define PM2XXX_CH_PRECH_VOL_2_9 0x2
|
||||
#define PM2XXX_CH_PRECH_VOL_3_1 0x3
|
||||
|
||||
#define PM2XXX_CH_VRESUME_VOL_3_2 (0x0<<2)
|
||||
#define PM2XXX_CH_VRESUME_VOL_3_4 (0x1<<2)
|
||||
#define PM2XXX_CH_VRESUME_VOL_3_6 (0x2<<2)
|
||||
#define PM2XXX_CH_VRESUME_VOL_3_8 (0x3<<2)
|
||||
|
||||
/* control Reg 8 */
|
||||
#define PM2XXX_CH_VOLT_MASK 0x3F
|
||||
#define PM2XXX_CH_VOLT_3_5 0x0
|
||||
#define PM2XXX_CH_VOLT_3_5225 0x1
|
||||
#define PM2XXX_CH_VOLT_3_6 0x4
|
||||
#define PM2XXX_CH_VOLT_3_7 0x8
|
||||
#define PM2XXX_CH_VOLT_4_0 0x14
|
||||
#define PM2XXX_CH_VOLT_4_175 0x1B
|
||||
#define PM2XXX_CH_VOLT_4_2 0x1C
|
||||
#define PM2XXX_CH_VOLT_4_275 0x1F
|
||||
#define PM2XXX_CH_VOLT_4_3 0x20
|
||||
|
||||
/*NTC control register 1*/
|
||||
#define PM2XXX_BTEMP_HIGH_TH_45 0x0
|
||||
#define PM2XXX_BTEMP_HIGH_TH_50 0x1
|
||||
#define PM2XXX_BTEMP_HIGH_TH_55 0x2
|
||||
#define PM2XXX_BTEMP_HIGH_TH_60 0x3
|
||||
#define PM2XXX_BTEMP_HIGH_TH_65 0x4
|
||||
|
||||
#define PM2XXX_BTEMP_LOW_TH_N5 (0x0<<3)
|
||||
#define PM2XXX_BTEMP_LOW_TH_0 (0x1<<3)
|
||||
#define PM2XXX_BTEMP_LOW_TH_5 (0x2<<3)
|
||||
#define PM2XXX_BTEMP_LOW_TH_10 (0x3<<3)
|
||||
|
||||
/*NTC control register 2*/
|
||||
#define PM2XXX_NTC_BETA_COEFF_3477 0x0
|
||||
#define PM2XXX_NTC_BETA_COEFF_3964 0x1
|
||||
|
||||
#define PM2XXX_NTC_RES_10K (0x0<<2)
|
||||
#define PM2XXX_NTC_RES_47K (0x1<<2)
|
||||
#define PM2XXX_NTC_RES_100K (0x2<<2)
|
||||
#define PM2XXX_NTC_RES_NO_NTC (0x3<<2)
|
||||
|
||||
/* control Reg 9 */
|
||||
#define PM2XXX_CH_CC_MODEDROP_EN 1
|
||||
#define PM2XXX_CH_CC_MODEDROP_DIS 0
|
||||
|
||||
#define PM2XXX_CH_CC_REDUCED_CURRENT_100MA (0x0<<1)
|
||||
#define PM2XXX_CH_CC_REDUCED_CURRENT_200MA (0x1<<1)
|
||||
#define PM2XXX_CH_CC_REDUCED_CURRENT_400MA (0x2<<1)
|
||||
#define PM2XXX_CH_CC_REDUCED_CURRENT_IDENT (0x3<<1)
|
||||
|
||||
#define PM2XXX_CHARCHING_INFO_DIS (0<<3)
|
||||
#define PM2XXX_CHARCHING_INFO_EN (1<<3)
|
||||
|
||||
#define PM2XXX_CH_150MV_DROP_300MV (0<<4)
|
||||
#define PM2XXX_CH_150MV_DROP_150MV (1<<4)
|
||||
|
||||
|
||||
/* charger status register */
|
||||
#define PM2XXX_CHG_STATUS_OFF 0x0
|
||||
#define PM2XXX_CHG_STATUS_ON 0x1
|
||||
#define PM2XXX_CHG_STATUS_FULL 0x2
|
||||
#define PM2XXX_CHG_STATUS_ERR 0x3
|
||||
#define PM2XXX_CHG_STATUS_WAIT 0x4
|
||||
#define PM2XXX_CHG_STATUS_NOBAT 0x5
|
||||
|
||||
/* Input charger voltage VPWR2 */
|
||||
#define PM2XXX_VPWR2_OVV_6_0 0x0
|
||||
#define PM2XXX_VPWR2_OVV_6_3 0x1
|
||||
#define PM2XXX_VPWR2_OVV_10 0x2
|
||||
#define PM2XXX_VPWR2_OVV_NONE 0x3
|
||||
|
||||
/* Input charger drop VPWR2 */
|
||||
#define PM2XXX_VPWR2_HW_OPT_EN (0x1<<4)
|
||||
#define PM2XXX_VPWR2_HW_OPT_DIS (0x0<<4)
|
||||
|
||||
#define PM2XXX_VPWR2_VALID_EN (0x1<<3)
|
||||
#define PM2XXX_VPWR2_VALID_DIS (0x0<<3)
|
||||
|
||||
#define PM2XXX_VPWR2_DROP_EN (0x1<<2)
|
||||
#define PM2XXX_VPWR2_DROP_DIS (0x0<<2)
|
||||
|
||||
/* Input charger voltage VPWR1 */
|
||||
#define PM2XXX_VPWR1_OVV_6_0 0x0
|
||||
#define PM2XXX_VPWR1_OVV_6_3 0x1
|
||||
#define PM2XXX_VPWR1_OVV_10 0x2
|
||||
#define PM2XXX_VPWR1_OVV_NONE 0x3
|
||||
|
||||
/* Input charger drop VPWR1 */
|
||||
#define PM2XXX_VPWR1_HW_OPT_EN (0x1<<4)
|
||||
#define PM2XXX_VPWR1_HW_OPT_DIS (0x0<<4)
|
||||
|
||||
#define PM2XXX_VPWR1_VALID_EN (0x1<<3)
|
||||
#define PM2XXX_VPWR1_VALID_DIS (0x0<<3)
|
||||
|
||||
#define PM2XXX_VPWR1_DROP_EN (0x1<<2)
|
||||
#define PM2XXX_VPWR1_DROP_DIS (0x0<<2)
|
||||
|
||||
/* Battery low level comparator control register */
|
||||
#define PM2XXX_VBAT_LOW_MONITORING_DIS 0x0
|
||||
#define PM2XXX_VBAT_LOW_MONITORING_ENA 0x1
|
||||
|
||||
/* Battery low level value control register */
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_3 0x0
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_4 0x1
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_5 0x2
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_6 0x3
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_7 0x4
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_8 0x5
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_2_9 0x6
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_0 0x7
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_1 0x8
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_2 0x9
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_3 0xA
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_4 0xB
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_5 0xC
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_6 0xD
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_7 0xE
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_8 0xF
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_3_9 0x10
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_4_0 0x11
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_4_1 0x12
|
||||
#define PM2XXX_VBAT_LOW_LEVEL_4_2 0x13
|
||||
|
||||
/* SW CTRL */
|
||||
#define PM2XXX_SWCTRL_HW 0x0
|
||||
#define PM2XXX_SWCTRL_SW 0x1
|
||||
|
||||
|
||||
/* LED Driver Control */
|
||||
#define PM2XXX_LED_CURRENT_MASK 0x0C
|
||||
#define PM2XXX_LED_CURRENT_2_5MA (0X0<<2)
|
||||
#define PM2XXX_LED_CURRENT_1MA (0X1<<2)
|
||||
#define PM2XXX_LED_CURRENT_5MA (0X2<<2)
|
||||
#define PM2XXX_LED_CURRENT_10MA (0X3<<2)
|
||||
|
||||
#define PM2XXX_LED_SELECT_MASK 0x02
|
||||
#define PM2XXX_LED_SELECT_EN (0X0<<1)
|
||||
#define PM2XXX_LED_SELECT_DIS (0X1<<1)
|
||||
|
||||
#define PM2XXX_ANTI_OVERSHOOT_MASK 0x01
|
||||
#define PM2XXX_ANTI_OVERSHOOT_DIS 0X0
|
||||
#define PM2XXX_ANTI_OVERSHOOT_EN 0X1
|
||||
|
||||
enum pm2xxx_reg_int1 {
|
||||
PM2XXX_INT1_ITVBATDISCONNECT = 0x02,
|
||||
PM2XXX_INT1_ITVBATLOWR = 0x04,
|
||||
PM2XXX_INT1_ITVBATLOWF = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int1 {
|
||||
PM2XXX_INT1_M_ITVBATDISCONNECT = 0x02,
|
||||
PM2XXX_INT1_M_ITVBATLOWR = 0x04,
|
||||
PM2XXX_INT1_M_ITVBATLOWF = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int1 {
|
||||
PM2XXX_INT1_S_ITVBATDISCONNECT = 0x02,
|
||||
PM2XXX_INT1_S_ITVBATLOWR = 0x04,
|
||||
PM2XXX_INT1_S_ITVBATLOWF = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_reg_int2 {
|
||||
PM2XXX_INT2_ITVPWR2PLUG = 0x01,
|
||||
PM2XXX_INT2_ITVPWR2UNPLUG = 0x02,
|
||||
PM2XXX_INT2_ITVPWR1PLUG = 0x04,
|
||||
PM2XXX_INT2_ITVPWR1UNPLUG = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int2 {
|
||||
PM2XXX_INT2_M_ITVPWR2PLUG = 0x01,
|
||||
PM2XXX_INT2_M_ITVPWR2UNPLUG = 0x02,
|
||||
PM2XXX_INT2_M_ITVPWR1PLUG = 0x04,
|
||||
PM2XXX_INT2_M_ITVPWR1UNPLUG = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int2 {
|
||||
PM2XXX_INT2_S_ITVPWR2PLUG = 0x03,
|
||||
PM2XXX_INT2_S_ITVPWR1PLUG = 0x0c,
|
||||
};
|
||||
|
||||
enum pm2xxx_reg_int3 {
|
||||
PM2XXX_INT3_ITCHPRECHARGEWD = 0x01,
|
||||
PM2XXX_INT3_ITCHCCWD = 0x02,
|
||||
PM2XXX_INT3_ITCHCVWD = 0x04,
|
||||
PM2XXX_INT3_ITAUTOTIMEOUTWD = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int3 {
|
||||
PM2XXX_INT3_M_ITCHPRECHARGEWD = 0x01,
|
||||
PM2XXX_INT3_M_ITCHCCWD = 0x02,
|
||||
PM2XXX_INT3_M_ITCHCVWD = 0x04,
|
||||
PM2XXX_INT3_M_ITAUTOTIMEOUTWD = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int3 {
|
||||
PM2XXX_INT3_S_ITCHPRECHARGEWD = 0x01,
|
||||
PM2XXX_INT3_S_ITCHCCWD = 0x02,
|
||||
PM2XXX_INT3_S_ITCHCVWD = 0x04,
|
||||
PM2XXX_INT3_S_ITAUTOTIMEOUTWD = 0x08,
|
||||
};
|
||||
|
||||
enum pm2xxx_reg_int4 {
|
||||
PM2XXX_INT4_ITBATTEMPCOLD = 0x01,
|
||||
PM2XXX_INT4_ITBATTEMPHOT = 0x02,
|
||||
PM2XXX_INT4_ITVPWR2OVV = 0x04,
|
||||
PM2XXX_INT4_ITVPWR1OVV = 0x08,
|
||||
PM2XXX_INT4_ITCHARGINGON = 0x10,
|
||||
PM2XXX_INT4_ITVRESUME = 0x20,
|
||||
PM2XXX_INT4_ITBATTFULL = 0x40,
|
||||
PM2XXX_INT4_ITCVPHASE = 0x80,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int4 {
|
||||
PM2XXX_INT4_M_ITBATTEMPCOLD = 0x01,
|
||||
PM2XXX_INT4_M_ITBATTEMPHOT = 0x02,
|
||||
PM2XXX_INT4_M_ITVPWR2OVV = 0x04,
|
||||
PM2XXX_INT4_M_ITVPWR1OVV = 0x08,
|
||||
PM2XXX_INT4_M_ITCHARGINGON = 0x10,
|
||||
PM2XXX_INT4_M_ITVRESUME = 0x20,
|
||||
PM2XXX_INT4_M_ITBATTFULL = 0x40,
|
||||
PM2XXX_INT4_M_ITCVPHASE = 0x80,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int4 {
|
||||
PM2XXX_INT4_S_ITBATTEMPCOLD = 0x01,
|
||||
PM2XXX_INT4_S_ITBATTEMPHOT = 0x02,
|
||||
PM2XXX_INT4_S_ITVPWR2OVV = 0x04,
|
||||
PM2XXX_INT4_S_ITVPWR1OVV = 0x08,
|
||||
PM2XXX_INT4_S_ITCHARGINGON = 0x10,
|
||||
PM2XXX_INT4_S_ITVRESUME = 0x20,
|
||||
PM2XXX_INT4_S_ITBATTFULL = 0x40,
|
||||
PM2XXX_INT4_S_ITCVPHASE = 0x80,
|
||||
};
|
||||
|
||||
enum pm2xxx_reg_int5 {
|
||||
PM2XXX_INT5_ITTHERMALSHUTDOWNRISE = 0x01,
|
||||
PM2XXX_INT5_ITTHERMALSHUTDOWNFALL = 0x02,
|
||||
PM2XXX_INT5_ITTHERMALWARNINGRISE = 0x04,
|
||||
PM2XXX_INT5_ITTHERMALWARNINGFALL = 0x08,
|
||||
PM2XXX_INT5_ITVSYSTEMOVV = 0x10,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int5 {
|
||||
PM2XXX_INT5_M_ITTHERMALSHUTDOWNRISE = 0x01,
|
||||
PM2XXX_INT5_M_ITTHERMALSHUTDOWNFALL = 0x02,
|
||||
PM2XXX_INT5_M_ITTHERMALWARNINGRISE = 0x04,
|
||||
PM2XXX_INT5_M_ITTHERMALWARNINGFALL = 0x08,
|
||||
PM2XXX_INT5_M_ITVSYSTEMOVV = 0x10,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int5 {
|
||||
PM2XXX_INT5_S_ITTHERMALSHUTDOWNRISE = 0x01,
|
||||
PM2XXX_INT5_S_ITTHERMALSHUTDOWNFALL = 0x02,
|
||||
PM2XXX_INT5_S_ITTHERMALWARNINGRISE = 0x04,
|
||||
PM2XXX_INT5_S_ITTHERMALWARNINGFALL = 0x08,
|
||||
PM2XXX_INT5_S_ITVSYSTEMOVV = 0x10,
|
||||
};
|
||||
|
||||
enum pm2xxx_reg_int6 {
|
||||
PM2XXX_INT6_ITVPWR2DROP = 0x01,
|
||||
PM2XXX_INT6_ITVPWR1DROP = 0x02,
|
||||
PM2XXX_INT6_ITVPWR2VALIDRISE = 0x04,
|
||||
PM2XXX_INT6_ITVPWR2VALIDFALL = 0x08,
|
||||
PM2XXX_INT6_ITVPWR1VALIDRISE = 0x10,
|
||||
PM2XXX_INT6_ITVPWR1VALIDFALL = 0x20,
|
||||
};
|
||||
|
||||
enum pm2xxx_mask_reg_int6 {
|
||||
PM2XXX_INT6_M_ITVPWR2DROP = 0x01,
|
||||
PM2XXX_INT6_M_ITVPWR1DROP = 0x02,
|
||||
PM2XXX_INT6_M_ITVPWR2VALIDRISE = 0x04,
|
||||
PM2XXX_INT6_M_ITVPWR2VALIDFALL = 0x08,
|
||||
PM2XXX_INT6_M_ITVPWR1VALIDRISE = 0x10,
|
||||
PM2XXX_INT6_M_ITVPWR1VALIDFALL = 0x20,
|
||||
};
|
||||
|
||||
enum pm2xxx_source_reg_int6 {
|
||||
PM2XXX_INT6_S_ITVPWR2DROP = 0x01,
|
||||
PM2XXX_INT6_S_ITVPWR1DROP = 0x02,
|
||||
PM2XXX_INT6_S_ITVPWR2VALIDRISE = 0x04,
|
||||
PM2XXX_INT6_S_ITVPWR2VALIDFALL = 0x08,
|
||||
PM2XXX_INT6_S_ITVPWR1VALIDRISE = 0x10,
|
||||
PM2XXX_INT6_S_ITVPWR1VALIDFALL = 0x20,
|
||||
};
|
||||
|
||||
struct pm2xxx_charger_info {
|
||||
int charger_connected;
|
||||
int charger_online;
|
||||
int cv_active;
|
||||
bool wd_expired;
|
||||
};
|
||||
|
||||
struct pm2xxx_charger_event_flags {
|
||||
bool mainextchnotok;
|
||||
bool main_thermal_prot;
|
||||
bool ovv;
|
||||
bool chgwdexp;
|
||||
};
|
||||
|
||||
struct pm2xxx_interrupts {
|
||||
u8 reg[PM2XXX_NUM_INT_REG];
|
||||
int (*handler[PM2XXX_NUM_INT_REG])(void *, int);
|
||||
};
|
||||
|
||||
struct pm2xxx_config {
|
||||
struct i2c_client *pm2xxx_i2c;
|
||||
struct i2c_device_id *pm2xxx_id;
|
||||
};
|
||||
|
||||
struct pm2xxx_irq {
|
||||
char *name;
|
||||
irqreturn_t (*isr)(int irq, void *data);
|
||||
};
|
||||
|
||||
struct pm2xxx_charger {
|
||||
struct device *dev;
|
||||
u8 chip_id;
|
||||
bool vddadc_en_ac;
|
||||
struct pm2xxx_config config;
|
||||
bool ac_conn;
|
||||
unsigned int gpio_irq;
|
||||
int vbat;
|
||||
int old_vbat;
|
||||
int failure_case;
|
||||
int failure_input_ovv;
|
||||
unsigned int lpn_pin;
|
||||
struct pm2xxx_interrupts *pm2_int;
|
||||
struct ab8500_gpadc *gpadc;
|
||||
struct regulator *regu;
|
||||
struct pm2xxx_bm_data *bat;
|
||||
struct mutex lock;
|
||||
struct ab8500 *parent;
|
||||
struct pm2xxx_charger_info ac;
|
||||
struct pm2xxx_charger_platform_data *pdata;
|
||||
struct workqueue_struct *charger_wq;
|
||||
struct delayed_work check_vbat_work;
|
||||
struct work_struct ac_work;
|
||||
struct work_struct check_main_thermal_prot_work;
|
||||
struct ux500_charger ac_chg;
|
||||
struct pm2xxx_charger_event_flags flags;
|
||||
};
|
||||
|
||||
#endif /* PM2301_CHARGER_H */
|
@ -254,6 +254,9 @@ struct abx500_bm_data {
|
||||
int usb_safety_tmr_h;
|
||||
int bkup_bat_v;
|
||||
int bkup_bat_i;
|
||||
bool autopower_cfg;
|
||||
bool ac_enabled;
|
||||
bool usb_enabled;
|
||||
bool no_maintenance;
|
||||
bool capacity_scaling;
|
||||
bool chg_unknown_bat;
|
||||
|
@ -226,6 +226,8 @@
|
||||
/* BatCtrl Current Source Constants */
|
||||
#define BAT_CTRL_7U_ENA 0x01
|
||||
#define BAT_CTRL_20U_ENA 0x02
|
||||
#define BAT_CTRL_18U_ENA 0x01
|
||||
#define BAT_CTRL_16U_ENA 0x02
|
||||
#define BAT_CTRL_CMP_ENA 0x04
|
||||
#define FORCE_BAT_CTRL_CMP_HIGH 0x08
|
||||
#define BAT_CTRL_PULL_UP_ENA 0x10
|
||||
@ -402,26 +404,6 @@ struct ab8500_bm_data {
|
||||
const struct ab8500_fg_parameters *fg_params;
|
||||
};
|
||||
|
||||
struct ab8500_charger_platform_data {
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
bool autopower_cfg;
|
||||
};
|
||||
|
||||
struct ab8500_btemp_platform_data {
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
};
|
||||
|
||||
struct ab8500_fg_platform_data {
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
};
|
||||
|
||||
struct ab8500_chargalg_platform_data {
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
};
|
||||
struct ab8500_btemp;
|
||||
struct ab8500_gpadc;
|
||||
struct ab8500_fg;
|
||||
|
@ -346,4 +346,23 @@ static inline int is_ab8500_2p0(struct ab8500 *ab)
|
||||
return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0));
|
||||
}
|
||||
|
||||
static inline int is_ab8505_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
|
||||
static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0));
|
||||
}
|
||||
|
||||
static inline int is_ab9540_2p0(struct ab8500 *ab)
|
||||
{
|
||||
return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0));
|
||||
}
|
||||
#endif /* MFD_AB8500_H */
|
||||
|
@ -27,12 +27,17 @@ struct ux500_charger_ops {
|
||||
* @ops ux500 charger operations
|
||||
* @max_out_volt maximum output charger voltage in mV
|
||||
* @max_out_curr maximum output charger current in mA
|
||||
* @enabled indicates if this charger is used or not
|
||||
* @external external charger unit (pm2xxx)
|
||||
*/
|
||||
struct ux500_charger {
|
||||
struct power_supply psy;
|
||||
struct ux500_charger_ops ops;
|
||||
int max_out_volt;
|
||||
int max_out_curr;
|
||||
int wdt_refresh;
|
||||
bool enabled;
|
||||
bool external;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
61
include/linux/pm2301_charger.h
Normal file
61
include/linux/pm2301_charger.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* PM2301 charger driver.
|
||||
*
|
||||
* Copyright (C) 2012 ST Ericsson Corporation
|
||||
*
|
||||
* Contact: Olivier LAUNAY (olivier.launay@stericsson.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_PM2301_H
|
||||
#define __LINUX_PM2301_H
|
||||
|
||||
/**
|
||||
* struct pm2xxx_bm_charger_parameters - Charger specific parameters
|
||||
* @ac_volt_max: maximum allowed AC charger voltage in mV
|
||||
* @ac_curr_max: maximum allowed AC charger current in mA
|
||||
*/
|
||||
struct pm2xxx_bm_charger_parameters {
|
||||
int ac_volt_max;
|
||||
int ac_curr_max;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pm2xxx_bm_data - pm2xxx battery management data
|
||||
* @enable_overshoot flag to enable VBAT overshoot control
|
||||
* @chg_params charger parameters
|
||||
*/
|
||||
struct pm2xxx_bm_data {
|
||||
bool enable_overshoot;
|
||||
const struct pm2xxx_bm_charger_parameters *chg_params;
|
||||
};
|
||||
|
||||
struct pm2xxx_charger_platform_data {
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
int i2c_bus;
|
||||
const char *label;
|
||||
int irq_number;
|
||||
unsigned int lpn_gpio;
|
||||
int irq_type;
|
||||
};
|
||||
|
||||
struct pm2xxx_platform_data {
|
||||
struct pm2xxx_charger_platform_data *wall_charger;
|
||||
struct pm2xxx_bm_data *battery;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_PM2301_H */
|
Loading…
Reference in New Issue
Block a user