blob: ce4d0b1bd0d631506d87738172df392cc7b1e74c [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Thierry Reding72323982014-07-11 13:19:06 +02002/*
3 * Copyright (C) 2014 NVIDIA Corporation
Thierry Reding72323982014-07-11 13:19:06 +02004 */
5
6#ifndef __SOC_TEGRA_PM_H__
7#define __SOC_TEGRA_PM_H__
8
Dmitry Osipenko77418682020-02-25 01:40:46 +03009#include <linux/errno.h>
10
Thierry Reding72323982014-07-11 13:19:06 +020011enum tegra_suspend_mode {
12 TEGRA_SUSPEND_NONE = 0,
13 TEGRA_SUSPEND_LP2, /* CPU voltage off */
14 TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
15 TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
16 TEGRA_MAX_SUSPEND_MODE,
Dmitry Osipenko9c93ccf2021-07-19 00:27:05 +030017 TEGRA_SUSPEND_NOT_READY,
Thierry Reding72323982014-07-11 13:19:06 +020018};
19
Dmitry Osipenko0d7281b2021-09-12 23:29:04 +030020#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_ARM) && defined(CONFIG_ARCH_TEGRA)
Thierry Reding72323982014-07-11 13:19:06 +020021enum tegra_suspend_mode
22tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode);
23
24/* low-level resume entry point */
25void tegra_resume(void);
Dmitry Osipenko77418682020-02-25 01:40:46 +030026
Dmitry Osipenko1f3e18e2020-02-25 01:40:47 +030027int tegra30_pm_secondary_cpu_suspend(unsigned long arg);
28void tegra_pm_clear_cpu_in_lp2(void);
29void tegra_pm_set_cpu_in_lp2(void);
30int tegra_pm_enter_lp2(void);
Dmitry Osipenko77418682020-02-25 01:40:46 +030031int tegra_pm_park_secondary_cpu(unsigned long cpu);
Dmitry Osipenko9c93ccf2021-07-19 00:27:05 +030032void tegra_pm_init_suspend(void);
Thierry Reding72323982014-07-11 13:19:06 +020033#else
34static inline enum tegra_suspend_mode
35tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode)
36{
37 return TEGRA_SUSPEND_NONE;
38}
39
40static inline void tegra_resume(void)
41{
42}
Dmitry Osipenko77418682020-02-25 01:40:46 +030043
Dmitry Osipenko1f3e18e2020-02-25 01:40:47 +030044static inline int tegra30_pm_secondary_cpu_suspend(unsigned long arg)
Dmitry Osipenko77418682020-02-25 01:40:46 +030045{
46 return -ENOTSUPP;
47}
48
Dmitry Osipenko1f3e18e2020-02-25 01:40:47 +030049static inline void tegra_pm_clear_cpu_in_lp2(void)
Dmitry Osipenko77418682020-02-25 01:40:46 +030050{
51}
52
Dmitry Osipenko1f3e18e2020-02-25 01:40:47 +030053static inline void tegra_pm_set_cpu_in_lp2(void)
Dmitry Osipenko77418682020-02-25 01:40:46 +030054{
55}
56
Dmitry Osipenko1f3e18e2020-02-25 01:40:47 +030057static inline int tegra_pm_enter_lp2(void)
Dmitry Osipenko77418682020-02-25 01:40:46 +030058{
59 return -ENOTSUPP;
60}
61
62static inline int tegra_pm_park_secondary_cpu(unsigned long cpu)
63{
64 return -ENOTSUPP;
65}
Dmitry Osipenko9c93ccf2021-07-19 00:27:05 +030066
67static inline void tegra_pm_init_suspend(void)
68{
69}
Thierry Reding72323982014-07-11 13:19:06 +020070#endif /* CONFIG_PM_SLEEP */
71
72#endif /* __SOC_TEGRA_PM_H__ */