Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright (c) 2010 Google, Inc
  4 * Copyright (c) 2014 NVIDIA Corporation
  5 *
  6 * Author:
  7 *	Colin Cross <ccross@google.com>
 
 
 
 
 
 
 
 
 
 
  8 */
  9
 10#ifndef __SOC_TEGRA_PMC_H__
 11#define __SOC_TEGRA_PMC_H__
 12
 13#include <linux/reboot.h>
 14
 15#include <soc/tegra/pm.h>
 16
 17struct clk;
 18struct reset_control;
 19
 20bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
 21int tegra_pmc_cpu_power_on(unsigned int cpuid);
 22int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
 
 
 
 
 
 
 
 
 23
 24/*
 25 * powergate and I/O rail APIs
 26 */
 27
 28#define TEGRA_POWERGATE_CPU	0
 29#define TEGRA_POWERGATE_3D	1
 30#define TEGRA_POWERGATE_VENC	2
 31#define TEGRA_POWERGATE_PCIE	3
 32#define TEGRA_POWERGATE_VDEC	4
 33#define TEGRA_POWERGATE_L2	5
 34#define TEGRA_POWERGATE_MPE	6
 35#define TEGRA_POWERGATE_HEG	7
 36#define TEGRA_POWERGATE_SATA	8
 37#define TEGRA_POWERGATE_CPU1	9
 38#define TEGRA_POWERGATE_CPU2	10
 39#define TEGRA_POWERGATE_CPU3	11
 40#define TEGRA_POWERGATE_CELP	12
 41#define TEGRA_POWERGATE_3D1	13
 42#define TEGRA_POWERGATE_CPU0	14
 43#define TEGRA_POWERGATE_C0NC	15
 44#define TEGRA_POWERGATE_C1NC	16
 45#define TEGRA_POWERGATE_SOR	17
 46#define TEGRA_POWERGATE_DIS	18
 47#define TEGRA_POWERGATE_DISB	19
 48#define TEGRA_POWERGATE_XUSBA	20
 49#define TEGRA_POWERGATE_XUSBB	21
 50#define TEGRA_POWERGATE_XUSBC	22
 51#define TEGRA_POWERGATE_VIC	23
 52#define TEGRA_POWERGATE_IRAM	24
 53#define TEGRA_POWERGATE_NVDEC	25
 54#define TEGRA_POWERGATE_NVJPG	26
 55#define TEGRA_POWERGATE_AUD	27
 56#define TEGRA_POWERGATE_DFD	28
 57#define TEGRA_POWERGATE_VE2	29
 58#define TEGRA_POWERGATE_MAX	TEGRA_POWERGATE_VE2
 59
 60#define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
 61
 62/**
 63 * enum tegra_io_pad - I/O pad group identifier
 64 *
 65 * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
 66 * can be used to control the common voltage signal level and power state of
 67 * the pins of the given pad.
 68 */
 69enum tegra_io_pad {
 70	TEGRA_IO_PAD_AUDIO,
 71	TEGRA_IO_PAD_AUDIO_HV,
 72	TEGRA_IO_PAD_BB,
 73	TEGRA_IO_PAD_CAM,
 74	TEGRA_IO_PAD_COMP,
 75	TEGRA_IO_PAD_CONN,
 76	TEGRA_IO_PAD_CSIA,
 77	TEGRA_IO_PAD_CSIB,
 78	TEGRA_IO_PAD_CSIC,
 79	TEGRA_IO_PAD_CSID,
 80	TEGRA_IO_PAD_CSIE,
 81	TEGRA_IO_PAD_CSIF,
 82	TEGRA_IO_PAD_CSIG,
 83	TEGRA_IO_PAD_CSIH,
 84	TEGRA_IO_PAD_DAP3,
 85	TEGRA_IO_PAD_DAP5,
 86	TEGRA_IO_PAD_DBG,
 87	TEGRA_IO_PAD_DEBUG_NONAO,
 88	TEGRA_IO_PAD_DMIC,
 89	TEGRA_IO_PAD_DMIC_HV,
 90	TEGRA_IO_PAD_DP,
 91	TEGRA_IO_PAD_DSI,
 92	TEGRA_IO_PAD_DSIB,
 93	TEGRA_IO_PAD_DSIC,
 94	TEGRA_IO_PAD_DSID,
 95	TEGRA_IO_PAD_EDP,
 96	TEGRA_IO_PAD_EMMC,
 97	TEGRA_IO_PAD_EMMC2,
 98	TEGRA_IO_PAD_EQOS,
 99	TEGRA_IO_PAD_GPIO,
100	TEGRA_IO_PAD_GP_PWM2,
101	TEGRA_IO_PAD_GP_PWM3,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B1,
145	TEGRA_IO_PAD_USB2,
146	TEGRA_IO_PAD_USB3,
147	TEGRA_IO_PAD_USB_BIAS,
148	TEGRA_IO_PAD_AO_HV,
149};
150
151#ifdef CONFIG_SOC_TEGRA_PMC
152int tegra_powergate_power_on(unsigned int id);
153int tegra_powergate_power_off(unsigned int id);
154int tegra_powergate_remove_clamping(unsigned int id);
155
156/* Must be called with clk disabled, and returns with clk enabled */
157int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
158				      struct reset_control *rst);
159
160int tegra_io_pad_power_enable(enum tegra_io_pad id);
161int tegra_io_pad_power_disable(enum tegra_io_pad id);
162
163void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
164void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
165
166bool tegra_pmc_core_domain_state_synced(void);
167
168#else
169static inline int tegra_powergate_power_on(unsigned int id)
170{
171	return -ENOSYS;
172}
173
174static inline int tegra_powergate_power_off(unsigned int id)
175{
176	return -ENOSYS;
177}
178
179static inline int tegra_powergate_remove_clamping(unsigned int id)
180{
181	return -ENOSYS;
182}
183
184static inline int tegra_powergate_sequence_power_up(unsigned int id,
185						    struct clk *clk,
186						    struct reset_control *rst)
187{
188	return -ENOSYS;
189}
190
191static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
 
