Commit 0f4aa401 authored by Yang QU's avatar Yang QU Committed by Lee Jones

ab8500-charger: Add backup battery charge voltages on the ab8540

Add 2.7v, 2.9v, 3.0v, 3.2v and 3.3v charging voltages for backup
battery. Before that only 2.5v, 2.6v, 2.8v, 3.1v were available.
Signed-off-by: default avatarYang QU <yang.qu@stericsson.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Reviewed-by: default avatarMaxime COQUELIN <maxime.coquelin@stericsson.com>
Reviewed-by: default avatarMarcus COOPER <marcus.xm.cooper@stericsson.com>
Tested-by: default avatarXiao Mei ZHANG <xiaomei.zhang@stericsson.com>
parent e82c5bdb
...@@ -2836,6 +2836,7 @@ static int ab8500_charger_usb_get_property(struct power_supply *psy, ...@@ -2836,6 +2836,7 @@ static int ab8500_charger_usb_get_property(struct power_supply *psy,
static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
{ {
int ret = 0; int ret = 0;
u8 bup_vch_range = 0, vbup33_vrtcn = 0;
/* Setup maximum charger current and voltage for ABB cut2.0 */ /* Setup maximum charger current and voltage for ABB cut2.0 */
if (!is_ab8500_1p1_or_earlier(di->parent)) { if (!is_ab8500_1p1_or_earlier(di->parent)) {
...@@ -2945,15 +2946,29 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) ...@@ -2945,15 +2946,29 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
} }
/* Backup battery voltage and current */ /* Backup battery voltage and current */
if (di->bm->bkup_bat_v > BUP_VCH_SEL_3P1V)
bup_vch_range = BUP_VCH_RANGE;
if (di->bm->bkup_bat_v == BUP_VCH_SEL_3P3V)
vbup33_vrtcn = VBUP33_VRTCN;
ret = abx500_set_register_interruptible(di->dev, ret = abx500_set_register_interruptible(di->dev,
AB8500_RTC, AB8500_RTC,
AB8500_RTC_BACKUP_CHG_REG, AB8500_RTC_BACKUP_CHG_REG,
di->bm->bkup_bat_v | (di->bm->bkup_bat_v & 0x3) | di->bm->bkup_bat_i);
di->bm->bkup_bat_i);
if (ret) { if (ret) {
dev_err(di->dev, "failed to setup backup battery charging\n"); dev_err(di->dev, "failed to setup backup battery charging\n");
goto out; goto out;
} }
if (is_ab8540(di->parent)) {
ret = abx500_set_register_interruptible(di->dev,
AB8500_RTC,
AB8500_RTC_CTRL1_REG,
bup_vch_range | vbup33_vrtcn);
if (ret) {
dev_err(di->dev, "failed to setup backup battery charging\n");
goto out;
}
}
/* Enable backup battery charging */ /* Enable backup battery charging */
abx500_mask_and_set_register_interruptible(di->dev, abx500_mask_and_set_register_interruptible(di->dev,
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
#define AB8500_RTC_BACKUP_CHG_REG 0x0C #define AB8500_RTC_BACKUP_CHG_REG 0x0C
#define AB8500_RTC_CC_CONF_REG 0x01 #define AB8500_RTC_CC_CONF_REG 0x01
#define AB8500_RTC_CTRL_REG 0x0B #define AB8500_RTC_CTRL_REG 0x0B
#define AB8500_RTC_CTRL1_REG 0x11
/* /*
* OTP register offsets * OTP register offsets
...@@ -179,10 +180,25 @@ ...@@ -179,10 +180,25 @@
#define BUP_ICH_SEL_300UA 0x08 #define BUP_ICH_SEL_300UA 0x08
#define BUP_ICH_SEL_700UA 0x0C #define BUP_ICH_SEL_700UA 0x0C
#define BUP_VCH_SEL_2P5V 0x00 enum bup_vch_sel {
#define BUP_VCH_SEL_2P6V 0x01 BUP_VCH_SEL_2P5V,
#define BUP_VCH_SEL_2P8V 0x02 BUP_VCH_SEL_2P6V,
#define BUP_VCH_SEL_3P1V 0x03 BUP_VCH_SEL_2P8V,
BUP_VCH_SEL_3P1V,
/*
* Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
* are only available on ab8540. You can't choose these 5
* voltage on ab8500/ab8505/ab9540.
*/
BUP_VCH_SEL_2P7V,
BUP_VCH_SEL_2P9V,
BUP_VCH_SEL_3P0V,
BUP_VCH_SEL_3P2V,
BUP_VCH_SEL_3P3V,
};
#define BUP_VCH_RANGE 0x02
#define VBUP33_VRTCN 0x01
/* Battery OVV constants */ /* Battery OVV constants */
#define BATT_OVV_ENA 0x02 #define BATT_OVV_ENA 0x02
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment