2 * include/linux/power/ricoh619_battery.h
4 * RICOH RC5T619 Charger Driver
6 * Copyright (C) 2012-2013 RICOH COMPANY,LTD
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LINUX_POWER_RICOH619_H_
23 #define __LINUX_POWER_RICOH619_H_
25 /* #include <linux/power_supply.h> */
26 /* #include <linux/types.h> */
29 #define RICOH_FG_DBG(fmt, args...) printk( "RICOH_FG_DBG:\t"fmt, ##args)
31 #define RICOH_FG_DBG(fmt, args...) {while(0);}
34 /* Defined battery information */
35 #define ADC_VDD_MV 2800
36 #define MIN_VOLTAGE 3100
37 #define MAX_VOLTAGE 4200
40 /* 619 Register information */
43 #define VINDAC_REG 0x03
45 #define INTEN_REG 0x9D
46 #define EN_ADCIR3_REG 0x8A
47 #define ADCCNT3_REG 0x66
48 #define VBATDATAH_REG 0x6A
49 #define VBATDATAL_REG 0x6B
50 #define VSYSDATAH_REG 0x70
51 #define VSYSDATAL_REG 0x71
53 #define CHGCTL1_REG 0xB3
54 #define REGISET1_REG 0xB6
55 #define REGISET2_REG 0xB7
56 #define CHGISET_REG 0xB8
57 #define TIMSET_REG 0xB9
58 #define BATSET1_REG 0xBA
59 #define BATSET2_REG 0xBB
61 #define CHGSTATE_REG 0xBD
63 #define FG_CTRL_REG 0xE0
65 #define RE_CAP_H_REG 0xE2
66 #define RE_CAP_L_REG 0xE3
67 #define FA_CAP_H_REG 0xE4
68 #define FA_CAP_L_REG 0xE5
69 #define TT_EMPTY_H_REG 0xE7
70 #define TT_EMPTY_L_REG 0xE8
71 #define TT_FULL_H_REG 0xE9
72 #define TT_FULL_L_REG 0xEA
73 #define VOLTAGE_1_REG 0xEB
74 #define VOLTAGE_2_REG 0xEC
75 #define TEMP_1_REG 0xED
76 #define TEMP_2_REG 0xEE
78 #define CC_CTRL_REG 0xEF
79 #define CC_SUMREG3_REG 0xF3
80 #define CC_SUMREG2_REG 0xF4
81 #define CC_SUMREG1_REG 0xF5
82 #define CC_SUMREG0_REG 0xF6
83 #define CC_AVERAGE1_REG 0xFB
84 #define CC_AVERAGE0_REG 0xFC
87 /* Top address for battery initial setting */
88 #define BAT_INIT_TOP_REG 0xBC
89 #define TEMP_GAIN_H_REG 0xD6
90 #define TEMP_OFF_H_REG 0xD8
91 #define BAT_REL_SEL_REG 0xDA
92 #define BAT_TA_SEL_REG 0xDB
93 /**************************/
95 /* detailed status in CHGSTATE (0xBD) */
97 CHG_STATE_CHG_OFF = 0,
98 CHG_STATE_CHG_READY_VADP,
99 CHG_STATE_CHG_TRICKLE,
101 CHG_STATE_CHG_COMPLETE,
103 CHG_STATE_VCHG_OVER_VOL,
106 CHG_STATE_BAT_OVER_VOL,
107 CHG_STATE_BAT_TEMP_ERR,
109 CHG_STATE_DIE_SHUTDOWN,
111 CHG_STATE_CHG_READY_VUSB,
115 SUPPLY_STATE_BAT = 0,
120 struct ricoh619_battery_type_data {
141 #define BATTERY_TYPE_NUM 1
142 struct ricoh619_battery_platform_data {
146 unsigned long monitor_time;
147 struct ricoh619_battery_type_data type[BATTERY_TYPE_NUM];
150 extern struct ricoh619 *g_ricoh619;