Harry Yang | 3b113a5 | 2016-12-08 12:37:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 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 __SMB2_CHARGER_H |
| 14 | #define __SMB2_CHARGER_H |
| 15 | #include <linux/types.h> |
Subbaraman Narayanamurthy | bbd7f45 | 2017-02-06 16:22:48 -0800 | [diff] [blame] | 16 | #include <linux/interrupt.h> |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 17 | #include <linux/irqreturn.h> |
| 18 | #include <linux/regulator/driver.h> |
| 19 | #include <linux/regulator/consumer.h> |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 20 | #include <linux/extcon.h> |
Nicholas Troast | 47ae461 | 2016-08-03 09:49:36 -0700 | [diff] [blame] | 21 | #include "storm-watch.h" |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 22 | |
| 23 | enum print_reason { |
| 24 | PR_INTERRUPT = BIT(0), |
| 25 | PR_REGISTER = BIT(1), |
| 26 | PR_MISC = BIT(2), |
Nicholas Troast | 87d69ba | 2016-10-10 19:29:47 -0700 | [diff] [blame] | 27 | PR_PARALLEL = BIT(3), |
Nicholas Troast | b11015f | 2017-01-17 17:56:45 -0800 | [diff] [blame] | 28 | PR_OTG = BIT(4), |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
Harry Yang | 995b742 | 2016-08-29 16:06:50 -0700 | [diff] [blame] | 31 | #define DEFAULT_VOTER "DEFAULT_VOTER" |
| 32 | #define USER_VOTER "USER_VOTER" |
| 33 | #define PD_VOTER "PD_VOTER" |
Harry Yang | 631b99e | 2016-11-17 11:24:25 -0800 | [diff] [blame] | 34 | #define DCP_VOTER "DCP_VOTER" |
Harry Yang | 4bf7d96 | 2017-03-13 16:51:43 -0700 | [diff] [blame] | 35 | #define QC_VOTER "QC_VOTER" |
Abhijeet Dharmapurikar | 7442e42 | 2017-02-08 13:35:14 -0800 | [diff] [blame] | 36 | #define PL_USBIN_USBIN_VOTER "PL_USBIN_USBIN_VOTER" |
Abhijeet Dharmapurikar | d92eca6 | 2016-10-07 19:04:33 -0700 | [diff] [blame] | 37 | #define USB_PSY_VOTER "USB_PSY_VOTER" |
Harry Yang | 995b742 | 2016-08-29 16:06:50 -0700 | [diff] [blame] | 38 | #define PL_TAPER_WORK_RUNNING_VOTER "PL_TAPER_WORK_RUNNING_VOTER" |
Harry Yang | 67f1952 | 2017-03-23 22:40:31 -0700 | [diff] [blame] | 39 | #define PL_QNOVO_VOTER "PL_QNOVO_VOTER" |
Harry Yang | aba1f5f | 2016-09-28 10:47:29 -0700 | [diff] [blame] | 40 | #define USBIN_V_VOTER "USBIN_V_VOTER" |
Harry Yang | 995b742 | 2016-08-29 16:06:50 -0700 | [diff] [blame] | 41 | #define CHG_STATE_VOTER "CHG_STATE_VOTER" |
| 42 | #define TYPEC_SRC_VOTER "TYPEC_SRC_VOTER" |
| 43 | #define TAPER_END_VOTER "TAPER_END_VOTER" |
Harry Yang | aba1f5f | 2016-09-28 10:47:29 -0700 | [diff] [blame] | 44 | #define THERMAL_DAEMON_VOTER "THERMAL_DAEMON_VOTER" |
Abhijeet Dharmapurikar | 4b13c6e | 2016-10-05 15:15:10 -0700 | [diff] [blame] | 45 | #define CC_DETACHED_VOTER "CC_DETACHED_VOTER" |
| 46 | #define HVDCP_TIMEOUT_VOTER "HVDCP_TIMEOUT_VOTER" |
| 47 | #define PD_DISALLOWED_INDIRECT_VOTER "PD_DISALLOWED_INDIRECT_VOTER" |
Abhijeet Dharmapurikar | f8a7a4a | 2016-10-07 18:46:45 -0700 | [diff] [blame] | 48 | #define PD_HARD_RESET_VOTER "PD_HARD_RESET_VOTER" |
Abhijeet Dharmapurikar | a8075d7 | 2016-10-06 12:59:04 -0700 | [diff] [blame] | 49 | #define VBUS_CC_SHORT_VOTER "VBUS_CC_SHORT_VOTER" |
Abhijeet Dharmapurikar | 716cd96 | 2016-10-14 12:50:37 -0700 | [diff] [blame] | 50 | #define PD_INACTIVE_VOTER "PD_INACTIVE_VOTER" |
Nicholas Troast | abedaf7 | 2016-09-16 11:07:45 -0700 | [diff] [blame] | 51 | #define BOOST_BACK_VOTER "BOOST_BACK_VOTER" |
Harry Yang | a2fb0e3 | 2017-03-22 22:45:25 -0700 | [diff] [blame] | 52 | #define USBIN_USBIN_BOOST_VOTER "USBIN_USBIN_BOOST_VOTER" |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 53 | #define HVDCP_INDIRECT_VOTER "HVDCP_INDIRECT_VOTER" |
| 54 | #define MICRO_USB_VOTER "MICRO_USB_VOTER" |
Ashay Jaiswal | 2fb369d | 2017-01-12 21:38:29 +0530 | [diff] [blame] | 55 | #define DEBUG_BOARD_VOTER "DEBUG_BOARD_VOTER" |
Abhijeet Dharmapurikar | 9567087 | 2017-02-09 22:55:51 +0530 | [diff] [blame] | 56 | #define PD_SUSPEND_SUPPORTED_VOTER "PD_SUSPEND_SUPPORTED_VOTER" |
Ashay Jaiswal | c036167 | 2017-03-21 12:24:16 +0530 | [diff] [blame] | 57 | #define PL_DELAY_VOTER "PL_DELAY_VOTER" |
Nicholas Troast | e1b0c04 | 2017-02-09 10:05:03 -0800 | [diff] [blame] | 58 | #define CTM_VOTER "CTM_VOTER" |
Ashay Jaiswal | 6d308da | 2017-02-18 09:59:23 +0530 | [diff] [blame] | 59 | #define SW_QC3_VOTER "SW_QC3_VOTER" |
Nicholas Troast | 20ae191 | 2017-02-15 10:15:32 -0800 | [diff] [blame] | 60 | #define AICL_RERUN_VOTER "AICL_RERUN_VOTER" |
Nicholas Troast | f9e4499 | 2017-03-14 09:06:56 -0700 | [diff] [blame] | 61 | #define LEGACY_UNKNOWN_VOTER "LEGACY_UNKNOWN_VOTER" |
Abhijeet Dharmapurikar | 3c93db3 | 2017-04-17 17:36:14 -0700 | [diff] [blame] | 62 | #define CC2_WA_VOTER "CC2_WA_VOTER" |
Abhijeet Dharmapurikar | c31b4ab | 2017-04-27 19:20:31 -0700 | [diff] [blame] | 63 | #define QNOVO_VOTER "QNOVO_VOTER" |
| 64 | #define BATT_PROFILE_VOTER "BATT_PROFILE_VOTER" |
Ashay Jaiswal | 1bf4133 | 2017-05-03 15:10:25 +0530 | [diff] [blame] | 65 | #define OTG_DELAY_VOTER "OTG_DELAY_VOTER" |
Abhijeet Dharmapurikar | 38ef142 | 2017-05-18 15:37:56 -0700 | [diff] [blame] | 66 | #define USBIN_I_VOTER "USBIN_I_VOTER" |
Ashay Jaiswal | 2f3b0c1 | 2017-06-14 16:04:45 +0530 | [diff] [blame] | 67 | #define WEAK_CHARGER_VOTER "WEAK_CHARGER_VOTER" |
Abhijeet Dharmapurikar | 66d2c44 | 2017-07-12 11:55:36 -0700 | [diff] [blame] | 68 | #define OTG_VOTER "OTG_VOTER" |
Harry Yang | a796cf7 | 2017-07-19 19:26:45 -0700 | [diff] [blame] | 69 | #define FCC_CHANGE_VOTER "FCC_CHANGE_VOTER" |
Ashay Jaiswal | 1829fcf | 2017-02-02 22:45:22 +0530 | [diff] [blame] | 70 | |
Nicholas Troast | 8995a70 | 2016-12-05 10:22:22 -0800 | [diff] [blame] | 71 | #define VCONN_MAX_ATTEMPTS 3 |
| 72 | #define OTG_MAX_ATTEMPTS 3 |
Ashay Jaiswal | 2f3b0c1 | 2017-06-14 16:04:45 +0530 | [diff] [blame] | 73 | #define BOOST_BACK_STORM_COUNT 3 |
| 74 | #define WEAK_CHG_STORM_COUNT 8 |
Nicholas Troast | 8995a70 | 2016-12-05 10:22:22 -0800 | [diff] [blame] | 75 | |
Nicholas Troast | 320839e | 2016-06-03 10:18:00 -0700 | [diff] [blame] | 76 | enum smb_mode { |
| 77 | PARALLEL_MASTER = 0, |
| 78 | PARALLEL_SLAVE, |
| 79 | NUM_MODES, |
| 80 | }; |
| 81 | |
Harry Yang | 1369b7a | 2016-09-27 15:59:50 -0700 | [diff] [blame] | 82 | enum { |
Harry Yang | 755a34b | 2016-11-01 01:18:51 -0700 | [diff] [blame] | 83 | QC_CHARGER_DETECTION_WA_BIT = BIT(0), |
| 84 | BOOST_BACK_WA = BIT(1), |
| 85 | TYPEC_CC2_REMOVAL_WA_BIT = BIT(2), |
Ashay Jaiswal | 67ec707 | 2017-02-16 14:14:58 +0530 | [diff] [blame] | 86 | QC_AUTH_INTERRUPT_WA_BIT = BIT(3), |
Ashay Jaiswal | 7c24138 | 2017-03-06 15:26:38 +0530 | [diff] [blame] | 87 | OTG_WA = BIT(4), |
Harry Yang | 1369b7a | 2016-09-27 15:59:50 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Subbaraman Narayanamurthy | bbd7f45 | 2017-02-06 16:22:48 -0800 | [diff] [blame] | 90 | enum smb_irq_index { |
| 91 | CHG_ERROR_IRQ = 0, |
| 92 | CHG_STATE_CHANGE_IRQ, |
| 93 | STEP_CHG_STATE_CHANGE_IRQ, |
| 94 | STEP_CHG_SOC_UPDATE_FAIL_IRQ, |
| 95 | STEP_CHG_SOC_UPDATE_REQ_IRQ, |
| 96 | OTG_FAIL_IRQ, |
| 97 | OTG_OVERCURRENT_IRQ, |
| 98 | OTG_OC_DIS_SW_STS_IRQ, |
| 99 | TESTMODE_CHANGE_DET_IRQ, |
| 100 | BATT_TEMP_IRQ, |
| 101 | BATT_OCP_IRQ, |
| 102 | BATT_OV_IRQ, |
| 103 | BATT_LOW_IRQ, |
| 104 | BATT_THERM_ID_MISS_IRQ, |
| 105 | BATT_TERM_MISS_IRQ, |
| 106 | USBIN_COLLAPSE_IRQ, |
| 107 | USBIN_LT_3P6V_IRQ, |
| 108 | USBIN_UV_IRQ, |
| 109 | USBIN_OV_IRQ, |
| 110 | USBIN_PLUGIN_IRQ, |
| 111 | USBIN_SRC_CHANGE_IRQ, |
| 112 | USBIN_ICL_CHANGE_IRQ, |
| 113 | TYPE_C_CHANGE_IRQ, |
| 114 | DCIN_COLLAPSE_IRQ, |
| 115 | DCIN_LT_3P6V_IRQ, |
| 116 | DCIN_UV_IRQ, |
| 117 | DCIN_OV_IRQ, |
| 118 | DCIN_PLUGIN_IRQ, |
| 119 | DIV2_EN_DG_IRQ, |
| 120 | DCIN_ICL_CHANGE_IRQ, |
| 121 | WDOG_SNARL_IRQ, |
| 122 | WDOG_BARK_IRQ, |
| 123 | AICL_FAIL_IRQ, |
| 124 | AICL_DONE_IRQ, |
| 125 | HIGH_DUTY_CYCLE_IRQ, |
| 126 | INPUT_CURRENT_LIMIT_IRQ, |
| 127 | TEMPERATURE_CHANGE_IRQ, |
| 128 | SWITCH_POWER_OK_IRQ, |
| 129 | SMB_IRQ_MAX, |
| 130 | }; |
| 131 | |
| 132 | struct smb_irq_info { |
| 133 | const char *name; |
| 134 | const irq_handler_t handler; |
| 135 | const bool wake; |
| 136 | const struct storm_watch storm_data; |
| 137 | struct smb_irq_data *irq_data; |
| 138 | int irq; |
| 139 | }; |
| 140 | |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 141 | static const unsigned int smblib_extcon_cable[] = { |
| 142 | EXTCON_USB, |
| 143 | EXTCON_USB_HOST, |
| 144 | EXTCON_NONE, |
| 145 | }; |
| 146 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 147 | struct smb_regulator { |
| 148 | struct regulator_dev *rdev; |
| 149 | struct regulator_desc rdesc; |
| 150 | }; |
| 151 | |
| 152 | struct smb_irq_data { |
Nicholas Troast | 47ae461 | 2016-08-03 09:49:36 -0700 | [diff] [blame] | 153 | void *parent_data; |
| 154 | const char *name; |
| 155 | struct storm_watch storm_data; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 156 | }; |
| 157 | |
| 158 | struct smb_chg_param { |
| 159 | const char *name; |
| 160 | u16 reg; |
| 161 | int min_u; |
| 162 | int max_u; |
| 163 | int step_u; |
Harry Yang | f8b4125 | 2016-08-10 14:21:10 -0700 | [diff] [blame] | 164 | int (*get_proc)(struct smb_chg_param *param, |
| 165 | u8 val_raw); |
| 166 | int (*set_proc)(struct smb_chg_param *param, |
| 167 | int val_u, |
| 168 | u8 *val_raw); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 169 | }; |
| 170 | |
Anirudh Ghayal | 4da3df9 | 2017-01-25 18:55:57 +0530 | [diff] [blame] | 171 | struct smb_chg_freq { |
| 172 | unsigned int freq_5V; |
| 173 | unsigned int freq_6V_8V; |
| 174 | unsigned int freq_9V; |
| 175 | unsigned int freq_12V; |
| 176 | unsigned int freq_removal; |
| 177 | unsigned int freq_below_otg_threshold; |
| 178 | unsigned int freq_above_otg_threshold; |
| 179 | }; |
| 180 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 181 | struct smb_params { |
| 182 | struct smb_chg_param fcc; |
| 183 | struct smb_chg_param fv; |
| 184 | struct smb_chg_param usb_icl; |
Harry Yang | 1d1034c | 2016-06-15 12:09:42 -0700 | [diff] [blame] | 185 | struct smb_chg_param icl_stat; |
Harry Yang | 360bd53 | 2016-09-26 11:03:22 -0700 | [diff] [blame] | 186 | struct smb_chg_param otg_cl; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 187 | struct smb_chg_param dc_icl; |
Abhijeet Dharmapurikar | 5cf5faf | 2016-06-21 14:20:24 -0700 | [diff] [blame] | 188 | struct smb_chg_param dc_icl_pt_lv; |
| 189 | struct smb_chg_param dc_icl_pt_hv; |
| 190 | struct smb_chg_param dc_icl_div2_lv; |
| 191 | struct smb_chg_param dc_icl_div2_mid_lv; |
| 192 | struct smb_chg_param dc_icl_div2_mid_hv; |
| 193 | struct smb_chg_param dc_icl_div2_hv; |
Abhijeet Dharmapurikar | 2644cd6 | 2016-07-20 16:54:55 -0700 | [diff] [blame] | 194 | struct smb_chg_param jeita_cc_comp; |
Harry Yang | f6df8b0 | 2016-10-05 15:38:03 -0700 | [diff] [blame] | 195 | struct smb_chg_param freq_buck; |
Harry Yang | d89ff1f | 2016-12-05 14:59:11 -0800 | [diff] [blame] | 196 | struct smb_chg_param freq_boost; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 197 | }; |
| 198 | |
Harry Yang | 1d1034c | 2016-06-15 12:09:42 -0700 | [diff] [blame] | 199 | struct parallel_params { |
| 200 | struct power_supply *psy; |
Harry Yang | 1d1034c | 2016-06-15 12:09:42 -0700 | [diff] [blame] | 201 | }; |
| 202 | |
Harry Yang | ba874ce | 2016-08-19 14:17:01 -0700 | [diff] [blame] | 203 | struct smb_iio { |
| 204 | struct iio_channel *temp_chan; |
| 205 | struct iio_channel *temp_max_chan; |
| 206 | struct iio_channel *usbin_i_chan; |
| 207 | struct iio_channel *usbin_v_chan; |
Nicholas Troast | 7dbcad2 | 2016-10-05 13:30:18 -0700 | [diff] [blame] | 208 | struct iio_channel *batt_i_chan; |
Nicholas Troast | c8434ac | 2017-02-14 16:11:56 -0800 | [diff] [blame] | 209 | struct iio_channel *connector_temp_chan; |
Nicholas Troast | ae0ea54 | 2017-01-31 19:23:10 -0800 | [diff] [blame] | 210 | struct iio_channel *connector_temp_thr1_chan; |
| 211 | struct iio_channel *connector_temp_thr2_chan; |
| 212 | struct iio_channel *connector_temp_thr3_chan; |
Harry Yang | ba874ce | 2016-08-19 14:17:01 -0700 | [diff] [blame] | 213 | }; |
| 214 | |
Harry Yang | 5e2bb71 | 2016-10-18 16:47:48 -0700 | [diff] [blame] | 215 | struct reg_info { |
| 216 | u16 reg; |
| 217 | u8 mask; |
| 218 | u8 val; |
| 219 | u8 bak; |
| 220 | const char *desc; |
| 221 | }; |
| 222 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 223 | struct smb_charger { |
| 224 | struct device *dev; |
Abhijeet Dharmapurikar | 31b98f3 | 2016-10-14 12:25:23 -0700 | [diff] [blame] | 225 | char *name; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 226 | struct regmap *regmap; |
Subbaraman Narayanamurthy | bbd7f45 | 2017-02-06 16:22:48 -0800 | [diff] [blame] | 227 | struct smb_irq_info *irq_info; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 228 | struct smb_params param; |
Harry Yang | ba874ce | 2016-08-19 14:17:01 -0700 | [diff] [blame] | 229 | struct smb_iio iio; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 230 | int *debug_mask; |
Nicholas Troast | 320839e | 2016-06-03 10:18:00 -0700 | [diff] [blame] | 231 | enum smb_mode mode; |
Anirudh Ghayal | 4da3df9 | 2017-01-25 18:55:57 +0530 | [diff] [blame] | 232 | struct smb_chg_freq chg_freq; |
Abhijeet Dharmapurikar | 7442e42 | 2017-02-08 13:35:14 -0800 | [diff] [blame] | 233 | int smb_version; |
Ashay Jaiswal | 1bf4133 | 2017-05-03 15:10:25 +0530 | [diff] [blame] | 234 | int otg_delay_ms; |
Ashay Jaiswal | 2f3b0c1 | 2017-06-14 16:04:45 +0530 | [diff] [blame] | 235 | int *weak_chg_icl_ua; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 236 | |
| 237 | /* locks */ |
Abhijeet Dharmapurikar | 11330d9 | 2017-04-17 12:15:19 -0700 | [diff] [blame] | 238 | struct mutex lock; |
Harry Yang | bacd222 | 2016-05-11 16:43:51 -0700 | [diff] [blame] | 239 | struct mutex write_lock; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 240 | struct mutex ps_change_lock; |
Nicholas Troast | b11015f | 2017-01-17 17:56:45 -0800 | [diff] [blame] | 241 | struct mutex otg_oc_lock; |
Nicholas Troast | 85d3a5a | 2017-05-03 10:19:43 -0700 | [diff] [blame] | 242 | struct mutex vconn_oc_lock; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 243 | |
| 244 | /* power supplies */ |
| 245 | struct power_supply *batt_psy; |
| 246 | struct power_supply *usb_psy; |
Harry Yang | f302359 | 2016-07-20 14:56:41 -0700 | [diff] [blame] | 247 | struct power_supply *dc_psy; |
Harry Yang | 5e1a522 | 2016-07-26 15:16:04 -0700 | [diff] [blame] | 248 | struct power_supply *bms_psy; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 249 | struct power_supply_desc usb_psy_desc; |
Abhijeet Dharmapurikar | a8bd6f0 | 2017-01-30 15:43:04 -0800 | [diff] [blame] | 250 | struct power_supply *usb_main_psy; |
Fenglin Wu | 80826e0 | 2017-04-25 21:45:08 +0800 | [diff] [blame] | 251 | struct power_supply *usb_port_psy; |
| 252 | enum power_supply_type real_charger_type; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 253 | |
Harry Yang | 5e1a522 | 2016-07-26 15:16:04 -0700 | [diff] [blame] | 254 | /* notifiers */ |
| 255 | struct notifier_block nb; |
| 256 | |
Harry Yang | 1d1034c | 2016-06-15 12:09:42 -0700 | [diff] [blame] | 257 | /* parallel charging */ |
| 258 | struct parallel_params pl; |
| 259 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 260 | /* regulators */ |
| 261 | struct smb_regulator *vbus_vreg; |
| 262 | struct smb_regulator *vconn_vreg; |
| 263 | struct regulator *dpdm_reg; |
| 264 | |
| 265 | /* votables */ |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 266 | struct votable *dc_suspend_votable; |
| 267 | struct votable *fcc_votable; |
Abhijeet Dharmapurikar | f9805d4 | 2016-05-17 18:38:42 -0700 | [diff] [blame] | 268 | struct votable *fv_votable; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 269 | struct votable *usb_icl_votable; |
| 270 | struct votable *dc_icl_votable; |
Abhijeet Dharmapurikar | 4b13c6e | 2016-10-05 15:15:10 -0700 | [diff] [blame] | 271 | struct votable *pd_disallowed_votable_indirect; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 272 | struct votable *pd_allowed_votable; |
Harry Yang | 1d1034c | 2016-06-15 12:09:42 -0700 | [diff] [blame] | 273 | struct votable *awake_votable; |
| 274 | struct votable *pl_disable_votable; |
Abhijeet Dharmapurikar | ee54de0 | 2016-07-08 14:51:47 -0700 | [diff] [blame] | 275 | struct votable *chg_disable_votable; |
Harry Yang | aba1f5f | 2016-09-28 10:47:29 -0700 | [diff] [blame] | 276 | struct votable *pl_enable_votable_indirect; |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 277 | struct votable *hvdcp_disable_votable_indirect; |
| 278 | struct votable *hvdcp_enable_votable; |
Abhijeet Dharmapurikar | f8a7a4a | 2016-10-07 18:46:45 -0700 | [diff] [blame] | 279 | struct votable *apsd_disable_votable; |
Ashay Jaiswal | 6d308da | 2017-02-18 09:59:23 +0530 | [diff] [blame] | 280 | struct votable *hvdcp_hw_inov_dis_votable; |
Harry Yang | 4bf7d96 | 2017-03-13 16:51:43 -0700 | [diff] [blame] | 281 | struct votable *usb_irq_enable_votable; |
Abhijeet Dharmapurikar | 3c93db3 | 2017-04-17 17:36:14 -0700 | [diff] [blame] | 282 | struct votable *typec_irq_disable_votable; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 283 | |
| 284 | /* work */ |
Harry Yang | 5e1a522 | 2016-07-26 15:16:04 -0700 | [diff] [blame] | 285 | struct work_struct bms_update_work; |
Harry Yang | 755a34b | 2016-11-01 01:18:51 -0700 | [diff] [blame] | 286 | struct work_struct rdstd_cc2_detach_work; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 287 | struct delayed_work hvdcp_detect_work; |
| 288 | struct delayed_work ps_change_timeout_work; |
Abhijeet Dharmapurikar | 0e36900 | 2016-09-07 17:25:36 -0700 | [diff] [blame] | 289 | struct delayed_work clear_hdc_work; |
Nicholas Troast | b11015f | 2017-01-17 17:56:45 -0800 | [diff] [blame] | 290 | struct work_struct otg_oc_work; |
| 291 | struct work_struct vconn_oc_work; |
| 292 | struct delayed_work otg_ss_done_work; |
Ashay Jaiswal | 4d82578 | 2017-02-18 10:11:34 +0530 | [diff] [blame] | 293 | struct delayed_work icl_change_work; |
Ashay Jaiswal | c036167 | 2017-03-21 12:24:16 +0530 | [diff] [blame] | 294 | struct delayed_work pl_enable_work; |
Abhijeet Dharmapurikar | 3c93db3 | 2017-04-17 17:36:14 -0700 | [diff] [blame] | 295 | struct work_struct legacy_detection_work; |
Ashay Jaiswal | 1bf4133 | 2017-05-03 15:10:25 +0530 | [diff] [blame] | 296 | struct delayed_work uusb_otg_work; |
Anirudh Ghayal | 36feefe | 2017-05-26 09:41:25 +0530 | [diff] [blame] | 297 | struct delayed_work bb_removal_work; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 298 | |
| 299 | /* cached status */ |
| 300 | int voltage_min_uv; |
| 301 | int voltage_max_uv; |
Abhijeet Dharmapurikar | 76e2af5 | 2016-10-06 17:25:01 -0700 | [diff] [blame] | 302 | int pd_active; |
Abhijeet Dharmapurikar | d92eca6 | 2016-10-07 19:04:33 -0700 | [diff] [blame] | 303 | bool system_suspend_supported; |
Harry Yang | d89ff1f | 2016-12-05 14:59:11 -0800 | [diff] [blame] | 304 | int boost_threshold_ua; |
Abhijeet Dharmapurikar | 99fb894 | 2016-07-08 11:39:23 -0700 | [diff] [blame] | 305 | int system_temp_level; |
| 306 | int thermal_levels; |
| 307 | int *thermal_mitigation; |
Harry Yang | 631b99e | 2016-11-17 11:24:25 -0800 | [diff] [blame] | 308 | int dcp_icl_ua; |
Abhijeet Dharmapurikar | 9e7e48c | 2016-08-23 12:55:49 -0700 | [diff] [blame] | 309 | int fake_capacity; |
Harry Yang | 589dd42 | 2017-07-28 18:41:42 -0700 | [diff] [blame] | 310 | int fake_batt_status; |
Harry Yang | fe91384 | 2016-08-10 12:27:28 -0700 | [diff] [blame] | 311 | bool step_chg_enabled; |
Ashay Jaiswal | 9aba44a | 2017-07-20 17:41:36 +0530 | [diff] [blame] | 312 | bool sw_jeita_enabled; |
Abhijeet Dharmapurikar | 0e36900 | 2016-09-07 17:25:36 -0700 | [diff] [blame] | 313 | bool is_hdc; |
Subbaraman Narayanamurthy | 270a265 | 2016-10-04 17:08:42 -0700 | [diff] [blame] | 314 | bool chg_done; |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 315 | bool micro_usb_mode; |
Nicholas Troast | 8995a70 | 2016-12-05 10:22:22 -0800 | [diff] [blame] | 316 | bool otg_en; |
| 317 | bool vconn_en; |
Ashay Jaiswal | da8669b | 2017-02-10 23:24:23 +0530 | [diff] [blame] | 318 | bool suspend_input_on_debug_batt; |
Nicholas Troast | 8995a70 | 2016-12-05 10:22:22 -0800 | [diff] [blame] | 319 | int otg_attempts; |
| 320 | int vconn_attempts; |
Abhijeet Dharmapurikar | 7442e42 | 2017-02-08 13:35:14 -0800 | [diff] [blame] | 321 | int default_icl_ua; |
Ashay Jaiswal | 7c24138 | 2017-03-06 15:26:38 +0530 | [diff] [blame] | 322 | int otg_cl_ua; |
Ashay Jaiswal | 8507aa5 | 2017-04-14 09:42:32 +0530 | [diff] [blame] | 323 | bool uusb_apsd_rerun_done; |
Abhijeet Dharmapurikar | 0e43281 | 2017-04-17 14:52:46 -0700 | [diff] [blame] | 324 | bool pd_hard_reset; |
Nicholas Troast | 8c28e0f | 2017-03-22 14:44:49 -0700 | [diff] [blame] | 325 | bool typec_present; |
Abhijeet Dharmapurikar | b0403c4 | 2017-04-17 12:26:26 -0700 | [diff] [blame] | 326 | u8 typec_status[5]; |
Abhijeet Dharmapurikar | 3c93db3 | 2017-04-17 17:36:14 -0700 | [diff] [blame] | 327 | bool typec_legacy_valid; |
Abhijeet Dharmapurikar | 2ec2a79 | 2017-05-01 20:00:25 -0700 | [diff] [blame] | 328 | int fake_input_current_limited; |
Abhijeet Dharmapurikar | 255da95 | 2017-05-24 20:52:09 -0700 | [diff] [blame] | 329 | bool pr_swap_in_progress; |
Nicholas Troast | e1932e4 | 2017-04-12 12:38:18 -0700 | [diff] [blame] | 330 | int typec_mode; |
Abhijeet Dharmapurikar | 109802f71 | 2017-07-07 18:30:54 -0700 | [diff] [blame] | 331 | int usb_icl_change_irq_enabled; |
Anirudh Ghayal | 941acaa | 2017-07-19 16:04:44 +0530 | [diff] [blame] | 332 | u32 jeita_status; |
Anirudh Ghayal | 1121f5d | 2017-07-26 20:26:20 +0530 | [diff] [blame] | 333 | u8 float_cfg; |
Harry Yang | f725198 | 2016-09-16 11:14:49 -0700 | [diff] [blame] | 334 | |
| 335 | /* workaround flag */ |
| 336 | u32 wa_flags; |
Abhijeet Dharmapurikar | 0e43281 | 2017-04-17 14:52:46 -0700 | [diff] [blame] | 337 | bool cc2_detach_wa_active; |
Abhijeet Dharmapurikar | 3c93db3 | 2017-04-17 17:36:14 -0700 | [diff] [blame] | 338 | bool typec_en_dis_active; |
Harry Yang | d89ff1f | 2016-12-05 14:59:11 -0800 | [diff] [blame] | 339 | int boost_current_ua; |
Harry Yang | e8e38ce | 2017-03-09 11:22:44 -0800 | [diff] [blame] | 340 | int temp_speed_reading_count; |
Ashay Jaiswal | 4aa2c0c | 2016-12-07 19:39:38 +0530 | [diff] [blame] | 341 | |
| 342 | /* extcon for VBUS / ID notification to USB for uUSB */ |
| 343 | struct extcon_dev *extcon; |
Abhijeet Dharmapurikar | a8bd6f0 | 2017-01-30 15:43:04 -0800 | [diff] [blame] | 344 | |
Abhijeet Dharmapurikar | c31b4ab | 2017-04-27 19:20:31 -0700 | [diff] [blame] | 345 | /* battery profile */ |
| 346 | int batt_profile_fcc_ua; |
| 347 | int batt_profile_fv_uv; |
| 348 | |
Harry Yang | 603e380 | 2017-02-09 17:45:12 -0800 | [diff] [blame] | 349 | /* qnovo */ |
Ashay Jaiswal | 6d308da | 2017-02-18 09:59:23 +0530 | [diff] [blame] | 350 | int usb_icl_delta_ua; |
| 351 | int pulse_cnt; |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 352 | }; |
| 353 | |
| 354 | int smblib_read(struct smb_charger *chg, u16 addr, u8 *val); |
| 355 | int smblib_masked_write(struct smb_charger *chg, u16 addr, u8 mask, u8 val); |
| 356 | int smblib_write(struct smb_charger *chg, u16 addr, u8 val); |
| 357 | |
Nicholas Troast | 4c31049 | 2016-05-12 17:56:35 -0700 | [diff] [blame] | 358 | int smblib_get_charge_param(struct smb_charger *chg, |
| 359 | struct smb_chg_param *param, int *val_u); |
| 360 | int smblib_get_usb_suspend(struct smb_charger *chg, int *suspend); |
| 361 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 362 | int smblib_enable_charging(struct smb_charger *chg, bool enable); |
Nicholas Troast | 4c31049 | 2016-05-12 17:56:35 -0700 | [diff] [blame] | 363 | int smblib_set_charge_param(struct smb_charger *chg, |
| 364 | struct smb_chg_param *param, int val_u); |
| 365 | int smblib_set_usb_suspend(struct smb_charger *chg, bool suspend); |
| 366 | int smblib_set_dc_suspend(struct smb_charger *chg, bool suspend); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 367 | |
Harry Yang | fe91384 | 2016-08-10 12:27:28 -0700 | [diff] [blame] | 368 | int smblib_mapping_soc_from_field_value(struct smb_chg_param *param, |
| 369 | int val_u, u8 *val_raw); |
| 370 | int smblib_mapping_cc_delta_to_field_value(struct smb_chg_param *param, |
| 371 | u8 val_raw); |
| 372 | int smblib_mapping_cc_delta_from_field_value(struct smb_chg_param *param, |
| 373 | int val_u, u8 *val_raw); |
Anirudh Ghayal | 4da3df9 | 2017-01-25 18:55:57 +0530 | [diff] [blame] | 374 | int smblib_set_chg_freq(struct smb_chg_param *param, |
| 375 | int val_u, u8 *val_raw); |
Harry Yang | fe91384 | 2016-08-10 12:27:28 -0700 | [diff] [blame] | 376 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 377 | int smblib_vbus_regulator_enable(struct regulator_dev *rdev); |
| 378 | int smblib_vbus_regulator_disable(struct regulator_dev *rdev); |
| 379 | int smblib_vbus_regulator_is_enabled(struct regulator_dev *rdev); |
| 380 | |
| 381 | int smblib_vconn_regulator_enable(struct regulator_dev *rdev); |
| 382 | int smblib_vconn_regulator_disable(struct regulator_dev *rdev); |
| 383 | int smblib_vconn_regulator_is_enabled(struct regulator_dev *rdev); |
| 384 | |
| 385 | irqreturn_t smblib_handle_debug(int irq, void *data); |
Nicholas Troast | 8995a70 | 2016-12-05 10:22:22 -0800 | [diff] [blame] | 386 | irqreturn_t smblib_handle_otg_overcurrent(int irq, void *data); |
Harry Yang | 6fe72ab | 2016-06-14 16:21:39 -0700 | [diff] [blame] | 387 | irqreturn_t smblib_handle_chg_state_change(int irq, void *data); |
Abhijeet Dharmapurikar | 2644cd6 | 2016-07-20 16:54:55 -0700 | [diff] [blame] | 388 | irqreturn_t smblib_handle_batt_temp_changed(int irq, void *data); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 389 | irqreturn_t smblib_handle_batt_psy_changed(int irq, void *data); |
| 390 | irqreturn_t smblib_handle_usb_psy_changed(int irq, void *data); |
Subbaraman Narayanamurthy | 0932748 | 2017-02-06 16:33:12 -0800 | [diff] [blame] | 391 | irqreturn_t smblib_handle_usbin_uv(int irq, void *data); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 392 | irqreturn_t smblib_handle_usb_plugin(int irq, void *data); |
| 393 | irqreturn_t smblib_handle_usb_source_change(int irq, void *data); |
Harry Yang | 6fe72ab | 2016-06-14 16:21:39 -0700 | [diff] [blame] | 394 | irqreturn_t smblib_handle_icl_change(int irq, void *data); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 395 | irqreturn_t smblib_handle_usb_typec_change(int irq, void *data); |
Abhijeet Dharmapurikar | 2391664 | 2016-10-03 10:38:50 -0700 | [diff] [blame] | 396 | irqreturn_t smblib_handle_dc_plugin(int irq, void *data); |
Abhijeet Dharmapurikar | 0e36900 | 2016-09-07 17:25:36 -0700 | [diff] [blame] | 397 | irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data); |
Nicholas Troast | abedaf7 | 2016-09-16 11:07:45 -0700 | [diff] [blame] | 398 | irqreturn_t smblib_handle_switcher_power_ok(int irq, void *data); |
Nicholas Troast | 15dc0c8 | 2016-10-18 15:15:21 -0700 | [diff] [blame] | 399 | irqreturn_t smblib_handle_wdog_bark(int irq, void *data); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 400 | |
| 401 | int smblib_get_prop_input_suspend(struct smb_charger *chg, |
| 402 | union power_supply_propval *val); |
| 403 | int smblib_get_prop_batt_present(struct smb_charger *chg, |
| 404 | union power_supply_propval *val); |
| 405 | int smblib_get_prop_batt_capacity(struct smb_charger *chg, |
| 406 | union power_supply_propval *val); |
| 407 | int smblib_get_prop_batt_status(struct smb_charger *chg, |
| 408 | union power_supply_propval *val); |
| 409 | int smblib_get_prop_batt_charge_type(struct smb_charger *chg, |
| 410 | union power_supply_propval *val); |
Subbaraman Narayanamurthy | b491d02 | 2016-10-10 20:22:48 -0700 | [diff] [blame] | 411 | int smblib_get_prop_batt_charge_done(struct smb_charger *chg, |
| 412 | union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 413 | int smblib_get_prop_batt_health(struct smb_charger *chg, |
| 414 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | 99fb894 | 2016-07-08 11:39:23 -0700 | [diff] [blame] | 415 | int smblib_get_prop_system_temp_level(struct smb_charger *chg, |
| 416 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | acf3200 | 2017-05-11 11:54:17 -0700 | [diff] [blame] | 417 | int smblib_get_prop_system_temp_level_max(struct smb_charger *chg, |
| 418 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | 0e36900 | 2016-09-07 17:25:36 -0700 | [diff] [blame] | 419 | int smblib_get_prop_input_current_limited(struct smb_charger *chg, |
| 420 | union power_supply_propval *val); |
Nicholas Troast | 66b21d7 | 2016-09-20 15:33:20 -0700 | [diff] [blame] | 421 | int smblib_get_prop_batt_voltage_now(struct smb_charger *chg, |
| 422 | union power_supply_propval *val); |
| 423 | int smblib_get_prop_batt_current_now(struct smb_charger *chg, |
| 424 | union power_supply_propval *val); |
| 425 | int smblib_get_prop_batt_temp(struct smb_charger *chg, |
| 426 | union power_supply_propval *val); |
Nicholas Troast | 4fe68d0 | 2017-07-26 14:17:34 -0700 | [diff] [blame] | 427 | int smblib_get_prop_batt_charge_counter(struct smb_charger *chg, |
| 428 | union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 429 | int smblib_set_prop_input_suspend(struct smb_charger *chg, |
| 430 | const union power_supply_propval *val); |
Abhijeet Dharmapurikar | 9e7e48c | 2016-08-23 12:55:49 -0700 | [diff] [blame] | 431 | int smblib_set_prop_batt_capacity(struct smb_charger *chg, |
| 432 | const union power_supply_propval *val); |
Harry Yang | 589dd42 | 2017-07-28 18:41:42 -0700 | [diff] [blame] | 433 | int smblib_set_prop_batt_status(struct smb_charger *chg, |
| 434 | const union power_supply_propval *val); |
Abhijeet Dharmapurikar | 99fb894 | 2016-07-08 11:39:23 -0700 | [diff] [blame] | 435 | int smblib_set_prop_system_temp_level(struct smb_charger *chg, |
| 436 | const union power_supply_propval *val); |
Abhijeet Dharmapurikar | 2ec2a79 | 2017-05-01 20:00:25 -0700 | [diff] [blame] | 437 | int smblib_set_prop_input_current_limited(struct smb_charger *chg, |
| 438 | const union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 439 | |
Harry Yang | f302359 | 2016-07-20 14:56:41 -0700 | [diff] [blame] | 440 | int smblib_get_prop_dc_present(struct smb_charger *chg, |
| 441 | union power_supply_propval *val); |
| 442 | int smblib_get_prop_dc_online(struct smb_charger *chg, |
| 443 | union power_supply_propval *val); |
| 444 | int smblib_get_prop_dc_current_max(struct smb_charger *chg, |
| 445 | union power_supply_propval *val); |
| 446 | int smblib_set_prop_dc_current_max(struct smb_charger *chg, |
| 447 | const union power_supply_propval *val); |
| 448 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 449 | int smblib_get_prop_usb_present(struct smb_charger *chg, |
| 450 | union power_supply_propval *val); |
| 451 | int smblib_get_prop_usb_online(struct smb_charger *chg, |
| 452 | union power_supply_propval *val); |
| 453 | int smblib_get_prop_usb_suspend(struct smb_charger *chg, |
| 454 | union power_supply_propval *val); |
Nicholas Troast | 7f55c92 | 2017-07-25 13:18:03 -0700 | [diff] [blame] | 455 | int smblib_get_prop_usb_voltage_max(struct smb_charger *chg, |
| 456 | union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 457 | int smblib_get_prop_usb_voltage_now(struct smb_charger *chg, |
| 458 | union power_supply_propval *val); |
Harry Yang | ba874ce | 2016-08-19 14:17:01 -0700 | [diff] [blame] | 459 | int smblib_get_prop_usb_current_now(struct smb_charger *chg, |
| 460 | union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 461 | int smblib_get_prop_typec_cc_orientation(struct smb_charger *chg, |
| 462 | union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 463 | int smblib_get_prop_typec_power_role(struct smb_charger *chg, |
| 464 | union power_supply_propval *val); |
| 465 | int smblib_get_prop_pd_allowed(struct smb_charger *chg, |
| 466 | union power_supply_propval *val); |
Nicholas Troast | 133a7f5 | 2016-06-29 13:48:20 -0700 | [diff] [blame] | 467 | int smblib_get_prop_input_current_settled(struct smb_charger *chg, |
| 468 | union power_supply_propval *val); |
Fenglin Wu | ef4730e | 2017-01-11 18:16:25 +0800 | [diff] [blame] | 469 | int smblib_get_prop_input_voltage_settled(struct smb_charger *chg, |
| 470 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | f8a7a4a | 2016-10-07 18:46:45 -0700 | [diff] [blame] | 471 | int smblib_get_prop_pd_in_hard_reset(struct smb_charger *chg, |
| 472 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | b959887 | 2016-10-17 16:58:58 -0700 | [diff] [blame] | 473 | int smblib_get_pe_start(struct smb_charger *chg, |
| 474 | union power_supply_propval *val); |
Harry Yang | ba874ce | 2016-08-19 14:17:01 -0700 | [diff] [blame] | 475 | int smblib_get_prop_charger_temp(struct smb_charger *chg, |
| 476 | union power_supply_propval *val); |
| 477 | int smblib_get_prop_charger_temp_max(struct smb_charger *chg, |
| 478 | union power_supply_propval *val); |
Nicholas Troast | 7fdbd2e | 2017-02-08 10:47:37 -0800 | [diff] [blame] | 479 | int smblib_get_prop_die_health(struct smb_charger *chg, |
Nicholas Troast | b021dd9 | 2017-01-31 18:43:38 -0800 | [diff] [blame] | 480 | union power_supply_propval *val); |
Harry Yang | 40192cb | 2017-02-25 23:25:17 -0800 | [diff] [blame] | 481 | int smblib_get_prop_charge_qnovo_enable(struct smb_charger *chg, |
| 482 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | d92eca6 | 2016-10-07 19:04:33 -0700 | [diff] [blame] | 483 | int smblib_set_prop_pd_current_max(struct smb_charger *chg, |
| 484 | const union power_supply_propval *val); |
Nicholas Troast | 7f55c92 | 2017-07-25 13:18:03 -0700 | [diff] [blame] | 485 | int smblib_set_prop_sdp_current_max(struct smb_charger *chg, |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 486 | const union power_supply_propval *val); |
Nicholas Troast | 7f55c92 | 2017-07-25 13:18:03 -0700 | [diff] [blame] | 487 | int smblib_set_prop_pd_voltage_max(struct smb_charger *chg, |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 488 | const union power_supply_propval *val); |
Nicholas Troast | 7f55c92 | 2017-07-25 13:18:03 -0700 | [diff] [blame] | 489 | int smblib_set_prop_pd_voltage_min(struct smb_charger *chg, |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 490 | const union power_supply_propval *val); |
Harry Yang | d89ff1f | 2016-12-05 14:59:11 -0800 | [diff] [blame] | 491 | int smblib_set_prop_boost_current(struct smb_charger *chg, |
| 492 | const union power_supply_propval *val); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 493 | int smblib_set_prop_typec_power_role(struct smb_charger *chg, |
| 494 | const union power_supply_propval *val); |
| 495 | int smblib_set_prop_pd_active(struct smb_charger *chg, |
| 496 | const union power_supply_propval *val); |
Abhijeet Dharmapurikar | f8a7a4a | 2016-10-07 18:46:45 -0700 | [diff] [blame] | 497 | int smblib_set_prop_pd_in_hard_reset(struct smb_charger *chg, |
| 498 | const union power_supply_propval *val); |
Nicholas Troast | 7dbcad2 | 2016-10-05 13:30:18 -0700 | [diff] [blame] | 499 | int smblib_get_prop_slave_current_now(struct smb_charger *chg, |
| 500 | union power_supply_propval *val); |
Fenglin Wu | edd7079 | 2016-11-22 13:16:19 +0800 | [diff] [blame] | 501 | int smblib_set_prop_ship_mode(struct smb_charger *chg, |
| 502 | const union power_supply_propval *val); |
Harry Yang | 40192cb | 2017-02-25 23:25:17 -0800 | [diff] [blame] | 503 | int smblib_set_prop_charge_qnovo_enable(struct smb_charger *chg, |
| 504 | const union power_supply_propval *val); |
Ashay Jaiswal | 2fb369d | 2017-01-12 21:38:29 +0530 | [diff] [blame] | 505 | void smblib_suspend_on_debug_battery(struct smb_charger *chg); |
Abhijeet Dharmapurikar | 9dd6129 | 2017-01-25 16:40:08 -0800 | [diff] [blame] | 506 | int smblib_rerun_apsd_if_required(struct smb_charger *chg); |
Abhijeet Dharmapurikar | a8bd6f0 | 2017-01-30 15:43:04 -0800 | [diff] [blame] | 507 | int smblib_get_prop_fcc_delta(struct smb_charger *chg, |
Anirudh Ghayal | 9d0196d | 2017-07-23 23:02:48 +0530 | [diff] [blame] | 508 | union power_supply_propval *val); |
Abhijeet Dharmapurikar | 74021fc | 2017-02-06 18:39:19 -0800 | [diff] [blame] | 509 | int smblib_icl_override(struct smb_charger *chg, bool override); |
Ashay Jaiswal | 6d308da | 2017-02-18 09:59:23 +0530 | [diff] [blame] | 510 | int smblib_dp_dm(struct smb_charger *chg, int val); |
Abhijeet Dharmapurikar | 3a58004 | 2017-07-24 09:43:00 -0700 | [diff] [blame] | 511 | int smblib_disable_hw_jeita(struct smb_charger *chg, bool disable); |
Ashay Jaiswal | 6d308da | 2017-02-18 09:59:23 +0530 | [diff] [blame] | 512 | int smblib_rerun_aicl(struct smb_charger *chg); |
Ashay Jaiswal | ae1586d | 2017-03-22 23:18:51 +0530 | [diff] [blame] | 513 | int smblib_set_icl_current(struct smb_charger *chg, int icl_ua); |
Abhijeet Dharmapurikar | eecf558 | 2017-04-24 13:33:07 -0700 | [diff] [blame] | 514 | int smblib_get_icl_current(struct smb_charger *chg, int *icl_ua); |
Abhijeet Dharmapurikar | f59c835 | 2017-03-23 14:04:05 -0700 | [diff] [blame] | 515 | int smblib_get_charge_current(struct smb_charger *chg, int *total_current_ua); |
Abhijeet Dharmapurikar | 255da95 | 2017-05-24 20:52:09 -0700 | [diff] [blame] | 516 | int smblib_get_prop_pr_swap_in_progress(struct smb_charger *chg, |
| 517 | union power_supply_propval *val); |
| 518 | int smblib_set_prop_pr_swap_in_progress(struct smb_charger *chg, |
| 519 | const union power_supply_propval *val); |
Nicholas Troast | 7dbcad2 | 2016-10-05 13:30:18 -0700 | [diff] [blame] | 520 | |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 521 | int smblib_init(struct smb_charger *chg); |
Abhijeet Dharmapurikar | 8e9e757 | 2016-06-06 16:13:14 -0700 | [diff] [blame] | 522 | int smblib_deinit(struct smb_charger *chg); |
Nicholas Troast | 34db503 | 2016-03-28 12:26:44 -0700 | [diff] [blame] | 523 | #endif /* __SMB2_CHARGER_H */ |