blob: 1fdce23ae7e87bfbb72e2411118c5c282177246e (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
#ifndef _BQ24160_CHARGER_H_
#define _BQ24160_CHARGER_H_
#if defined(CONFIG_MACH_ESPRESSO5433) && defined(CONFIG_FUELGAUGE_S2MG001)
#include <linux/power/sec_charging_common.h>
#endif
#define BQ24160_NAME "bq24160"
struct bq24160_platform_data {
const char *name;
char **supplied_to;
size_t num_supplicants;
unsigned char support_boot_charging;
void (*notify_vbus_drop)(void);
int (*gpio_configure)(int);
#if defined(CONFIG_MACH_ESPRESSO5433) && defined(CONFIG_FUELGAUGE_S2MG001)
char *fuelgauge_name;
#endif
};
/**
* bq24160_turn_on_charger() - Turns the charger HW on
* @usb_compliant: If run in USB compliant mode or not
*
* The USB compliant mode will hold VBUS within the +-5 % margin.
*/
int bq24160_turn_on_charger(u8 usb_compliant);
/**
* bq24160_turn_off_charger() - Turns the charger HW off
*
*/
int bq24160_turn_off_charger(void);
/**
* bq24160_set_otg_lock() - Sets the OTG locking of BQ24160
* @lock: Setting to '1' OTG is locked.
*
* If driver is not yet registered in power_supply class this function will
* return '-EAGAIN' as error code.
*/
int bq24160_set_otg_lock(int lock);
/**
* bq24160_set_charger_voltage() - Sets the charge voltage
* @mv: The voltage in mV.
*
* Setting voltage to '0' mV stops charging.
*/
int bq24160_set_charger_voltage(u16 mv);
/**
* bq24160_set_charger_current() - Sets the charge current
* @ma: The current in mA.
*
* Setting current to '0' mA stops charging.
*/
int bq24160_set_charger_current(u16 ma);
/**
* bq24160_set_charger_termination_current() - Sets the end of charge current
* @ma: The current in mA.
*
* When battery voltage has reached the charger voltage level and the charging
* current has fallen below this current level charging is stopped,
*
* Setting current to '0' mA disables charge termination.
*/
int bq24160_set_charger_termination_current(u16 ma);
/**
* bq24160_set_safety_timer() - Sets the charging safety timer
* @minutes: The timeout in minutes.
*
* Setting '0' minutes disables safety timer.
*/
int bq24160_set_charger_safety_timer(u16 minutes);
/**
* bq24160_set_input_current_limit() - Limits the current from the supplier.
* @ma: The current in mA.
*
* The supplier is the i.e. USB of Wall charger.
*
* Setting current to '0' mA stops charging.
*/
int bq24160_set_input_current_limit(u16 ma);
/**
* bq24160_set_input_current_limit_dual() - Limits the current from dual suppliers.
* @ma_usb: The current from USB in mA.
* @ma_in: The current from IN port in mA.
*
* The suppliers are i.e. USB and Cradle.
*
* Setting current to '0' mA stops charging.
*/
int bq24160_set_input_current_limit_dual(u16 ma_usb, u16 ma_in);
/**
* bq24160_set_input_voltage_dpm_usb() - Sets input voltage based DPM(USB).
* @usb_compliant: If run in USB compliant mode or not
*
*/
int bq24160_set_input_voltage_dpm_usb(u8 usb_compliant);
/**
* bq24160_set_input_voltage_dpm_in() - Sets input voltage based DPM(IN).
*
*/
int bq24160_set_input_voltage_dpm_in(void);
/**
* bq24160_set_external_charging_status() - Sets the status of charging
* @status: The POWER_SUPPLY_STATUS_* or -1 to release external value
*
*/
int bq24160_set_ext_charging_status(int status);
/**
* bq24160_charger_initialized() - Gets whether chrger was initilized or not.
* return 0 as charger was not initilized
*
*/
int bq24160_charger_initialized(void);
/**
* bq24160_is_restricted_by_charger_revision() - Gets restricted control.
* @bvolt: battery voltage
* @volt: charge voltage setting now
* @curr: charge current setting now
* return true:restricted false:Not restricted
*
*/
bool bq24160_is_restricted_by_charger_revision(int bvolt, u16 volt, u16 curr);
/**
* bq24160_get_restricted_setting() - Gets restricted voltage and current.
* @volt: restricted charge voltage that specified from charger
* @curr: restricted charge current that specified from charger
*
*/
void bq24160_get_restricted_setting(u16 *volt, u16 *curr);
/**
* bq24160_setup_exchanged_power_supply() - Setup when power supply connection
* is exchanged.
* @connection: Connection status of charger.
* 0x01: USB charger is connected.
* 0x02: Wall charger is connected.
* 0x04: Cradle charger is connected.
*
*/
int bq24160_setup_exchanged_power_supply(u8 connection);
#endif
|