From b4f340af5537094fc72076b8e9de9b27e1c35b20 Mon Sep 17 00:00:00 2001 From: Johan Palsson Date: Thu, 20 Jan 2011 14:23:05 +0100 Subject: U8500: Lower cut-off voltage threshold in AB8500 The cut-off voltage for AB8500 is set too high in the OTP. To be able to start with a charger from a drained battery, we have to lower this threshold before the backlight and display is started. ST-Ericsson ID: ER320113 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ia5c8c5b749fa9cb9cf8a15072ddfe5b0d1f33f5f Signed-off-by: Johan Palsson Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/13028 Reviewed-by: QATOOLS Reviewed-by: Michael BRANDT --- board/st/u8500/u8500.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c index 621a168d6..8b4609bf5 100644 --- a/board/st/u8500/u8500.c +++ b/board/st/u8500/u8500.c @@ -297,16 +297,41 @@ static void probe_href(void) } +#define BATT_OK_SEL1_TH_F_MASK 0xF0 +#define BATT_OK_SEL1_TH_F_2V71 0x70 + /* * board_early_access - for functionality that needs to run before * board_late_init but after board_init and emmc init. */ int board_early_access(block_dev_desc_t *block_dev) { + int ret; + int battok_regval; /* set board_id according to HREF version */ probe_href(); + /* + * In AB8500 rev2.0, the cut-off voltage threshold is set too low + * and the AB will power-off when we start with a drained battery + * and a charger connected when the backlight is turned on. + * Here we will lower the cut-off voltage threshold before + * power consumption goes up + */ + ret = ab8500_read(AB8500_SYS_CTRL2_BLOCK, AB8500_BATT_OK_REG); + if (ret < 0) + return -EINVAL; + + battok_regval = ret; + + /* Mask and set BattOkSel1ThF */ + ret = ab8500_write(AB8500_SYS_CTRL2_BLOCK, AB8500_BATT_OK_REG, + (battok_regval & ~BATT_OK_SEL1_TH_F_MASK) | + BATT_OK_SEL1_TH_F_2V71); + if (ret < 0) + return -EINVAL; + /* * Don't load itp, modem and splash if restarted (eg crashdump). */ -- cgit v1.2.3