xref: /openbmc/u-boot/include/power/max17042_fg.h (revision d9b23e26)
1 /*
2  *  Copyright (C) 2012 Samsung Electronics
3  *  Lukasz Majewski <l.majewski@samsung.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __MAX17042_FG_H_
9 #define __MAX17042_FG_H_
10 
11 /* MAX 17042 registers */
12 enum {
13 	MAX17042_STATUS         = 0x00,
14 	MAX17042_SOCREP         = 0x06,
15 	MAX17042_VCELL          = 0x09,
16 	MAX17042_CURRENT        = 0x0A,
17 	MAX17042_AVG_CURRENT	= 0x0B,
18 	MAX17042_SOCMIX	= 0x0D,
19 	MAX17042_SOCAV		= 0x0E,
20 	MAX17042_DESIGN_CAP	= 0x18,
21 	MAX17042_AVG_VCELL	= 0x19,
22 	MAX17042_CONFIG	= 0x1D,
23 	MAX17042_VERSION	= 0x21,
24 	MAX17042_LEARNCFG       = 0x28,
25 	MAX17042_FILTERCFG	= 0x29,
26 	MAX17042_RELAXCFG	= 0x2A,
27 	MAX17042_MISCCFG	= 0x2B,
28 	MAX17042_CGAIN		= 0x2E,
29 	MAX17042_COFF		= 0x2F,
30 	MAX17042_RCOMP0	= 0x38,
31 	MAX17042_TEMPCO	= 0x39,
32 	MAX17042_FSTAT		= 0x3D,
33 	MAX17042_MLOCKReg1	= 0x62,
34 	MAX17042_MLOCKReg2	= 0x63,
35 	MAX17042_MODEL1         = 0x80,
36 	MAX17042_MODEL2         = 0x90,
37 	MAX17042_MODEL3         = 0xA0,
38 	MAX17042_VFOCV		= 0xFB,
39 	MAX17042_VFSOC		= 0xFF,
40 
41 	FG_NUM_OF_REGS = 0x100,
42 };
43 
44 #define RCOMP0			0x0060
45 #define TempCo			0x1015
46 
47 
48 #define MAX17042_POR (1 << 1)
49 
50 #define MODEL_UNLOCK1		0x0059
51 #define MODEL_UNLOCK2		0x00c4
52 #define MODEL_LOCK1		0x0000
53 #define MODEL_LOCK2		0x0000
54 
55 #define MAX17042_I2C_ADDR	(0x6C >> 1)
56 
57 int power_fg_init(unsigned char bus);
58 #endif /* __MAX17042_FG_H_ */
59