diff options
author | Anson Huang <b20788@freescale.com> | 2013-03-20 19:39:42 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-04-12 07:01:42 -0400 |
commit | e95dddb34c896f33e89f97365491e7932f89a0c0 (patch) | |
tree | 1c8a95766fb00b1120882836ea6e8822b6101c77 /arch/arm/mach-imx/anatop.c | |
parent | cb872cacb2ef57ade6bb0ff41e18b9508a0e073e (diff) |
ARM: imx: enable anatop suspend/resume
Anatop module have sereval configurations for user
to reduce the power consumption in suspend, provide
suspend/resume interface for further use and enable
fet_odrive to reduce CORE LDO leakage during suspend.
As we have a common anatop file, remove all the operations
of anatop module in other files, use anatop interfaces to
do that.
Signed-off-by: Anson Huang <b20788@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx/anatop.c')
-rw-r--r-- | arch/arm/mach-imx/anatop.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c new file mode 100644 index 000000000000..b396b92526d3 --- /dev/null +++ b/arch/arm/mach-imx/anatop.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/err.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/mfd/syscon.h> | ||
17 | #include <linux/regmap.h> | ||
18 | |||
19 | #define REG_SET 0x4 | ||
20 | #define REG_CLR 0x8 | ||
21 | |||
22 | #define ANADIG_REG_CORE 0x140 | ||
23 | #define ANADIG_USB1_CHRG_DETECT 0x1b0 | ||
24 | #define ANADIG_USB2_CHRG_DETECT 0x210 | ||
25 | #define ANADIG_DIGPROG 0x260 | ||
26 | |||
27 | #define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000 | ||
28 | #define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000 | ||
29 | #define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000 | ||
30 | |||
31 | static struct regmap *anatop; | ||
32 | |||
33 | static void imx_anatop_enable_fet_odrive(bool enable) | ||
34 | { | ||
35 | regmap_write(anatop, ANADIG_REG_CORE + (enable ? REG_SET : REG_CLR), | ||
36 | BM_ANADIG_REG_CORE_FET_ODRIVE); | ||
37 | } | ||
38 | |||
39 | void imx_anatop_pre_suspend(void) | ||
40 | { | ||
41 | imx_anatop_enable_fet_odrive(true); | ||
42 | } | ||
43 | |||
44 | void imx_anatop_post_resume(void) | ||
45 | { | ||
46 | imx_anatop_enable_fet_odrive(false); | ||
47 | } | ||
48 | |||
49 | void imx_anatop_usb_chrg_detect_disable(void) | ||
50 | { | ||
51 | regmap_write(anatop, ANADIG_USB1_CHRG_DETECT, | ||
52 | BM_ANADIG_USB_CHRG_DETECT_EN_B | ||
53 | | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); | ||
54 | regmap_write(anatop, ANADIG_USB2_CHRG_DETECT, | ||
55 | BM_ANADIG_USB_CHRG_DETECT_EN_B | | ||
56 | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); | ||
57 | } | ||
58 | |||
59 | u32 imx_anatop_get_digprog(void) | ||
60 | { | ||
61 | u32 val; | ||
62 | |||
63 | regmap_read(anatop, ANADIG_DIGPROG, &val); | ||
64 | return val; | ||
65 | } | ||
66 | |||
67 | void __init imx_anatop_init(void) | ||
68 | { | ||
69 | anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop"); | ||
70 | if (IS_ERR(anatop)) { | ||
71 | pr_err("%s: failed to find imx6q-anatop regmap!\n", __func__); | ||
72 | return; | ||
73 | } | ||
74 | } | ||