use := instead of = for PKG_CONFIG_PATH to prevent recursion
[openwrt/openwrt.git] / target / linux / omap24xx / patches-2.6.36 / 900-n810-battery-management.patch
1 ---
2 arch/arm/mach-omap2/board-n8x0.c | 13 +
3 drivers/cbus/Kconfig | 12 +
4 drivers/cbus/Makefile | 3
5 drivers/cbus/lipocharge.c | 63 ++++++
6 drivers/cbus/lipocharge.h | 50 ++++
7 drivers/cbus/n810bm_main.c | 397 +++++++++++++++++++++++++++++++++++++++
8 drivers/cbus/retu.c | 4
9 drivers/cbus/retu.h | 3
10 drivers/cbus/tahvo.h | 6
11 9 files changed, 548 insertions(+), 3 deletions(-)
12
13 --- linux-2.6.36-rc7.orig/drivers/cbus/Kconfig
14 +++ linux-2.6.36-rc7/drivers/cbus/Kconfig
15 @@ -94,4 +94,16 @@ config CBUS_RETU_HEADSET
16 to Retu/Vilma. Detection state and events are exposed through
17 sysfs.
18
19 +config N810BM
20 + depends on CBUS_RETU && CBUS_TAHVO
21 + tristate "Nokia n810 battery management"
22 + ---help---
23 + Nokia n810 device battery management.
24 +
25 + WARNING: This driver is based on reverse engineered information.
26 + It is possibly dangerous to use this software.
27 + Use this software at your own risk!
28 +
29 + If unsure, say N.
30 +
31 endmenu
32 --- linux-2.6.36-rc7.orig/drivers/cbus/Makefile
33 +++ linux-2.6.36-rc7/drivers/cbus/Makefile
34 @@ -12,3 +12,6 @@ obj-$(CONFIG_CBUS_RETU_WDT) += retu-wdt.
35 obj-$(CONFIG_CBUS_TAHVO_USER) += tahvo-user.o
36 obj-$(CONFIG_CBUS_RETU_USER) += retu-user.o
37 obj-$(CONFIG_CBUS_RETU_HEADSET) += retu-headset.o
38 +n810bm-y += n810bm_main.o
39 +n810bm-y += lipocharge.o
40 +obj-$(CONFIG_N810BM) += n810bm.o
41 --- /dev/null
42 +++ linux-2.6.36-rc7/drivers/cbus/n810bm_main.c
43 @@ -0,0 +1,397 @@
44 +/*
45 + * Nokia n810 battery management
46 + *
47 + * WARNING: This driver is based on reverse engineered information.
48 + * It is possibly dangerous to use this software.
49 + * Use this software at your own risk!
50 + *
51 + * Copyright (c) 2010 Michael Buesch <mb@bu3sch.de>
52 + *
53 + * This program is free software; you can redistribute it and/or
54 + * modify it under the terms of the GNU General Public License
55 + * as published by the Free Software Foundation; either version 2
56 + * of the License, or (at your option) any later version.
57 + *
58 + * This program is distributed in the hope that it will be useful,
59 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
60 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61 + * GNU General Public License for more details.
62 + */
63 +
64 +#include <linux/module.h>
65 +#include <linux/device.h>
66 +#include <linux/platform_device.h>
67 +#include <linux/slab.h>
68 +#include <linux/spinlock.h>
69 +#include <linux/timer.h>
70 +#include <linux/reboot.h>
71 +
72 +#include "retu.h"
73 +#include "tahvo.h"
74 +#include "lipocharge.h"
75 +
76 +
77 +#define N810BM_CHECK_INTERVAL (HZ * 5)
78 +#define N810BM_MIN_VOLTAGE_THRES 3300 /* Absolute minimum voltage threshold */
79 +
80 +
81 +/* Battery related retu ADC channels */
82 +#define RETU_ADC_BSI 0x01 /* Battery Size Indicator */
83 +#define RETU_ADC_BATTVOLT 0x08 /* Battery voltage measurement */
84 +
85 +/* RETU_ADC_BSI
86 + * The battery size indicator ADC measures the resistance between
87 + * the battery BSI pin and ground. This is used to detect the battery
88 + * capacity, as the BSI resistor is related to capacity.
89 + *
90 + * Manually measured lookup table.
91 + * Hard to measure, thus not very accurate.
92 + *
93 + * Resistance | ADC value
94 + * ========================
95 + * 120k | 0x3AC
96 + * 110k | 0x37C
97 + * 100k | 0x351
98 + * 90k | 0x329
99 + */
100 +
101 +/* RETU_ADC_BATTVOLT
102 + * Manually measured lookup table.
103 + * Hard to measure, thus not very accurate.
104 + *
105 + * Voltage | ADC value
106 + * =====================
107 + * 2.80V | 0x037
108 + * 2.90V | 0x05E
109 + * 3.00V | 0x090
110 + * 3.10V | 0x0A4
111 + * 3.20V | 0x0CC
112 + * 3.30V | 0x0EF
113 + * 3.40V | 0x115
114 + * 3.50V | 0x136
115 + * 3.60V | 0x15C
116 + * 3.70V | 0x187
117 + * 3.80V | 0x1A5
118 + * 3.90V | 0x1C9
119 + * 4.00V | 0x1ED
120 + * 4.10V | 0x212
121 + * 4.20V | 0x236
122 + */
123 +
124 +
125 +enum n810bm_capacity {
126 + N810BM_CAP_UNKNOWN = 0,
127 + N810BM_CAP_1500MAH = 1500, /* 1500 mAh battery */
128 +};
129 +
130 +struct n810bm {
131 + struct platform_device *pdev;
132 +
133 + enum n810bm_capacity capacity;
134 + struct timer_list check_timer;
135 +
136 + struct lipocharge *charger;
137 +
138 + spinlock_t lock;
139 +};
140 +
141 +
142 +static NORET_TYPE void n810bm_emergency(struct n810bm *bm, const char *message) ATTRIB_NORET;
143 +static void n810bm_emergency(struct n810bm *bm, const char *message)
144 +{
145 + printk(KERN_EMERG "n810 battery management fatal fault: %s\n", message);
146 + /* Force a hard shutdown. */
147 + machine_power_off();
148 + panic("n810bm: Failed to halt machine in emergency state\n");
149 +}
150 +
151 +#if 0
152 +static u16 retu_read(struct n810bm *bm, unsigned int reg)
153 +{
154 + int ret;
155 + unsigned long flags;
156 +
157 + spin_lock_irqsave(&retu_lock, flags);
158 + ret = retu_read_reg(reg);
159 + spin_unlock_irqrestore(&retu_lock, flags);
160 + if (ret < 0 || ret > 0xFFFF)
161 + n810bm_emergency(bm, "retu_read");
162 +
163 + return ret;
164 +}
165 +#endif
166 +
167 +static void retu_maskset(struct n810bm *bm, unsigned int reg, u16 mask, u16 set)
168 +{
169 + int ret;
170 + unsigned long flags;
171 + u16 value;
172 +
173 + spin_lock_irqsave(&retu_lock, flags);
174 + if (~mask) {
175 + ret = retu_read_reg(reg);
176 + if (ret < 0 || ret > 0xFFFF)
177 + goto fatal_unlock;
178 + value = ret;
179 + } else
180 + value = 0;
181 + value &= ~mask;
182 + value |= set;
183 + ret = retu_write_reg(reg, value);
184 + if (ret)
185 + goto fatal_unlock;
186 + spin_unlock_irqrestore(&retu_lock, flags);
187 +
188 + return;
189 +
190 +fatal_unlock:
191 + spin_unlock_irqrestore(&retu_lock, flags);
192 + n810bm_emergency(bm, "retu_maskset");
193 +}
194 +
195 +static inline void retu_write(struct n810bm *bm, unsigned int reg, u16 value)
196 +{
197 + return retu_maskset(bm, reg, 0xFFFF, value);
198 +}
199 +
200 +static int retu_adc_average(struct n810bm *bm, unsigned int chan,
201 + unsigned int nr_passes)
202 +{
203 + unsigned int i, value = 0;
204 + int ret;
205 +
206 + if (WARN_ON(!nr_passes))
207 + return 0;
208 + for (i = 0; i < nr_passes; i++) {
209 + ret = retu_read_adc(chan);
210 + if (ret < 0)
211 + return ret;
212 + value += ret;
213 + }
214 + value /= nr_passes;
215 +
216 + return value;
217 +}
218 +
219 +/* Measure the battery voltage. Returns the value in mV (or negative value on error). */
220 +static int n810bm_measure_batt_voltage(struct n810bm *bm)
221 +{
222 + int adc;
223 + unsigned int mv;
224 + const unsigned int scale = 1000;
225 +
226 + adc = retu_adc_average(bm, RETU_ADC_BATTVOLT, 5);
227 + if (adc < 0)
228 + return adc;
229 + if (adc <= 0x37)
230 + return 2800;
231 + mv = 2800 + ((adc - 0x37) * (((4200 - 2800) * scale) / (0x236 - 0x37))) / scale;
232 +
233 + return mv;
234 +}
235 +
236 +/* Read the battery capacity via BSI pin. */
237 +static enum n810bm_capacity n810bm_read_batt_capacity(struct n810bm *bm)
238 +{
239 + int adc;
240 + const unsigned int hyst = 20;
241 +
242 + adc = retu_adc_average(bm, RETU_ADC_BSI, 5);
243 + if (adc < 0) {
244 + dev_err(&bm->pdev->dev, "Failed to read BSI ADC");
245 + return N810BM_CAP_UNKNOWN;
246 + }
247 +
248 + if (adc >= 0x3B5 - hyst && adc <= 0x3B5 + hyst)
249 + return N810BM_CAP_1500MAH;
250 +
251 + dev_err(&bm->pdev->dev, "Capacity indicator 0x%X unknown", adc);
252 +
253 + return N810BM_CAP_UNKNOWN;
254 +}
255 +
256 +/* Convert a battery voltage (in mV) to percentage. */
257 +static unsigned int n810bm_mvolt2percent(unsigned int mv)
258 +{
259 + const unsigned int minv = 3700;
260 + const unsigned int maxv = 4150;
261 + unsigned int percent;
262 +
263 + mv = clamp(mv, minv, maxv);
264 + percent = (mv - minv) * 100 / (maxv - minv);
265 +
266 + return percent;
267 +}
268 +
269 +static void n810bm_check_timer(unsigned long data)
270 +{
271 + struct n810bm *bm = (struct n810bm *)data;
272 + unsigned long flags;
273 + int mv;
274 +
275 + spin_lock_irqsave(&bm->lock, flags);
276 +
277 + mv = n810bm_measure_batt_voltage(bm);
278 + if (mv < 0)
279 + n810bm_emergency(bm, "check timer: Failed to measure");
280 + if (mv < N810BM_MIN_VOLTAGE_THRES)
281 + n810bm_emergency(bm, "check timer: Minimum voltage threshold reached");
282 +
283 + mod_timer(&bm->check_timer, round_jiffies(jiffies + N810BM_CHECK_INTERVAL));
284 + spin_unlock_irqrestore(&bm->lock, flags);
285 +
286 + return;
287 +}
288 +
289 +static void n810bm_adc_irq_handler(unsigned long data)
290 +{
291 + struct n810bm *bm = (struct n810bm *)data;
292 +
293 + retu_ack_irq(RETU_INT_ADCS);
294 + //TODO
295 +printk("n810bm: ADC timer triggered\n");
296 +}
297 +
298 +static ssize_t n810bm_attr_charge_show(struct device *dev,
299 + struct device_attribute *attr,
300 + char *buf)
301 +{
302 + struct platform_device *pdev = to_platform_device(dev);
303 + struct n810bm *bm = platform_get_drvdata(pdev);
304 + int err = -ENODEV;
305 + ssize_t count = 0;
306 + int millivolt;
307 +
308 + spin_lock_irq(&bm->lock);
309 + millivolt = n810bm_measure_batt_voltage(bm);
310 + if (millivolt >= 0) {
311 + count = snprintf(buf, PAGE_SIZE, "%u\n",
312 + n810bm_mvolt2percent(millivolt));
313 + err = 0;
314 + }
315 + spin_unlock_irq(&bm->lock);
316 +
317 + return err ? err : count;
318 +}
319 +static DEVICE_ATTR(batt_charge, 0444, n810bm_attr_charge_show, NULL);
320 +
321 +static ssize_t n810bm_attr_capacity_show(struct device *dev,
322 + struct device_attribute *attr,
323 + char *buf)
324 +{
325 + struct platform_device *pdev = to_platform_device(dev);
326 + struct n810bm *bm = platform_get_drvdata(pdev);
327 + ssize_t count;
328 +
329 + spin_lock_irq(&bm->lock);
330 + count = snprintf(buf, PAGE_SIZE, "%u\n",
331 + (unsigned int)bm->capacity);
332 + spin_unlock_irq(&bm->lock);
333 +
334 + return count;
335 +}
336 +static DEVICE_ATTR(batt_capacity, 0444, n810bm_attr_capacity_show, NULL);
337 +
338 +static void n810bm_hw_exit(struct n810bm *bm)
339 +{
340 + retu_write(bm, RETU_REG_ADCSCR, 0);
341 +}
342 +
343 +static int n810bm_hw_init(struct n810bm *bm)
344 +{
345 + retu_write(bm, RETU_REG_ADCSCR, 0);
346 +
347 + bm->capacity = n810bm_read_batt_capacity(bm);
348 + if (bm->capacity == N810BM_CAP_UNKNOWN) {
349 + dev_err(&bm->pdev->dev, "Unknown battery detected");
350 + return -ENODEV;
351 + }
352 + dev_info(&bm->pdev->dev, "Detected %u mAh battery\n",
353 + (unsigned int)bm->capacity);
354 +
355 + return 0;
356 +}
357 +
358 +static int __devinit n810bm_probe(struct platform_device *pdev)
359 +{
360 + struct n810bm *bm;
361 + int err;
362 +
363 + bm = kzalloc(sizeof(*bm), GFP_KERNEL);
364 + if (!bm)
365 + return -ENOMEM;
366 + bm->pdev = pdev;
367 + platform_set_drvdata(pdev, bm);
368 + spin_lock_init(&bm->lock);
369 + setup_timer(&bm->check_timer, n810bm_check_timer, (unsigned long)bm);
370 +
371 + err = n810bm_hw_init(bm);
372 + if (err)
373 + goto err_free;
374 + err = device_create_file(&pdev->dev, &dev_attr_batt_charge);
375 + if (err)
376 + goto err_exit;
377 + err = device_create_file(&pdev->dev, &dev_attr_batt_capacity);
378 + if (err)
379 + goto err_rem_charge;
380 + err = retu_request_irq(RETU_INT_ADCS, n810bm_adc_irq_handler,
381 + (unsigned long)bm, "n810bm");
382 + if (err)
383 + goto err_rem_capa;
384 +
385 + mod_timer(&bm->check_timer, round_jiffies(jiffies + N810BM_CHECK_INTERVAL));
386 +
387 + dev_info(&pdev->dev, "Battery management initialized");
388 +
389 + return 0;
390 +
391 +err_rem_capa:
392 + device_remove_file(&pdev->dev, &dev_attr_batt_capacity);
393 +err_rem_charge:
394 + device_remove_file(&pdev->dev, &dev_attr_batt_charge);
395 +err_exit:
396 + n810bm_hw_exit(bm);
397 +err_free:
398 + kfree(bm);
399 + platform_set_drvdata(pdev, NULL);
400 + return err;
401 +}
402 +
403 +static int __devexit n810bm_remove(struct platform_device *pdev)
404 +{
405 + struct n810bm *bm = platform_get_drvdata(pdev);
406 +
407 + retu_free_irq(RETU_INT_ADCS);
408 + del_timer_sync(&bm->check_timer);
409 + device_remove_file(&pdev->dev, &dev_attr_batt_capacity);
410 + device_remove_file(&pdev->dev, &dev_attr_batt_charge);
411 + n810bm_hw_exit(bm);
412 +
413 + kfree(bm);
414 + platform_set_drvdata(pdev, NULL);
415 +
416 + return 0;
417 +}
418 +
419 +static struct platform_driver n810bm_driver = {
420 + .remove = __devexit_p(n810bm_remove),
421 + .driver = {
422 + .name = "n810bm",
423 + }
424 +};
425 +
426 +static int __init n810bm_modinit(void)
427 +{
428 + return platform_driver_probe(&n810bm_driver, n810bm_probe);
429 +}
430 +module_init(n810bm_modinit);
431 +
432 +static void __exit n810bm_modexit(void)
433 +{
434 + platform_driver_unregister(&n810bm_driver);
435 +}
436 +module_exit(n810bm_modexit);
437 +
438 +MODULE_DESCRIPTION("Nokia n810 battery management");
439 +MODULE_LICENSE("GPL");
440 +MODULE_AUTHOR("Michael Buesch");
441 --- linux-2.6.36-rc7.orig/drivers/cbus/retu.c
442 +++ linux-2.6.36-rc7/drivers/cbus/retu.c
443 @@ -85,10 +85,10 @@ int retu_read_reg(int reg)
444 *
445 * This function writes a value to the specified register
446 */
447 -void retu_write_reg(int reg, u16 val)
448 +int retu_write_reg(int reg, u16 val)
449 {
450 BUG_ON(!retu_initialized);
451 - cbus_write_reg(cbus_host, RETU_ID, reg, val);
452 + return cbus_write_reg(cbus_host, RETU_ID, reg, val);
453 }
454
455 void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
456 --- linux-2.6.36-rc7.orig/drivers/cbus/retu.h
457 +++ linux-2.6.36-rc7/drivers/cbus/retu.h
458 @@ -39,6 +39,7 @@
459 #define RETU_REG_CC2 0x0e /* Common control register 2 */
460 #define RETU_REG_CTRL_CLR 0x0f /* Regulator clear register */
461 #define RETU_REG_CTRL_SET 0x10 /* Regulator set register */
462 +#define RETU_REG_UNK1 0x14 /* 0x1000 is set when charger is plugged in */
463 #define RETU_REG_STATUS 0x16 /* Status register */
464 #define RETU_REG_WATCHDOG 0x17 /* Watchdog register */
465 #define RETU_REG_AUDTXR 0x18 /* Audio Codec Tx register */
466 @@ -58,7 +59,7 @@
467 #define MAX_RETU_IRQ_HANDLERS 16
468
469 int retu_read_reg(int reg);
470 -void retu_write_reg(int reg, u16 val);
471 +int retu_write_reg(int reg, u16 val);
472 void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
473 int retu_read_adc(int channel);
474 int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
475 --- linux-2.6.36-rc7.orig/arch/arm/mach-omap2/board-n8x0.c
476 +++ linux-2.6.36-rc7/arch/arm/mach-omap2/board-n8x0.c
477 @@ -920,6 +920,17 @@ static int __init n810_tlv320aic3x_regis
478 }
479 arch_initcall(n810_tlv320aic3x_register);
480
481 +static struct platform_device n810_bm_device = {
482 + .name = "n810bm",
483 + .id = -1,
484 +};
485 +
486 +static void __init n810_bm_init(void)
487 +{
488 + if (platform_device_register(&n810_bm_device))
489 + BUG();
490 +}
491 +
492 static void __init n8x0_init_machine(void)
493 {
494 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
495 @@ -947,6 +958,8 @@ static void __init n8x0_init_machine(voi
496 n8x0_onenand_init();
497 n8x0_mmc_init();
498 n8x0_usb_init();
499 +
500 + n810_bm_init();
501 }
502
503 MACHINE_START(NOKIA_N800, "Nokia N800")
504 --- /dev/null
505 +++ linux-2.6.36-rc7/drivers/cbus/lipocharge.c
506 @@ -0,0 +1,63 @@
507 +/*
508 + * Generic LIPO battery charger
509 + *
510 + * Copyright (c) 2010 Michael Buesch <mb@bu3sch.de>
511 + *
512 + * This program is free software; you can redistribute it and/or
513 + * modify it under the terms of the GNU General Public License
514 + * as published by the Free Software Foundation; either version 2
515 + * of the License, or (at your option) any later version.
516 + *
517 + * This program is distributed in the hope that it will be useful,
518 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
519 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
520 + * GNU General Public License for more details.
521 + */
522 +
523 +#include "lipocharge.h"
524 +
525 +#include <linux/slab.h>
526 +
527 +
528 +static void lipocharge_timer(unsigned long data)
529 +{
530 + struct lipocharge *c = (struct lipocharge *)data;
531 +
532 + spin_lock(&c->lock);
533 + //TODO
534 + spin_unlock(&c->lock);
535 +}
536 +
537 +struct lipocharge * lipocharge_alloc(gfp_t gfp)
538 +{
539 + struct lipocharge *c;
540 +
541 + c = kzalloc(sizeof(*c), gfp);
542 + if (!c)
543 + return NULL;
544 + spin_lock_init(&c->lock);
545 + setup_timer(&c->timer, lipocharge_timer, (unsigned long)c);
546 +
547 + return c;
548 +}
549 +
550 +void lipocharge_free(struct lipocharge *c)
551 +{
552 + kfree(c);
553 +}
554 +
555 +int lipocharge_start(struct lipocharge *c)
556 +{
557 + if (!c->set_current || !c->get_voltage ||
558 + !c->finished || !c->emergency)
559 + return -EINVAL;
560 + if (!c->top_voltage || c->top_voltage > 4200)
561 + return -EINVAL;
562 + //TODO
563 +}
564 +
565 +void lipocharge_stop(struct lipocharge *c)
566 +{
567 + del_timer_sync(&c->timer);
568 + //TODO
569 +}
570 --- /dev/null
571 +++ linux-2.6.36-rc7/drivers/cbus/lipocharge.h
572 @@ -0,0 +1,50 @@
573 +#ifndef LIPOCHARGE_H_
574 +#define LIPOCHARGE_H_
575 +
576 +#include <linux/timer.h>
577 +#include <linux/spinlock.h>
578 +
579 +
580 +#define LIPORATE(a,b) (((a) * 1000) + (b))
581 +#define LIPORATE_1C LIPORATE(1,0) /* 1C */
582 +#define LIPORATE_p8C LIPORATE(0,8) /* 0.8C */
583 +
584 +/** struct lipocharge - A generic LIPO charger
585 + *
586 + * @capacity: Battery capacity in mAh.
587 + * @rate: Charge rate.
588 + * @top_voltage: Fully charged voltage, in mV.
589 + *
590 + * @set_current: Set the charge current, in mA.
591 + * @get_voltage: Get the battery voltage, in mV.
592 + *
593 + * @emergency: Something went wrong. Force shutdown.
594 + *
595 + * @priv: opaque pointer.
596 + */
597 +struct lipocharge
598 +{
599 + unsigned int capacity;
600 + unsigned int rate;
601 + unsigned int top_voltage;
602 +
603 + int (*set_current)(struct lipocharge *c, unsigned int ma);
604 + int (*get_voltage)(struct lipocharge *c, unsigned int *mv);
605 +
606 + void (*finished)(struct lipocharge *c);
607 + void (*emergency)(struct lipocharge *c);
608 +
609 + void *priv;
610 +
611 + /* internal */
612 + spinlock_t lock;
613 + struct timer_list timer;
614 +};
615 +
616 +struct lipocharge * lipocharge_alloc(gfp_t gfp);
617 +void lipocharge_free(struct lipocharge *c);
618 +
619 +int lipocharge_start(struct lipocharge *c);
620 +void lipocharge_stop(struct lipocharge *c);
621 +
622 +#endif /* LIPOCHARGE_H_ */
623 --- linux-2.6.36-rc7.orig/drivers/cbus/tahvo.h
624 +++ linux-2.6.36-rc7/drivers/cbus/tahvo.h
625 @@ -30,8 +30,14 @@
626 #define TAHVO_REG_IDR 0x01 /* Interrupt ID */
627 #define TAHVO_REG_IDSR 0x02 /* Interrupt status */
628 #define TAHVO_REG_IMR 0x03 /* Interrupt mask */
629 +#define TAHVO_REG_CHGCURR 0x04 /* Charge current control (8-bit) */
630 #define TAHVO_REG_LEDPWMR 0x05 /* LED PWM */
631 #define TAHVO_REG_USBR 0x06 /* USB control */
632 +#define TAHVO_REG_CHGCTL 0x08 /* Charge control register */
633 +#define TAHVO_REG_CHGCTL_EN 0x0001 /* Global charge enable */
634 +#define TAHVO_REG_CHGCTL2 0x0c /* Charge control register 2 */
635 +#define TAHVO_REG_BATCURR 0x0d /* Battery (dis)charge current (signed 16-bit) */
636 +
637 #define TAHVO_REG_MAX 0x0d
638
639 /* Interrupt sources */