linux/include/soc/tegra/pmc.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2010 Google, Inc
 * Copyright (c) 2014 NVIDIA Corporation
 *
 * Author:
 *	Colin Cross <[email protected]>
 */

#ifndef __SOC_TEGRA_PMC_H__
#define __SOC_TEGRA_PMC_H__

#include <linux/reboot.h>

#include <soc/tegra/pm.h>

struct clk;
struct reset_control;

bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
int tegra_pmc_cpu_power_on(unsigned int cpuid);
int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);

/*
 * powergate and I/O rail APIs
 */

#define TEGRA_POWERGATE_CPU
#define TEGRA_POWERGATE_3D
#define TEGRA_POWERGATE_VENC
#define TEGRA_POWERGATE_PCIE
#define TEGRA_POWERGATE_VDEC
#define TEGRA_POWERGATE_L2
#define TEGRA_POWERGATE_MPE
#define TEGRA_POWERGATE_HEG
#define TEGRA_POWERGATE_SATA
#define TEGRA_POWERGATE_CPU1
#define TEGRA_POWERGATE_CPU2
#define TEGRA_POWERGATE_CPU3
#define TEGRA_POWERGATE_CELP
#define TEGRA_POWERGATE_3D1
#define TEGRA_POWERGATE_CPU0
#define TEGRA_POWERGATE_C0NC
#define TEGRA_POWERGATE_C1NC
#define TEGRA_POWERGATE_SOR
#define TEGRA_POWERGATE_DIS
#define TEGRA_POWERGATE_DISB
#define TEGRA_POWERGATE_XUSBA
#define TEGRA_POWERGATE_XUSBB
#define TEGRA_POWERGATE_XUSBC
#define TEGRA_POWERGATE_VIC
#define TEGRA_POWERGATE_IRAM
#define TEGRA_POWERGATE_NVDEC
#define TEGRA_POWERGATE_NVJPG
#define TEGRA_POWERGATE_AUD
#define TEGRA_POWERGATE_DFD
#define TEGRA_POWERGATE_VE2
#define TEGRA_POWERGATE_MAX

#define TEGRA_POWERGATE_3D0

/**
 * enum tegra_io_pad - I/O pad group identifier
 *
 * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
 * can be used to control the common voltage signal level and power state of
 * the pins of the given pad.
 */
enum tegra_io_pad {};

#ifdef CONFIG_SOC_TEGRA_PMC
int tegra_powergate_power_on(unsigned int id);
int tegra_powergate_power_off(unsigned int id);
int tegra_powergate_remove_clamping(unsigned int id);

/* Must be called with clk disabled, and returns with clk enabled */
int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
				      struct reset_control *rst);

int tegra_io_pad_power_enable(enum tegra_io_pad id);
int tegra_io_pad_power_disable(enum tegra_io_pad id);

void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);

bool tegra_pmc_core_domain_state_synced(void);

#else
static inline int tegra_powergate_power_on(unsigned int id)
{}

static inline int tegra_powergate_power_off(unsigned int id)
{}

static inline int tegra_powergate_remove_clamping(unsigned int id)
{}

static inline int tegra_powergate_sequence_power_up(unsigned int id,
						    struct clk *clk,
						    struct reset_control *rst)
{}

static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
{}

static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
{}

static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
{}

static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
{}

static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
{}

static inline bool tegra_pmc_core_domain_state_synced(void)
{}

#endif /* CONFIG_SOC_TEGRA_PMC */

#if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
#else
static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
{}
#endif

#endif /* __SOC_TEGRA_PMC_H__ */