Loading drivers/hwmon/qpnp-adc-common.c +73 −0 Original line number Diff line number Diff line Loading @@ -439,6 +439,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skuc_btm_threshold[] = { {800, 477}, }; static const struct qpnp_vadc_map_pt adcmap_qrd_skue_btm_threshold[] = { {-200, 1385}, {-180, 1353}, {-160, 1320}, {-140, 1287}, {-120, 1253}, {-100, 1218}, {-80, 1184}, {-60, 1149}, {-40, 1115}, {-20, 1080}, {0, 1046}, {20, 1013}, {40, 980}, {60, 948}, {80, 917}, {100, 887}, {120, 858}, {140, 830}, {160, 803}, {180, 777}, {200, 752}, {220, 729}, {240, 706}, {260, 685}, {280, 664}, {300, 645}, {320, 626}, {340, 609}, {360, 593}, {380, 577}, {400, 563}, {420, 549}, {440, 536}, {460, 524}, {480, 512}, {500, 501}, {520, 491}, {540, 481}, {560, 472}, {580, 464}, {600, 456}, {620, 448}, {640, 441}, {660, 435}, {680, 428}, {700, 423}, {720, 417}, {740, 412}, {760, 407}, {780, 402}, {800, 398}, }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = { {1758, -40}, Loading Loading @@ -1069,6 +1123,25 @@ int32_t qpnp_adc_scale_qrd_skuc_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuc_batt_therm); int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, const struct qpnp_vadc_chan_properties *chan_properties, struct qpnp_vadc_result *adc_chan_result) { int64_t bat_voltage = 0; qpnp_adc_scale_with_calib_param(adc_code, adc_properties, chan_properties, &bat_voltage); return qpnp_adc_map_temp_voltage( adcmap_qrd_skue_btm_threshold, ARRAY_SIZE(adcmap_qrd_skue_btm_threshold), bat_voltage, &adc_chan_result->physical); } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skue_batt_therm); int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading drivers/hwmon/qpnp-adc-voltage.c +1 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = { [SCALE_NCP_03WF683_THERM] = {qpnp_adc_scale_therm_ncp03}, [SCALE_QRD_SKUT1_BATT_THERM] = {qpnp_adc_scale_qrd_skut1_batt_therm}, [SCALE_QRD_SKUC_BATT_THERM] = {qpnp_adc_scale_qrd_skuc_batt_therm}, [SCALE_QRD_SKUE_BATT_THERM] = {qpnp_adc_scale_qrd_skue_batt_therm}, [SCALE_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, }; Loading include/linux/qpnp/qpnp-adc.h +26 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ enum qpnp_adc_channel_scaling_param { * btm parameters for SKUT1 * %SCALE_QRD_SKUC_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUC * %SCALE_QRD_SKUE_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUE * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_NONE: Do not use this scaling type. */ Loading @@ -398,6 +400,7 @@ enum qpnp_adc_scale_fn_type { SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_QRD_SKUC_BATT_THERM, SCALE_QRD_SKUE_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_NONE, }; Loading Loading @@ -1494,6 +1497,23 @@ int32_t qpnp_adc_scale_qrd_skuc_batt_therm(struct qpnp_vadc_chip *dev, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt); /** * qpnp_adc_scale_qrd_skue_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. Returns the temperature in decidegC. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, * reference voltage. * @chan_prop: individual channel properties to compensate the i/p scaling, * slope and offset. * @chan_rslt: physical result to be stored. */ int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *dev, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt); /** * qpnp_adc_scale_smb_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1963,6 +1983,12 @@ static inline int32_t qpnp_adc_scale_qrd_skuc_batt_therm( const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_scale_qrd_skue_batt_therm( struct qpnp_vadc_chip *vdev, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading Loading
drivers/hwmon/qpnp-adc-common.c +73 −0 Original line number Diff line number Diff line Loading @@ -439,6 +439,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skuc_btm_threshold[] = { {800, 477}, }; static const struct qpnp_vadc_map_pt adcmap_qrd_skue_btm_threshold[] = { {-200, 1385}, {-180, 1353}, {-160, 1320}, {-140, 1287}, {-120, 1253}, {-100, 1218}, {-80, 1184}, {-60, 1149}, {-40, 1115}, {-20, 1080}, {0, 1046}, {20, 1013}, {40, 980}, {60, 948}, {80, 917}, {100, 887}, {120, 858}, {140, 830}, {160, 803}, {180, 777}, {200, 752}, {220, 729}, {240, 706}, {260, 685}, {280, 664}, {300, 645}, {320, 626}, {340, 609}, {360, 593}, {380, 577}, {400, 563}, {420, 549}, {440, 536}, {460, 524}, {480, 512}, {500, 501}, {520, 491}, {540, 481}, {560, 472}, {580, 464}, {600, 456}, {620, 448}, {640, 441}, {660, 435}, {680, 428}, {700, 423}, {720, 417}, {740, 412}, {760, 407}, {780, 402}, {800, 398}, }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = { {1758, -40}, Loading Loading @@ -1069,6 +1123,25 @@ int32_t qpnp_adc_scale_qrd_skuc_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuc_batt_therm); int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, const struct qpnp_vadc_chan_properties *chan_properties, struct qpnp_vadc_result *adc_chan_result) { int64_t bat_voltage = 0; qpnp_adc_scale_with_calib_param(adc_code, adc_properties, chan_properties, &bat_voltage); return qpnp_adc_map_temp_voltage( adcmap_qrd_skue_btm_threshold, ARRAY_SIZE(adcmap_qrd_skue_btm_threshold), bat_voltage, &adc_chan_result->physical); } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skue_batt_therm); int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading
drivers/hwmon/qpnp-adc-voltage.c +1 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = { [SCALE_NCP_03WF683_THERM] = {qpnp_adc_scale_therm_ncp03}, [SCALE_QRD_SKUT1_BATT_THERM] = {qpnp_adc_scale_qrd_skut1_batt_therm}, [SCALE_QRD_SKUC_BATT_THERM] = {qpnp_adc_scale_qrd_skuc_batt_therm}, [SCALE_QRD_SKUE_BATT_THERM] = {qpnp_adc_scale_qrd_skue_batt_therm}, [SCALE_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, }; Loading
include/linux/qpnp/qpnp-adc.h +26 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ enum qpnp_adc_channel_scaling_param { * btm parameters for SKUT1 * %SCALE_QRD_SKUC_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUC * %SCALE_QRD_SKUE_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUE * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_NONE: Do not use this scaling type. */ Loading @@ -398,6 +400,7 @@ enum qpnp_adc_scale_fn_type { SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_QRD_SKUC_BATT_THERM, SCALE_QRD_SKUE_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_NONE, }; Loading Loading @@ -1494,6 +1497,23 @@ int32_t qpnp_adc_scale_qrd_skuc_batt_therm(struct qpnp_vadc_chip *dev, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt); /** * qpnp_adc_scale_qrd_skue_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. Returns the temperature in decidegC. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, * reference voltage. * @chan_prop: individual channel properties to compensate the i/p scaling, * slope and offset. * @chan_rslt: physical result to be stored. */ int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *dev, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt); /** * qpnp_adc_scale_smb_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1963,6 +1983,12 @@ static inline int32_t qpnp_adc_scale_qrd_skuc_batt_therm( const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_scale_qrd_skue_batt_therm( struct qpnp_vadc_chip *vdev, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading