Loading drivers/hwmon/qpnp-adc-common.c +74 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -385,6 +385,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skut1_btm_threshold[] = { {1000, 477}, }; static const struct qpnp_vadc_map_pt adcmap_qrd_skuc_btm_threshold[] = { {-200, 1539}, {-180, 1515}, {-160, 1491}, {-140, 1465}, {-120, 1438}, {-100, 1410}, {-80, 1381}, {-60, 1352}, {-40, 1322}, {-20, 1291}, {0, 1260}, {20, 1229}, {40, 1197}, {60, 1166}, {80, 1134}, {100, 1103}, {120, 1072}, {140, 1042}, {160, 1012}, {180, 982}, {200, 954}, {220, 926}, {240, 899}, {260, 873}, {280, 847}, {300, 823}, {320, 800}, {340, 777}, {360, 756}, {380, 735}, {400, 715}, {420, 696}, {440, 679}, {460, 662}, {480, 645}, {500, 630}, {520, 615}, {540, 602}, {560, 588}, {580, 576}, {600, 564}, {620, 553}, {640, 543}, {660, 533}, {680, 523}, {700, 515}, {720, 506}, {740, 498}, {760, 491}, {780, 484}, {800, 477}, }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = { {1758, -40}, Loading Loading @@ -996,6 +1050,25 @@ int32_t qpnp_adc_scale_qrd_skut1_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skut1_batt_therm); int32_t qpnp_adc_scale_qrd_skuc_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_skuc_btm_threshold, ARRAY_SIZE(adcmap_qrd_skuc_btm_threshold), bat_voltage, &adc_chan_result->physical); } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuc_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 +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -219,6 +219,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = { [SCALE_QRD_SKUH_BATT_THERM] = {qpnp_adc_scale_qrd_skuh_batt_therm}, [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_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, }; Loading include/linux/qpnp/qpnp-adc.h +27 −1 Original line number Diff line number Diff line /* * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -378,6 +378,8 @@ enum qpnp_adc_channel_scaling_param { * btm parameters for SKUH * %SCALE_QRD_SKUT1_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUT1 * %SCALE_QRD_SKUC_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUC * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_NONE: Do not use this scaling type. */ Loading @@ -395,6 +397,7 @@ enum qpnp_adc_scale_fn_type { SCALE_QRD_SKUH_BATT_THERM, SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_QRD_SKUC_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_NONE, }; Loading Loading @@ -1474,6 +1477,23 @@ int32_t qpnp_adc_scale_qrd_skut1_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_skuc_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_skuc_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 @@ -1937,6 +1957,12 @@ static inline int32_t qpnp_adc_scale_qrd_skut1_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_skuc_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 +74 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -385,6 +385,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skut1_btm_threshold[] = { {1000, 477}, }; static const struct qpnp_vadc_map_pt adcmap_qrd_skuc_btm_threshold[] = { {-200, 1539}, {-180, 1515}, {-160, 1491}, {-140, 1465}, {-120, 1438}, {-100, 1410}, {-80, 1381}, {-60, 1352}, {-40, 1322}, {-20, 1291}, {0, 1260}, {20, 1229}, {40, 1197}, {60, 1166}, {80, 1134}, {100, 1103}, {120, 1072}, {140, 1042}, {160, 1012}, {180, 982}, {200, 954}, {220, 926}, {240, 899}, {260, 873}, {280, 847}, {300, 823}, {320, 800}, {340, 777}, {360, 756}, {380, 735}, {400, 715}, {420, 696}, {440, 679}, {460, 662}, {480, 645}, {500, 630}, {520, 615}, {540, 602}, {560, 588}, {580, 576}, {600, 564}, {620, 553}, {640, 543}, {660, 533}, {680, 523}, {700, 515}, {720, 506}, {740, 498}, {760, 491}, {780, 484}, {800, 477}, }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = { {1758, -40}, Loading Loading @@ -996,6 +1050,25 @@ int32_t qpnp_adc_scale_qrd_skut1_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skut1_batt_therm); int32_t qpnp_adc_scale_qrd_skuc_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_skuc_btm_threshold, ARRAY_SIZE(adcmap_qrd_skuc_btm_threshold), bat_voltage, &adc_chan_result->physical); } EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuc_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 +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -219,6 +219,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = { [SCALE_QRD_SKUH_BATT_THERM] = {qpnp_adc_scale_qrd_skuh_batt_therm}, [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_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, }; Loading
include/linux/qpnp/qpnp-adc.h +27 −1 Original line number Diff line number Diff line /* * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -378,6 +378,8 @@ enum qpnp_adc_channel_scaling_param { * btm parameters for SKUH * %SCALE_QRD_SKUT1_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUT1 * %SCALE_QRD_SKUC_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUC * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_NONE: Do not use this scaling type. */ Loading @@ -395,6 +397,7 @@ enum qpnp_adc_scale_fn_type { SCALE_QRD_SKUH_BATT_THERM, SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_QRD_SKUC_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_NONE, }; Loading Loading @@ -1474,6 +1477,23 @@ int32_t qpnp_adc_scale_qrd_skut1_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_skuc_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_skuc_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 @@ -1937,6 +1957,12 @@ static inline int32_t qpnp_adc_scale_qrd_skut1_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_skuc_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