Lines Matching +full:no +full:- +full:tick +full:- +full:in +full:- +full:suspend
1 // SPDX-License-Identifier: GPL-2.0
3 // Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
6 // Exynos - Suspend support
8 // Based on arch/arm/mach-s3c2410/pm.c
13 #include <linux/suspend.h>
23 #include <linux/soc/samsung/exynos-pmu.h>
24 #include <linux/soc/samsung/exynos-regs-pmu.h>
27 #include <asm/hardware/cache-l2x0.h>
31 #include <asm/suspend.h>
36 #define REG_TABLE_END (-1U)
41 * struct exynos_wkup_irq - PMU IRQ to mask mapping
43 * @mask: Mask in PMU wake-up mask register
74 * GIC wake-up support
81 { 74, BIT(2) }, /* RTC tick */
87 { 45, BIT(2) }, /* RTC tick */
93 { 44, BIT(2) }, /* RTC tick */
106 if (!pm_data->wkup_irq) in exynos_irq_set_wake()
107 return -ENOENT; in exynos_irq_set_wake()
108 wkup_irq = pm_data->wkup_irq; in exynos_irq_set_wake()
110 while (wkup_irq->mask) { in exynos_irq_set_wake()
111 if (wkup_irq->hwirq == data->hwirq) { in exynos_irq_set_wake()
113 exynos_irqwake_intmask |= wkup_irq->mask; in exynos_irq_set_wake()
115 exynos_irqwake_intmask &= ~wkup_irq->mask; in exynos_irq_set_wake()
121 return -ENOENT; in exynos_irq_set_wake()
141 if (is_of_node(fwspec->fwnode)) { in exynos_pmu_domain_translate()
142 if (fwspec->param_count != 3) in exynos_pmu_domain_translate()
143 return -EINVAL; in exynos_pmu_domain_translate()
145 /* No PPI should point to this domain */ in exynos_pmu_domain_translate()
146 if (fwspec->param[0] != 0) in exynos_pmu_domain_translate()
147 return -EINVAL; in exynos_pmu_domain_translate()
149 *hwirq = fwspec->param[1]; in exynos_pmu_domain_translate()
150 *type = fwspec->param[2]; in exynos_pmu_domain_translate()
154 return -EINVAL; in exynos_pmu_domain_translate()
166 if (fwspec->param_count != 3) in exynos_pmu_domain_alloc()
167 return -EINVAL; /* Not GIC compliant */ in exynos_pmu_domain_alloc()
168 if (fwspec->param[0] != 0) in exynos_pmu_domain_alloc()
169 return -EINVAL; /* No PPI should point to this domain */ in exynos_pmu_domain_alloc()
171 hwirq = fwspec->param[1]; in exynos_pmu_domain_alloc()
178 parent_fwspec.fwnode = domain->parent->fwnode; in exynos_pmu_domain_alloc()
195 pr_err("%pOF: no parent, giving up\n", node); in exynos_pmu_irq_init()
196 return -ENODEV; in exynos_pmu_irq_init()
202 return -ENXIO; in exynos_pmu_irq_init()
209 return -ENOMEM; in exynos_pmu_irq_init()
218 return -ENOMEM; in exynos_pmu_irq_init()
222 * Clear the OF_POPULATED flag set in of_irq_init so that in exynos_pmu_irq_init()
232 EXYNOS_PMU_IRQ(exynos3250_pmu_irq, "samsung,exynos3250-pmu");
233 EXYNOS_PMU_IRQ(exynos4210_pmu_irq, "samsung,exynos4210-pmu");
234 EXYNOS_PMU_IRQ(exynos4412_pmu_irq, "samsung,exynos4412-pmu");
235 EXYNOS_PMU_IRQ(exynos5250_pmu_irq, "samsung,exynos5250-pmu");
236 EXYNOS_PMU_IRQ(exynos5420_pmu_irq, "samsung,exynos5420-pmu");
243 pr_info("Failed to suspend the system\n"); in exynos_cpu_do_idle()
244 return 1; /* Aborting suspend */ in exynos_cpu_do_idle()
276 pr_info("Failed to suspend the system\n"); in exynos5420_cpu_suspend()
285 * Set wake-up mask registers in exynos_pm_set_wakeup_mask()
286 * EXYNOS_EINT_WAKEUP_MASK is set by pinctrl driver in late suspend. in exynos_pm_set_wakeup_mask()
302 /* Set wake-up mask registers */ in exynos_pm_prepare()
315 /* Set wake-up mask registers */ in exynos3250_pm_prepare()
332 /* Set wake-up mask registers */ in exynos5420_pm_prepare()
338 * secondary CPUs will enter low power start. Though the U-Boot in exynos5420_pm_prepare()
340 * needs to restore it back in case, the primary cpu fails to in exynos5420_pm_prepare()
341 * suspend for any reason. in exynos5420_pm_prepare()
421 if (call_firmware_op(resume) == -ENOSYS in exynos_pm_resume()
427 /* Clear SLEEP mode set in INFORM1 */ in exynos_pm_resume()
441 if (call_firmware_op(resume) == -ENOSYS in exynos3250_pm_resume()
447 /* Clear SLEEP mode set in INFORM1 */ in exynos3250_pm_resume()
516 /* Clear SLEEP mode set in INFORM1 */ in exynos5420_pm_resume()
521 * Suspend Ops
534 if (exynos_irqwake_intmask == -1U in exynos_suspend_enter()
536 pr_err("%s: No wake-up sources!\n", __func__); in exynos_suspend_enter()
538 return -EINVAL; in exynos_suspend_enter()
541 if (pm_data->pm_prepare) in exynos_suspend_enter()
542 pm_data->pm_prepare(); in exynos_suspend_enter()
545 ret = call_firmware_op(suspend); in exynos_suspend_enter()
546 if (ret == -ENOSYS) in exynos_suspend_enter()
547 ret = cpu_suspend(0, pm_data->cpu_suspend); in exynos_suspend_enter()
551 if (pm_data->pm_resume_prepare) in exynos_suspend_enter()
552 pm_data->pm_resume_prepare(); in exynos_suspend_enter()
569 * avoid hard-coding the suspend to mem state. It's safe to do in exynos_suspend_prepare()
576 pr_err("Failed to prepare regulators for suspend (%d)\n", ret); in exynos_suspend_prepare()
589 pr_warn("Failed to resume regulators from suspend (%d)\n", ret); in exynos_suspend_finish()
638 .compatible = "samsung,exynos3250-pmu",
641 .compatible = "samsung,exynos4210-pmu",
644 .compatible = "samsung,exynos4412-pmu",
647 .compatible = "samsung,exynos5250-pmu",
650 .compatible = "samsung,exynos5420-pmu",
670 if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { in exynos_pm_init()
671 pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); in exynos_pm_init()
677 pm_data = (const struct exynos_pm_data *) match->data; in exynos_pm_init()
681 tmp |= pm_data->wake_disable_mask; in exynos_pm_init()
684 exynos_pm_syscore_ops.suspend = pm_data->pm_suspend; in exynos_pm_init()
685 exynos_pm_syscore_ops.resume = pm_data->pm_resume; in exynos_pm_init()
692 * firmware, the non-secure region of sysram should be used. in exynos_pm_init()