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