1 // SPDX-License-Identifier: GPL-2.0
2
3 /*
4 * Battery data and characteristics for Samsung SDI (Samsung Digital Interface)
5 * batteries. The data is retrieved automatically into drivers using
6 * the power_supply_get_battery_info() call.
7 *
8 * The BTI (battery type indicator) resistance in the code drops was very
9 * unreliable. The resistance listed here was obtained by simply measuring
10 * the BTI resistance with a multimeter on the battery.
11 */
12 #include <linux/module.h>
13 #include <linux/power_supply.h>
14 #include "samsung-sdi-battery.h"
15
16 struct samsung_sdi_battery {
17 char *compatible;
18 char *name;
19 struct power_supply_battery_info info;
20 };
21
22 /*
23 * Voltage to internal resistance tables. The internal resistance varies
24 * depending on the VBAT voltage, so look this up from a table. Different
25 * tables apply depending on whether we are charging or not.
26 */
27
28 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb_l1m7flu[] = {
29 { .vbat_uv = 4240000, .ri_uohm = 160000 },
30 { .vbat_uv = 4210000, .ri_uohm = 179000 },
31 { .vbat_uv = 4180000, .ri_uohm = 183000 },
32 { .vbat_uv = 4160000, .ri_uohm = 184000 },
33 { .vbat_uv = 4140000, .ri_uohm = 191000 },
34 { .vbat_uv = 4120000, .ri_uohm = 204000 },
35 { .vbat_uv = 4076000, .ri_uohm = 220000 },
36 { .vbat_uv = 4030000, .ri_uohm = 227000 },
37 { .vbat_uv = 3986000, .ri_uohm = 215000 },
38 { .vbat_uv = 3916000, .ri_uohm = 221000 },
39 { .vbat_uv = 3842000, .ri_uohm = 259000 },
40 { .vbat_uv = 3773000, .ri_uohm = 287000 },
41 { .vbat_uv = 3742000, .ri_uohm = 283000 },
42 { .vbat_uv = 3709000, .ri_uohm = 277000 },
43 { .vbat_uv = 3685000, .ri_uohm = 297000 },
44 { .vbat_uv = 3646000, .ri_uohm = 310000 },
45 { .vbat_uv = 3616000, .ri_uohm = 331000 },
46 { .vbat_uv = 3602000, .ri_uohm = 370000 },
47 { .vbat_uv = 3578000, .ri_uohm = 350000 },
48 { .vbat_uv = 3553000, .ri_uohm = 321000 },
49 { .vbat_uv = 3503000, .ri_uohm = 322000 },
50 { .vbat_uv = 3400000, .ri_uohm = 269000 },
51 { .vbat_uv = 3360000, .ri_uohm = 328000 },
52 { .vbat_uv = 3330000, .ri_uohm = 305000 },
53 { .vbat_uv = 3300000, .ri_uohm = 339000 },
54 };
55
56 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb_l1m7flu[] = {
57 { .vbat_uv = 4302000, .ri_uohm = 230000 },
58 { .vbat_uv = 4276000, .ri_uohm = 345000 },
59 { .vbat_uv = 4227000, .ri_uohm = 345000 },
60 { .vbat_uv = 4171000, .ri_uohm = 346000 },
61 { .vbat_uv = 4134000, .ri_uohm = 311000 },
62 { .vbat_uv = 4084000, .ri_uohm = 299000 },
63 { .vbat_uv = 4052000, .ri_uohm = 316000 },
64 { .vbat_uv = 4012000, .ri_uohm = 309000 },
65 { .vbat_uv = 3961000, .ri_uohm = 303000 },
66 { .vbat_uv = 3939000, .ri_uohm = 280000 },
67 { .vbat_uv = 3904000, .ri_uohm = 261000 },
68 { .vbat_uv = 3850000, .ri_uohm = 212000 },
69 { .vbat_uv = 3800000, .ri_uohm = 232000 },
70 { .vbat_uv = 3750000, .ri_uohm = 177000 },
71 { .vbat_uv = 3712000, .ri_uohm = 164000 },
72 { .vbat_uv = 3674000, .ri_uohm = 161000 },
73 { .vbat_uv = 3590000, .ri_uohm = 164000 },
74 };
75
76 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb425161la[] = {
77 { .vbat_uv = 4240000, .ri_uohm = 160000 },
78 { .vbat_uv = 4210000, .ri_uohm = 179000 },
79 { .vbat_uv = 4180000, .ri_uohm = 183000 },
80 { .vbat_uv = 4160000, .ri_uohm = 184000 },
81 { .vbat_uv = 4140000, .ri_uohm = 191000 },
82 { .vbat_uv = 4120000, .ri_uohm = 204000 },
83 { .vbat_uv = 4080000, .ri_uohm = 200000 },
84 { .vbat_uv = 4027000, .ri_uohm = 202000 },
85 { .vbat_uv = 3916000, .ri_uohm = 221000 },
86 { .vbat_uv = 3842000, .ri_uohm = 259000 },
87 { .vbat_uv = 3800000, .ri_uohm = 262000 },
88 { .vbat_uv = 3742000, .ri_uohm = 263000 },
89 { .vbat_uv = 3709000, .ri_uohm = 277000 },
90 { .vbat_uv = 3685000, .ri_uohm = 312000 },
91 { .vbat_uv = 3668000, .ri_uohm = 258000 },
92 { .vbat_uv = 3660000, .ri_uohm = 247000 },
93 { .vbat_uv = 3636000, .ri_uohm = 293000 },
94 { .vbat_uv = 3616000, .ri_uohm = 331000 },
95 { .vbat_uv = 3600000, .ri_uohm = 349000 },
96 { .vbat_uv = 3593000, .ri_uohm = 345000 },
97 { .vbat_uv = 3585000, .ri_uohm = 344000 },
98 { .vbat_uv = 3572000, .ri_uohm = 336000 },
99 { .vbat_uv = 3553000, .ri_uohm = 321000 },
100 { .vbat_uv = 3517000, .ri_uohm = 336000 },
101 { .vbat_uv = 3503000, .ri_uohm = 322000 },
102 { .vbat_uv = 3400000, .ri_uohm = 269000 },
103 { .vbat_uv = 3360000, .ri_uohm = 328000 },
104 { .vbat_uv = 3330000, .ri_uohm = 305000 },
105 { .vbat_uv = 3300000, .ri_uohm = 339000 },
106 };
107
108 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb425161la[] = {
109 { .vbat_uv = 4345000, .ri_uohm = 230000 },
110 { .vbat_uv = 4329000, .ri_uohm = 238000 },
111 { .vbat_uv = 4314000, .ri_uohm = 225000 },
112 { .vbat_uv = 4311000, .ri_uohm = 239000 },
113 { .vbat_uv = 4294000, .ri_uohm = 235000 },
114 { .vbat_uv = 4264000, .ri_uohm = 229000 },
115 { .vbat_uv = 4262000, .ri_uohm = 228000 },
116 { .vbat_uv = 4252000, .ri_uohm = 236000 },
117 { .vbat_uv = 4244000, .ri_uohm = 234000 },
118 { .vbat_uv = 4235000, .ri_uohm = 234000 },
119 { .vbat_uv = 4227000, .ri_uohm = 238000 },
120 { .vbat_uv = 4219000, .ri_uohm = 242000 },
121 { .vbat_uv = 4212000, .ri_uohm = 239000 },
122 { .vbat_uv = 4206000, .ri_uohm = 231000 },
123 { .vbat_uv = 4201000, .ri_uohm = 231000 },
124 { .vbat_uv = 4192000, .ri_uohm = 224000 },
125 { .vbat_uv = 4184000, .ri_uohm = 238000 },
126 { .vbat_uv = 4173000, .ri_uohm = 245000 },
127 { .vbat_uv = 4161000, .ri_uohm = 244000 },
128 { .vbat_uv = 4146000, .ri_uohm = 244000 },
129 { .vbat_uv = 4127000, .ri_uohm = 228000 },
130 { .vbat_uv = 4119000, .ri_uohm = 218000 },
131 { .vbat_uv = 4112000, .ri_uohm = 215000 },
132 { .vbat_uv = 4108000, .ri_uohm = 209000 },
133 { .vbat_uv = 4102000, .ri_uohm = 214000 },
134 { .vbat_uv = 4096000, .ri_uohm = 215000 },
135 { .vbat_uv = 4090000, .ri_uohm = 215000 },
136 { .vbat_uv = 4083000, .ri_uohm = 219000 },
137 { .vbat_uv = 4078000, .ri_uohm = 208000 },
138 { .vbat_uv = 4071000, .ri_uohm = 205000 },
139 { .vbat_uv = 4066000, .ri_uohm = 208000 },
140 { .vbat_uv = 4061000, .ri_uohm = 210000 },
141 { .vbat_uv = 4055000, .ri_uohm = 212000 },
142 { .vbat_uv = 4049000, .ri_uohm = 215000 },
143 { .vbat_uv = 4042000, .ri_uohm = 212000 },
144 { .vbat_uv = 4032000, .ri_uohm = 217000 },
145 { .vbat_uv = 4027000, .ri_uohm = 220000 },
146 { .vbat_uv = 4020000, .ri_uohm = 210000 },
147 { .vbat_uv = 4013000, .ri_uohm = 214000 },
148 { .vbat_uv = 4007000, .ri_uohm = 219000 },
149 { .vbat_uv = 4003000, .ri_uohm = 229000 },
150 { .vbat_uv = 3996000, .ri_uohm = 246000 },
151 { .vbat_uv = 3990000, .ri_uohm = 245000 },
152 { .vbat_uv = 3984000, .ri_uohm = 242000 },
153 { .vbat_uv = 3977000, .ri_uohm = 236000 },
154 { .vbat_uv = 3971000, .ri_uohm = 231000 },
155 { .vbat_uv = 3966000, .ri_uohm = 229000 },
156 { .vbat_uv = 3952000, .ri_uohm = 226000 },
157 { .vbat_uv = 3946000, .ri_uohm = 222000 },
158 { .vbat_uv = 3941000, .ri_uohm = 222000 },
159 { .vbat_uv = 3936000, .ri_uohm = 217000 },
160 { .vbat_uv = 3932000, .ri_uohm = 217000 },
161 { .vbat_uv = 3928000, .ri_uohm = 212000 },
162 { .vbat_uv = 3926000, .ri_uohm = 214000 },
163 { .vbat_uv = 3922000, .ri_uohm = 209000 },
164 { .vbat_uv = 3917000, .ri_uohm = 215000 },
165 { .vbat_uv = 3914000, .ri_uohm = 212000 },
166 { .vbat_uv = 3912000, .ri_uohm = 220000 },
167 { .vbat_uv = 3910000, .ri_uohm = 226000 },
168 { .vbat_uv = 3903000, .ri_uohm = 226000 },
169 { .vbat_uv = 3891000, .ri_uohm = 222000 },
170 { .vbat_uv = 3871000, .ri_uohm = 221000 },
171 { .vbat_uv = 3857000, .ri_uohm = 219000 },
172 { .vbat_uv = 3850000, .ri_uohm = 216000 },
173 { .vbat_uv = 3843000, .ri_uohm = 212000 },
174 { .vbat_uv = 3835000, .ri_uohm = 206000 },
175 { .vbat_uv = 3825000, .ri_uohm = 217000 },
176 { .vbat_uv = 3824000, .ri_uohm = 220000 },
177 { .vbat_uv = 3820000, .ri_uohm = 237000 },
178 { .vbat_uv = 3800000, .ri_uohm = 232000 },
179 { .vbat_uv = 3750000, .ri_uohm = 177000 },
180 { .vbat_uv = 3712000, .ri_uohm = 164000 },
181 { .vbat_uv = 3674000, .ri_uohm = 161000 },
182 { .vbat_uv = 3590000, .ri_uohm = 164000 },
183 };
184
185 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb425161lu[] = {
186 { .vbat_uv = 4240000, .ri_uohm = 160000 },
187 { .vbat_uv = 4210000, .ri_uohm = 179000 },
188 { .vbat_uv = 4180000, .ri_uohm = 183000 },
189 { .vbat_uv = 4160000, .ri_uohm = 184000 },
190 { .vbat_uv = 4140000, .ri_uohm = 191000 },
191 { .vbat_uv = 4120000, .ri_uohm = 204000 },
192 { .vbat_uv = 4080000, .ri_uohm = 200000 },
193 { .vbat_uv = 4027000, .ri_uohm = 202000 },
194 { .vbat_uv = 3916000, .ri_uohm = 221000 },
195 { .vbat_uv = 3842000, .ri_uohm = 259000 },
196 { .vbat_uv = 3800000, .ri_uohm = 262000 },
197 { .vbat_uv = 3742000, .ri_uohm = 263000 },
198 { .vbat_uv = 3708000, .ri_uohm = 277000 },
199 { .vbat_uv = 3684000, .ri_uohm = 272000 },
200 { .vbat_uv = 3664000, .ri_uohm = 278000 },
201 { .vbat_uv = 3655000, .ri_uohm = 285000 },
202 { .vbat_uv = 3638000, .ri_uohm = 261000 },
203 { .vbat_uv = 3624000, .ri_uohm = 259000 },
204 { .vbat_uv = 3616000, .ri_uohm = 266000 },
205 { .vbat_uv = 3597000, .ri_uohm = 278000 },
206 { .vbat_uv = 3581000, .ri_uohm = 281000 },
207 { .vbat_uv = 3560000, .ri_uohm = 287000 },
208 { .vbat_uv = 3527000, .ri_uohm = 289000 },
209 { .vbat_uv = 3512000, .ri_uohm = 286000 },
210 { .vbat_uv = 3494000, .ri_uohm = 282000 },
211 { .vbat_uv = 3400000, .ri_uohm = 269000 },
212 { .vbat_uv = 3360000, .ri_uohm = 328000 },
213 { .vbat_uv = 3330000, .ri_uohm = 305000 },
214 { .vbat_uv = 3300000, .ri_uohm = 339000 },
215 };
216
217 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb425161lu[] = {
218 { .vbat_uv = 4346000, .ri_uohm = 293000 },
219 { .vbat_uv = 4336000, .ri_uohm = 290000 },
220 { .vbat_uv = 4315000, .ri_uohm = 274000 },
221 { .vbat_uv = 4310000, .ri_uohm = 264000 },
222 { .vbat_uv = 4275000, .ri_uohm = 275000 },
223 { .vbat_uv = 4267000, .ri_uohm = 274000 },
224 { .vbat_uv = 4227000, .ri_uohm = 262000 },
225 { .vbat_uv = 4186000, .ri_uohm = 282000 },
226 { .vbat_uv = 4136000, .ri_uohm = 246000 },
227 { .vbat_uv = 4110000, .ri_uohm = 242000 },
228 { .vbat_uv = 4077000, .ri_uohm = 249000 },
229 { .vbat_uv = 4049000, .ri_uohm = 238000 },
230 { .vbat_uv = 4017000, .ri_uohm = 268000 },
231 { .vbat_uv = 3986000, .ri_uohm = 261000 },
232 { .vbat_uv = 3962000, .ri_uohm = 252000 },
233 { .vbat_uv = 3940000, .ri_uohm = 235000 },
234 { .vbat_uv = 3930000, .ri_uohm = 237000 },
235 { .vbat_uv = 3924000, .ri_uohm = 255000 },
236 { .vbat_uv = 3910000, .ri_uohm = 244000 },
237 { .vbat_uv = 3889000, .ri_uohm = 231000 },
238 { .vbat_uv = 3875000, .ri_uohm = 249000 },
239 { .vbat_uv = 3850000, .ri_uohm = 212000 },
240 { .vbat_uv = 3800000, .ri_uohm = 232000 },
241 { .vbat_uv = 3750000, .ri_uohm = 177000 },
242 { .vbat_uv = 3712000, .ri_uohm = 164000 },
243 { .vbat_uv = 3674000, .ri_uohm = 161000 },
244 { .vbat_uv = 3590000, .ri_uohm = 164000 },
245 };
246
247 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb485159lu[] = {
248 { .vbat_uv = 4240000, .ri_uohm = 160000 },
249 { .vbat_uv = 4210000, .ri_uohm = 179000 },
250 { .vbat_uv = 4180000, .ri_uohm = 183000 },
251 { .vbat_uv = 4160000, .ri_uohm = 184000 },
252 { .vbat_uv = 4140000, .ri_uohm = 191000 },
253 { .vbat_uv = 4120000, .ri_uohm = 204000 },
254 { .vbat_uv = 4080000, .ri_uohm = 200000 },
255 { .vbat_uv = 4027000, .ri_uohm = 202000 },
256 { .vbat_uv = 3916000, .ri_uohm = 221000 },
257 { .vbat_uv = 3842000, .ri_uohm = 259000 },
258 { .vbat_uv = 3800000, .ri_uohm = 262000 },
259 { .vbat_uv = 3715000, .ri_uohm = 340000 },
260 { .vbat_uv = 3700000, .ri_uohm = 300000 },
261 { .vbat_uv = 3682000, .ri_uohm = 233000 },
262 { .vbat_uv = 3655000, .ri_uohm = 246000 },
263 { .vbat_uv = 3639000, .ri_uohm = 260000 },
264 { .vbat_uv = 3621000, .ri_uohm = 254000 },
265 { .vbat_uv = 3583000, .ri_uohm = 266000 },
266 { .vbat_uv = 3536000, .ri_uohm = 274000 },
267 { .vbat_uv = 3502000, .ri_uohm = 300000 },
268 { .vbat_uv = 3465000, .ri_uohm = 245000 },
269 { .vbat_uv = 3438000, .ri_uohm = 225000 },
270 { .vbat_uv = 3330000, .ri_uohm = 305000 },
271 { .vbat_uv = 3300000, .ri_uohm = 339000 },
272 };
273
274 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb485159lu[] = {
275 { .vbat_uv = 4302000, .ri_uohm = 200000 },
276 { .vbat_uv = 4258000, .ri_uohm = 206000 },
277 { .vbat_uv = 4200000, .ri_uohm = 231000 },
278 { .vbat_uv = 4150000, .ri_uohm = 198000 },
279 { .vbat_uv = 4134000, .ri_uohm = 268000 },
280 { .vbat_uv = 4058000, .ri_uohm = 172000 },
281 { .vbat_uv = 4003000, .ri_uohm = 227000 },
282 { .vbat_uv = 3972000, .ri_uohm = 241000 },
283 { .vbat_uv = 3953000, .ri_uohm = 244000 },
284 { .vbat_uv = 3950000, .ri_uohm = 213000 },
285 { .vbat_uv = 3900000, .ri_uohm = 225000 },
286 { .vbat_uv = 3850000, .ri_uohm = 212000 },
287 { .vbat_uv = 3800000, .ri_uohm = 232000 },
288 { .vbat_uv = 3750000, .ri_uohm = 177000 },
289 { .vbat_uv = 3712000, .ri_uohm = 164000 },
290 { .vbat_uv = 3674000, .ri_uohm = 161000 },
291 { .vbat_uv = 3590000, .ri_uohm = 164000 },
292 };
293
294 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb535151vu[] = {
295 { .vbat_uv = 4071000, .ri_uohm = 158000 },
296 { .vbat_uv = 4019000, .ri_uohm = 187000 },
297 { .vbat_uv = 3951000, .ri_uohm = 191000 },
298 { .vbat_uv = 3901000, .ri_uohm = 193000 },
299 { .vbat_uv = 3850000, .ri_uohm = 273000 },
300 { .vbat_uv = 3800000, .ri_uohm = 305000 },
301 { .vbat_uv = 3750000, .ri_uohm = 205000 },
302 { .vbat_uv = 3700000, .ri_uohm = 290000 },
303 { .vbat_uv = 3650000, .ri_uohm = 262000 },
304 { .vbat_uv = 3618000, .ri_uohm = 290000 },
305 { .vbat_uv = 3505000, .ri_uohm = 235000 },
306 { .vbat_uv = 3484000, .ri_uohm = 253000 },
307 { .vbat_uv = 3413000, .ri_uohm = 243000 },
308 { .vbat_uv = 3393000, .ri_uohm = 285000 },
309 { .vbat_uv = 3361000, .ri_uohm = 281000 },
310 { .vbat_uv = 3302000, .ri_uohm = 286000 },
311 { .vbat_uv = 3280000, .ri_uohm = 250000 },
312 };
313
314 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb535151vu[] = {
315 { .vbat_uv = 4190000, .ri_uohm = 214000 },
316 { .vbat_uv = 4159000, .ri_uohm = 252000 },
317 { .vbat_uv = 4121000, .ri_uohm = 245000 },
318 { .vbat_uv = 4069000, .ri_uohm = 228000 },
319 { .vbat_uv = 4046000, .ri_uohm = 229000 },
320 { .vbat_uv = 4026000, .ri_uohm = 233000 },
321 { .vbat_uv = 4007000, .ri_uohm = 240000 },
322 { .vbat_uv = 3982000, .ri_uohm = 291000 },
323 { .vbat_uv = 3945000, .ri_uohm = 276000 },
324 { .vbat_uv = 3924000, .ri_uohm = 266000 },
325 { .vbat_uv = 3910000, .ri_uohm = 258000 },
326 { .vbat_uv = 3900000, .ri_uohm = 271000 },
327 { .vbat_uv = 3844000, .ri_uohm = 279000 },
328 { .vbat_uv = 3772000, .ri_uohm = 217000 },
329 { .vbat_uv = 3673000, .ri_uohm = 208000 },
330 { .vbat_uv = 3571000, .ri_uohm = 208000 },
331 { .vbat_uv = 3510000, .ri_uohm = 228000 },
332 };
333
334 static struct power_supply_vbat_ri_table samsung_vbat2res_discharging_eb585157lu[] = {
335 { .vbat_uv = 4194000, .ri_uohm = 121000 },
336 { .vbat_uv = 4169000, .ri_uohm = 188000 },
337 { .vbat_uv = 4136000, .ri_uohm = 173000 },
338 { .vbat_uv = 4108000, .ri_uohm = 158000 },
339 { .vbat_uv = 4064000, .ri_uohm = 143000 },
340 { .vbat_uv = 3956000, .ri_uohm = 160000 },
341 { .vbat_uv = 3847000, .ri_uohm = 262000 },
342 { .vbat_uv = 3806000, .ri_uohm = 280000 },
343 { .vbat_uv = 3801000, .ri_uohm = 266000 },
344 { .vbat_uv = 3794000, .ri_uohm = 259000 },
345 { .vbat_uv = 3785000, .ri_uohm = 234000 },
346 { .vbat_uv = 3779000, .ri_uohm = 227000 },
347 { .vbat_uv = 3772000, .ri_uohm = 222000 },
348 { .vbat_uv = 3765000, .ri_uohm = 221000 },
349 { .vbat_uv = 3759000, .ri_uohm = 216000 },
350 { .vbat_uv = 3754000, .ri_uohm = 206000 },
351 { .vbat_uv = 3747000, .ri_uohm = 212000 },
352 { .vbat_uv = 3743000, .ri_uohm = 208000 },
353 { .vbat_uv = 3737000, .ri_uohm = 212000 },
354 { .vbat_uv = 3733000, .ri_uohm = 200000 },
355 { .vbat_uv = 3728000, .ri_uohm = 203000 },
356 { .vbat_uv = 3722000, .ri_uohm = 207000 },
357 { .vbat_uv = 3719000, .ri_uohm = 208000 },
358 { .vbat_uv = 3715000, .ri_uohm = 209000 },
359 { .vbat_uv = 3712000, .ri_uohm = 211000 },
360 { .vbat_uv = 3709000, .ri_uohm = 210000 },
361 { .vbat_uv = 3704000, .ri_uohm = 216000 },
362 { .vbat_uv = 3701000, .ri_uohm = 218000 },
363 { .vbat_uv = 3698000, .ri_uohm = 222000 },
364 { .vbat_uv = 3694000, .ri_uohm = 218000 },
365 { .vbat_uv = 3692000, .ri_uohm = 215000 },
366 { .vbat_uv = 3688000, .ri_uohm = 224000 },
367 { .vbat_uv = 3686000, .ri_uohm = 224000 },
368 { .vbat_uv = 3683000, .ri_uohm = 228000 },
369 { .vbat_uv = 3681000, .ri_uohm = 228000 },
370 { .vbat_uv = 3679000, .ri_uohm = 229000 },
371 { .vbat_uv = 3676000, .ri_uohm = 232000 },
372 { .vbat_uv = 3675000, .ri_uohm = 229000 },
373 { .vbat_uv = 3673000, .ri_uohm = 229000 },
374 { .vbat_uv = 3672000, .ri_uohm = 223000 },
375 { .vbat_uv = 3669000, .ri_uohm = 224000 },
376 { .vbat_uv = 3666000, .ri_uohm = 224000 },
377 { .vbat_uv = 3663000, .ri_uohm = 221000 },
378 { .vbat_uv = 3660000, .ri_uohm = 218000 },
379 { .vbat_uv = 3657000, .ri_uohm = 215000 },
380 { .vbat_uv = 3654000, .ri_uohm = 212000 },
381 { .vbat_uv = 3649000, .ri_uohm = 215000 },
382 { .vbat_uv = 3644000, .ri_uohm = 215000 },
383 { .vbat_uv = 3636000, .ri_uohm = 215000 },
384 { .vbat_uv = 3631000, .ri_uohm = 206000 },
385 { .vbat_uv = 3623000, .ri_uohm = 205000 },
386 { .vbat_uv = 3616000, .ri_uohm = 193000 },
387 { .vbat_uv = 3605000, .ri_uohm = 193000 },
388 { .vbat_uv = 3600000, .ri_uohm = 198000 },
389 { .vbat_uv = 3597000, .ri_uohm = 198000 },
390 { .vbat_uv = 3592000, .ri_uohm = 203000 },
391 { .vbat_uv = 3591000, .ri_uohm = 188000 },
392 { .vbat_uv = 3587000, .ri_uohm = 188000 },
393 { .vbat_uv = 3583000, .ri_uohm = 177000 },
394 { .vbat_uv = 3577000, .ri_uohm = 170000 },
395 { .vbat_uv = 3568000, .ri_uohm = 135000 },
396 { .vbat_uv = 3552000, .ri_uohm = 54000 },
397 { .vbat_uv = 3526000, .ri_uohm = 130000 },
398 { .vbat_uv = 3501000, .ri_uohm = 48000 },
399 { .vbat_uv = 3442000, .ri_uohm = 183000 },
400 { .vbat_uv = 3326000, .ri_uohm = 372000 },
401 { .vbat_uv = 3161000, .ri_uohm = 452000 },
402 };
403
404 static struct power_supply_vbat_ri_table samsung_vbat2res_charging_eb585157lu[] = {
405 { .vbat_uv = 4360000, .ri_uohm = 128000 },
406 { .vbat_uv = 4325000, .ri_uohm = 130000 },
407 { .vbat_uv = 4316000, .ri_uohm = 148000 },
408 { .vbat_uv = 4308000, .ri_uohm = 162000 },
409 { .vbat_uv = 4301000, .ri_uohm = 162000 },
410 { .vbat_uv = 4250000, .ri_uohm = 162000 },
411 { .vbat_uv = 4230000, .ri_uohm = 164000 },
412 { .vbat_uv = 4030000, .ri_uohm = 164000 },
413 { .vbat_uv = 4000000, .ri_uohm = 193000 },
414 { .vbat_uv = 3950000, .ri_uohm = 204000 },
415 { .vbat_uv = 3850000, .ri_uohm = 210000 },
416 { .vbat_uv = 3800000, .ri_uohm = 230000 },
417 { .vbat_uv = 3790000, .ri_uohm = 240000 },
418 { .vbat_uv = 3780000, .ri_uohm = 311000 },
419 { .vbat_uv = 3760000, .ri_uohm = 420000 },
420 { .vbat_uv = 3700000, .ri_uohm = 504000 },
421 { .vbat_uv = 3600000, .ri_uohm = 565000 },
422 };
423
424 /*
425 * Temperature to internal resistance scaling tables.
426 *
427 * "resistance" is the percentage of the resistance determined from the voltage
428 * so this represents the capacity ratio at different temperatures.
429 *
430 * FIXME: the proper table is missing: Samsung does not provide the necessary
431 * temperature compensation tables so we just state 100% for every temperature.
432 * If you have the datasheets, please provide these tables.
433 */
434 static struct power_supply_resistance_temp_table samsung_temp2res[] = {
435 { .temp = 50, .resistance = 100 },
436 { .temp = 40, .resistance = 100 },
437 { .temp = 30, .resistance = 100 },
438 { .temp = 20, .resistance = 100 },
439 { .temp = 10, .resistance = 100 },
440 { .temp = 00, .resistance = 100 },
441 { .temp = -10, .resistance = 100 },
442 { .temp = -20, .resistance = 100 },
443 };
444
445 /*
446 * Capacity tables for different Open Circuit Voltages (OCV).
447 * These must be sorted by falling OCV value.
448 */
449
450 static struct power_supply_battery_ocv_table samsung_ocv_cap_eb485159lu[] = {
451 { .ocv = 4330000, .capacity = 100},
452 { .ocv = 4320000, .capacity = 99},
453 { .ocv = 4283000, .capacity = 95},
454 { .ocv = 4246000, .capacity = 92},
455 { .ocv = 4211000, .capacity = 89},
456 { .ocv = 4167000, .capacity = 85},
457 { .ocv = 4146000, .capacity = 83},
458 { .ocv = 4124000, .capacity = 81},
459 { .ocv = 4062000, .capacity = 75},
460 { .ocv = 4013000, .capacity = 70},
461 { .ocv = 3977000, .capacity = 66},
462 { .ocv = 3931000, .capacity = 60},
463 { .ocv = 3914000, .capacity = 58},
464 { .ocv = 3901000, .capacity = 57},
465 { .ocv = 3884000, .capacity = 56},
466 { .ocv = 3870000, .capacity = 55},
467 { .ocv = 3862000, .capacity = 54},
468 { .ocv = 3854000, .capacity = 53},
469 { .ocv = 3838000, .capacity = 50},
470 { .ocv = 3823000, .capacity = 47},
471 { .ocv = 3813000, .capacity = 45},
472 { .ocv = 3807000, .capacity = 43},
473 { .ocv = 3800000, .capacity = 41},
474 { .ocv = 3795000, .capacity = 40},
475 { .ocv = 3786000, .capacity = 37},
476 { .ocv = 3783000, .capacity = 35},
477 { .ocv = 3773000, .capacity = 30},
478 { .ocv = 3758000, .capacity = 25},
479 { .ocv = 3745000, .capacity = 22},
480 { .ocv = 3738000, .capacity = 20},
481 { .ocv = 3733000, .capacity = 19},
482 { .ocv = 3716000, .capacity = 17},
483 { .ocv = 3709000, .capacity = 16},
484 { .ocv = 3698000, .capacity = 15},
485 { .ocv = 3687000, .capacity = 14},
486 { .ocv = 3684000, .capacity = 13},
487 { .ocv = 3684000, .capacity = 12},
488 { .ocv = 3678000, .capacity = 10},
489 { .ocv = 3671000, .capacity = 9},
490 { .ocv = 3665000, .capacity = 8},
491 { .ocv = 3651000, .capacity = 7},
492 { .ocv = 3634000, .capacity = 6},
493 { .ocv = 3601000, .capacity = 5},
494 { .ocv = 3564000, .capacity = 4},
495 { .ocv = 3516000, .capacity = 3},
496 { .ocv = 3456000, .capacity = 2},
497 { .ocv = 3381000, .capacity = 1},
498 { .ocv = 3300000, .capacity = 0},
499 };
500
501 /* Same capacity table is used by eb-l1m7flu, eb425161la, eb425161lu */
502 static struct power_supply_battery_ocv_table samsung_ocv_cap_1500mah[] = {
503 { .ocv = 4328000, .capacity = 100},
504 { .ocv = 4299000, .capacity = 99},
505 { .ocv = 4281000, .capacity = 98},
506 { .ocv = 4241000, .capacity = 95},
507 { .ocv = 4183000, .capacity = 90},
508 { .ocv = 4150000, .capacity = 87},
509 { .ocv = 4116000, .capacity = 84},
510 { .ocv = 4077000, .capacity = 80},
511 { .ocv = 4068000, .capacity = 79},
512 { .ocv = 4058000, .capacity = 77},
513 { .ocv = 4026000, .capacity = 75},
514 { .ocv = 3987000, .capacity = 72},
515 { .ocv = 3974000, .capacity = 69},
516 { .ocv = 3953000, .capacity = 66},
517 { .ocv = 3933000, .capacity = 63},
518 { .ocv = 3911000, .capacity = 60},
519 { .ocv = 3900000, .capacity = 58},
520 { .ocv = 3873000, .capacity = 55},
521 { .ocv = 3842000, .capacity = 52},
522 { .ocv = 3829000, .capacity = 50},
523 { .ocv = 3810000, .capacity = 45},
524 { .ocv = 3793000, .capacity = 40},
525 { .ocv = 3783000, .capacity = 35},
526 { .ocv = 3776000, .capacity = 30},
527 { .ocv = 3762000, .capacity = 25},
528 { .ocv = 3746000, .capacity = 20},
529 { .ocv = 3739000, .capacity = 18},
530 { .ocv = 3715000, .capacity = 15},
531 { .ocv = 3700000, .capacity = 12},
532 { .ocv = 3690000, .capacity = 10},
533 { .ocv = 3680000, .capacity = 9},
534 { .ocv = 3670000, .capacity = 7},
535 { .ocv = 3656000, .capacity = 5},
536 { .ocv = 3634000, .capacity = 4},
537 { .ocv = 3614000, .capacity = 3},
538 { .ocv = 3551000, .capacity = 2},
539 { .ocv = 3458000, .capacity = 1},
540 { .ocv = 3300000, .capacity = 0},
541 };
542
543 static struct power_supply_battery_ocv_table samsung_ocv_cap_eb535151vu[] = {
544 { .ocv = 4178000, .capacity = 100},
545 { .ocv = 4148000, .capacity = 99},
546 { .ocv = 4105000, .capacity = 95},
547 { .ocv = 4078000, .capacity = 92},
548 { .ocv = 4057000, .capacity = 89},
549 { .ocv = 4013000, .capacity = 85},
550 { .ocv = 3988000, .capacity = 82},
551 { .ocv = 3962000, .capacity = 77},
552 { .ocv = 3920000, .capacity = 70},
553 { .ocv = 3891000, .capacity = 65},
554 { .ocv = 3874000, .capacity = 62},
555 { .ocv = 3839000, .capacity = 59},
556 { .ocv = 3816000, .capacity = 55},
557 { .ocv = 3798000, .capacity = 50},
558 { .ocv = 3778000, .capacity = 40},
559 { .ocv = 3764000, .capacity = 30},
560 { .ocv = 3743000, .capacity = 25},
561 { .ocv = 3711000, .capacity = 20},
562 { .ocv = 3691000, .capacity = 18},
563 { .ocv = 3685000, .capacity = 15},
564 { .ocv = 3680000, .capacity = 12},
565 { .ocv = 3662000, .capacity = 10},
566 { .ocv = 3638000, .capacity = 9},
567 { .ocv = 3593000, .capacity = 7},
568 { .ocv = 3566000, .capacity = 6},
569 { .ocv = 3497000, .capacity = 4},
570 { .ocv = 3405000, .capacity = 2},
571 { .ocv = 3352000, .capacity = 1},
572 { .ocv = 3300000, .capacity = 0},
573 };
574
575 static struct power_supply_battery_ocv_table samsung_ocv_cap_eb585157lu[] = {
576 { .ocv = 4320000, .capacity = 100},
577 { .ocv = 4296000, .capacity = 99},
578 { .ocv = 4283000, .capacity = 98},
579 { .ocv = 4245000, .capacity = 95},
580 { .ocv = 4185000, .capacity = 90},
581 { .ocv = 4152000, .capacity = 87},
582 { .ocv = 4119000, .capacity = 84},
583 { .ocv = 4077000, .capacity = 80},
584 { .ocv = 4057000, .capacity = 78},
585 { .ocv = 4048000, .capacity = 77},
586 { .ocv = 4020000, .capacity = 74},
587 { .ocv = 4003000, .capacity = 72},
588 { .ocv = 3978000, .capacity = 69},
589 { .ocv = 3955000, .capacity = 66},
590 { .ocv = 3934000, .capacity = 63},
591 { .ocv = 3912000, .capacity = 60},
592 { .ocv = 3894000, .capacity = 58},
593 { .ocv = 3860000, .capacity = 55},
594 { .ocv = 3837000, .capacity = 52},
595 { .ocv = 3827000, .capacity = 50},
596 { .ocv = 3806000, .capacity = 45},
597 { .ocv = 3791000, .capacity = 40},
598 { .ocv = 3779000, .capacity = 35},
599 { .ocv = 3770000, .capacity = 30},
600 { .ocv = 3758000, .capacity = 25},
601 { .ocv = 3739000, .capacity = 20},
602 { .ocv = 3730000, .capacity = 18},
603 { .ocv = 3706000, .capacity = 15},
604 { .ocv = 3684000, .capacity = 13},
605 { .ocv = 3675000, .capacity = 10},
606 { .ocv = 3673000, .capacity = 9},
607 { .ocv = 3665000, .capacity = 7},
608 { .ocv = 3649000, .capacity = 5},
609 { .ocv = 3628000, .capacity = 4},
610 { .ocv = 3585000, .capacity = 3},
611 { .ocv = 3525000, .capacity = 2},
612 { .ocv = 3441000, .capacity = 1},
613 { .ocv = 3300000, .capacity = 0},
614 };
615
616 static struct power_supply_maintenance_charge_table samsung_maint_charge_table[] = {
617 {
618 /* Maintenance charging phase A, 60 hours */
619 .charge_current_max_ua = 600000,
620 .charge_voltage_max_uv = 4150000,
621 .charge_safety_timer_minutes = 60*60,
622 },
623 {
624 /* Maintenance charging phase B, 200 hours */
625 .charge_current_max_ua = 600000,
626 .charge_voltage_max_uv = 4100000,
627 .charge_safety_timer_minutes = 200*60,
628 }
629 };
630
631 static struct samsung_sdi_battery samsung_sdi_batteries[] = {
632 {
633 /*
634 * Used in Samsung GT-I8190 "Golden"
635 * Data from vendor boardfile board-golden-[bm|battery].c
636 */
637 .compatible = "samsung,eb-l1m7flu",
638 .name = "EB-L1M7FLU",
639 .info = {
640 .charge_full_design_uah = 1500000,
641 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
642 .factory_internal_resistance_uohm = 100000,
643 .factory_internal_resistance_charging_uohm = 200000,
644 /* If you have data on this fix the min_design_uv */
645 .voltage_min_design_uv = 3320000,
646 .voltage_max_design_uv = 4340000,
647 .overvoltage_limit_uv = 4500000,
648 .constant_charge_current_max_ua = 900000,
649 .constant_charge_voltage_max_uv = 4320000,
650 .charge_term_current_ua = 200000,
651 .charge_restart_voltage_uv = 4300000,
652 .maintenance_charge = samsung_maint_charge_table,
653 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
654 .alert_low_temp_charge_current_ua = 300000,
655 .alert_low_temp_charge_voltage_uv = 4000000,
656 .alert_high_temp_charge_current_ua = 300000,
657 .alert_high_temp_charge_voltage_uv = 4000000,
658 .temp_min = -50,
659 .temp_alert_min = 0,
660 .temp_alert_max = 40,
661 .temp_max = 60,
662 .resist_table = samsung_temp2res,
663 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
664 /* If you have tables for more temperatures, add them */
665 .ocv_temp[0] = 25,
666 .ocv_table[0] = samsung_ocv_cap_1500mah,
667 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_1500mah),
668 .vbat2ri_discharging = samsung_vbat2res_discharging_eb_l1m7flu,
669 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb_l1m7flu),
670 .vbat2ri_charging = samsung_vbat2res_charging_eb_l1m7flu,
671 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb_l1m7flu),
672 .bti_resistance_ohm = 2400,
673 .bti_resistance_tolerance = 40,
674 },
675 },
676 {
677 /*
678 * Used in Samsung SGH-T599 "Codina TMO" and SGH-I407 "Kyle"
679 * Data from vendor boardfile board-kyle-[bm|battery].c
680 */
681 .compatible = "samsung,eb425161la",
682 .name = "EB425161LA",
683 .info = {
684 .charge_full_design_uah = 1500000,
685 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
686 .factory_internal_resistance_uohm = 136000,
687 .factory_internal_resistance_charging_uohm = 200000,
688 /* If you have data on this fix the min_design_uv */
689 .voltage_min_design_uv = 3320000,
690 .voltage_max_design_uv = 4340000,
691 .overvoltage_limit_uv = 4500000,
692 .constant_charge_current_max_ua = 900000,
693 .constant_charge_voltage_max_uv = 4320000,
694 .charge_term_current_ua = 200000,
695 .charge_restart_voltage_uv = 4270000,
696 .maintenance_charge = samsung_maint_charge_table,
697 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
698 .alert_low_temp_charge_current_ua = 300000,
699 .alert_low_temp_charge_voltage_uv = 4000000,
700 .alert_high_temp_charge_current_ua = 300000,
701 .alert_high_temp_charge_voltage_uv = 4000000,
702 .temp_min = -30,
703 .temp_alert_min = 0,
704 .temp_alert_max = 40,
705 .temp_max = 47,
706 .resist_table = samsung_temp2res,
707 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
708 /* If you have tables for more temperatures, add them */
709 .ocv_temp[0] = 25,
710 .ocv_table[0] = samsung_ocv_cap_1500mah,
711 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_1500mah),
712 .vbat2ri_discharging = samsung_vbat2res_discharging_eb425161la,
713 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb425161la),
714 .vbat2ri_charging = samsung_vbat2res_charging_eb425161la,
715 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb425161la),
716 .bti_resistance_ohm = 2400,
717 .bti_resistance_tolerance = 40,
718 },
719 },
720 {
721 /*
722 * Used in Samsung GT-I8160 "Codina"
723 * Data from vendor boardfile board-codina-[bm|battery].c
724 */
725 .compatible = "samsung,eb425161lu",
726 .name = "EB425161LU",
727 .info = {
728 .charge_full_design_uah = 1500000,
729 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
730 .factory_internal_resistance_uohm = 100000,
731 .factory_internal_resistance_charging_uohm = 200000,
732 /* If you have data on this fix the min_design_uv */
733 .voltage_min_design_uv = 3320000,
734 .voltage_max_design_uv = 4350000,
735 .overvoltage_limit_uv = 4500000,
736 .constant_charge_current_max_ua = 900000,
737 .constant_charge_voltage_max_uv = 4340000,
738 .charge_term_current_ua = 200000,
739 .charge_restart_voltage_uv = 4280000,
740 .maintenance_charge = samsung_maint_charge_table,
741 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
742 .alert_low_temp_charge_current_ua = 300000,
743 .alert_low_temp_charge_voltage_uv = 4000000,
744 .alert_high_temp_charge_current_ua = 300000,
745 .alert_high_temp_charge_voltage_uv = 4000000,
746 .temp_min = -50,
747 .temp_alert_min = 0,
748 .temp_alert_max = 43,
749 .temp_max = 49,
750 .resist_table = samsung_temp2res,
751 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
752 /* If you have tables for more temperatures, add them */
753 .ocv_temp[0] = 25,
754 .ocv_table[0] = samsung_ocv_cap_1500mah,
755 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_1500mah),
756 .vbat2ri_discharging = samsung_vbat2res_discharging_eb425161lu,
757 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb425161lu),
758 .vbat2ri_charging = samsung_vbat2res_charging_eb425161lu,
759 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb425161lu),
760 .bti_resistance_ohm = 2400,
761 .bti_resistance_tolerance = 40,
762 },
763 },
764 {
765 /*
766 * Used in Samsung GT-S7710 "Skomer"
767 * Data from vendor boardfile board-skomer-[bm|battery].c
768 */
769 .compatible = "samsung,eb485159lu",
770 .name = "EB485159LU",
771 .info = {
772 .charge_full_design_uah = 1700000,
773 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
774 .factory_internal_resistance_uohm = 100000,
775 .factory_internal_resistance_charging_uohm = 200000,
776 .voltage_min_design_uv = 3320000,
777 .voltage_max_design_uv = 4350000,
778 .overvoltage_limit_uv = 4500000,
779 .constant_charge_current_max_ua = 900000,
780 .constant_charge_voltage_max_uv = 4340000,
781 .charge_term_current_ua = 200000,
782 .charge_restart_voltage_uv = 4300000,
783 .maintenance_charge = samsung_maint_charge_table,
784 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
785 .alert_low_temp_charge_current_ua = 300000,
786 .alert_low_temp_charge_voltage_uv = 4000000,
787 .alert_high_temp_charge_current_ua = 300000,
788 .alert_high_temp_charge_voltage_uv = 4000000,
789 .temp_min = -50,
790 .temp_alert_min = 0,
791 .temp_alert_max = 40,
792 .temp_max = 60,
793 .resist_table = samsung_temp2res,
794 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
795 /* If you have tables for more temperatures, add them */
796 .ocv_temp[0] = 25,
797 .ocv_table[0] = samsung_ocv_cap_eb485159lu,
798 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_eb485159lu),
799 /* CHECKME: vendor uses the 1500 mAh table, check against datasheet */
800 .vbat2ri_discharging = samsung_vbat2res_discharging_eb485159lu,
801 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb485159lu),
802 .vbat2ri_charging = samsung_vbat2res_charging_eb485159lu,
803 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb485159lu),
804 .bti_resistance_ohm = 2400,
805 .bti_resistance_tolerance = 40,
806 },
807 },
808 {
809 /*
810 * Used in Samsung GT-I9070 "Janice"
811 * Data from vendor boardfile board-janice-bm.c
812 */
813 .compatible = "samsung,eb535151vu",
814 .name = "EB535151VU",
815 .info = {
816 .charge_full_design_uah = 1500000,
817 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
818 .factory_internal_resistance_uohm = 100000,
819 .factory_internal_resistance_charging_uohm = 200000,
820 /* If you have data on this fix the min_design_uv */
821 .voltage_min_design_uv = 3300000,
822 .voltage_max_design_uv = 4180000,
823 .overvoltage_limit_uv = 4500000,
824 .constant_charge_current_max_ua = 900000,
825 .constant_charge_voltage_max_uv = 4200000,
826 .charge_term_current_ua = 200000,
827 .charge_restart_voltage_uv = 4170000,
828 .maintenance_charge = samsung_maint_charge_table,
829 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
830 .alert_low_temp_charge_current_ua = 300000,
831 .alert_low_temp_charge_voltage_uv = 4000000,
832 .alert_high_temp_charge_current_ua = 300000,
833 .alert_high_temp_charge_voltage_uv = 4000000,
834 .temp_min = -5,
835 .temp_alert_min = 0,
836 .temp_alert_max = 40,
837 .temp_max = 60,
838 .resist_table = samsung_temp2res,
839 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
840 /* If you have tables for more temperatures, add them */
841 .ocv_temp[0] = 25,
842 .ocv_table[0] = samsung_ocv_cap_eb535151vu,
843 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_eb535151vu),
844 .vbat2ri_discharging = samsung_vbat2res_discharging_eb535151vu,
845 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb535151vu),
846 .vbat2ri_charging = samsung_vbat2res_charging_eb535151vu,
847 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb535151vu),
848 .bti_resistance_ohm = 1500,
849 .bti_resistance_tolerance = 40,
850 },
851 },
852 {
853 /*
854 * Used in Samsung GT-I8530 "Gavini"
855 * Data from vendor boardfile board-gavini-bm.c
856 */
857 .compatible = "samsung,eb585157lu",
858 .name = "EB585157LU",
859 .info = {
860 .charge_full_design_uah = 2000000,
861 .technology = POWER_SUPPLY_TECHNOLOGY_LION,
862 .factory_internal_resistance_uohm = 105000,
863 .factory_internal_resistance_charging_uohm = 160000,
864 /* If you have data on this fix the min_design_uv */
865 .voltage_min_design_uv = 3300000,
866 .voltage_max_design_uv = 4320000,
867 .overvoltage_limit_uv = 4500000,
868 .constant_charge_current_max_ua = 1500000,
869 .constant_charge_voltage_max_uv = 4350000,
870 .charge_term_current_ua = 120000,
871 .charge_restart_voltage_uv = 4300000,
872 .maintenance_charge = samsung_maint_charge_table,
873 .maintenance_charge_size = ARRAY_SIZE(samsung_maint_charge_table),
874 .alert_low_temp_charge_current_ua = 300000,
875 .alert_low_temp_charge_voltage_uv = 4000000,
876 .alert_high_temp_charge_current_ua = 300000,
877 .alert_high_temp_charge_voltage_uv = 4000000,
878 .temp_min = -5,
879 .temp_alert_min = 0,
880 .temp_alert_max = 40,
881 .temp_max = 60,
882 .resist_table = samsung_temp2res,
883 .resist_table_size = ARRAY_SIZE(samsung_temp2res),
884 /* If you have tables for more temperatures, add them */
885 .ocv_temp[0] = 25,
886 .ocv_table[0] = samsung_ocv_cap_eb585157lu,
887 .ocv_table_size[0] = ARRAY_SIZE(samsung_ocv_cap_eb585157lu),
888 .vbat2ri_discharging = samsung_vbat2res_discharging_eb585157lu,
889 .vbat2ri_discharging_size = ARRAY_SIZE(samsung_vbat2res_discharging_eb585157lu),
890 .vbat2ri_charging = samsung_vbat2res_charging_eb585157lu,
891 .vbat2ri_charging_size = ARRAY_SIZE(samsung_vbat2res_charging_eb585157lu),
892 .bti_resistance_ohm = 2400,
893 .bti_resistance_tolerance = 40,
894 },
895 },
896 };
897
samsung_sdi_battery_get_info(struct device * dev,const char * compatible,struct power_supply_battery_info ** info)898 int samsung_sdi_battery_get_info(struct device *dev,
899 const char *compatible,
900 struct power_supply_battery_info **info)
901 {
902 struct samsung_sdi_battery *batt;
903 int i;
904
905 for (i = 0; i < ARRAY_SIZE(samsung_sdi_batteries); i++) {
906 batt = &samsung_sdi_batteries[i];
907 if (!strcmp(compatible, batt->compatible))
908 break;
909 }
910
911 if (i == ARRAY_SIZE(samsung_sdi_batteries))
912 return -ENODEV;
913
914 *info = &batt->info;
915 dev_info(dev, "Samsung SDI %s battery %d mAh\n",
916 batt->name, batt->info.charge_full_design_uah / 1000);
917
918 return 0;
919 }
920 EXPORT_SYMBOL_GPL(samsung_sdi_battery_get_info);
921