power: bq27x00_battery: Fix lines over 80 characters long
[deliverable/linux.git] / drivers / power / bq27x00_battery.c
CommitLineData
b996ad0e
RG
1/*
2 * BQ27x00 battery driver
3 *
4 * Copyright (C) 2008 Rodolfo Giometti <giometti@linux.it>
5 * Copyright (C) 2008 Eurotech S.p.A. <info@eurotech.it>
7fb7ba58 6 * Copyright (C) 2010-2011 Lars-Peter Clausen <lars@metafoo.de>
73c244a8 7 * Copyright (C) 2011 Pali Rohár <pali.rohar@gmail.com>
b996ad0e
RG
8 *
9 * Based on a previous work by Copyright (C) 2008 Texas Instruments, Inc.
10 *
11 * This package is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 *
631c17ee
PR
19 * Datasheets:
20 * http://focus.ti.com/docs/prod/folders/print/bq27000.html
21 * http://focus.ti.com/docs/prod/folders/print/bq27500.html
a66f59ba 22 * http://www.ti.com/product/bq27425-g1
628ef02c 23 * http://www.ti.com/product/BQ27742-G1
f46bf82e 24 * http://www.ti.com/product/BQ27510-G3
631c17ee
PR
25 */
26
1cb82fdb 27#include <linux/device.h>
b996ad0e
RG
28#include <linux/module.h>
29#include <linux/param.h>
30#include <linux/jiffies.h>
31#include <linux/workqueue.h>
32#include <linux/delay.h>
33#include <linux/platform_device.h>
34#include <linux/power_supply.h>
35#include <linux/idr.h>
b996ad0e 36#include <linux/i2c.h>
5a0e3ad6 37#include <linux/slab.h>
8aef7e8f 38#include <asm/unaligned.h>
b996ad0e 39
7fb7ba58
LPC
40#include <linux/power/bq27x00_battery.h>
41
6eb207f2 42#define DRIVER_VERSION "1.2.0"
b996ad0e 43
db04fc5c
AD
44#define BQ27XXX_MANUFACTURER "Texas Instruments"
45
6eb207f2
AD
46#define BQ27x00_REG_TEMP 0x06
47#define BQ27x00_REG_VOLT 0x08
48#define BQ27x00_REG_AI 0x14
49#define BQ27x00_REG_FLAGS 0x0A
50#define BQ27x00_REG_TTE 0x16
51#define BQ27x00_REG_TTF 0x18
52#define BQ27x00_REG_TTECP 0x26
53#define BQ27x00_REG_NAC 0x0C /* Nominal available capacity */
54#define BQ27x00_REG_LMD 0x12 /* Last measured discharge */
55#define BQ27x00_REG_CYCT 0x2A /* Cycle count total */
56#define BQ27x00_REG_AE 0x22 /* Available energy */
57#define BQ27x00_POWER_AVG 0x24
58
59#define BQ27000_REG_RSOC 0x0B /* Relative State-of-Charge */
60#define BQ27000_REG_ILMD 0x76 /* Initial last measured discharge */
61#define BQ27000_FLAG_EDVF BIT(0) /* Final End-of-Discharge-Voltage flag */
62#define BQ27000_FLAG_EDV1 BIT(1) /* First End-of-Discharge-Voltage flag */
63#define BQ27000_FLAG_CI BIT(4) /* Capacity Inaccurate flag */
64#define BQ27000_FLAG_FC BIT(5)
65#define BQ27000_FLAG_CHGS BIT(7) /* Charge state flag */
66
67#define BQ27500_REG_SOC 0x2C
68#define BQ27500_REG_DCAP 0x3C /* Design capacity */
69#define BQ27500_FLAG_DSC BIT(0)
70#define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */
71#define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */
72#define BQ27500_FLAG_FC BIT(9)
73#define BQ27500_FLAG_OTC BIT(15)
74
75#define BQ27742_POWER_AVG 0x76
76
77#define BQ27510_REG_SOC 0x20
78#define BQ27510_REG_DCAP 0x2E /* Design capacity */
79#define BQ27510_REG_CYCT 0x1E /* Cycle count total */
f46bf82e 80
a66f59ba 81/* bq27425 register addresses are same as bq27x00 addresses minus 4 */
6eb207f2 82#define BQ27425_REG_OFFSET 0x04
9dbf5a28 83#define BQ27425_REG_SOC (0x1C + BQ27425_REG_OFFSET)
6eb207f2 84#define BQ27425_REG_DCAP (0x3C + BQ27425_REG_OFFSET)
a66f59ba 85
a2e5118c 86#define BQ27000_RS 20 /* Resistor sense */
9903e627 87#define BQ27x00_POWER_CONSTANT (256 * 29200 / 1000)
a2e5118c 88
b996ad0e
RG
89struct bq27x00_device_info;
90struct bq27x00_access_methods {
297a533b 91 int (*read)(struct bq27x00_device_info *di, u8 reg, bool single);
b996ad0e
RG
92};
93
f46bf82e 94enum bq27x00_chip { BQ27000, BQ27500, BQ27425, BQ27742, BQ27510};
e20908d9 95
297a533b
LPC
96struct bq27x00_reg_cache {
97 int temperature;
98 int time_to_empty;
99 int time_to_empty_avg;
100 int time_to_full;
631c17ee 101 int charge_full;
73c244a8 102 int cycle_count;
297a533b 103 int capacity;
a8f6bd23 104 int energy;
297a533b 105 int flags;
9903e627
SR
106 int power_avg;
107 int health;
297a533b
LPC
108};
109
b996ad0e
RG
110struct bq27x00_device_info {
111 struct device *dev;
112 int id;
e20908d9 113 enum bq27x00_chip chip;
b996ad0e 114
297a533b 115 struct bq27x00_reg_cache cache;
631c17ee
PR
116 int charge_design_full;
117
297a533b 118 unsigned long last_update;
740b755a 119 struct delayed_work work;
297a533b 120
297d716f 121 struct power_supply *bat;
a40402ef
LPC
122
123 struct bq27x00_access_methods bus;
740b755a
LPC
124
125 struct mutex lock;
b996ad0e
RG
126};
127
128static enum power_supply_property bq27x00_battery_props[] = {
4e924a81 129 POWER_SUPPLY_PROP_STATUS,
b996ad0e
RG
130 POWER_SUPPLY_PROP_PRESENT,
131 POWER_SUPPLY_PROP_VOLTAGE_NOW,
132 POWER_SUPPLY_PROP_CURRENT_NOW,
133 POWER_SUPPLY_PROP_CAPACITY,
d66bab3f 134 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
b996ad0e 135 POWER_SUPPLY_PROP_TEMP,
4e924a81
GI
136 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
137 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
138 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
5661f334 139 POWER_SUPPLY_PROP_TECHNOLOGY,
631c17ee
PR
140 POWER_SUPPLY_PROP_CHARGE_FULL,
141 POWER_SUPPLY_PROP_CHARGE_NOW,
142 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
73c244a8 143 POWER_SUPPLY_PROP_CYCLE_COUNT,
631c17ee 144 POWER_SUPPLY_PROP_ENERGY_NOW,
9903e627
SR
145 POWER_SUPPLY_PROP_POWER_AVG,
146 POWER_SUPPLY_PROP_HEALTH,
db04fc5c 147 POWER_SUPPLY_PROP_MANUFACTURER,
b996ad0e
RG
148};
149
a66f59ba
SG
150static enum power_supply_property bq27425_battery_props[] = {
151 POWER_SUPPLY_PROP_STATUS,
152 POWER_SUPPLY_PROP_PRESENT,
153 POWER_SUPPLY_PROP_VOLTAGE_NOW,
154 POWER_SUPPLY_PROP_CURRENT_NOW,
155 POWER_SUPPLY_PROP_CAPACITY,
156 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
157 POWER_SUPPLY_PROP_TEMP,
158 POWER_SUPPLY_PROP_TECHNOLOGY,
159 POWER_SUPPLY_PROP_CHARGE_FULL,
160 POWER_SUPPLY_PROP_CHARGE_NOW,
161 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
db04fc5c 162 POWER_SUPPLY_PROP_MANUFACTURER,
a66f59ba
SG
163};
164
628ef02c
PV
165static enum power_supply_property bq27742_battery_props[] = {
166 POWER_SUPPLY_PROP_STATUS,
167 POWER_SUPPLY_PROP_PRESENT,
168 POWER_SUPPLY_PROP_VOLTAGE_NOW,
169 POWER_SUPPLY_PROP_CURRENT_NOW,
170 POWER_SUPPLY_PROP_CAPACITY,
171 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
172 POWER_SUPPLY_PROP_TEMP,
173 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
174 POWER_SUPPLY_PROP_TECHNOLOGY,
175 POWER_SUPPLY_PROP_CHARGE_FULL,
176 POWER_SUPPLY_PROP_CHARGE_NOW,
177 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
178 POWER_SUPPLY_PROP_CYCLE_COUNT,
179 POWER_SUPPLY_PROP_POWER_AVG,
180 POWER_SUPPLY_PROP_HEALTH,
db04fc5c 181 POWER_SUPPLY_PROP_MANUFACTURER,
628ef02c
PV
182};
183
f46bf82e
AB
184static enum power_supply_property bq27510_battery_props[] = {
185 POWER_SUPPLY_PROP_STATUS,
186 POWER_SUPPLY_PROP_PRESENT,
187 POWER_SUPPLY_PROP_VOLTAGE_NOW,
188 POWER_SUPPLY_PROP_CURRENT_NOW,
189 POWER_SUPPLY_PROP_CAPACITY,
190 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
191 POWER_SUPPLY_PROP_TEMP,
192 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
193 POWER_SUPPLY_PROP_TECHNOLOGY,
194 POWER_SUPPLY_PROP_CHARGE_FULL,
195 POWER_SUPPLY_PROP_CHARGE_NOW,
196 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
197 POWER_SUPPLY_PROP_CYCLE_COUNT,
198 POWER_SUPPLY_PROP_POWER_AVG,
199 POWER_SUPPLY_PROP_HEALTH,
db04fc5c 200 POWER_SUPPLY_PROP_MANUFACTURER,
f46bf82e
AB
201};
202
740b755a
LPC
203static unsigned int poll_interval = 360;
204module_param(poll_interval, uint, 0644);
205MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \
206 "0 disables polling");
207
b996ad0e
RG
208/*
209 * Common code for BQ27x00 devices
210 */
211
a40402ef 212static inline int bq27x00_read(struct bq27x00_device_info *di, u8 reg,
297a533b 213 bool single)
b996ad0e 214{
a66f59ba
SG
215 if (di->chip == BQ27425)
216 return di->bus.read(di, reg - BQ27425_REG_OFFSET, single);
297a533b 217 return di->bus.read(di, reg, single);
b996ad0e
RG
218}
219
a66f59ba
SG
220/*
221 * Higher versions of the chip like BQ27425 and BQ27500
222 * differ from BQ27000 and BQ27200 in calculation of certain
223 * parameters. Hence we need to check for the chip type.
224 */
225static bool bq27xxx_is_chip_version_higher(struct bq27x00_device_info *di)
226{
f46bf82e
AB
227 if (di->chip == BQ27425 || di->chip == BQ27500 || di->chip == BQ27742
228 || di->chip == BQ27510)
a66f59ba
SG
229 return true;
230 return false;
231}
232
b996ad0e 233/*
297a533b 234 * Return the battery Relative State-of-Charge
b996ad0e
RG
235 * Or < 0 if something fails.
236 */
297a533b 237static int bq27x00_battery_read_rsoc(struct bq27x00_device_info *di)
b996ad0e 238{
297a533b 239 int rsoc;
b996ad0e 240
628ef02c 241 if (di->chip == BQ27500 || di->chip == BQ27742)
297a533b 242 rsoc = bq27x00_read(di, BQ27500_REG_SOC, false);
f46bf82e
AB
243 else if (di->chip == BQ27510)
244 rsoc = bq27x00_read(di, BQ27510_REG_SOC, false);
a66f59ba
SG
245 else if (di->chip == BQ27425)
246 rsoc = bq27x00_read(di, BQ27425_REG_SOC, false);
e20908d9 247 else
297a533b
LPC
248 rsoc = bq27x00_read(di, BQ27000_REG_RSOC, true);
249
250 if (rsoc < 0)
c6cd4f26 251 dev_dbg(di->dev, "error reading relative State-of-Charge\n");
297a533b
LPC
252
253 return rsoc;
b996ad0e
RG
254}
255
631c17ee
PR
256/*
257 * Return a battery charge value in µAh
258 * Or < 0 if something fails.
259 */
260static int bq27x00_battery_read_charge(struct bq27x00_device_info *di, u8 reg)
261{
262 int charge;
263
264 charge = bq27x00_read(di, reg, false);
265 if (charge < 0) {
c6cd4f26
PR
266 dev_dbg(di->dev, "error reading charge register %02x: %d\n",
267 reg, charge);
631c17ee
PR
268 return charge;
269 }
270
a66f59ba 271 if (bq27xxx_is_chip_version_higher(di))
631c17ee
PR
272 charge *= 1000;
273 else
274 charge = charge * 3570 / BQ27000_RS;
275
276 return charge;
277}
278
279/*
280 * Return the battery Nominal available capaciy in µAh
281 * Or < 0 if something fails.
282 */
283static inline int bq27x00_battery_read_nac(struct bq27x00_device_info *di)
284{
e59ec4a1
PR
285 int flags;
286 bool is_bq27500 = di->chip == BQ27500;
a3c0c3e7 287 bool is_bq27742 = di->chip == BQ27742;
e59ec4a1 288 bool is_higher = bq27xxx_is_chip_version_higher(di);
a3c0c3e7 289 bool flags_1b = !(is_bq27500 || is_bq27742);
e59ec4a1 290
a3c0c3e7 291 flags = bq27x00_read(di, BQ27x00_REG_FLAGS, flags_1b);
e59ec4a1
PR
292 if (flags >= 0 && !is_higher && (flags & BQ27000_FLAG_CI))
293 return -ENODATA;
294
631c17ee
PR
295 return bq27x00_battery_read_charge(di, BQ27x00_REG_NAC);
296}
297
298/*
299 * Return the battery Last measured discharge in µAh
300 * Or < 0 if something fails.
301 */
302static inline int bq27x00_battery_read_lmd(struct bq27x00_device_info *di)
303{
304 return bq27x00_battery_read_charge(di, BQ27x00_REG_LMD);
305}
306
307/*
308 * Return the battery Initial last measured discharge in µAh
309 * Or < 0 if something fails.
310 */
311static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
312{
313 int ilmd;
314
9dbf5a28
EB
315 if (bq27xxx_is_chip_version_higher(di)) {
316 if (di->chip == BQ27425)
317 ilmd = bq27x00_read(di, BQ27425_REG_DCAP, false);
f46bf82e
AB
318 else if (di->chip == BQ27510)
319 ilmd = bq27x00_read(di, BQ27510_REG_DCAP, false);
9dbf5a28
EB
320 else
321 ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
322 } else
631c17ee
PR
323 ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);
324
325 if (ilmd < 0) {
c6cd4f26 326 dev_dbg(di->dev, "error reading initial last measured discharge\n");
631c17ee
PR
327 return ilmd;
328 }
329
a66f59ba 330 if (bq27xxx_is_chip_version_higher(di))
631c17ee
PR
331 ilmd *= 1000;
332 else
333 ilmd = ilmd * 256 * 3570 / BQ27000_RS;
334
335 return ilmd;
336}
337
a8f6bd23
PR
338/*
339 * Return the battery Available energy in µWh
340 * Or < 0 if something fails.
341 */
342static int bq27x00_battery_read_energy(struct bq27x00_device_info *di)
343{
344 int ae;
345
346 ae = bq27x00_read(di, BQ27x00_REG_AE, false);
347 if (ae < 0) {
c6cd4f26 348 dev_dbg(di->dev, "error reading available energy\n");
a8f6bd23
PR
349 return ae;
350 }
351
352 if (di->chip == BQ27500)
353 ae *= 1000;
354 else
355 ae = ae * 29200 / BQ27000_RS;
356
357 return ae;
358}
359
d149e98e 360/*
5dc3443e 361 * Return the battery temperature in tenths of degree Kelvin
d149e98e
PR
362 * Or < 0 if something fails.
363 */
364static int bq27x00_battery_read_temperature(struct bq27x00_device_info *di)
365{
366 int temp;
367
368 temp = bq27x00_read(di, BQ27x00_REG_TEMP, false);
369 if (temp < 0) {
370 dev_err(di->dev, "error reading temperature\n");
371 return temp;
372 }
373
5dc3443e
PR
374 if (!bq27xxx_is_chip_version_higher(di))
375 temp = 5 * temp / 2;
d149e98e
PR
376
377 return temp;
378}
379
631c17ee
PR
380/*
381 * Return the battery Cycle count total
382 * Or < 0 if something fails.
383 */
384static int bq27x00_battery_read_cyct(struct bq27x00_device_info *di)
385{
386 int cyct;
387
f46bf82e
AB
388 if (di->chip == BQ27510)
389 cyct = bq27x00_read(di, BQ27510_REG_CYCT, false);
390 else
391 cyct = bq27x00_read(di, BQ27x00_REG_CYCT, false);
631c17ee
PR
392 if (cyct < 0)
393 dev_err(di->dev, "error reading cycle count total\n");
394
395 return cyct;
396}
397
b996ad0e 398/*
297a533b
LPC
399 * Read a time register.
400 * Return < 0 if something fails.
b996ad0e 401 */
297a533b 402static int bq27x00_battery_read_time(struct bq27x00_device_info *di, u8 reg)
b996ad0e 403{
297a533b 404 int tval;
b996ad0e 405
297a533b
LPC
406 tval = bq27x00_read(di, reg, false);
407 if (tval < 0) {
c6cd4f26
PR
408 dev_dbg(di->dev, "error reading time register %02x: %d\n",
409 reg, tval);
297a533b 410 return tval;
b996ad0e
RG
411 }
412
297a533b
LPC
413 if (tval == 65535)
414 return -ENODATA;
415
416 return tval * 60;
417}
418
9903e627
SR
419/*
420 * Read a power avg register.
421 * Return < 0 if something fails.
422 */
423static int bq27x00_battery_read_pwr_avg(struct bq27x00_device_info *di, u8 reg)
424{
425 int tval;
426
427 tval = bq27x00_read(di, reg, false);
428 if (tval < 0) {
429 dev_err(di->dev, "error reading power avg rgister %02x: %d\n",
430 reg, tval);
431 return tval;
432 }
433
434 if (di->chip == BQ27500)
435 return tval;
436 else
437 return (tval * BQ27x00_POWER_CONSTANT) / BQ27000_RS;
438}
439
440/*
441 * Read flag register.
442 * Return < 0 if something fails.
443 */
444static int bq27x00_battery_read_health(struct bq27x00_device_info *di)
445{
446 int tval;
447
448 tval = bq27x00_read(di, BQ27x00_REG_FLAGS, false);
449 if (tval < 0) {
450 dev_err(di->dev, "error reading flag register:%d\n", tval);
451 return tval;
452 }
453
454 if ((di->chip == BQ27500)) {
455 if (tval & BQ27500_FLAG_SOCF)
456 tval = POWER_SUPPLY_HEALTH_DEAD;
457 else if (tval & BQ27500_FLAG_OTC)
458 tval = POWER_SUPPLY_HEALTH_OVERHEAT;
459 else
460 tval = POWER_SUPPLY_HEALTH_GOOD;
461 return tval;
f46bf82e
AB
462 } else if (di->chip == BQ27510) {
463 if (tval & BQ27500_FLAG_OTC)
464 return POWER_SUPPLY_HEALTH_OVERHEAT;
465 return POWER_SUPPLY_HEALTH_GOOD;
9903e627
SR
466 } else {
467 if (tval & BQ27000_FLAG_EDV1)
468 tval = POWER_SUPPLY_HEALTH_DEAD;
469 else
470 tval = POWER_SUPPLY_HEALTH_GOOD;
471 return tval;
472 }
473
474 return -1;
475}
476
297a533b
LPC
477static void bq27x00_update(struct bq27x00_device_info *di)
478{
479 struct bq27x00_reg_cache cache = {0, };
480 bool is_bq27500 = di->chip == BQ27500;
f46bf82e 481 bool is_bq27510 = di->chip == BQ27510;
a66f59ba 482 bool is_bq27425 = di->chip == BQ27425;
628ef02c 483 bool is_bq27742 = di->chip == BQ27742;
a3c0c3e7 484 bool flags_1b = !(is_bq27500 || is_bq27742);
297a533b 485
a3c0c3e7 486 cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, flags_1b);
3dd843e1
MB
487 if ((cache.flags & 0xff) == 0xff)
488 /* read error */
489 cache.flags = -1;
297a533b 490 if (cache.flags >= 0) {
f46bf82e 491 if (!is_bq27500 && !is_bq27425 && !is_bq27742 && !is_bq27510
a66f59ba 492 && (cache.flags & BQ27000_FLAG_CI)) {
c6cd4f26 493 dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n");
4b226c2c 494 cache.capacity = -ENODATA;
a8f6bd23 495 cache.energy = -ENODATA;
4b226c2c
PR
496 cache.time_to_empty = -ENODATA;
497 cache.time_to_empty_avg = -ENODATA;
498 cache.time_to_full = -ENODATA;
499 cache.charge_full = -ENODATA;
9903e627 500 cache.health = -ENODATA;
4b226c2c
PR
501 } else {
502 cache.capacity = bq27x00_battery_read_rsoc(di);
f46bf82e 503 if (is_bq27742 || is_bq27510)
628ef02c
PV
504 cache.time_to_empty =
505 bq27x00_battery_read_time(di,
506 BQ27x00_REG_TTE);
507 else if (!is_bq27425) {
a66f59ba
SG
508 cache.energy = bq27x00_battery_read_energy(di);
509 cache.time_to_empty =
510 bq27x00_battery_read_time(di,
511 BQ27x00_REG_TTE);
512 cache.time_to_empty_avg =
513 bq27x00_battery_read_time(di,
514 BQ27x00_REG_TTECP);
515 cache.time_to_full =
516 bq27x00_battery_read_time(di,
517 BQ27x00_REG_TTF);
518 }
a3c0c3e7 519 cache.charge_full = bq27x00_battery_read_lmd(di);
9903e627 520 cache.health = bq27x00_battery_read_health(di);
4b226c2c 521 }
d149e98e 522 cache.temperature = bq27x00_battery_read_temperature(di);
a66f59ba
SG
523 if (!is_bq27425)
524 cache.cycle_count = bq27x00_battery_read_cyct(di);
628ef02c
PV
525 if (is_bq27742)
526 cache.power_avg =
527 bq27x00_battery_read_pwr_avg(di,
528 BQ27742_POWER_AVG);
529 else
530 cache.power_avg =
531 bq27x00_battery_read_pwr_avg(di,
532 BQ27x00_POWER_AVG);
297a533b 533
631c17ee
PR
534 /* We only have to read charge design full once */
535 if (di->charge_design_full <= 0)
536 di->charge_design_full = bq27x00_battery_read_ilmd(di);
297a533b
LPC
537 }
538
90f04a28 539 if (di->cache.capacity != cache.capacity)
297d716f 540 power_supply_changed(di->bat);
90f04a28
PV
541
542 if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
543 di->cache = cache;
297a533b
LPC
544
545 di->last_update = jiffies;
546}
547
740b755a
LPC
548static void bq27x00_battery_poll(struct work_struct *work)
549{
550 struct bq27x00_device_info *di =
551 container_of(work, struct bq27x00_device_info, work.work);
552
553 bq27x00_update(di);
554
555 if (poll_interval > 0) {
556 /* The timer does not have to be accurate. */
557 set_timer_slack(&di->work.timer, poll_interval * HZ / 4);
558 schedule_delayed_work(&di->work, poll_interval * HZ);
559 }
560}
561
b996ad0e 562/*
bf7d4140 563 * Return the battery average current in µA
b996ad0e
RG
564 * Note that current can be negative signed as well
565 * Or 0 if something fails.
566 */
297a533b
LPC
567static int bq27x00_battery_current(struct bq27x00_device_info *di,
568 union power_supply_propval *val)
b996ad0e 569{
297a533b 570 int curr;
b68f6216 571 int flags;
b996ad0e 572
b68f6216 573 curr = bq27x00_read(di, BQ27x00_REG_AI, false);
c6cd4f26
PR
574 if (curr < 0) {
575 dev_err(di->dev, "error reading current\n");
297a533b 576 return curr;
c6cd4f26 577 }
e20908d9 578
a66f59ba 579 if (bq27xxx_is_chip_version_higher(di)) {
e20908d9 580 /* bq27500 returns signed value */
297a533b 581 val->intval = (int)((s16)curr) * 1000;
e20908d9 582 } else {
b68f6216
PR
583 flags = bq27x00_read(di, BQ27x00_REG_FLAGS, false);
584 if (flags & BQ27000_FLAG_CHGS) {
e20908d9 585 dev_dbg(di->dev, "negative current!\n");
afbc74fd 586 curr = -curr;
e20908d9 587 }
b996ad0e 588
297a533b 589 val->intval = curr * 3570 / BQ27000_RS;
b996ad0e
RG
590 }
591
297a533b 592 return 0;
b996ad0e
RG
593}
594
4e924a81 595static int bq27x00_battery_status(struct bq27x00_device_info *di,
297a533b 596 union power_supply_propval *val)
4e924a81 597{
4e924a81 598 int status;
4e924a81 599
a66f59ba 600 if (bq27xxx_is_chip_version_higher(di)) {
297a533b 601 if (di->cache.flags & BQ27500_FLAG_FC)
4e924a81 602 status = POWER_SUPPLY_STATUS_FULL;
b7aaacf5 603 else if (di->cache.flags & BQ27500_FLAG_DSC)
4e924a81 604 status = POWER_SUPPLY_STATUS_DISCHARGING;
270968c0 605 else
b7aaacf5 606 status = POWER_SUPPLY_STATUS_CHARGING;
4e924a81 607 } else {
c1b9ab67
LPC
608 if (di->cache.flags & BQ27000_FLAG_FC)
609 status = POWER_SUPPLY_STATUS_FULL;
610 else if (di->cache.flags & BQ27000_FLAG_CHGS)
4e924a81 611 status = POWER_SUPPLY_STATUS_CHARGING;
297d716f 612 else if (power_supply_am_i_supplied(di->bat))
c1b9ab67 613 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
4e924a81
GI
614 else
615 status = POWER_SUPPLY_STATUS_DISCHARGING;
616 }
617
618 val->intval = status;
297a533b 619
4e924a81
GI
620 return 0;
621}
622
d66bab3f
PR
623static int bq27x00_battery_capacity_level(struct bq27x00_device_info *di,
624 union power_supply_propval *val)
625{
626 int level;
627
a66f59ba 628 if (bq27xxx_is_chip_version_higher(di)) {
d66bab3f
PR
629 if (di->cache.flags & BQ27500_FLAG_FC)
630 level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
631 else if (di->cache.flags & BQ27500_FLAG_SOC1)
632 level = POWER_SUPPLY_CAPACITY_LEVEL_LOW;
633 else if (di->cache.flags & BQ27500_FLAG_SOCF)
634 level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
635 else
636 level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
637 } else {
638 if (di->cache.flags & BQ27000_FLAG_FC)
639 level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
640 else if (di->cache.flags & BQ27000_FLAG_EDV1)
641 level = POWER_SUPPLY_CAPACITY_LEVEL_LOW;
642 else if (di->cache.flags & BQ27000_FLAG_EDVF)
643 level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
644 else
645 level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
646 }
647
648 val->intval = level;
649
650 return 0;
651}
652
4e924a81 653/*
91fe4d50 654 * Return the battery Voltage in millivolts
297a533b 655 * Or < 0 if something fails.
4e924a81 656 */
297a533b
LPC
657static int bq27x00_battery_voltage(struct bq27x00_device_info *di,
658 union power_supply_propval *val)
4e924a81 659{
297a533b 660 int volt;
4e924a81 661
297a533b 662 volt = bq27x00_read(di, BQ27x00_REG_VOLT, false);
c6cd4f26
PR
663 if (volt < 0) {
664 dev_err(di->dev, "error reading voltage\n");
297a533b 665 return volt;
c6cd4f26 666 }
4e924a81 667
297a533b
LPC
668 val->intval = volt * 1000;
669
670 return 0;
671}
672
673static int bq27x00_simple_value(int value,
674 union power_supply_propval *val)
675{
676 if (value < 0)
677 return value;
678
679 val->intval = value;
4e924a81 680
4e924a81
GI
681 return 0;
682}
683
b996ad0e
RG
684static int bq27x00_battery_get_property(struct power_supply *psy,
685 enum power_supply_property psp,
686 union power_supply_propval *val)
687{
4e924a81 688 int ret = 0;
297d716f 689 struct bq27x00_device_info *di = power_supply_get_drvdata(psy);
3413b4ea 690
740b755a
LPC
691 mutex_lock(&di->lock);
692 if (time_is_before_jiffies(di->last_update + 5 * HZ)) {
693 cancel_delayed_work_sync(&di->work);
694 bq27x00_battery_poll(&di->work.work);
695 }
696 mutex_unlock(&di->lock);
297a533b
LPC
697
698 if (psp != POWER_SUPPLY_PROP_PRESENT && di->cache.flags < 0)
3413b4ea 699 return -ENODEV;
b996ad0e
RG
700
701 switch (psp) {
4e924a81
GI
702 case POWER_SUPPLY_PROP_STATUS:
703 ret = bq27x00_battery_status(di, val);
704 break;
b996ad0e 705 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
297a533b 706 ret = bq27x00_battery_voltage(di, val);
3413b4ea 707 break;
b996ad0e 708 case POWER_SUPPLY_PROP_PRESENT:
297a533b 709 val->intval = di->cache.flags < 0 ? 0 : 1;
b996ad0e
RG
710 break;
711 case POWER_SUPPLY_PROP_CURRENT_NOW:
297a533b 712 ret = bq27x00_battery_current(di, val);
b996ad0e
RG
713 break;
714 case POWER_SUPPLY_PROP_CAPACITY:
297a533b 715 ret = bq27x00_simple_value(di->cache.capacity, val);
b996ad0e 716 break;
d66bab3f
PR
717 case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
718 ret = bq27x00_battery_capacity_level(di, val);
719 break;
b996ad0e 720 case POWER_SUPPLY_PROP_TEMP:
d149e98e 721 ret = bq27x00_simple_value(di->cache.temperature, val);
5dc3443e
PR
722 if (ret == 0)
723 val->intval -= 2731;
b996ad0e 724 break;
4e924a81 725 case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
297a533b 726 ret = bq27x00_simple_value(di->cache.time_to_empty, val);
4e924a81
GI
727 break;
728 case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
297a533b 729 ret = bq27x00_simple_value(di->cache.time_to_empty_avg, val);
4e924a81
GI
730 break;
731 case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW:
297a533b 732 ret = bq27x00_simple_value(di->cache.time_to_full, val);
4e924a81 733 break;
5661f334
LPC
734 case POWER_SUPPLY_PROP_TECHNOLOGY:
735 val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
736 break;
631c17ee
PR
737 case POWER_SUPPLY_PROP_CHARGE_NOW:
738 ret = bq27x00_simple_value(bq27x00_battery_read_nac(di), val);
739 break;
740 case POWER_SUPPLY_PROP_CHARGE_FULL:
741 ret = bq27x00_simple_value(di->cache.charge_full, val);
742 break;
743 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
744 ret = bq27x00_simple_value(di->charge_design_full, val);
745 break;
73c244a8
PR
746 case POWER_SUPPLY_PROP_CYCLE_COUNT:
747 ret = bq27x00_simple_value(di->cache.cycle_count, val);
631c17ee
PR
748 break;
749 case POWER_SUPPLY_PROP_ENERGY_NOW:
a8f6bd23 750 ret = bq27x00_simple_value(di->cache.energy, val);
631c17ee 751 break;
9903e627
SR
752 case POWER_SUPPLY_PROP_POWER_AVG:
753 ret = bq27x00_simple_value(di->cache.power_avg, val);
754 break;
755 case POWER_SUPPLY_PROP_HEALTH:
756 ret = bq27x00_simple_value(di->cache.health, val);
757 break;
db04fc5c
AD
758 case POWER_SUPPLY_PROP_MANUFACTURER:
759 val->strval = BQ27XXX_MANUFACTURER;
760 break;
b996ad0e
RG
761 default:
762 return -EINVAL;
763 }
764
4e924a81 765 return ret;
b996ad0e
RG
766}
767
740b755a
LPC
768static void bq27x00_external_power_changed(struct power_supply *psy)
769{
297d716f 770 struct bq27x00_device_info *di = power_supply_get_drvdata(psy);
740b755a
LPC
771
772 cancel_delayed_work_sync(&di->work);
773 schedule_delayed_work(&di->work, 0);
774}
775
297d716f
KK
776static int bq27x00_powersupply_init(struct bq27x00_device_info *di,
777 const char *name)
b996ad0e 778{
a40402ef 779 int ret;
297d716f
KK
780 struct power_supply_desc *psy_desc;
781 struct power_supply_config psy_cfg = { .drv_data = di, };
782
783 psy_desc = devm_kzalloc(di->dev, sizeof(*psy_desc), GFP_KERNEL);
784 if (!psy_desc)
785 return -ENOMEM;
a40402ef 786
297d716f
KK
787 psy_desc->name = name;
788 psy_desc->type = POWER_SUPPLY_TYPE_BATTERY;
a66f59ba 789 if (di->chip == BQ27425) {
297d716f
KK
790 psy_desc->properties = bq27425_battery_props;
791 psy_desc->num_properties = ARRAY_SIZE(bq27425_battery_props);
628ef02c 792 } else if (di->chip == BQ27742) {
297d716f
KK
793 psy_desc->properties = bq27742_battery_props;
794 psy_desc->num_properties = ARRAY_SIZE(bq27742_battery_props);
f46bf82e 795 } else if (di->chip == BQ27510) {
297d716f
KK
796 psy_desc->properties = bq27510_battery_props;
797 psy_desc->num_properties = ARRAY_SIZE(bq27510_battery_props);
a66f59ba 798 } else {
297d716f
KK
799 psy_desc->properties = bq27x00_battery_props;
800 psy_desc->num_properties = ARRAY_SIZE(bq27x00_battery_props);
a66f59ba 801 }
297d716f
KK
802 psy_desc->get_property = bq27x00_battery_get_property;
803 psy_desc->external_power_changed = bq27x00_external_power_changed;
740b755a
LPC
804
805 INIT_DELAYED_WORK(&di->work, bq27x00_battery_poll);
806 mutex_init(&di->lock);
a40402ef 807
297d716f
KK
808 di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
809 if (IS_ERR(di->bat)) {
810 ret = PTR_ERR(di->bat);
a40402ef
LPC
811 dev_err(di->dev, "failed to register battery: %d\n", ret);
812 return ret;
813 }
814
815 dev_info(di->dev, "support ver. %s enabled\n", DRIVER_VERSION);
816
297a533b
LPC
817 bq27x00_update(di);
818
a40402ef 819 return 0;
b996ad0e
RG
820}
821
740b755a
LPC
822static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
823{
8cfaaa81
PR
824 /*
825 * power_supply_unregister call bq27x00_battery_get_property which
826 * call bq27x00_battery_poll.
827 * Make sure that bq27x00_battery_poll will not call
828 * schedule_delayed_work again after unregister (which cause OOPS).
829 */
830 poll_interval = 0;
831
740b755a
LPC
832 cancel_delayed_work_sync(&di->work);
833
297d716f 834 power_supply_unregister(di->bat);
740b755a
LPC
835
836 mutex_destroy(&di->lock);
837}
838
7fb7ba58
LPC
839
840/* i2c specific code */
841#ifdef CONFIG_BATTERY_BQ27X00_I2C
842
843/* If the system has several batteries we need a different name for each
844 * of them...
b996ad0e 845 */
7fb7ba58
LPC
846static DEFINE_IDR(battery_id);
847static DEFINE_MUTEX(battery_mutex);
b996ad0e 848
297a533b 849static int bq27x00_read_i2c(struct bq27x00_device_info *di, u8 reg, bool single)
b996ad0e 850{
a40402ef 851 struct i2c_client *client = to_i2c_client(di->dev);
9e912f45 852 struct i2c_msg msg[2];
b996ad0e 853 unsigned char data[2];
297a533b 854 int ret;
b996ad0e
RG
855
856 if (!client->adapter)
857 return -ENODEV;
858
9e912f45
GI
859 msg[0].addr = client->addr;
860 msg[0].flags = 0;
861 msg[0].buf = &reg;
862 msg[0].len = sizeof(reg);
863 msg[1].addr = client->addr;
864 msg[1].flags = I2C_M_RD;
865 msg[1].buf = data;
2ec523a8 866 if (single)
9e912f45 867 msg[1].len = 1;
2ec523a8 868 else
9e912f45 869 msg[1].len = 2;
2ec523a8 870
9e912f45 871 ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
2ec523a8
LPC
872 if (ret < 0)
873 return ret;
874
875 if (!single)
876 ret = get_unaligned_le16(data);
877 else
878 ret = data[0];
b996ad0e 879
297a533b 880 return ret;
b996ad0e
RG
881}
882
e20908d9 883static int bq27x00_battery_probe(struct i2c_client *client,
b996ad0e
RG
884 const struct i2c_device_id *id)
885{
886 char *name;
887 struct bq27x00_device_info *di;
b996ad0e
RG
888 int num;
889 int retval = 0;
890
891 /* Get new ID for the new battery device */
b996ad0e 892 mutex_lock(&battery_mutex);
05e2cefa 893 num = idr_alloc(&battery_id, client, 0, 0, GFP_KERNEL);
b996ad0e 894 mutex_unlock(&battery_mutex);
05e2cefa
TH
895 if (num < 0)
896 return num;
b996ad0e 897
297d716f 898 name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num);
b996ad0e
RG
899 if (!name) {
900 dev_err(&client->dev, "failed to allocate device name\n");
901 retval = -ENOMEM;
297d716f 902 goto batt_failed;
b996ad0e
RG
903 }
904
1cb82fdb 905 di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
b996ad0e
RG
906 if (!di) {
907 dev_err(&client->dev, "failed to allocate device info data\n");
908 retval = -ENOMEM;
297d716f 909 goto batt_failed;
b996ad0e 910 }
a40402ef 911
b996ad0e 912 di->id = num;
a40402ef 913 di->dev = &client->dev;
e20908d9 914 di->chip = id->driver_data;
a40402ef 915 di->bus.read = &bq27x00_read_i2c;
b996ad0e 916
297d716f 917 retval = bq27x00_powersupply_init(di, name);
f7760995 918 if (retval)
297d716f 919 goto batt_failed;
b996ad0e
RG
920
921 i2c_set_clientdata(client, di);
b996ad0e
RG
922
923 return 0;
924
297d716f 925batt_failed:
b996ad0e
RG
926 mutex_lock(&battery_mutex);
927 idr_remove(&battery_id, num);
928 mutex_unlock(&battery_mutex);
929
930 return retval;
931}
932
e20908d9 933static int bq27x00_battery_remove(struct i2c_client *client)
b996ad0e
RG
934{
935 struct bq27x00_device_info *di = i2c_get_clientdata(client);
936
740b755a 937 bq27x00_powersupply_unregister(di);
b996ad0e 938
b996ad0e
RG
939 mutex_lock(&battery_mutex);
940 idr_remove(&battery_id, di->id);
941 mutex_unlock(&battery_mutex);
942
b996ad0e
RG
943 return 0;
944}
945
e20908d9
GI
946static const struct i2c_device_id bq27x00_id[] = {
947 { "bq27200", BQ27000 }, /* bq27200 is same as bq27000, but with i2c */
948 { "bq27500", BQ27500 },
a66f59ba 949 { "bq27425", BQ27425 },
628ef02c 950 { "bq27742", BQ27742 },
f46bf82e 951 { "bq27510", BQ27510 },
b996ad0e
RG
952 {},
953};
fd9b958c 954MODULE_DEVICE_TABLE(i2c, bq27x00_id);
b996ad0e 955
e20908d9 956static struct i2c_driver bq27x00_battery_driver = {
b996ad0e 957 .driver = {
e20908d9 958 .name = "bq27x00-battery",
b996ad0e 959 },
e20908d9
GI
960 .probe = bq27x00_battery_probe,
961 .remove = bq27x00_battery_remove,
962 .id_table = bq27x00_id,
b996ad0e
RG
963};
964
7fb7ba58
LPC
965static inline int bq27x00_battery_i2c_init(void)
966{
967 int ret = i2c_add_driver(&bq27x00_battery_driver);
968 if (ret)
969 printk(KERN_ERR "Unable to register BQ27x00 i2c driver\n");
970
971 return ret;
972}
973
974static inline void bq27x00_battery_i2c_exit(void)
975{
976 i2c_del_driver(&bq27x00_battery_driver);
977}
978
979#else
980
981static inline int bq27x00_battery_i2c_init(void) { return 0; }
982static inline void bq27x00_battery_i2c_exit(void) {};
983
984#endif
985
986/* platform specific code */
987#ifdef CONFIG_BATTERY_BQ27X00_PLATFORM
988
989static int bq27000_read_platform(struct bq27x00_device_info *di, u8 reg,
297a533b 990 bool single)
7fb7ba58
LPC
991{
992 struct device *dev = di->dev;
993 struct bq27000_platform_data *pdata = dev->platform_data;
994 unsigned int timeout = 3;
995 int upper, lower;
996 int temp;
997
998 if (!single) {
999 /* Make sure the value has not changed in between reading the
1000 * lower and the upper part */
1001 upper = pdata->read(dev, reg + 1);
1002 do {
1003 temp = upper;
1004 if (upper < 0)
1005 return upper;
1006
1007 lower = pdata->read(dev, reg);
1008 if (lower < 0)
1009 return lower;
1010
1011 upper = pdata->read(dev, reg + 1);
1012 } while (temp != upper && --timeout);
1013
1014 if (timeout == 0)
1015 return -EIO;
1016
297a533b 1017 return (upper << 8) | lower;
7fb7ba58 1018 }
297a533b
LPC
1019
1020 return pdata->read(dev, reg);
7fb7ba58
LPC
1021}
1022
c8afa640 1023static int bq27000_battery_probe(struct platform_device *pdev)
7fb7ba58
LPC
1024{
1025 struct bq27x00_device_info *di;
1026 struct bq27000_platform_data *pdata = pdev->dev.platform_data;
297d716f 1027 const char *name;
7fb7ba58
LPC
1028
1029 if (!pdata) {
1030 dev_err(&pdev->dev, "no platform_data supplied\n");
1031 return -EINVAL;
1032 }
1033
1034 if (!pdata->read) {
1035 dev_err(&pdev->dev, "no hdq read callback supplied\n");
1036 return -EINVAL;
1037 }
1038
1cb82fdb 1039 di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
7fb7ba58
LPC
1040 if (!di) {
1041 dev_err(&pdev->dev, "failed to allocate device info data\n");
1042 return -ENOMEM;
1043 }
1044
1045 platform_set_drvdata(pdev, di);
1046
1047 di->dev = &pdev->dev;
1048 di->chip = BQ27000;
1049
297d716f 1050 name = pdata->name ?: dev_name(&pdev->dev);
7fb7ba58
LPC
1051 di->bus.read = &bq27000_read_platform;
1052
297d716f 1053 return bq27x00_powersupply_init(di, name);
7fb7ba58
LPC
1054}
1055
415ec69f 1056static int bq27000_battery_remove(struct platform_device *pdev)
7fb7ba58
LPC
1057{
1058 struct bq27x00_device_info *di = platform_get_drvdata(pdev);
1059
740b755a
LPC
1060 bq27x00_powersupply_unregister(di);
1061
7fb7ba58
LPC
1062 return 0;
1063}
1064
1065static struct platform_driver bq27000_battery_driver = {
1066 .probe = bq27000_battery_probe,
28ea73f4 1067 .remove = bq27000_battery_remove,
7fb7ba58
LPC
1068 .driver = {
1069 .name = "bq27000-battery",
7fb7ba58
LPC
1070 },
1071};
1072
1073static inline int bq27x00_battery_platform_init(void)
1074{
1075 int ret = platform_driver_register(&bq27000_battery_driver);
1076 if (ret)
1077 printk(KERN_ERR "Unable to register BQ27000 platform driver\n");
1078
1079 return ret;
1080}
1081
1082static inline void bq27x00_battery_platform_exit(void)
1083{
1084 platform_driver_unregister(&bq27000_battery_driver);
1085}
1086
1087#else
1088
1089static inline int bq27x00_battery_platform_init(void) { return 0; }
1090static inline void bq27x00_battery_platform_exit(void) {};
1091
1092#endif
1093
1094/*
1095 * Module stuff
1096 */
1097
b996ad0e
RG
1098static int __init bq27x00_battery_init(void)
1099{
1100 int ret;
1101
7fb7ba58
LPC
1102 ret = bq27x00_battery_i2c_init();
1103 if (ret)
1104 return ret;
1105
1106 ret = bq27x00_battery_platform_init();
b996ad0e 1107 if (ret)
7fb7ba58 1108 bq27x00_battery_i2c_exit();
b996ad0e
RG
1109
1110 return ret;
1111}
1112module_init(bq27x00_battery_init);
1113
1114static void __exit bq27x00_battery_exit(void)
1115{
7fb7ba58
LPC
1116 bq27x00_battery_platform_exit();
1117 bq27x00_battery_i2c_exit();
b996ad0e
RG
1118}
1119module_exit(bq27x00_battery_exit);
1120
8ebb7e9c
MB
1121#ifdef CONFIG_BATTERY_BQ27X00_PLATFORM
1122MODULE_ALIAS("platform:bq27000-battery");
1123#endif
1124
1125#ifdef CONFIG_BATTERY_BQ27X00_I2C
1126MODULE_ALIAS("i2c:bq27000-battery");
1127#endif
1128
b996ad0e
RG
1129MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>");
1130MODULE_DESCRIPTION("BQ27x00 battery monitor driver");
1131MODULE_LICENSE("GPL");
This page took 0.449799 seconds and 5 git commands to generate.