pmc.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. #ifndef __SOC_TEGRA_PMC_H__
  19. #define __SOC_TEGRA_PMC_H__
  20. #include <linux/reboot.h>
  21. #include <soc/tegra/pm.h>
  22. struct clk;
  23. struct reset_control;
  24. #ifdef CONFIG_SMP
  25. bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
  26. int tegra_pmc_cpu_power_on(unsigned int cpuid);
  27. int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
  28. #endif /* CONFIG_SMP */
  29. /*
  30. * powergate and I/O rail APIs
  31. */
  32. #define TEGRA_POWERGATE_CPU 0
  33. #define TEGRA_POWERGATE_3D 1
  34. #define TEGRA_POWERGATE_VENC 2
  35. #define TEGRA_POWERGATE_PCIE 3
  36. #define TEGRA_POWERGATE_VDEC 4
  37. #define TEGRA_POWERGATE_L2 5
  38. #define TEGRA_POWERGATE_MPE 6
  39. #define TEGRA_POWERGATE_HEG 7
  40. #define TEGRA_POWERGATE_SATA 8
  41. #define TEGRA_POWERGATE_CPU1 9
  42. #define TEGRA_POWERGATE_CPU2 10
  43. #define TEGRA_POWERGATE_CPU3 11
  44. #define TEGRA_POWERGATE_CELP 12
  45. #define TEGRA_POWERGATE_3D1 13
  46. #define TEGRA_POWERGATE_CPU0 14
  47. #define TEGRA_POWERGATE_C0NC 15
  48. #define TEGRA_POWERGATE_C1NC 16
  49. #define TEGRA_POWERGATE_SOR 17
  50. #define TEGRA_POWERGATE_DIS 18
  51. #define TEGRA_POWERGATE_DISB 19
  52. #define TEGRA_POWERGATE_XUSBA 20
  53. #define TEGRA_POWERGATE_XUSBB 21
  54. #define TEGRA_POWERGATE_XUSBC 22
  55. #define TEGRA_POWERGATE_VIC 23
  56. #define TEGRA_POWERGATE_IRAM 24
  57. #define TEGRA_POWERGATE_NVDEC 25
  58. #define TEGRA_POWERGATE_NVJPG 26
  59. #define TEGRA_POWERGATE_AUD 27
  60. #define TEGRA_POWERGATE_DFD 28
  61. #define TEGRA_POWERGATE_VE2 29
  62. #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2
  63. #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
  64. /**
  65. * enum tegra_io_pad - I/O pad group identifier
  66. *
  67. * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
  68. * can be used to control the common voltage signal level and power state of
  69. * the pins of the given pad.
  70. */
  71. enum tegra_io_pad {
  72. TEGRA_IO_PAD_AUDIO,
  73. TEGRA_IO_PAD_AUDIO_HV,
  74. TEGRA_IO_PAD_BB,
  75. TEGRA_IO_PAD_CAM,
  76. TEGRA_IO_PAD_COMP,
  77. TEGRA_IO_PAD_CONN,
  78. TEGRA_IO_PAD_CSIA,
  79. TEGRA_IO_PAD_CSIB,
  80. TEGRA_IO_PAD_CSIC,
  81. TEGRA_IO_PAD_CSID,
  82. TEGRA_IO_PAD_CSIE,
  83. TEGRA_IO_PAD_CSIF,
  84. TEGRA_IO_PAD_DBG,
  85. TEGRA_IO_PAD_DEBUG_NONAO,
  86. TEGRA_IO_PAD_DMIC,
  87. TEGRA_IO_PAD_DMIC_HV,
  88. TEGRA_IO_PAD_DP,
  89. TEGRA_IO_PAD_DSI,
  90. TEGRA_IO_PAD_DSIB,
  91. TEGRA_IO_PAD_DSIC,
  92. TEGRA_IO_PAD_DSID,
  93. TEGRA_IO_PAD_EDP,
  94. TEGRA_IO_PAD_EMMC,
  95. TEGRA_IO_PAD_EMMC2,
  96. TEGRA_IO_PAD_GPIO,
  97. TEGRA_IO_PAD_HDMI,
  98. TEGRA_IO_PAD_HDMI_DP0,
  99. TEGRA_IO_PAD_HDMI_DP1,
  100. TEGRA_IO_PAD_HSIC,
  101. TEGRA_IO_PAD_HV,
  102. TEGRA_IO_PAD_LVDS,
  103. TEGRA_IO_PAD_MIPI_BIAS,
  104. TEGRA_IO_PAD_NAND,
  105. TEGRA_IO_PAD_PEX_BIAS,
  106. TEGRA_IO_PAD_PEX_CLK_BIAS,
  107. TEGRA_IO_PAD_PEX_CLK1,
  108. TEGRA_IO_PAD_PEX_CLK2,
  109. TEGRA_IO_PAD_PEX_CLK3,
  110. TEGRA_IO_PAD_PEX_CNTRL,
  111. TEGRA_IO_PAD_SDMMC1,
  112. TEGRA_IO_PAD_SDMMC1_HV,
  113. TEGRA_IO_PAD_SDMMC2,
  114. TEGRA_IO_PAD_SDMMC2_HV,
  115. TEGRA_IO_PAD_SDMMC3,
  116. TEGRA_IO_PAD_SDMMC3_HV,
  117. TEGRA_IO_PAD_SDMMC4,
  118. TEGRA_IO_PAD_SPI,
  119. TEGRA_IO_PAD_SPI_HV,
  120. TEGRA_IO_PAD_SYS_DDC,
  121. TEGRA_IO_PAD_UART,
  122. TEGRA_IO_PAD_UFS,
  123. TEGRA_IO_PAD_USB0,
  124. TEGRA_IO_PAD_USB1,
  125. TEGRA_IO_PAD_USB2,
  126. TEGRA_IO_PAD_USB3,
  127. TEGRA_IO_PAD_USB_BIAS,
  128. TEGRA_IO_PAD_AO_HV,
  129. };
  130. /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */
  131. #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI
  132. #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS
  133. /**
  134. * enum tegra_io_pad_voltage - voltage level of the I/O pad's source rail
  135. * @TEGRA_IO_PAD_1800000UV: 1.8 V
  136. * @TEGRA_IO_PAD_3300000UV: 3.3 V
  137. */
  138. enum tegra_io_pad_voltage {
  139. TEGRA_IO_PAD_1800000UV,
  140. TEGRA_IO_PAD_3300000UV,
  141. };
  142. #ifdef CONFIG_SOC_TEGRA_PMC
  143. int tegra_powergate_is_powered(unsigned int id);
  144. int tegra_powergate_power_on(unsigned int id);
  145. int tegra_powergate_power_off(unsigned int id);
  146. int tegra_powergate_remove_clamping(unsigned int id);
  147. /* Must be called with clk disabled, and returns with clk enabled */
  148. int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
  149. struct reset_control *rst);
  150. int tegra_io_pad_power_enable(enum tegra_io_pad id);
  151. int tegra_io_pad_power_disable(enum tegra_io_pad id);
  152. int tegra_io_pad_set_voltage(enum tegra_io_pad id,
  153. enum tegra_io_pad_voltage voltage);
  154. int tegra_io_pad_get_voltage(enum tegra_io_pad id);
  155. /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */
  156. int tegra_io_rail_power_on(unsigned int id);
  157. int tegra_io_rail_power_off(unsigned int id);
  158. enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
  159. void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
  160. void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
  161. #else
  162. static inline int tegra_powergate_is_powered(unsigned int id)
  163. {
  164. return -ENOSYS;
  165. }
  166. static inline int tegra_powergate_power_on(unsigned int id)
  167. {
  168. return -ENOSYS;
  169. }
  170. static inline int tegra_powergate_power_off(unsigned int id)
  171. {
  172. return -ENOSYS;
  173. }
  174. static inline int tegra_powergate_remove_clamping(unsigned int id)
  175. {
  176. return -ENOSYS;
  177. }
  178. static inline int tegra_powergate_sequence_power_up(unsigned int id,
  179. struct clk *clk,
  180. struct reset_control *rst)
  181. {
  182. return -ENOSYS;
  183. }
  184. static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
  185. {
  186. return -ENOSYS;
  187. }
  188. static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
  189. {
  190. return -ENOSYS;
  191. }
  192. static inline int tegra_io_pad_set_voltage(enum tegra_io_pad id,
  193. enum tegra_io_pad_voltage voltage)
  194. {
  195. return -ENOSYS;
  196. }
  197. static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
  198. {
  199. return -ENOSYS;
  200. }
  201. static inline int tegra_io_rail_power_on(unsigned int id)
  202. {
  203. return -ENOSYS;
  204. }
  205. static inline int tegra_io_rail_power_off(unsigned int id)
  206. {
  207. return -ENOSYS;
  208. }
  209. static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
  210. {
  211. return TEGRA_SUSPEND_NONE;
  212. }
  213. static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
  214. {
  215. }
  216. static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
  217. {
  218. }
  219. #endif /* CONFIG_SOC_TEGRA_PMC */
  220. #endif /* __SOC_TEGRA_PMC_H__ */