192{
193	return -ENOSYS;
194}
195
196static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
197{
198	return -ENOSYS;
199}
200
201static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
202{
203	return -ENOSYS;
204}
205
206static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
207{
208}
209
210static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
211{
212}
213
214static inline bool tegra_pmc_core_domain_state_synced(void)
215{
216	return false;
217}
218
219#endif /* CONFIG_SOC_TEGRA_PMC */
220
221#if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
222enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
223#else
224static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
225{
226	return TEGRA_SUSPEND_NONE;
227}
228#endif
229
230#endif /* __SOC_TEGRA_PMC_H__ */
v4.6
 
  1/*
  2 * Copyright (c) 2010 Google, Inc
  3 * Copyright (c) 2014 NVIDIA Corporation
  4 *
  5 * Author:
  6 *	Colin Cross <ccross@google.com>
  7 *
  8 * This software is licensed under the terms of the GNU General Public
  9 * License version 2, as published by the Free Software Foundation, and
 10 * may be copied, distributed, and modified under those terms.
 11 *
 12 * This program is distributed in the hope that it will be useful,
 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15 * GNU General Public License for more details.
 16 *
 17 */
 18
 19#ifndef __SOC_TEGRA_PMC_H__
 20#define __SOC_TEGRA_PMC_H__
 21
 22#include <linux/reboot.h>
 23
 24#include <soc/tegra/pm.h>
 25
 26struct clk;
 27struct reset_control;
 28
 29#ifdef CONFIG_PM_SLEEP
 30enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
 31void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
 32void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
 33#endif /* CONFIG_PM_SLEEP */
 34
 35#ifdef CONFIG_SMP
 36bool tegra_pmc_cpu_is_powered(int cpuid);
 37int tegra_pmc_cpu_power_on(int cpuid);
 38int tegra_pmc_cpu_remove_clamping(int cpuid);
 39#endif /* CONFIG_SMP */
 40
 41/*
 42 * powergate and I/O rail APIs
 43 */
 44
 45#define TEGRA_POWERGATE_CPU	0
 46#define TEGRA_POWERGATE_3D	1
 47#define TEGRA_POWERGATE_VENC	2
 48#define TEGRA_POWERGATE_PCIE	3
 49#define TEGRA_POWERGATE_VDEC	4
 50#define TEGRA_POWERGATE_L2	5
 51#define TEGRA_POWERGATE_MPE	6
 52#define TEGRA_POWERGATE_HEG	7
 53#define TEGRA_POWERGATE_SATA	8
 54#define TEGRA_POWERGATE_CPU1	9
 55#define TEGRA_POWERGATE_CPU2	10
 56#define TEGRA_POWERGATE_CPU3	11
 57#define TEGRA_POWERGATE_CELP	12
 58#define TEGRA_POWERGATE_3D1	13
 59#define TEGRA_POWERGATE_CPU0	14
 60#define TEGRA_POWERGATE_C0NC	15
 61#define TEGRA_POWERGATE_C1NC	16
 62#define TEGRA_POWERGATE_SOR	17
 63#define TEGRA_POWERGATE_DIS	18
 64#define TEGRA_POWERGATE_DISB	19
 65#define TEGRA_POWERGATE_XUSBA	20
 66#define TEGRA_POWERGATE_XUSBB	21
 67#define TEGRA_POWERGATE_XUSBC	22
 68#define TEGRA_POWERGATE_VIC	23
 69#define TEGRA_POWERGATE_IRAM	24
 70#define TEGRA_POWERGATE_NVDEC	25
 71#define TEGRA_POWERGATE_NVJPG	26
 72#define TEGRA_POWERGATE_AUD	27
 73#define TEGRA_POWERGATE_DFD	28
 74#define TEGRA_POWERGATE_VE2	29
 
 75
 76#define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
 77
 78#define TEGRA_IO_RAIL_CSIA	0
 79#define TEGRA_IO_RAIL_CSIB	1
 80#define TEGRA_IO_RAIL_DSI	2
 81#define TEGRA_IO_RAIL_MIPI_BIAS	3
 82#define TEGRA_IO_RAIL_PEX_BIAS	4
 83#define TEGRA_IO_RAIL_PEX_CLK1	5
 84#define TEGRA_IO_RAIL_PEX_CLK2	6
 85#define TEGRA_IO_RAIL_USB0	9
 86#define TEGRA_IO_RAIL_USB1	10
 87#define TEGRA_IO_RAIL_USB2	11
 88#define TEGRA_IO_RAIL_USB_BIAS	12
 89#define TEGRA_IO_RAIL_NAND	13
 90#define TEGRA_IO_RAIL_UART	14
 91#define TEGRA_IO_RAIL_BB	15
 92#define TEGRA_IO_RAIL_AUDIO	17
 93#define TEGRA_IO_RAIL_HSIC	19
 94#define TEGRA_IO_RAIL_COMP	22
 95#define TEGRA_IO_RAIL_HDMI	28
 96#define TEGRA_IO_RAIL_PEX_CNTRL	32
 97#define TEGRA_IO_RAIL_SDMMC1	33
 98#define TEGRA_IO_RAIL_SDMMC3	34
 99#define TEGRA_IO_RAIL_SDMMC4	35
