summaryrefslogtreecommitdiff
path: root/include/linux/sprd_battery_common.h
blob: 9df669812ca276ee717c99868b451d66c76636e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef _SPRD_BATTERY_COMMON_H_
#define _SPRD_BATTERY_COMMON_H_

#include <linux/types.h>
#include <linux/power_supply.h>

struct sprdbat_table_data {
	int x;
	int y;
};

struct sprd_battery_platform_data {
	uint32_t chg_end_vol_h;	//charging
	uint32_t chg_end_vol_l;
	uint32_t chg_false_full_vol;    /* false full */
	uint32_t chg_end_vol_pure;
	uint32_t chg_bat_safety_vol;
	uint32_t rechg_vol;
	uint32_t adp_cdp_cur;
	uint32_t adp_dcp_cur;
	uint32_t adp_sdp_cur;
	uint32_t ovp_stop;	//opt param
	uint32_t ovp_restart;
	uint32_t chg_timeout;
	uint32_t chgtimeout_show_full;	// when charging :1:timeout display 100%, 0 : timeout NOT display 100%
	uint32_t chg_rechg_timeout;
	uint32_t chg_cv_timeout;	//cv charging timeout
	uint32_t chg_eoc_level;
	uint32_t cccv_default;
	int chg_end_cur;
	int otp_high_stop;	//ovp param
	int otp_high_restart;
	int otp_low_stop;
	int otp_low_restart;
	uint32_t chg_polling_time;
	uint32_t chg_polling_time_fast;
	uint32_t bat_polling_time;
	uint32_t bat_polling_time_fast;
	uint32_t bat_polling_time_sleep;	//reserved
	uint32_t cap_one_per_time;
	uint32_t cap_one_per_time_fast;	//reserved
	int cap_valid_range_poweron;

	//temp param
	int temp_support;	/*0:do NOT support temperature,1:support temperature */
	int temp_adc_ch;
	int temp_adc_scale;
	int temp_adc_sample_cnt;	/*1-15,should be lower than 16 */
	int temp_table_mode;	//0:adc-degree;1:voltage-degree
	int temp_comp_res;	//mohm, use rsense + connector resistor to compensate temp;
	struct sprdbat_table_data *temp_tab;	/* OCV curve adjustment */
	int temp_tab_size;

	//resource
	uint32_t gpio_vchg_detect;
	uint32_t gpio_vbat_detect;	//reserved
	uint32_t gpio_cv_state;
	uint32_t gpio_vchg_ovi;
	uint32_t gpio_chg_en;	//reserved
	uint32_t irq_chg_timer;
	uint32_t irq_fgu;
	unsigned long chg_reg_base;
	unsigned long fgu_reg_base;

	//fgu param
	uint32_t fgu_mode;	/* 1=voltage mode, 0=mixed mode */
	uint32_t alm_soc;	/* SOC alm level % */
	uint32_t alm_vol;	/* Vbat alm level mV */
	uint32_t soft_vbat_uvlo;	/*reserved, if vbat voltage lower than it, should shutdown device */
	uint32_t soft_vbat_ovp;	/*reserved,if battery voltage higher than it maybe shutdown device */
	int rint;		/*battery internal impedance */
	int cnom;		/* nominal capacity in mAh */
	int rsense_real;	/* sense resistor 0.2mOhm from real environment */
	int rsense_spec;	/* sense resistor 0.2mOhm from specification */
	uint32_t relax_current;	/* current for relaxation in mA */
	int fgu_cal_ajust;	//reserved
	int qmax_update_period;	/*reserved */
	struct sprdbat_table_data *cnom_temp_tab;	/* capacity temp table */
	int cnom_temp_tab_size;
	struct sprdbat_table_data *rint_temp_tab;	/* impedance temp table */
	int rint_temp_tab_size;
	struct sprdbat_table_data *ocv_tab;	/* OCV curve adjustment */
	int ocv_tab_size;
	void *ext_data;		/*reserved, other battery data,fg ic data,and so on */
};
#endif