Channagoud Kadabi | 9dc19c8 | 2015-04-23 14:20:55 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015, The Linux Foundation. All rights reserved. |
| 2 | |
| 3 | Redistribution and use in source and binary forms, with or without |
| 4 | modification, are permitted provided that the following conditions are |
| 5 | met: |
| 6 | * Redistributions of source code must retain the above copyright |
| 7 | notice, this list of conditions and the following disclaimer. |
| 8 | * Redistributions in binary form must reproduce the above |
| 9 | copyright notice, this list of conditions and the following |
| 10 | disclaimer in the documentation and/or other materials provided |
| 11 | with the distribution. |
| 12 | * Neither the name of The Linux Foundation nor the names of its |
| 13 | contributors may be used to endorse or promote products derived |
| 14 | from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef PM_APP_SMBCHG__H |
| 30 | #define PM_APP_SMBCHG__H |
| 31 | |
| 32 | /*=========================================================================== |
| 33 | |
| 34 | INCLUDE FILES |
| 35 | |
| 36 | ===========================================================================*/ |
| 37 | |
| 38 | #include "pm_err_flags.h" |
| 39 | #include "pm_smbchg_bat_if.h" |
| 40 | #include "pm_smbchg_misc.h" |
| 41 | #include "pm_smbchg_usb_chgpth.h" |
| 42 | #include "pm_resources_and_types.h" |
| 43 | |
| 44 | /*=========================================================================== |
| 45 | |
| 46 | GLOBAL DEFINES |
| 47 | |
| 48 | ===========================================================================*/ |
| 49 | |
| 50 | |
| 51 | |
| 52 | /*=========================================================================== |
| 53 | |
| 54 | GLOBAL TYPE DEFINITIONS |
| 55 | |
| 56 | ===========================================================================*/ |
| 57 | typedef struct |
| 58 | { |
| 59 | pm_smbchg_bat_if_low_bat_thresh_type vlowbatt_threshold; |
| 60 | pm_smbchg_param_config_enable_type enable_config; |
| 61 | } pm_smbchg_vlowbatt_threshold_data_type; |
| 62 | |
| 63 | typedef struct |
| 64 | { |
| 65 | pm_smbchg_chgpth_input_priority_type chgpth_input_priority; //0=DCIN; 1=USBIN |
| 66 | pm_smbchg_param_config_enable_type enable_config; |
| 67 | } pm_smbchg_chgpth_input_priority_data_type; |
| 68 | |
| 69 | |
| 70 | typedef struct |
| 71 | { |
| 72 | pm_smbchg_bat_miss_detect_src_type bat_missing_detection_src; |
| 73 | pm_smbchg_param_config_enable_type enable_config; |
| 74 | } pm_smbchg_bat_miss_detect_src_data_type ; |
| 75 | |
| 76 | |
| 77 | typedef struct |
| 78 | { |
| 79 | pm_smbchg_wdog_timeout_type wdog_timeout; |
| 80 | pm_smbchg_param_config_enable_type enable_config; |
| 81 | } pm_smbchg_wdog_timeout_data_type; |
| 82 | |
| 83 | |
| 84 | typedef struct |
| 85 | { |
| 86 | boolean enable_wdog; |
| 87 | pm_smbchg_param_config_enable_type enable_config; |
| 88 | } pm_smbchg_enable_wdog_data_type; |
| 89 | |
| 90 | |
| 91 | typedef struct |
| 92 | { |
| 93 | uint32 fast_chg_i_ma; //Valid values are 300 to 3000 mAmp |
| 94 | pm_smbchg_param_config_enable_type enable_config; |
| 95 | } pm_smbchg_fast_chg_current_data_type; |
| 96 | |
| 97 | |
| 98 | typedef struct |
| 99 | { |
| 100 | uint32 pre_chg_i_ma; //Valid values are 100 to 550 mAmp |
| 101 | pm_smbchg_param_config_enable_type enable_config; |
| 102 | } pm_smbchg_pre_chg_current_data_type; |
| 103 | |
| 104 | |
| 105 | typedef struct |
| 106 | { |
| 107 | uint32 pre_to_fast_chg_theshold_mv; //Valid range is 2400mV to 3000mV |
| 108 | pm_smbchg_param_config_enable_type enable_config; |
| 109 | } pm_smbchg_pre_to_fast_chg_threshold_data_type; |
| 110 | |
| 111 | |
| 112 | typedef struct |
| 113 | { |
| 114 | uint32 float_volt_theshold_mv; //Valid range is 3600mV to 4500 mv |
| 115 | pm_smbchg_param_config_enable_type enable_config; |
| 116 | } pm_smbchg_float_voltage_threshold_data_type; |
| 117 | |
| 118 | typedef struct |
| 119 | { |
| 120 | uint32 usbin_input_current_limit; //Valid value is 300 to 3000mAmp |
| 121 | pm_smbchg_param_config_enable_type enable_config; |
| 122 | } pm_smbchg_usbin_input_current_limit_data_type; |
| 123 | |
| 124 | |
| 125 | typedef struct |
| 126 | { |
| 127 | uint32 dcin_input_current_limit; //valid range is 300 to 2000 mAmp |
| 128 | pm_smbchg_param_config_enable_type enable_config; |
| 129 | } pm_smbchg_dcin_input_current_limit_data_type; |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | typedef struct |
| 135 | { |
| 136 | pm_smbchg_vlowbatt_threshold_data_type dbc_bootup_volt_threshold; |
| 137 | pm_smbchg_chgpth_input_priority_data_type chgpth_input_priority; |
| 138 | pm_smbchg_bat_miss_detect_src_data_type bat_miss_detect_src; |
| 139 | pm_smbchg_wdog_timeout_data_type wdog_timeout; |
| 140 | pm_smbchg_enable_wdog_data_type enable_wdog; |
| 141 | pm_smbchg_fast_chg_current_data_type fast_chg_i; |
| 142 | pm_smbchg_pre_chg_current_data_type pre_chg_i; |
| 143 | pm_smbchg_pre_to_fast_chg_threshold_data_type pre_to_fast_chg_theshold_mv; |
| 144 | pm_smbchg_float_voltage_threshold_data_type float_volt_theshold_mv; |
| 145 | pm_smbchg_usbin_input_current_limit_data_type usbin_input_current_limit; |
| 146 | pm_smbchg_dcin_input_current_limit_data_type dcin_input_current_limit; |
| 147 | uint32 bootup_battery_theshold_mv; |
| 148 | uint32 wipwr_bootup_battery_theshold_mv; |
| 149 | boolean enable_jeita_hard_limit_check; |
| 150 | } pm_smbchg_specific_data_type; |
| 151 | |
| 152 | |
| 153 | |
| 154 | /*=========================================================================== |
| 155 | |
| 156 | PROTOTYPES |
| 157 | |
| 158 | ===========================================================================*/ |
| 159 | /** |
| 160 | * @name |
| 161 | * pm_sbl_chg_config_vbat_low_threshold |
| 162 | * |
| 163 | * @description |
| 164 | * This function configures battery charge status |
| 165 | * |
| 166 | * @param |
| 167 | * None |
| 168 | * |
| 169 | * @return |
| 170 | * pm_err_flag_type |
| 171 | * |
| 172 | * @dependency |
| 173 | * The following function must have been called: |
| 174 | * pm_target_information_init() |
| 175 | */ |
Channagoud Kadabi | 4ab0b17 | 2015-07-13 20:12:26 -0700 | [diff] [blame] | 176 | pm_err_flag_type pm_appsbl_chg_config_vbat_low_threshold(uint32 device_index, pm_smbchg_specific_data_type *chg_param_ptr); |
Channagoud Kadabi | 9dc19c8 | 2015-04-23 14:20:55 -0700 | [diff] [blame] | 177 | |
| 178 | |
| 179 | |
| 180 | /** |
| 181 | * @name |
| 182 | * pm_sbl_chg_check_weak_battery_status |
| 183 | * |
| 184 | * @description |
| 185 | * This function checks the battery charge status |
| 186 | * |
| 187 | * @param |
| 188 | * None |
| 189 | * |
| 190 | * @return |
| 191 | * pm_err_flag_type |
| 192 | * |
| 193 | * @dependency |
| 194 | * The following function must have been called: |
| 195 | * pm_driver_init() |
| 196 | */ |
Channagoud Kadabi | 4ab0b17 | 2015-07-13 20:12:26 -0700 | [diff] [blame] | 197 | pm_err_flag_type pm_appsbl_chg_check_weak_battery_status(uint32 device_index); |
Channagoud Kadabi | 9dc19c8 | 2015-04-23 14:20:55 -0700 | [diff] [blame] | 198 | |
Channagoud Kadabi | 4ab0b17 | 2015-07-13 20:12:26 -0700 | [diff] [blame] | 199 | void *pm_target_information_get_specific_info(); |
| 200 | void *pm_target_chg_range_data(); |
| 201 | bool pm_appsbl_display_init_done(); |
| 202 | bool pm_appsbl_charging_in_progress(); |
| 203 | pm_err_flag_type pm_appsbl_set_dcin_suspend(); |
Channagoud Kadabi | 9dc19c8 | 2015-04-23 14:20:55 -0700 | [diff] [blame] | 204 | #endif //PM_APP_SMBCHG__H |
| 205 | |