GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / linux / mfd / pcf50633 / mbc.h
blob385c5f88ea2c0f33d1718ea39d0c34064b3641ae
1 /*
2 * mbc.h -- Driver for NXP PCF50633 Main Battery Charger
4 * (C) 2006-2008 by Openmoko, Inc.
5 * All rights reserved.
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.
13 #ifndef __LINUX_MFD_PCF50633_MBC_H
14 #define __LINUX_MFD_PCF50633_MBC_H
16 #include <linux/mfd/pcf50633/core.h>
17 #include <linux/platform_device.h>
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
31 enum pcf50633_reg_mbcc1 {
32 PCF50633_MBCC1_CHGENA = 0x01, /* Charger enable */
33 PCF50633_MBCC1_AUTOSTOP = 0x02,
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 */
38 PCF50633_MBCC1_WDTIME_1H = 0x00,
39 PCF50633_MBCC1_WDTIME_2H = 0x40,
40 PCF50633_MBCC1_WDTIME_4H = 0x80,
41 PCF50633_MBCC1_WDTIME_6H = 0xc0,
43 #define PCF50633_MBCC1_WDTIME_MASK 0xc0
45 enum pcf50633_reg_mbcc2 {
46 PCF50633_MBCC2_VBATCOND_2V7 = 0x00,
47 PCF50633_MBCC2_VBATCOND_2V85 = 0x01,
48 PCF50633_MBCC2_VBATCOND_3V0 = 0x02,
49 PCF50633_MBCC2_VBATCOND_3V15 = 0x03,
50 PCF50633_MBCC2_VMAX_4V = 0x00,
51 PCF50633_MBCC2_VMAX_4V20 = 0x28,
52 PCF50633_MBCC2_VRESDEBTIME_64S = 0x80, /* debounce time (32/64sec) */
55 enum pcf50633_reg_mbcc7 {
56 PCF50633_MBCC7_USB_100mA = 0x00,
57 PCF50633_MBCC7_USB_500mA = 0x01,
58 PCF50633_MBCC7_USB_1000mA = 0x02,
59 PCF50633_MBCC7_USB_SUSPEND = 0x03,
60 PCF50633_MBCC7_BATTEMP_EN = 0x04,
61 PCF50633_MBCC7_BATSYSIMAX_1A6 = 0x00,
62 PCF50633_MBCC7_BATSYSIMAX_1A8 = 0x40,
63 PCF50633_MBCC7_BATSYSIMAX_2A0 = 0x80,
64 PCF50633_MBCC7_BATSYSIMAX_2A2 = 0xc0,
66 #define PCF50633_MBCC7_USB_MASK 0x03
68 enum pcf50633_reg_mbcc8 {
69 PCF50633_MBCC8_USBENASUS = 0x10,
72 enum pcf50633_reg_mbcs1 {
73 PCF50633_MBCS1_USBPRES = 0x01,
74 PCF50633_MBCS1_USBOK = 0x02,
75 PCF50633_MBCS1_ADAPTPRES = 0x04,
76 PCF50633_MBCS1_ADAPTOK = 0x08,
77 PCF50633_MBCS1_TBAT_OK = 0x00,
78 PCF50633_MBCS1_TBAT_ABOVE = 0x10,
79 PCF50633_MBCS1_TBAT_BELOW = 0x20,
80 PCF50633_MBCS1_TBAT_UNDEF = 0x30,
81 PCF50633_MBCS1_PREWDTEXP = 0x40,
82 PCF50633_MBCS1_WDTEXP = 0x80,
85 enum pcf50633_reg_mbcs2_mbcmod {
86 PCF50633_MBCS2_MBC_PLAY = 0x00,
87 PCF50633_MBCS2_MBC_USB_PRE = 0x01,
88 PCF50633_MBCS2_MBC_USB_PRE_WAIT = 0x02,
89 PCF50633_MBCS2_MBC_USB_FAST = 0x03,
90 PCF50633_MBCS2_MBC_USB_FAST_WAIT = 0x04,
91 PCF50633_MBCS2_MBC_USB_SUSPEND = 0x05,
92 PCF50633_MBCS2_MBC_ADP_PRE = 0x06,
93 PCF50633_MBCS2_MBC_ADP_PRE_WAIT = 0x07,
94 PCF50633_MBCS2_MBC_ADP_FAST = 0x08,
95 PCF50633_MBCS2_MBC_ADP_FAST_WAIT = 0x09,
96 PCF50633_MBCS2_MBC_BAT_FULL = 0x0a,
97 PCF50633_MBCS2_MBC_HALT = 0x0b,
99 #define PCF50633_MBCS2_MBC_MASK 0x0f
100 enum pcf50633_reg_mbcs2_chgstat {
101 PCF50633_MBCS2_CHGS_NONE = 0x00,
102 PCF50633_MBCS2_CHGS_ADAPTER = 0x10,
103 PCF50633_MBCS2_CHGS_USB = 0x20,
104 PCF50633_MBCS2_CHGS_BOTH = 0x30,
106 #define PCF50633_MBCS2_RESSTAT_AUTO 0x40
108 enum pcf50633_reg_mbcs3 {
109 PCF50633_MBCS3_USBLIM_PLAY = 0x01,
110 PCF50633_MBCS3_USBLIM_CGH = 0x02,
111 PCF50633_MBCS3_TLIM_PLAY = 0x04,
112 PCF50633_MBCS3_TLIM_CHG = 0x08,
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) */
119 #define PCF50633_MBCC2_VBATCOND_MASK 0x03
120 #define PCF50633_MBCC2_VMAX_MASK 0x3c
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
128 int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
130 int pcf50633_mbc_get_status(struct pcf50633 *);
131 int pcf50633_mbc_get_usb_online_status(struct pcf50633 *);
133 #endif