]> git.ipfire.org Git - people/ms/u-boot.git/blob - include/power/max17042_fg.h
Merge branch 'next'
[people/ms/u-boot.git] / include / power / max17042_fg.h
1 /*
2 * Copyright (C) 2012 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (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,
21 * MA 02111-1307 USA
22 */
23
24 #ifndef __MAX17042_FG_H_
25 #define __MAX17042_FG_H_
26
27 /* MAX 17042 registers */
28 enum {
29 MAX17042_STATUS = 0x00,
30 MAX17042_SOCREP = 0x06,
31 MAX17042_VCELL = 0x09,
32 MAX17042_CURRENT = 0x0A,
33 MAX17042_AVG_CURRENT = 0x0B,
34 MAX17042_SOCMIX = 0x0D,
35 MAX17042_SOCAV = 0x0E,
36 MAX17042_DESIGN_CAP = 0x18,
37 MAX17042_AVG_VCELL = 0x19,
38 MAX17042_CONFIG = 0x1D,
39 MAX17042_VERSION = 0x21,
40 MAX17042_LEARNCFG = 0x28,
41 MAX17042_FILTERCFG = 0x29,
42 MAX17042_RELAXCFG = 0x2A,
43 MAX17042_MISCCFG = 0x2B,
44 MAX17042_CGAIN = 0x2E,
45 MAX17042_COFF = 0x2F,
46 MAX17042_RCOMP0 = 0x38,
47 MAX17042_TEMPCO = 0x39,
48 MAX17042_FSTAT = 0x3D,
49 MAX17042_MLOCKReg1 = 0x62,
50 MAX17042_MLOCKReg2 = 0x63,
51 MAX17042_MODEL1 = 0x80,
52 MAX17042_MODEL2 = 0x90,
53 MAX17042_MODEL3 = 0xA0,
54 MAX17042_VFOCV = 0xFB,
55 MAX17042_VFSOC = 0xFF,
56
57 FG_NUM_OF_REGS = 0x100,
58 };
59
60 #define RCOMP0 0x0060
61 #define TempCo 0x1015
62
63
64 #define MAX17042_POR (1 << 1)
65
66 #define MODEL_UNLOCK1 0x0059
67 #define MODEL_UNLOCK2 0x00c4
68 #define MODEL_LOCK1 0x0000
69 #define MODEL_LOCK2 0x0000
70
71 #define MAX17042_I2C_ADDR (0x6C >> 1)
72
73 int power_fg_init(unsigned char bus);
74 #endif /* __MAX17042_FG_H_ */