17 #include <linux/kernel.h>
18 #include <linux/types.h>
19 #include <linux/list.h>
20 #include <linux/errno.h>
21 #include <linux/string.h>
40 #define PWRDM_TRACE_STATES_FLAG (1<<31)
79 static int _pwrdm_register(
struct powerdomain *pwrdm)
84 if (!pwrdm || !pwrdm->
name)
89 pr_err(
"powerdomain: %s: missing OMAP4 PRCM partition ID\n",
94 if (_pwrdm_lookup(pwrdm->
name))
99 pr_err(
"powerdomain: %s: voltagedomain %s does not exist\n",
126 static void _update_logic_membank_counters(
struct powerdomain *pwrdm)
129 u8 prev_logic_pwrst, prev_mem_pwrst;
136 for (i = 0; i < pwrdm->
banks; i++) {
161 if (pwrdm->
state != prev)
164 _update_logic_membank_counters(pwrdm);
173 trace_power_domain_target(pwrdm->
name, trace_state,
249 for (p = ps; *
p; p++)
270 if (list_empty(&pwrdm_list))
293 pwrdm = _pwrdm_lookup(name);
318 ret = (*fn)(temp_pwrdm,
user);
341 if (!pwrdm || !clkdm)
344 pr_debug(
"powerdomain: %s: associating clockdomain %s\n",
358 if (i == PWRDM_MAX_CLKDMS) {
359 pr_debug(
"powerdomain: %s: increase PWRDM_MAX_CLKDMS for clkdm %s\n",
389 if (!pwrdm || !clkdm)
392 pr_debug(
"powerdomain: %s: dissociating clockdomain %s\n",
399 if (i == PWRDM_MAX_CLKDMS) {
400 pr_debug(
"powerdomain: %s: clkdm %s not associated?!\n",
487 if (!(pwrdm->
pwrsts & (1 << pwrst)))
490 pr_debug(
"powerdomain: %s: setting next powerstate to %0x\n",
495 trace_power_domain_target(pwrdm->
name, pwrst,
592 pr_debug(
"powerdomain: %s: setting next logic powerstate to %0x\n",
623 if (pwrdm->
banks < (bank + 1))
629 pr_debug(
"powerdomain: %s: setting next memory powerstate for bank %0x while pwrdm-ON to %0x\n",
630 pwrdm->
name, bank, pwrst);
661 if (pwrdm->
banks < (bank + 1))
667 pr_debug(
"powerdomain: %s: setting next memory powerstate for bank %0x while pwrdm-RET to %0x\n",
668 pwrdm->
name, bank, pwrst);
757 if (pwrdm->
banks < (bank + 1))
787 if (pwrdm->
banks < (bank + 1))
816 if (pwrdm->
banks < (bank + 1))
846 pr_debug(
"powerdomain: %s: clearing previous power state reg\n",
876 pr_debug(
"powerdomain: %s: setting SAVEANDRESTORE bit\n", pwrdm->
name);
905 pr_debug(
"powerdomain: %s: clearing SAVEANDRESTORE bit\n", pwrdm->
name);
945 pr_debug(
"powerdomain: %s: setting LOWPOWERSTATECHANGE bit\n",
991 _pwrdm_pre_transition_cb(pwrdm,
NULL);
1001 _pwrdm_post_transition_cb(pwrdm,
NULL);
1021 WARN(1,
"powerdomain: %s: pwrdm is null\n", __func__);
1028 for (i = 0; i < pwrdm->
banks; i++)
1037 pr_debug(
"powerdomain: %s: context loss count = %d\n",
1038 pwrdm->
name, count);
1059 if (IS_ERR_OR_NULL(pwrdm)) {
1060 pr_debug(
"powerdomain: %s: invalid powerdomain pointer\n",
1072 for (i = 0; i < pwrdm->
banks; i++)
1077 for (i = 0; i < pwrdm->
banks; i++)