Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mbc.h
Go to the documentation of this file.
1 /*
2  * mbc.h -- Driver for NXP PCF50633 Main Battery Charger
3  *
4  * (C) 2006-2008 by Openmoko, Inc.
5  * All rights reserved.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; either version 2 of the License, or (at your
10  * option) any later version.
11  */
12 
13 #ifndef __LINUX_MFD_PCF50633_MBC_H
14 #define __LINUX_MFD_PCF50633_MBC_H
15 
17 #include <linux/platform_device.h>
18 
19 #define PCF50633_REG_MBCC1 0x43
20 #define PCF50633_REG_MBCC2 0x44
21 #define PCF50633_REG_MBCC3 0x45
22 #define PCF50633_REG_MBCC4 0x46
23 #define PCF50633_REG_MBCC5 0x47
24 #define PCF50633_REG_MBCC6 0x48
25 #define PCF50633_REG_MBCC7 0x49
26 #define PCF50633_REG_MBCC8 0x4a
27 #define PCF50633_REG_MBCS1 0x4b
28 #define PCF50633_REG_MBCS2 0x4c
29 #define PCF50633_REG_MBCS3 0x4d
30 
32  PCF50633_MBCC1_CHGENA = 0x01, /* Charger enable */
34  PCF50633_MBCC1_AUTORES = 0x04, /* automatic resume */
35  PCF50633_MBCC1_RESUME = 0x08, /* explicit resume cmd */
36  PCF50633_MBCC1_RESTART = 0x10, /* restart charging */
37  PCF50633_MBCC1_PREWDTIME_60M = 0x20, /* max. precharging time */
42 };
43 #define PCF50633_MBCC1_WDTIME_MASK 0xc0
44 
52  PCF50633_MBCC2_VRESDEBTIME_64S = 0x80, /* debounce time (32/64sec) */
53 };
54 
65 };
66 #define PCF50633_MBCC7_USB_MASK 0x03
67 
70 };
71 
83 };
84 
98 };
99 #define PCF50633_MBCS2_MBC_MASK 0x0f
105 };
106 #define PCF50633_MBCS2_RESSTAT_AUTO 0x40
107 
113  PCF50633_MBCS3_ILIM = 0x10, /* 1: Ibat > Icutoff */
114  PCF50633_MBCS3_VLIM = 0x20, /* 1: Vbat == Vmax */
115  PCF50633_MBCS3_VBATSTAT = 0x40, /* 1: Vbat > Vbatcond */
116  PCF50633_MBCS3_VRES = 0x80, /* 1: Vbat > Vth(RES) */
117 };
118 
119 #define PCF50633_MBCC2_VBATCOND_MASK 0x03
120 #define PCF50633_MBCC2_VMAX_MASK 0x3c
121 
122 /* Charger status */
123 #define PCF50633_MBC_USB_ONLINE 0x01
124 #define PCF50633_MBC_USB_ACTIVE 0x02
125 #define PCF50633_MBC_ADAPTER_ONLINE 0x04
126 #define PCF50633_MBC_ADAPTER_ACTIVE 0x08
127 
128 int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
129 
130 int pcf50633_mbc_get_status(struct pcf50633 *);
132 
133 #endif
134