100#define TEGRA_IO_RAIL_CAM	36
101#define TEGRA_IO_RAIL_RES	37
102#define TEGRA_IO_RAIL_HV	38
103#define TEGRA_IO_RAIL_DSIB	39
104#define TEGRA_IO_RAIL_DSIC	40
105#define TEGRA_IO_RAIL_DSID	41
106#define TEGRA_IO_RAIL_CSIE	44
107#define TEGRA_IO_RAIL_LVDS	57
108#define TEGRA_IO_RAIL_SYS_DDC	58
109
110#ifdef CONFIG_ARCH_TEGRA
111int tegra_powergate_is_powered(int id);
112int tegra_powergate_power_on(int id);
113int tegra_powergate_power_off(int id);
114int tegra_powergate_remove_clamping(int id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
116/* Must be called with clk disabled, and returns with clk enabled */
117int tegra_powergate_sequence_power_up(int id, struct clk *clk,
118				      struct reset_control *rst);
119
120int tegra_io_rail_power_on(int id);
121int tegra_io_rail_power_off(int id);
 
 
 
 
 
 
122#else
123static inline int tegra_powergate_is_powered(int id)
124{
125	return -ENOSYS;
126}
127
128static inline int tegra_powergate_power_on(int id)
129{
130	return -ENOSYS;
131}
132
133static inline int tegra_powergate_power_off(int id)
134{
135	return -ENOSYS;
136}
137
138static inline int tegra_powergate_remove_clamping(int id)
 
 
139{
140	return -ENOSYS;
141}
142
143static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
144						    struct reset_control *rst)
145{
146	return -ENOSYS;
147}
148
149static inline int tegra_io_rail_power_on(int id)
150{
151	return -ENOSYS;
152}
153
154static inline int tegra_io_rail_power_off(int id)
155{
156	return -ENOSYS;
157}
158#endif /* CONFIG_ARCH_TEGRA */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
160#endif /* __SOC_TEGRA_PMC_H__ */