linux-omap 2.6.39: sync with meta-texasinstruments
[openembedded.git] / recipes / linux / linux-omap-2.6.39 / sakoman / 0016-RTC-add-support-for-backup-battery-recharge.patch
blob23447476d2aa97a75cce11cad391d00f715fe4cb
1 From a49740bb7066dbbf1b7f6bda73cdc45169202ebf Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <steve@sakoman.com>
3 Date: Thu, 4 Feb 2010 12:26:22 -0800
4 Subject: [PATCH 16/31] RTC: add support for backup battery recharge
6 ---
7 drivers/rtc/rtc-twl.c | 25 +++++++++++++++++++++++++
8 1 files changed, 25 insertions(+), 0 deletions(-)
10 diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
11 index f9a2799..713b8ea 100644
12 --- a/drivers/rtc/rtc-twl.c
13 +++ b/drivers/rtc/rtc-twl.c
14 @@ -30,6 +30,23 @@
16 #include <linux/i2c/twl.h>
18 +/*
19 + * PM_RECEIVER block register offsets (use TWL4030_MODULE_PM_RECEIVER)
20 + */
21 +#define REG_BB_CFG 0x12
23 +/* PM_RECEIVER BB_CFG bitfields */
24 +#define BIT_PM_RECEIVER_BB_CFG_BBCHEN 0x10
25 +#define BIT_PM_RECEIVER_BB_CFG_BBSEL 0x0C
26 +#define BIT_PM_RECEIVER_BB_CFG_BBSEL_2V5 0x00
27 +#define BIT_PM_RECEIVER_BB_CFG_BBSEL_3V0 0x04
28 +#define BIT_PM_RECEIVER_BB_CFG_BBSEL_3V1 0x08
29 +#define BIT_PM_RECEIVER_BB_CFG_BBSEL_3v2 0x0c
30 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL 0x03
31 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_25UA 0x00
32 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_150UA 0x01
33 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_500UA 0x02
34 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_1MA 0x03
37 * RTC block register offsets (use TWL_MODULE_RTC)
38 @@ -495,6 +512,14 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
39 if (ret < 0)
40 goto out2;
42 + /* enable backup battery charging */
43 + /* use a conservative 25uA @ 3.1V */
44 + ret = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
45 + BIT_PM_RECEIVER_BB_CFG_BBCHEN |
46 + BIT_PM_RECEIVER_BB_CFG_BBSEL_3V1 |
47 + BIT_PM_RECEIVER_BB_CFG_BBISEL_25UA,
48 + REG_BB_CFG);
50 return ret;
52 out2:
53 --
54 1.6.6.1