diff options
author | Ramakrishna Pallala <ramakrishna.pallala@intel.com> | 2012-03-13 14:03:52 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-03-26 12:37:35 -0400 |
commit | f3a71a6eb13b71cc8a3dc5b6e5692e3db66b92f0 (patch) | |
tree | 8657e58127d2b72d97df5d4d89fdb6372fe02d67 /include/linux/power | |
parent | f42c2b45b139b7b21c0c2eca70c82ce8d4104815 (diff) |
max17042: Add POR init procedure from Maxim appnote
Add power on reset (POR) init procedure defined by the maxim
appnote. Using this procedure ensures that the part is
configured/initialized correctly at POR and improves early accuracy of
the fuel gauge and informs the fuel gauge with the battery
characterization parameters. The battery characterization parameters
come from the maxim characterization procedure.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'include/linux/power')
-rw-r--r-- | include/linux/power/max17042_battery.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h index 67eeada71073..e01b167e66f0 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define MAX17042_BATTERY_FULL (100) | 27 | #define MAX17042_BATTERY_FULL (100) |
28 | #define MAX17042_DEFAULT_SNS_RESISTOR (10000) | 28 | #define MAX17042_DEFAULT_SNS_RESISTOR (10000) |
29 | 29 | ||
30 | #define MAX17042_CHARACTERIZATION_DATA_SIZE 48 | ||
31 | |||
30 | enum max17042_register { | 32 | enum max17042_register { |
31 | MAX17042_STATUS = 0x00, | 33 | MAX17042_STATUS = 0x00, |
32 | MAX17042_VALRT_Th = 0x01, | 34 | MAX17042_VALRT_Th = 0x01, |
@@ -124,10 +126,64 @@ struct max17042_reg_data { | |||
124 | u16 data; | 126 | u16 data; |
125 | }; | 127 | }; |
126 | 128 | ||
129 | struct max17042_config_data { | ||
130 | /* External current sense resistor value in milli-ohms */ | ||
131 | u32 cur_sense_val; | ||
132 | |||
133 | /* A/D measurement */ | ||
134 | u16 tgain; /* 0x2C */ | ||
135 | u16 toff; /* 0x2D */ | ||
136 | u16 cgain; /* 0x2E */ | ||
137 | u16 coff; /* 0x2F */ | ||
138 | |||
139 | /* Alert / Status */ | ||
140 | u16 valrt_thresh; /* 0x01 */ | ||
141 | u16 talrt_thresh; /* 0x02 */ | ||
142 | u16 soc_alrt_thresh; /* 0x03 */ | ||
143 | u16 config; /* 0x01D */ | ||
144 | u16 shdntimer; /* 0x03F */ | ||
145 | |||
146 | /* App data */ | ||
147 | u16 design_cap; /* 0x18 */ | ||
148 | u16 ichgt_term; /* 0x1E */ | ||
149 | |||
150 | /* MG3 config */ | ||
151 | u16 at_rate; /* 0x04 */ | ||
152 | u16 learn_cfg; /* 0x28 */ | ||
153 | u16 filter_cfg; /* 0x29 */ | ||
154 | u16 relax_cfg; /* 0x2A */ | ||
155 | u16 misc_cfg; /* 0x2B */ | ||
156 | u16 masksoc; /* 0x32 */ | ||
157 | |||
158 | /* MG3 save and restore */ | ||
159 | u16 fullcap; /* 0x10 */ | ||
160 | u16 fullcapnom; /* 0x23 */ | ||
161 | u16 socempty; /* 0x33 */ | ||
162 | u16 lavg_empty; /* 0x36 */ | ||
163 | u16 dqacc; /* 0x45 */ | ||
164 | u16 dpacc; /* 0x46 */ | ||
165 | |||
166 | /* Cell technology from power_supply.h */ | ||
167 | u16 cell_technology; | ||
168 | |||
169 | /* Cell Data */ | ||
170 | u16 vempty; /* 0x12 */ | ||
171 | u16 temp_nom; /* 0x24 */ | ||
172 | u16 temp_lim; /* 0x25 */ | ||
173 | u16 fctc; /* 0x37 */ | ||
174 | u16 rcomp0; /* 0x38 */ | ||
175 | u16 tcompc0; /* 0x39 */ | ||
176 | u16 empty_tempco; /* 0x3A */ | ||
177 | u16 kempty0; /* 0x3B */ | ||
178 | u16 cell_char_tbl[MAX17042_CHARACTERIZATION_DATA_SIZE]; | ||
179 | } __packed; | ||
180 | |||
127 | struct max17042_platform_data { | 181 | struct max17042_platform_data { |
128 | struct max17042_reg_data *init_data; | 182 | struct max17042_reg_data *init_data; |
183 | struct max17042_config_data *config_data; | ||
129 | int num_init_data; /* Number of enties in init_data array */ | 184 | int num_init_data; /* Number of enties in init_data array */ |
130 | bool enable_current_sense; | 185 | bool enable_current_sense; |
186 | bool enable_por_init; /* Use POR init from Maxim appnote */ | ||
131 | 187 | ||
132 | /* | 188 | /* |
133 | * R_sns in micro-ohms. | 189 | * R_sns in micro-ohms. |