Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/power/max17050.h
3694 views
1
/*
2
* Fuel gauge driver for Nintendo Switch's Maxim 17050
3
*
4
* Copyright (c) 2011 Samsung Electronics
5
* MyungJoo Ham <[email protected]>
6
* Copyright (c) 2018-2020 CTCaer
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#ifndef __MAX17050_H_
24
#define __MAX17050_H_
25
26
#include <utils/types.h>
27
28
#define MAXIM17050_I2C_ADDR 0x36
29
30
enum MAX17050_reg {
31
MAX17050_STATUS = 0x00,
32
MAX17050_VALRT_Th = 0x01,
33
MAX17050_TALRT_Th = 0x02,
34
MAX17050_SALRT_Th = 0x03,
35
MAX17050_AtRate = 0x04,
36
MAX17050_RepCap = 0x05,
37
MAX17050_RepSOC = 0x06,
38
MAX17050_Age = 0x07,
39
MAX17050_TEMP = 0x08,
40
MAX17050_VCELL = 0x09,
41
MAX17050_Current = 0x0A,
42
MAX17050_AvgCurrent = 0x0B,
43
44
MAX17050_SOC = 0x0D,
45
MAX17050_AvSOC = 0x0E,
46
MAX17050_RemCap = 0x0F,
47
MAX17050_FullCAP = 0x10,
48
MAX17050_TTE = 0x11,
49
MAX17050_QRTbl00 = 0x12,
50
MAX17050_FullSOCThr = 0x13,
51
MAX17050_RSLOW = 0x14,
52
53
MAX17050_AvgTA = 0x16,
54
MAX17050_Cycles = 0x17,
55
MAX17050_DesignCap = 0x18,
56
MAX17050_AvgVCELL = 0x19,
57
MAX17050_MinMaxTemp = 0x1A,
58
MAX17050_MinMaxVolt = 0x1B,
59
MAX17050_MinMaxCurr = 0x1C,
60
MAX17050_CONFIG = 0x1D,
61
MAX17050_ICHGTerm = 0x1E,
62
MAX17050_AvCap = 0x1F,
63
MAX17050_ManName = 0x20,
64
MAX17050_DevName = 0x21,
65
MAX17050_QRTbl10 = 0x22,
66
MAX17050_FullCAPNom = 0x23,
67
MAX17050_TempNom = 0x24,
68
MAX17050_TempLim = 0x25,
69
MAX17050_TempHot = 0x26,
70
MAX17050_AIN = 0x27,
71
MAX17050_LearnCFG = 0x28,
72
MAX17050_FilterCFG = 0x29,
73
MAX17050_RelaxCFG = 0x2A,
74
MAX17050_MiscCFG = 0x2B,
75
MAX17050_TGAIN = 0x2C,
76
MAX17050_TOFF = 0x2D,
77
MAX17050_CGAIN = 0x2E,
78
MAX17050_COFF = 0x2F,
79
80
MAX17050_QRTbl20 = 0x32,
81
MAX17050_SOC_empty = 0x33,
82
MAX17050_T_empty = 0x34,
83
MAX17050_FullCAP0 = 0x35,
84
MAX17050_LAvg_empty = 0x36,
85
MAX17050_FCTC = 0x37,
86
MAX17050_RCOMP0 = 0x38,
87
MAX17050_TempCo = 0x39,
88
MAX17050_V_empty = 0x3A,
89
MAX17050_K_empty0 = 0x3B,
90
MAX17050_TaskPeriod = 0x3C,
91
MAX17050_FSTAT = 0x3D,
92
MAX17050_TIMER = 0x3E,
93
MAX17050_SHDNTIMER = 0x3F,
94
95
MAX17050_QRTbl30 = 0x42,
96
97
MAX17050_dQacc = 0x45,
98
MAX17050_dPacc = 0x46,
99
100
MAX17050_VFSOC0 = 0x48,
101
102
Max17050_QH0 = 0x4C,
103
MAX17050_QH = 0x4D,
104
MAX17050_QL = 0x4E,
105
106
MAX17050_MinVolt = 0x50, // Custom ID. Not to be sent to i2c.
107
MAX17050_MaxVolt = 0x51, // Custom ID. Not to be sent to i2c.
108
109
MAX17050_VFSOC0Enable = 0x60,
110
MAX17050_MODELEnable1 = 0x62,
111
MAX17050_MODELEnable2 = 0x63,
112
113
MAX17050_MODELChrTbl = 0x80,
114
115
MAX17050_OCV = 0xEE,
116
117
MAX17050_OCVInternal = 0xFB,
118
119
MAX17050_VFSOC = 0xFF,
120
};
121
122
int max17050_get_version(u32 *value);
123
int max17050_get_property(enum MAX17050_reg reg, int *value);
124
void max17050_fix_configuration();
125
void max17050_dump_regs(void *buf);
126
127
#endif /* __MAX17050_H_ */
128
129