Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/power/max77812.h
1476 views
1
/*
2
* Copyright (c) 2020 CTCaer
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms and conditions of the GNU General Public License,
6
* version 2, as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
* more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*/
16
17
#ifndef _MAX77812_H_
18
#define _MAX77812_H_
19
20
#define MAX77812_PHASE31_CPU_I2C_ADDR 0x31 // High power GPU. 2 Outputs: 3-phase M1 + 1-phase M4.
21
#define MAX77812_PHASE211_CPU_I2C_ADDR 0x33 // Low power GPU. 3 Outputs: 2-phase M1 + 1-phase M3 + 1-phase M4.
22
23
#define MAX77812_REG_RSET 0x00
24
#define MAX77812_REG_INT_SRC 0x01
25
#define MAX77812_REG_INT_SRC_M 0x02
26
#define MAX77812_REG_TOPSYS_INT 0x03
27
#define MAX77812_REG_TOPSYS_INT_M 0x04
28
#define MAX77812_REG_TOPSYS_STAT 0x05
29
#define MAX77812_REG_EN_CTRL 0x06
30
#define MAX77812_EN_CTRL_ENABLE 1
31
#define MAX77812_EN_CTRL_EN_M1_SHIFT 0
32
#define MAX77812_EN_CTRL_EN_M1_MASK (1 << MAX77812_EN_CTRL_EN_M1_SHIFT)
33
#define MAX77812_EN_CTRL_EN_M2_SHIFT 2
34
#define MAX77812_EN_CTRL_EN_M2_MASK (1 << MAX77812_EN_CTRL_EN_M2_SHIFT)
35
#define MAX77812_EN_CTRL_EN_M3_SHIFT 4
36
#define MAX77812_EN_CTRL_EN_M3_MASK (1 << MAX77812_EN_CTRL_EN_M3_SHIFT)
37
#define MAX77812_EN_CTRL_EN_M4_SHIFT 6
38
#define MAX77812_EN_CTRL_EN_M4_MASK (1 << MAX77812_EN_CTRL_EN_M4_SHIFT)
39
#define MAX77812_REG_STUP_DLY2 0x07
40
#define MAX77812_REG_STUP_DLY3 0x08
41
#define MAX77812_REG_STUP_DLY4 0x09
42
#define MAX77812_REG_SHDN_DLY1 0x0A
43
#define MAX77812_REG_SHDN_DLY2 0x0B
44
#define MAX77812_REG_SHDN_DLY3 0x0C
45
#define MAX77812_REG_SHDN_DLY4 0x0D
46
#define MAX77812_REG_WDTRSTB_DEB 0x0E
47
#define MAX77812_REG_GPI_FUNC 0x0F
48
#define MAX77812_REG_GPI_DEB1 0x10
49
#define MAX77812_REG_GPI_DEB2 0x11
50
#define MAX77812_REG_GPI_PD_CTRL 0x12
51
#define MAX77812_REG_PROT_CFG 0x13
52
#define MAX77812_REG_VERSION 0x14
53
#define MAX77812_REG_I2C_CFG 0x15
54
#define MAX77812_REG_BUCK_INT 0x20
55
#define MAX77812_REG_BUCK_INT_M 0x21
56
#define MAX77812_REG_BUCK_STAT 0x22
57
#define MAX77812_REG_M1_VOUT 0x23 // GPU.
58
#define MAX77812_REG_M2_VOUT 0x24
59
#define MAX77812_REG_M3_VOUT 0x25 // DRAM on PHASE211.
60
#define MAX77812_REG_M4_VOUT 0x26 // CPU.
61
#define MAX77812_REG_M1_VOUT_D 0x27
62
#define MAX77812_REG_M2_VOUT_D 0x28
63
#define MAX77812_REG_M3_VOUT_D 0x29
64
#define MAX77812_REG_M4_VOUT_D 0x2A
65
#define MAX77812_REG_M1_VOUT_S 0x2B
66
#define MAX77812_REG_M2_VOUT_S 0x2C
67
#define MAX77812_REG_M3_VOUT_S 0x2D
68
#define MAX77812_REG_M4_VOUT_S 0x2E
69
#define MAX77812_REG_M1_CFG 0x2F // HOS: M1_ILIM - 7.2A/4.8A.
70
#define MAX77812_REG_M2_CFG 0x30 // HOS: M2_ILIM - 7.2A/4.8A.
71
#define MAX77812_REG_M3_CFG 0x31 // HOS: M3_ILIM - 7.2A/4.8A.
72
#define MAX77812_REG_M4_CFG 0x32 // HOS: M4_ILIM - 7.2A/4.8A.
73
#define MAX77812_REG_GLB_CFG1 0x33 // HOS: B_SD_SR/B_SS_SR - 5mV/us.
74
#define MAX77812_REG_GLB_CFG2 0x34 // HOS: B_RD_SR/B_RU_SR - 5mV/us
75
#define MAX77812_REG_GLB_CFG3 0x35
76
77
/*! Protected area and settings only for MAX77812_ES2_VERSION */
78
#define MAX77812_REG_GLB_CFG4 0x36 // QS: 0xBB.
79
#define MAX77812_REG_GLB_CFG5 0x37 // QS: 0x39. ES2: Set to 0x3E.
80
#define MAX77812_REG_GLB_CFG6 0x38 // QS: 0x88. ES2: Set to 0x90.
81
#define MAX77812_REG_GLB_CFG7 0x39 // QS: 0x04.
82
#define MAX77812_REG_GLB_CFG8 0x3A // QS: 0x3A. ES2: Set to 0x3A.
83
84
#define MAX77812_REG_PROT_ACCESS 0xFD // 0x00: Lock, 0x5A: Unlock.
85
#define MAX77812_REG_UNKNOWN 0xFE
86
87
#define MAX77812_REG_EN_CTRL_MASK(n) BIT(n)
88
#define MAX77812_START_SLEW_RATE_MASK 0x07
89
#define MAX77812_SHDN_SLEW_RATE_MASK 0x70
90
#define MAX77812_RAMPUP_SLEW_RATE_MASK 0x07
91
#define MAX77812_RAMPDOWN_SLEW_RATE_MASK 0x70
92
#define MAX77812_SLEW_RATE_SHIFT 4
93
94
#define MAX77812_OP_ACTIVE_DISCHARGE_MASK BIT(7)
95
#define MAX77812_PEAK_CURRENT_LMT_MASK 0x70
96
#define MAX77812_SWITCH_FREQ_MASK 0x0C
97
#define MAX77812_FORCED_PWM_MASK BIT(1)
98
#define MAX77812_SLEW_RATE_CNTRL_MASK BIT(0)
99
#define MAX77812_START_SHD_DELAY_MASK 0x1F
100
#define MAX77812_VERSION_MASK 0x07
101
#define MAX77812_ES2_VERSION 0x04
102
#define MAX77812_QS_VERSION 0x05
103
104
#define MAX77812_BUCK_VOLT_MASK 0xFF
105
106
#endif
107
108