Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
max17042_battery.h
Go to the documentation of this file.
1 /*
2  * Fuel gauge driver for Maxim 17042 / 8966 / 8997
3  * Note that Maxim 8966 and 8997 are mfd and this is its subdevice.
4  *
5  * Copyright (C) 2011 Samsung Electronics
6  * MyungJoo Ham <[email protected]>
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 __MAX17042_BATTERY_H_
24 #define __MAX17042_BATTERY_H_
25 
26 #define MAX17042_STATUS_BattAbsent (1 << 3)
27 #define MAX17042_BATTERY_FULL (100)
28 #define MAX17042_DEFAULT_SNS_RESISTOR (10000)
29 
30 #define MAX17042_CHARACTERIZATION_DATA_SIZE 48
31 
40  MAX17042_Age = 0x07,
41  MAX17042_TEMP = 0x08,
45 
46  MAX17042_SOC = 0x0D,
50  MAX17042_TTE = 0x11,
52 
54 
67 
72  MAX17042_AIN = 0x27,
78  MAx17042_TOFF = 0x2D,
80  MAX17042_COFF = 0x2F,
81 
85 
88  MAX17042_FCTC = 0x37,
95 
97 
100 
102 
103  MAX17042_QH = 0x4D,
104  MAX17042_QL = 0x4E,
105 
109 
111 
112  MAX17042_OCV = 0xEE,
113 
115 
117 };
118 
119 /* Registers specific to max17047/50 */
127 };
128 
130 
131 /*
132  * used for setting a register to a desired value
133  * addr : address for a register
134  * data : setting value for the register
135  */
139 };
140 
142  /* External current sense resistor value in milli-ohms */
144 
145  /* A/D measurement */
146  u16 tgain; /* 0x2C */
147  u16 toff; /* 0x2D */
148  u16 cgain; /* 0x2E */
149  u16 coff; /* 0x2F */
150 
151  /* Alert / Status */
152  u16 valrt_thresh; /* 0x01 */
153  u16 talrt_thresh; /* 0x02 */
154  u16 soc_alrt_thresh; /* 0x03 */
155  u16 config; /* 0x01D */
156  u16 shdntimer; /* 0x03F */
157 
158  /* App data */
159  u16 full_soc_thresh; /* 0x13 */
160  u16 design_cap; /* 0x18 */
161  u16 ichgt_term; /* 0x1E */
162 
163  /* MG3 config */
164  u16 at_rate; /* 0x04 */
165  u16 learn_cfg; /* 0x28 */
166  u16 filter_cfg; /* 0x29 */
167  u16 relax_cfg; /* 0x2A */
168  u16 misc_cfg; /* 0x2B */
169  u16 masksoc; /* 0x32 */
170 
171  /* MG3 save and restore */
172  u16 fullcap; /* 0x10 */
173  u16 fullcapnom; /* 0x23 */
174  u16 socempty; /* 0x33 */
175  u16 lavg_empty; /* 0x36 */
176  u16 dqacc; /* 0x45 */
177  u16 dpacc; /* 0x46 */
178  u16 qrtbl00; /* 0x12 */
179  u16 qrtbl10; /* 0x22 */
180  u16 qrtbl20; /* 0x32 */
181  u16 qrtbl30; /* 0x42 */
182 
183  /* Cell technology from power_supply.h */
185 
186  /* Cell Data */
187  u16 vempty; /* 0x12 */
188  u16 temp_nom; /* 0x24 */
189  u16 temp_lim; /* 0x25 */
190  u16 fctc; /* 0x37 */
191  u16 rcomp0; /* 0x38 */
192  u16 tcompc0; /* 0x39 */
193  u16 empty_tempco; /* 0x3A */
194  u16 kempty0; /* 0x3B */
196 } __packed;
197 
201  int num_init_data; /* Number of enties in init_data array */
203  bool enable_por_init; /* Use POR init from Maxim appnote */
204 
205  /*
206  * R_sns in micro-ohms.
207  * default 10000 (if r_sns = 0) as it is the recommended value by
208  * the datasheet although it can be changed by board designers.
209  */
210  unsigned int r_sns;
211 };
212 
213 #endif /* __MAX17042_BATTERY_H_ */