int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_properties, const struct pm8xxx_adc_chan_properties *chan_properties, struct pm8xxx_adc_chan_result *adc_chan_result) { int64_t bat_voltage = 0; struct pm8xxx_adc_map_pt *adc_map = NULL; uint32_t adc_map_array_size; unsigned int phaseid = 0; bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code, adc_properties, chan_properties); ext_bat_voltage = bat_voltage; if (phaseid == 0) phaseid = fih_get_product_phase(); if (phaseid <= PHASE_SP) { adc_map = adcmap_btm_threshold; adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold); } else { adc_map = adcmap_btm_threshold_pre_ap; adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold_pre_ap); } return pm8xxx_adc_map_batt_therm( adc_map, adc_map_array_size, bat_voltage, &adc_chan_result->physical); }
int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_properties, const struct pm8xxx_adc_chan_properties *chan_properties, struct pm8xxx_adc_chan_result *adc_chan_result) { int64_t bat_voltage = 0; bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code, adc_properties, chan_properties); return pm8xxx_adc_map_batt_therm( adcmap_btm_threshold, ARRAY_SIZE(adcmap_btm_threshold), bat_voltage, &adc_chan_result->physical); }
int32_t pm8xxx_adc_scale_sys_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_properties, const struct pm8xxx_adc_chan_properties *chan_properties, struct pm8xxx_adc_chan_result *adc_chan_result) { int64_t sys_voltage = 0; sys_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code, adc_properties, chan_properties); ext_sys_voltage = sys_voltage; //printk(KERN_ERR "temperature ADC sys = %lld\n", sys_voltage); return pm8xxx_adc_map_batt_therm( adcmap_sys_therm, ARRAY_SIZE(adcmap_sys_therm), sys_voltage, &adc_chan_result->physical); }
int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_properties, const struct pm8xxx_adc_chan_properties *chan_properties, struct pm8xxx_adc_chan_result *adc_chan_result) { int64_t bat_voltage = 0; struct pm8xxx_adc_map_pt *adc_map = NULL; uint32_t adc_map_array_size; unsigned int phaseid = 0; bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code, adc_properties, chan_properties); ext_bat_voltage = bat_voltage; if (ext_bat_voltage > 1700) { pr_err("[chg %s %d]ERROR!! Battery removed %lld", __func__, __LINE__, ext_bat_voltage); machine_power_off(); } if (phaseid == 0) phaseid = fih_get_product_phase(); if (phaseid <= PHASE_SP) { adc_map = adcmap_btm_threshold; adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold); } else { adc_map = adcmap_btm_threshold_pre_ap; adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold_pre_ap); } return pm8xxx_adc_map_batt_therm( adc_map, adc_map_array_size, bat_voltage, &adc_chan_result->physical); }
int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_properties, const struct pm8xxx_adc_chan_properties *chan_properties, struct pm8xxx_adc_chan_result *adc_chan_result) { int64_t bat_voltage = 0; bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code, adc_properties, chan_properties); #if defined(ORG_VER) #else adc_chan_result->measurement = bat_voltage; #endif return pm8xxx_adc_map_batt_therm( adcmap_btm_threshold, ARRAY_SIZE(adcmap_btm_threshold), bat_voltage, &adc_chan_result->physical); }