blob: 57281cc7752cee1574694c042bbc66db73a662a4 [file] [log] [blame]
Harry Yang4b7db0f2017-11-27 10:50:44 -08001/* Copyright (c) 2018 The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __SMB5_CHARGER_H
14#define __SMB5_CHARGER_H
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/irqreturn.h>
18#include <linux/regulator/driver.h>
19#include <linux/regulator/consumer.h>
20#include <linux/extcon.h>
21#include "storm-watch.h"
22
23enum print_reason {
24 PR_INTERRUPT = BIT(0),
25 PR_REGISTER = BIT(1),
26 PR_MISC = BIT(2),
27 PR_PARALLEL = BIT(3),
28 PR_OTG = BIT(4),
29};
30
31#define DEFAULT_VOTER "DEFAULT_VOTER"
32#define USER_VOTER "USER_VOTER"
33#define PD_VOTER "PD_VOTER"
34#define DCP_VOTER "DCP_VOTER"
35#define QC_VOTER "QC_VOTER"
36#define PL_USBIN_USBIN_VOTER "PL_USBIN_USBIN_VOTER"
37#define USB_PSY_VOTER "USB_PSY_VOTER"
38#define PL_TAPER_WORK_RUNNING_VOTER "PL_TAPER_WORK_RUNNING_VOTER"
39#define PL_QNOVO_VOTER "PL_QNOVO_VOTER"
40#define USBIN_V_VOTER "USBIN_V_VOTER"
41#define CHG_STATE_VOTER "CHG_STATE_VOTER"
42#define TYPEC_SRC_VOTER "TYPEC_SRC_VOTER"
43#define TAPER_END_VOTER "TAPER_END_VOTER"
44#define THERMAL_DAEMON_VOTER "THERMAL_DAEMON_VOTER"
45#define CC_DETACHED_VOTER "CC_DETACHED_VOTER"
46#define APSD_VOTER "APSD_VOTER"
47#define PD_DISALLOWED_INDIRECT_VOTER "PD_DISALLOWED_INDIRECT_VOTER"
48#define VBUS_CC_SHORT_VOTER "VBUS_CC_SHORT_VOTER"
49#define PD_INACTIVE_VOTER "PD_INACTIVE_VOTER"
50#define BOOST_BACK_VOTER "BOOST_BACK_VOTER"
51#define USBIN_USBIN_BOOST_VOTER "USBIN_USBIN_BOOST_VOTER"
52#define MICRO_USB_VOTER "MICRO_USB_VOTER"
53#define DEBUG_BOARD_VOTER "DEBUG_BOARD_VOTER"
54#define PD_SUSPEND_SUPPORTED_VOTER "PD_SUSPEND_SUPPORTED_VOTER"
55#define PL_DELAY_VOTER "PL_DELAY_VOTER"
56#define CTM_VOTER "CTM_VOTER"
57#define SW_QC3_VOTER "SW_QC3_VOTER"
58#define AICL_RERUN_VOTER "AICL_RERUN_VOTER"
Harry Yangf7b89902018-03-13 22:37:53 -070059#define SW_ICL_MAX_VOTER "SW_ICL_MAX_VOTER"
Harry Yang4b7db0f2017-11-27 10:50:44 -080060#define QNOVO_VOTER "QNOVO_VOTER"
61#define BATT_PROFILE_VOTER "BATT_PROFILE_VOTER"
62#define OTG_DELAY_VOTER "OTG_DELAY_VOTER"
63#define USBIN_I_VOTER "USBIN_I_VOTER"
64#define WEAK_CHARGER_VOTER "WEAK_CHARGER_VOTER"
65#define OTG_VOTER "OTG_VOTER"
66#define PL_FCC_LOW_VOTER "PL_FCC_LOW_VOTER"
67#define WBC_VOTER "WBC_VOTER"
68#define HW_LIMIT_VOTER "HW_LIMIT_VOTER"
Anirudh Ghayaldfdb8412018-04-21 10:37:18 +053069#define FORCE_RECHARGE_VOTER "FORCE_RECHARGE_VOTER"
Harry Yang4b7db0f2017-11-27 10:50:44 -080070
71#define BOOST_BACK_STORM_COUNT 3
72#define WEAK_CHG_STORM_COUNT 8
73
Anirudh Ghayal1380d312018-02-23 00:01:43 +053074#define VBAT_TO_VRAW_ADC(v) div_u64((u64)v * 1000000UL, 194637UL)
75
Harry Yang4b7db0f2017-11-27 10:50:44 -080076enum smb_mode {
77 PARALLEL_MASTER = 0,
78 PARALLEL_SLAVE,
79 NUM_MODES,
80};
81
Harry Yang6afaea22018-03-26 19:11:07 -070082enum sink_src_mode {
83 SINK_MODE,
84 SRC_MODE,
85 UNATTACHED_MODE,
86};
87
Harry Yang4b7db0f2017-11-27 10:50:44 -080088enum {
89 BOOST_BACK_WA = BIT(0),
90};
91
92enum smb_irq_index {
93 /* CHGR */
94 CHGR_ERROR_IRQ = 0,
95 CHG_STATE_CHANGE_IRQ,
96 STEP_CHG_STATE_CHANGE_IRQ,
97 STEP_CHG_SOC_UPDATE_FAIL_IRQ,
98 STEP_CHG_SOC_UPDATE_REQ_IRQ,
99 FG_FVCAL_QUALIFIED_IRQ,
100 VPH_ALARM_IRQ,
101 VPH_DROP_PRECHG_IRQ,
102 /* DCDC */
103 OTG_FAIL_IRQ,
104 OTG_OC_DISABLE_SW_IRQ,
105 OTG_OC_HICCUP_IRQ,
106 BSM_ACTIVE_IRQ,
107 HIGH_DUTY_CYCLE_IRQ,
108 INPUT_CURRENT_LIMITING_IRQ,
109 CONCURRENT_MODE_DISABLE_IRQ,
110 SWITCHER_POWER_OK_IRQ,
111 /* BATIF */
112 BAT_TEMP_IRQ,
113 ALL_CHNL_CONV_DONE_IRQ,
114 BAT_OV_IRQ,
115 BAT_LOW_IRQ,
116 BAT_THERM_OR_ID_MISSING_IRQ,
117 BAT_TERMINAL_MISSING_IRQ,
118 BUCK_OC_IRQ,
119 VPH_OV_IRQ,
120 /* USB */
121 USBIN_COLLAPSE_IRQ,
122 USBIN_VASHDN_IRQ,
123 USBIN_UV_IRQ,
124 USBIN_OV_IRQ,
125 USBIN_PLUGIN_IRQ,
126 USBIN_REVI_CHANGE_IRQ,
127 USBIN_SRC_CHANGE_IRQ,
128 USBIN_ICL_CHANGE_IRQ,
129 /* DC */
130 DCIN_VASHDN_IRQ,
131 DCIN_UV_IRQ,
132 DCIN_OV_IRQ,
133 DCIN_PLUGIN_IRQ,
134 DCIN_REVI_IRQ,
135 DCIN_PON_IRQ,
136 DCIN_EN_IRQ,
137 /* TYPEC */
138 TYPEC_OR_RID_DETECTION_CHANGE_IRQ,
139 TYPEC_VPD_DETECT_IRQ,
140 TYPEC_CC_STATE_CHANGE_IRQ,
141 TYPEC_VCONN_OC_IRQ,
142 TYPEC_VBUS_CHANGE_IRQ,
143 TYPEC_ATTACH_DETACH_IRQ,
144 TYPEC_LEGACY_CABLE_DETECT_IRQ,
145 TYPEC_TRY_SNK_SRC_DETECT_IRQ,
146 /* MISC */
147 WDOG_SNARL_IRQ,
148 WDOG_BARK_IRQ,
149 AICL_FAIL_IRQ,
150 AICL_DONE_IRQ,
151 SMB_EN_IRQ,
152 IMP_TRIGGER_IRQ,
153 TEMP_CHANGE_IRQ,
154 TEMP_CHANGE_SMB_IRQ,
Ashay Jaiswal09feab82018-02-12 12:33:18 +0530155 /* FLASH */
156 VREG_OK_IRQ,
157 ILIM_S2_IRQ,
158 ILIM_S1_IRQ,
159 VOUT_DOWN_IRQ,
160 VOUT_UP_IRQ,
161 FLASH_STATE_CHANGE_IRQ,
162 TORCH_REQ_IRQ,
163 FLASH_EN_IRQ,
Harry Yang4b7db0f2017-11-27 10:50:44 -0800164 /* END */
165 SMB_IRQ_MAX,
166};
167
168enum float_options {
169 FLOAT_DCP = 1,
170 FLOAT_SDP = 2,
171 DISABLE_CHARGING = 3,
172 SUSPEND_INPUT = 4,
173};
174
175struct smb_irq_info {
176 const char *name;
177 const irq_handler_t handler;
178 const bool wake;
179 const struct storm_watch storm_data;
180 struct smb_irq_data *irq_data;
181 int irq;
182};
183
184static const unsigned int smblib_extcon_cable[] = {
185 EXTCON_USB,
186 EXTCON_USB_HOST,
187 EXTCON_NONE,
188};
189
190/* EXTCON_USB and EXTCON_USB_HOST are mutually exclusive */
191static const u32 smblib_extcon_exclusive[] = {0x3, 0};
192
193struct smb_regulator {
194 struct regulator_dev *rdev;
195 struct regulator_desc rdesc;
196};
197
198struct smb_irq_data {
199 void *parent_data;
200 const char *name;
201 struct storm_watch storm_data;
202};
203
204struct smb_chg_param {
205 const char *name;
206 u16 reg;
207 int min_u;
208 int max_u;
209 int step_u;
210 int (*get_proc)(struct smb_chg_param *param,
211 u8 val_raw);
212 int (*set_proc)(struct smb_chg_param *param,
213 int val_u,
214 u8 *val_raw);
215};
216
Ashay Jaiswala9e10912018-02-02 14:03:35 +0530217struct buck_boost_freq {
218 int freq_khz;
219 u8 val;
220};
221
Harry Yang4b7db0f2017-11-27 10:50:44 -0800222struct smb_chg_freq {
223 unsigned int freq_5V;
224 unsigned int freq_6V_8V;
225 unsigned int freq_9V;
226 unsigned int freq_12V;
227 unsigned int freq_removal;
228 unsigned int freq_below_otg_threshold;
229 unsigned int freq_above_otg_threshold;
230};
231
232struct smb_params {
233 struct smb_chg_param fcc;
234 struct smb_chg_param fv;
235 struct smb_chg_param usb_icl;
Harry Yangf7b89902018-03-13 22:37:53 -0700236 struct smb_chg_param icl_max_stat;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800237 struct smb_chg_param icl_stat;
238 struct smb_chg_param otg_cl;
239 struct smb_chg_param jeita_cc_comp_hot;
240 struct smb_chg_param jeita_cc_comp_cold;
241 struct smb_chg_param freq_switcher;
242};
243
244struct parallel_params {
245 struct power_supply *psy;
246};
247
248struct smb_iio {
249 struct iio_channel *temp_chan;
250 struct iio_channel *temp_max_chan;
251 struct iio_channel *usbin_i_chan;
252 struct iio_channel *usbin_v_chan;
253 struct iio_channel *batt_i_chan;
254 struct iio_channel *connector_temp_chan;
255 struct iio_channel *connector_temp_thr1_chan;
256 struct iio_channel *connector_temp_thr2_chan;
257 struct iio_channel *connector_temp_thr3_chan;
258};
259
260struct smb_charger {
261 struct device *dev;
262 char *name;
263 struct regmap *regmap;
264 struct smb_irq_info *irq_info;
265 struct smb_params param;
266 struct smb_iio iio;
267 int *debug_mask;
Harry Yang6afaea22018-03-26 19:11:07 -0700268 int *pd_disabled;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800269 enum smb_mode mode;
270 struct smb_chg_freq chg_freq;
271 int smb_version;
272 int otg_delay_ms;
273 int *weak_chg_icl_ua;
Ashay Jaiswal20688262018-04-25 11:45:34 +0530274 struct qpnp_vadc_chip *vadc_dev;
Ashay Jaiswalf2ca7092018-05-22 21:33:15 +0530275 bool pd_not_supported;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800276
277 /* locks */
278 struct mutex lock;
279 struct mutex ps_change_lock;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800280
281 /* power supplies */
282 struct power_supply *batt_psy;
283 struct power_supply *usb_psy;
284 struct power_supply *dc_psy;
285 struct power_supply *bms_psy;
286 struct power_supply *usb_main_psy;
287 struct power_supply *usb_port_psy;
288 enum power_supply_type real_charger_type;
289
290 /* notifiers */
291 struct notifier_block nb;
292
293 /* parallel charging */
294 struct parallel_params pl;
295
296 /* regulators */
297 struct smb_regulator *vbus_vreg;
298 struct smb_regulator *vconn_vreg;
299 struct regulator *dpdm_reg;
300
301 /* votables */
302 struct votable *dc_suspend_votable;
303 struct votable *fcc_votable;
304 struct votable *fv_votable;
305 struct votable *usb_icl_votable;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800306 struct votable *awake_votable;
307 struct votable *pl_disable_votable;
308 struct votable *chg_disable_votable;
309 struct votable *pl_enable_votable_indirect;
310 struct votable *usb_irq_enable_votable;
311
312 /* work */
313 struct work_struct bms_update_work;
314 struct work_struct pl_update_work;
Ashay Jaiswalf05bd552018-04-12 18:11:00 +0530315 struct work_struct jeita_update_work;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800316 struct delayed_work ps_change_timeout_work;
317 struct delayed_work clear_hdc_work;
318 struct delayed_work icl_change_work;
319 struct delayed_work pl_enable_work;
320 struct delayed_work uusb_otg_work;
321 struct delayed_work bb_removal_work;
322
Harry Yang6afaea22018-03-26 19:11:07 -0700323 /* pd */
Harry Yang4b7db0f2017-11-27 10:50:44 -0800324 int voltage_min_uv;
325 int voltage_max_uv;
326 int pd_active;
Harry Yang6afaea22018-03-26 19:11:07 -0700327 bool pd_hard_reset;
328 bool pr_swap_in_progress;
329 bool early_usb_attach;
330 bool ok_to_pd;
331 bool typec_legacy;
332
333 /* cached status */
Harry Yang4b7db0f2017-11-27 10:50:44 -0800334 bool system_suspend_supported;
335 int boost_threshold_ua;
336 int system_temp_level;
337 int thermal_levels;
338 int *thermal_mitigation;
339 int dcp_icl_ua;
340 int fake_capacity;
341 int fake_batt_status;
342 bool step_chg_enabled;
343 bool sw_jeita_enabled;
344 bool is_hdc;
345 bool chg_done;
Ashay Jaiswala9e10912018-02-02 14:03:35 +0530346 int connector_type;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800347 bool otg_en;
348 bool suspend_input_on_debug_batt;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800349 int default_icl_ua;
350 int otg_cl_ua;
351 bool uusb_apsd_rerun_done;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800352 int fake_input_current_limited;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800353 int typec_mode;
354 int usb_icl_change_irq_enabled;
355 u32 jeita_status;
356 u8 float_cfg;
357 bool use_extcon;
358 bool otg_present;
Ashay Jaiswala9e10912018-02-02 14:03:35 +0530359 int hw_max_icl_ua;
Anirudh Ghayal1380d312018-02-23 00:01:43 +0530360 int auto_recharge_soc;
Ashay Jaiswalf05bd552018-04-12 18:11:00 +0530361 bool jeita_configured;
Harry Yang6afaea22018-03-26 19:11:07 -0700362 enum sink_src_mode sink_src_mode;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800363
364 /* workaround flag */
365 u32 wa_flags;
366 int boost_current_ua;
367
368 /* extcon for VBUS / ID notification to USB for uUSB */
369 struct extcon_dev *extcon;
370
371 /* battery profile */
372 int batt_profile_fcc_ua;
373 int batt_profile_fv_uv;
374
375 int usb_icl_delta_ua;
376 int pulse_cnt;
377
378 int die_health;
Ashay Jaiswal09feab82018-02-12 12:33:18 +0530379
380 /* flash */
381 u32 flash_derating_soc;
382 u32 flash_disable_soc;
383 u32 headroom_mode;
384 bool flash_init_done;
385 bool flash_active;
Harry Yang4b7db0f2017-11-27 10:50:44 -0800386};
387
388int smblib_read(struct smb_charger *chg, u16 addr, u8 *val);
389int smblib_masked_write(struct smb_charger *chg, u16 addr, u8 mask, u8 val);
390int smblib_write(struct smb_charger *chg, u16 addr, u8 val);
Anirudh Ghayal1380d312018-02-23 00:01:43 +0530391int smblib_batch_write(struct smb_charger *chg, u16 addr, u8 *val, int count);
392int smblib_batch_read(struct smb_charger *chg, u16 addr, u8 *val, int count);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800393
394int smblib_get_charge_param(struct smb_charger *chg,
395 struct smb_chg_param *param, int *val_u);
396int smblib_get_usb_suspend(struct smb_charger *chg, int *suspend);
397
398int smblib_enable_charging(struct smb_charger *chg, bool enable);
399int smblib_set_charge_param(struct smb_charger *chg,
400 struct smb_chg_param *param, int val_u);
401int smblib_set_usb_suspend(struct smb_charger *chg, bool suspend);
402int smblib_set_dc_suspend(struct smb_charger *chg, bool suspend);
403
404int smblib_mapping_soc_from_field_value(struct smb_chg_param *param,
405 int val_u, u8 *val_raw);
406int smblib_mapping_cc_delta_to_field_value(struct smb_chg_param *param,
407 u8 val_raw);
408int smblib_mapping_cc_delta_from_field_value(struct smb_chg_param *param,
409 int val_u, u8 *val_raw);
410int smblib_set_chg_freq(struct smb_chg_param *param,
411 int val_u, u8 *val_raw);
Ashay Jaiswala9e10912018-02-02 14:03:35 +0530412int smblib_set_prop_boost_current(struct smb_charger *chg,
413 const union power_supply_propval *val);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800414int smblib_vbus_regulator_enable(struct regulator_dev *rdev);
415int smblib_vbus_regulator_disable(struct regulator_dev *rdev);
416int smblib_vbus_regulator_is_enabled(struct regulator_dev *rdev);
417
418int smblib_vconn_regulator_enable(struct regulator_dev *rdev);
419int smblib_vconn_regulator_disable(struct regulator_dev *rdev);
420int smblib_vconn_regulator_is_enabled(struct regulator_dev *rdev);
421
422irqreturn_t default_irq_handler(int irq, void *data);
423irqreturn_t chg_state_change_irq_handler(int irq, void *data);
424irqreturn_t batt_temp_changed_irq_handler(int irq, void *data);
425irqreturn_t batt_psy_changed_irq_handler(int irq, void *data);
426irqreturn_t usbin_uv_irq_handler(int irq, void *data);
427irqreturn_t usb_plugin_irq_handler(int irq, void *data);
428irqreturn_t usb_source_change_irq_handler(int irq, void *data);
429irqreturn_t icl_change_irq_handler(int irq, void *data);
430irqreturn_t typec_state_change_irq_handler(int irq, void *data);
Harry Yang6afaea22018-03-26 19:11:07 -0700431irqreturn_t typec_attach_detach_irq_handler(int irq, void *data);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800432irqreturn_t dc_plugin_irq_handler(int irq, void *data);
433irqreturn_t high_duty_cycle_irq_handler(int irq, void *data);
434irqreturn_t switcher_power_ok_irq_handler(int irq, void *data);
435irqreturn_t wdog_bark_irq_handler(int irq, void *data);
Ashay Jaiswala9e10912018-02-02 14:03:35 +0530436irqreturn_t typec_or_rid_detection_change_irq_handler(int irq, void *data);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800437
438int smblib_get_prop_input_suspend(struct smb_charger *chg,
439 union power_supply_propval *val);
440int smblib_get_prop_batt_present(struct smb_charger *chg,
441 union power_supply_propval *val);
442int smblib_get_prop_batt_capacity(struct smb_charger *chg,
443 union power_supply_propval *val);
444int smblib_get_prop_batt_status(struct smb_charger *chg,
445 union power_supply_propval *val);
446int smblib_get_prop_batt_charge_type(struct smb_charger *chg,
447 union power_supply_propval *val);
448int smblib_get_prop_batt_charge_done(struct smb_charger *chg,
449 union power_supply_propval *val);
450int smblib_get_prop_batt_health(struct smb_charger *chg,
451 union power_supply_propval *val);
452int smblib_get_prop_system_temp_level(struct smb_charger *chg,
453 union power_supply_propval *val);
454int smblib_get_prop_system_temp_level_max(struct smb_charger *chg,
455 union power_supply_propval *val);
456int smblib_get_prop_input_current_limited(struct smb_charger *chg,
457 union power_supply_propval *val);
458int smblib_get_prop_batt_voltage_now(struct smb_charger *chg,
459 union power_supply_propval *val);
460int smblib_get_prop_batt_current_now(struct smb_charger *chg,
461 union power_supply_propval *val);
462int smblib_get_prop_batt_temp(struct smb_charger *chg,
463 union power_supply_propval *val);
464int smblib_get_prop_batt_charge_counter(struct smb_charger *chg,
465 union power_supply_propval *val);
Subbaraman Narayanamurthyc4feb892018-05-07 18:43:45 -0700466int smblib_get_prop_batt_cycle_count(struct smb_charger *chg,
467 union power_supply_propval *val);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800468int smblib_set_prop_input_suspend(struct smb_charger *chg,
469 const union power_supply_propval *val);
470int smblib_set_prop_batt_capacity(struct smb_charger *chg,
471 const union power_supply_propval *val);
472int smblib_set_prop_batt_status(struct smb_charger *chg,
473 const union power_supply_propval *val);
474int smblib_set_prop_system_temp_level(struct smb_charger *chg,
475 const union power_supply_propval *val);
476int smblib_set_prop_input_current_limited(struct smb_charger *chg,
477 const union power_supply_propval *val);
478
479int smblib_get_prop_dc_present(struct smb_charger *chg,
480 union power_supply_propval *val);
481int smblib_get_prop_dc_online(struct smb_charger *chg,
482 union power_supply_propval *val);
483int smblib_get_prop_dc_current_max(struct smb_charger *chg,
484 union power_supply_propval *val);
485int smblib_set_prop_dc_current_max(struct smb_charger *chg,
486 const union power_supply_propval *val);
487int smblib_get_prop_usb_present(struct smb_charger *chg,
488 union power_supply_propval *val);
489int smblib_get_prop_usb_online(struct smb_charger *chg,
490 union power_supply_propval *val);
491int smblib_get_prop_usb_suspend(struct smb_charger *chg,
492 union power_supply_propval *val);
493int smblib_get_prop_usb_voltage_max(struct smb_charger *chg,
494 union power_supply_propval *val);
495int smblib_get_prop_typec_cc_orientation(struct smb_charger *chg,
496 union power_supply_propval *val);
497int smblib_get_prop_typec_power_role(struct smb_charger *chg,
498 union power_supply_propval *val);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800499int smblib_get_prop_input_current_settled(struct smb_charger *chg,
500 union power_supply_propval *val);
501int smblib_get_prop_input_voltage_settled(struct smb_charger *chg,
502 union power_supply_propval *val);
503int smblib_get_prop_pd_in_hard_reset(struct smb_charger *chg,
504 union power_supply_propval *val);
505int smblib_get_pe_start(struct smb_charger *chg,
506 union power_supply_propval *val);
507int smblib_get_prop_die_health(struct smb_charger *chg,
508 union power_supply_propval *val);
509int smblib_set_prop_pd_current_max(struct smb_charger *chg,
510 const union power_supply_propval *val);
511int smblib_set_prop_sdp_current_max(struct smb_charger *chg,
512 const union power_supply_propval *val);
513int smblib_set_prop_pd_voltage_max(struct smb_charger *chg,
514 const union power_supply_propval *val);
515int smblib_set_prop_pd_voltage_min(struct smb_charger *chg,
516 const union power_supply_propval *val);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800517int smblib_set_prop_typec_power_role(struct smb_charger *chg,
518 const union power_supply_propval *val);
519int smblib_set_prop_pd_active(struct smb_charger *chg,
520 const union power_supply_propval *val);
521int smblib_set_prop_pd_in_hard_reset(struct smb_charger *chg,
522 const union power_supply_propval *val);
523int smblib_set_prop_ship_mode(struct smb_charger *chg,
524 const union power_supply_propval *val);
525void smblib_suspend_on_debug_battery(struct smb_charger *chg);
526int smblib_rerun_apsd_if_required(struct smb_charger *chg);
527int smblib_get_prop_fcc_delta(struct smb_charger *chg,
528 union power_supply_propval *val);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800529int smblib_dp_dm(struct smb_charger *chg, int val);
530int smblib_disable_hw_jeita(struct smb_charger *chg, bool disable);
531int smblib_rerun_aicl(struct smb_charger *chg);
532int smblib_set_icl_current(struct smb_charger *chg, int icl_ua);
533int smblib_get_icl_current(struct smb_charger *chg, int *icl_ua);
534int smblib_get_charge_current(struct smb_charger *chg, int *total_current_ua);
535int smblib_get_prop_pr_swap_in_progress(struct smb_charger *chg,
536 union power_supply_propval *val);
537int smblib_set_prop_pr_swap_in_progress(struct smb_charger *chg,
538 const union power_supply_propval *val);
539int smblib_stat_sw_override_cfg(struct smb_charger *chg, bool override);
Ashay Jaiswala55b7ed2018-03-23 17:23:48 +0530540int smblib_configure_wdog(struct smb_charger *chg, bool enable);
Ashay Jaiswal4d334f42018-04-25 10:58:49 +0530541int smblib_force_vbus_voltage(struct smb_charger *chg, u8 val);
Ashay Jaiswalc96380de2018-05-16 12:02:36 +0530542int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable);
Harry Yang4b7db0f2017-11-27 10:50:44 -0800543
544int smblib_init(struct smb_charger *chg);
545int smblib_deinit(struct smb_charger *chg);
546#endif /* __SMB5_CHARGER_H */