[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap-psp-2.6.32 / 0035-RTC-add-support-for-backup-battery-recharge.patch
1 From eade32775fc8fc3c25c9bdace1828fe649a31e0a 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 35/45] 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 c6a83a2..2329b5b 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
22 +
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
36 /*
37 * RTC block register offsets (use TWL_MODULE_RTC)
38 @@ -508,6 +525,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);
49 +
50 return ret;
52 out2:
53 --
54 1.6.6.1