aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang QU <yang.qu@stericsson.com>2012-06-26 07:25:52 -0400
committerLee Jones <lee.jones@linaro.org>2013-03-06 23:35:37 -0500
commit0f4aa401853e07885707aedfc68c608051b0d6e4 (patch)
tree80ff2a11824319eb46b5211097ea39f4422e14c1
parente82c5bdbf3aa26d22e9eab3626213795d8338da1 (diff)
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: Yang QU <yang.qu@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Maxime COQUELIN <maxime.coquelin@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Xiao Mei ZHANG <xiaomei.zhang@stericsson.com>
-rw-r--r--drivers/power/ab8500_charger.c19
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h24
2 files changed, 37 insertions, 6 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index 24b30b7ea5ca..fd3fa2beca2b 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2836,6 +2836,7 @@ static int ab8500_charger_usb_get_property(struct power_supply *psy,
2836static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) 2836static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
2837{ 2837{
2838 int ret = 0; 2838 int ret = 0;
2839 u8 bup_vch_range = 0, vbup33_vrtcn = 0;
2839 2840
2840 /* Setup maximum charger current and voltage for ABB cut2.0 */ 2841 /* Setup maximum charger current and voltage for ABB cut2.0 */
2841 if (!is_ab8500_1p1_or_earlier(di->parent)) { 2842 if (!is_ab8500_1p1_or_earlier(di->parent)) {
@@ -2945,15 +2946,29 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
2945 } 2946 }
2946 2947
2947 /* Backup battery voltage and current */ 2948 /* Backup battery voltage and current */
2949 if (di->bm->bkup_bat_v > BUP_VCH_SEL_3P1V)
2950 bup_vch_range = BUP_VCH_RANGE;
2951 if (di->bm->bkup_bat_v == BUP_VCH_SEL_3P3V)
2952 vbup33_vrtcn = VBUP33_VRTCN;
2953
2948 ret = abx500_set_register_interruptible(di->dev, 2954 ret = abx500_set_register_interruptible(di->dev,
2949 AB8500_RTC, 2955 AB8500_RTC,
2950 AB8500_RTC_BACKUP_CHG_REG, 2956 AB8500_RTC_BACKUP_CHG_REG,
2951 di->bm->bkup_bat_v | 2957 (di->bm->bkup_bat_v & 0x3) | di->bm->bkup_bat_i);
2952 di->bm->bkup_bat_i);
2953 if (ret) { 2958 if (ret) {
2954 dev_err(di->dev, "failed to setup backup battery charging\n"); 2959 dev_err(di->dev, "failed to setup backup battery charging\n");
2955 goto out; 2960 goto out;
2956 } 2961 }
2962 if (is_ab8540(di->parent)) {
2963 ret = abx500_set_register_interruptible(di->dev,
2964 AB8500_RTC,
2965 AB8500_RTC_CTRL1_REG,
2966 bup_vch_range | vbup33_vrtcn);
2967 if (ret) {
2968 dev_err(di->dev, "failed to setup backup battery charging\n");
2969 goto out;
2970 }
2971 }
2957 2972
2958 /* Enable backup battery charging */ 2973 /* Enable backup battery charging */
2959 abx500_mask_and_set_register_interruptible(di->dev, 2974 abx500_mask_and_set_register_interruptible(di->dev,
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 0efbe0efee7f..a73e05a0441b 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -105,6 +105,7 @@
105#define AB8500_RTC_BACKUP_CHG_REG 0x0C 105#define AB8500_RTC_BACKUP_CHG_REG 0x0C
106#define AB8500_RTC_CC_CONF_REG 0x01 106#define AB8500_RTC_CC_CONF_REG 0x01
107#define AB8500_RTC_CTRL_REG 0x0B 107#define AB8500_RTC_CTRL_REG 0x0B
108#define AB8500_RTC_CTRL1_REG 0x11
108 109
109/* 110/*
110 * OTP register offsets 111 * OTP register offsets
@@ -179,10 +180,25 @@
179#define BUP_ICH_SEL_300UA 0x08 180#define BUP_ICH_SEL_300UA 0x08
180#define BUP_ICH_SEL_700UA 0x0C 181#define BUP_ICH_SEL_700UA 0x0C
181 182
182#define BUP_VCH_SEL_2P5V 0x00 183enum bup_vch_sel {
183#define BUP_VCH_SEL_2P6V 0x01 184 BUP_VCH_SEL_2P5V,
184#define BUP_VCH_SEL_2P8V 0x02 185 BUP_VCH_SEL_2P6V,
185#define BUP_VCH_SEL_3P1V 0x03 186 BUP_VCH_SEL_2P8V,
187 BUP_VCH_SEL_3P1V,
188 /*
189 * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
190 * are only available on ab8540. You can't choose these 5
191 * voltage on ab8500/ab8505/ab9540.
192 */
193 BUP_VCH_SEL_2P7V,
194 BUP_VCH_SEL_2P9V,
195 BUP_VCH_SEL_3P0V,
196 BUP_VCH_SEL_3P2V,
197 BUP_VCH_SEL_3P3V,
198};
199
200#define BUP_VCH_RANGE 0x02
201#define VBUP33_VRTCN 0x01
186 202
187/* Battery OVV constants */ 203/* Battery OVV constants */
188#define BATT_OVV_ENA 0x02 204#define BATT_OVV_ENA 0x02