]>
Commit | Line | Data |
---|---|---|
8459293c KM |
1 | /* |
2 | * r8a7740 power management support | |
3 | * | |
4 | * Copyright (C) 2012 Renesas Solutions Corp. | |
5 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | |
6 | * | |
7 | * This file is subject to the terms and conditions of the GNU General Public | |
8 | * License. See the file "COPYING" in the main directory of this archive | |
9 | * for more details. | |
10 | */ | |
802a5639 | 11 | #include <linux/console.h> |
895d3b53 | 12 | #include <linux/suspend.h> |
fd44aa5e | 13 | #include "common.h" |
6b8b0cb4 | 14 | #include "pm-rmobile.h" |
8459293c | 15 | |
c41215b7 | 16 | #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM) |
dc4470e1 | 17 | static int r8a7740_pd_a3sm_suspend(void) |
8459293c KM |
18 | { |
19 | /* | |
dc4470e1 | 20 | * The A3SM domain contains the CPU core and therefore it should |
8237f9e5 | 21 | * only be turned off if the CPU is not in use. |
8459293c KM |
22 | */ |
23 | return -EBUSY; | |
24 | } | |
25 | ||
802a5639 KM |
26 | static int r8a7740_pd_a3sp_suspend(void) |
27 | { | |
28 | /* | |
29 | * Serial consoles make use of SCIF hardware located in A3SP, | |
30 | * keep such power domain on if "no_console_suspend" is set. | |
31 | */ | |
32 | return console_suspend_enabled ? 0 : -EBUSY; | |
33 | } | |
34 | ||
7e81f543 GU |
35 | static int r8a7740_pd_d4_suspend(void) |
36 | { | |
37 | /* | |
38 | * The D4 domain contains the Coresight-ETM hardware block and | |
39 | * therefore it should only be turned off if the debug module is | |
40 | * not in use. | |
41 | */ | |
42 | return -EBUSY; | |
43 | } | |
44 | ||
7b567407 RW |
45 | static struct rmobile_pm_domain r8a7740_pm_domains[] = { |
46 | { | |
75349099 GU |
47 | .genpd.name = "A4LC", |
48 | .bit_shift = 1, | |
77192e1e GU |
49 | }, { |
50 | .genpd.name = "A4MP", | |
51 | .bit_shift = 2, | |
7e81f543 GU |
52 | }, { |
53 | .genpd.name = "D4", | |
54 | .bit_shift = 3, | |
55 | .gov = &pm_domain_always_on_gov, | |
56 | .suspend = r8a7740_pd_d4_suspend, | |
1618a677 GU |
57 | }, { |
58 | .genpd.name = "A4R", | |
59 | .bit_shift = 5, | |
995d9250 GU |
60 | }, { |
61 | .genpd.name = "A3RV", | |
62 | .bit_shift = 6, | |
75349099 | 63 | }, { |
7b567407 RW |
64 | .genpd.name = "A4S", |
65 | .bit_shift = 10, | |
7b567407 | 66 | .no_debug = true, |
75349099 | 67 | }, { |
7b567407 RW |
68 | .genpd.name = "A3SP", |
69 | .bit_shift = 11, | |
70 | .gov = &pm_domain_always_on_gov, | |
71 | .no_debug = true, | |
72 | .suspend = r8a7740_pd_a3sp_suspend, | |
dc4470e1 GU |
73 | }, { |
74 | .genpd.name = "A3SM", | |
75 | .bit_shift = 12, | |
76 | .gov = &pm_domain_always_on_gov, | |
77 | .suspend = r8a7740_pd_a3sm_suspend, | |
92e88fd7 GU |
78 | }, { |
79 | .genpd.name = "A3SG", | |
80 | .bit_shift = 13, | |
4ee7830c GU |
81 | }, { |
82 | .genpd.name = "A4SU", | |
83 | .bit_shift = 20, | |
7b567407 | 84 | }, |
802a5639 KM |
85 | }; |
86 | ||
7b567407 RW |
87 | void __init r8a7740_init_pm_domains(void) |
88 | { | |
89 | rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); | |
1618a677 | 90 | pm_genpd_add_subdomain_names("A4R", "A3RV"); |
7b567407 | 91 | pm_genpd_add_subdomain_names("A4S", "A3SP"); |
dc4470e1 | 92 | pm_genpd_add_subdomain_names("A4S", "A3SM"); |
92e88fd7 | 93 | pm_genpd_add_subdomain_names("A4S", "A3SG"); |
7b567407 | 94 | } |
c41215b7 | 95 | #endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */ |
895d3b53 BH |
96 | |
97 | #ifdef CONFIG_SUSPEND | |
98 | static int r8a7740_enter_suspend(suspend_state_t suspend_state) | |
99 | { | |
100 | cpu_do_idle(); | |
101 | return 0; | |
102 | } | |
103 | ||
104 | static void r8a7740_suspend_init(void) | |
105 | { | |
106 | shmobile_suspend_ops.enter = r8a7740_enter_suspend; | |
107 | } | |
108 | #else | |
109 | static void r8a7740_suspend_init(void) {} | |
110 | #endif | |
111 | ||
112 | void __init r8a7740_pm_init(void) | |
113 | { | |
114 | r8a7740_suspend_init(); | |
115 | } |