tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / power / sprd_2713_charge.h
1 /*
2 * Copyright (C) 2012 Spreadtrum Communications Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 */
13
14 #ifndef _SPRD_2713_CHARGE_H_
15 #define _SPRD_2713_CHARGE_H_
16
17 #ifdef CONFIG_SHARK_PAD_HW_V102
18 #define SPRDBAT_TWO_CHARGE_CHANNEL
19 #endif
20
21 #define SPRDBAT_CCCV_MIN    0x00
22 #define SPRDBAT_CCCV_MAX   0x3F
23 #define ONE_CCCV_STEP_VOL   75  //7.5mV
24
25 #define SPRDBAT_CHG_OVP_LEVEL_MIN       5600
26 #define SPRDBAT_CHG_OVP_LEVEL_MAX   9000
27
28 /*charge current type*/
29 #define SPRDBAT_CHG_CUR_LEVEL_MIN       300
30 #define SPRDBAT_CHG_CUR_LEVEL_MAX       2300
31
32 #define SPRDBAT_ADC_CHANNEL_VCHG ADC_CHANNEL_VCHGSEN
33
34 #define SPRDBAT_TEMP_TRIGGER_TIMES 2
35
36 //sprdchg api
37 void sprdchg_timer_enable(uint32_t cycles);
38 void sprdchg_timer_disable(void);
39 int sprdchg_timer_init(int (*fn_cb) (void *data), void *data);
40 void sprdchg_init(struct sprd_battery_platform_data *pdata);
41 int sprdchg_read_temp(void);
42 int sprdchg_read_temp_adc(void);
43 uint32_t sprdchg_read_vchg_vol(void);
44 void sprdchg_start_charge(void);
45 void sprdchg_stop_charge(void);
46 void sprdchg_set_eoc_level(int level);
47 int sprdchg_get_eoc_level(void);
48 int sprdchg_get_cccvstate(void);
49
50 void sprdchg_set_cccvpoint(unsigned int cvpoint);
51 uint32_t sprdchg_get_cccvpoint(void);
52 uint32_t sprdchg_tune_endvol_cccv(uint32_t chg_end_vol, uint32_t cal_cccv);
53 void sprdchg_set_chg_cur(uint32_t chg_current);
54 int sprdchg_charger_is_adapter(void);
55 void sprdchg_set_chg_ovp(uint32_t ovp_vol);
56 uint32_t sprdchg_read_chg_current(void);
57 void sprdchg_put_chgcur(uint32_t chging_current);
58 uint32_t sprdchg_get_chgcur_ave(void);
59 uint32_t sprdchg_read_vbat_vol(void);
60 void sprdchg_led_brightness_set(struct led_classdev *led_cdev,
61                                 enum led_brightness brightness);
62
63 #endif /* _CHG_DRVAPI_H_ */