Loading arch/arm64/boot/dts/qcom/pmi632.dtsi +156 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,162 @@ qcom,secondary-pon-reset; }; pmi632_vadc: vadc@3100 { compatible = "qcom,qpnp-vadc-hc"; reg = <0x3100 0x100>; #address-cells = <1>; #size-cells = <0>; interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>; interrupt-names = "eoc-int-en-set"; qcom,adc-vdd-reference = <1875>; qcom,adc-full-scale-code = <0x70e4>; chan@0 { label = "ref_gnd"; reg = <0>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@1 { label = "ref_1250v"; reg = <1>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@83 { label = "vph_pwr"; reg = <0x83>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <1>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@84 { label = "vbat_sns"; reg = <0x84>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <1>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@6 { label = "die_temp"; reg = <6>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <19>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@7 { label = "usb_in_i"; reg = <7>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <21>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@8 { label = "usb_in_v"; reg = <8>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <8>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@9 { label = "chg_temp"; reg = <9>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <18>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4a { label = "bat_therm"; reg = <0x4a>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <17>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4b { label = "bat_id"; reg = <0x4b>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4c { label = "xo_therm"; reg = <0x4c>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <4>; qcom,hw-settle-time = <8>; qcom,fast-avg-setup = <0>; }; chan@1e { label = "mid_chg"; reg = <0x1e>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <3>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; }; pmi632_tz: qcom,temp-alarm@2400 { compatible = "qcom,qpnp-temp-alarm"; reg = <0x2400 0x100>; Loading drivers/hwmon/qpnp-adc-common.c +249 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, 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 @@ -39,9 +39,22 @@ #define PMI_CHG_SCALE_2 391750000000 #define QPNP_VADC_HC_VREF_CODE 0x4000 #define QPNP_VADC_HC_VDD_REFERENCE_MV 1875 #define CHRG_SCALE_1 -250 #define CHRG_SCALE_2 377500000 #define DIE_SCALE_1 500 #define DIE_SCALE_2 -273150000 /* Clamp negative ADC code to 0 */ #define QPNP_VADC_HC_MAX_CODE 0x7FFF /*Invalid current reading*/ #define QPNP_IADC_INV 0x8000 #define IADC_SCALE_1 0xffff #define IADC_SCALE_2 152593 #define USBIN_I_SCALE 25 /* * Units for temperature below (on x axis) is in 0.1DegC as * required by the battery driver. Note the resolution used Loading Loading @@ -590,6 +603,80 @@ static const struct qpnp_vadc_map_pt adcmap_ncp03wf683[] = { {30, 125} }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_batt_therm[] = { {1770, -400}, {1757, -380}, {1743, -360}, {1727, -340}, {1710, -320}, {1691, -300}, {1671, -280}, {1650, -260}, {1627, -240}, {1602, -220}, {1576, -200}, {1548, -180}, {1519, -160}, {1488, -140}, {1456, -120}, {1423, -100}, {1388, -80}, {1353, -60}, {1316, -40}, {1278, -20}, {1240, 0}, {1201, 20}, {1162, 40}, {1122, 60}, {1082, 80}, {1042, 100}, {1003, 120}, {964, 140}, {925, 160}, {887, 180}, {849, 200}, {812, 220}, {777, 240}, {742, 260}, {708, 280}, {675, 300}, {643, 320}, {613, 340}, {583, 360}, {555, 380}, {528, 400}, {502, 420}, {477, 440}, {453, 460}, {430, 480}, {409, 500}, {388, 520}, {369, 540}, {350, 560}, {333, 580}, {316, 600}, {300, 620}, {285, 640}, {271, 660}, {257, 680}, {245, 700}, {233, 720}, {221, 740}, {210, 760}, {200, 780}, {190, 800}, {181, 820}, {173, 840}, {164, 860}, {157, 880}, {149, 900}, {142, 920}, {136, 940}, {129, 960}, {124, 980} }; /* * Voltage to temperature table for 100k pull up for NTCG104EF104 with * 1.875V reference. Loading Loading @@ -899,6 +986,36 @@ int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_tdkntcg_therm); int32_t qpnp_adc_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 batt_thm_voltage = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; if (adc_properties->adc_hc) { /* (code * vref_vadc (1.875V) * 1000) / (scale_code * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; batt_thm_voltage = (int64_t) adc_code; batt_thm_voltage *= (adc_properties->adc_vdd_reference * 1000); batt_thm_voltage = div64_s64(batt_thm_voltage, adc_properties->full_scale_code * 1000); qpnp_adc_map_voltage_temp(adcmap_batt_therm, ARRAY_SIZE(adcmap_batt_therm), batt_thm_voltage, &adc_chan_result->physical); } return 0; } EXPORT_SYMBOL(qpnp_adc_batt_therm); int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading @@ -920,6 +1037,70 @@ int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_batt_therm); int32_t qpnp_adc_scale_chrg_temp(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((CHRG_SCALE_1) * (adc_chan_result->physical)); adc_chan_result->physical = (int64_t) (adc_chan_result->physical + CHRG_SCALE_2); adc_chan_result->physical = (int64_t) adc_chan_result->physical; adc_chan_result->physical = div64_s64(adc_chan_result->physical, 1000000); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_chrg_temp); int32_t qpnp_adc_scale_die_temp(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((DIE_SCALE_1) * (adc_chan_result->physical)); adc_chan_result->physical = (int64_t) (adc_chan_result->physical + DIE_SCALE_2); adc_chan_result->physical = (int64_t) adc_chan_result->physical; adc_chan_result->physical = div64_s64(adc_chan_result->physical, 1000000); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_die_temp); int32_t qpnp_adc_scale_qrd_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading Loading @@ -1279,6 +1460,73 @@ int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, } EXPORT_SYMBOL(qpnp_adc_scale_default); int32_t qpnp_iadc_scale_default(struct qpnp_vadc_chip *vadc, 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 scale_current = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; if (adc_properties->adc_hc) { if (adc_code == QPNP_IADC_INV) return -EINVAL; scale_current = (int64_t) adc_code; if (adc_code > QPNP_IADC_INV) { scale_current = ((~scale_current) & IADC_SCALE_1); scale_current++; scale_current = -scale_current; } } scale_current *= IADC_SCALE_2; scale_current = div64_s64(scale_current, 1000); scale_current *= chan_properties->offset_gain_denominator; scale_current = div64_s64(scale_current, chan_properties->offset_gain_numerator); adc_chan_result->measurement = scale_current; /* * Note: adc_chan_result->measurement is in uA. */ adc_chan_result->physical = adc_chan_result->measurement; return 0; } EXPORT_SYMBOL(qpnp_iadc_scale_default); int qpnp_adc_scale_usbin_curr(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((USBIN_I_SCALE) * adc_chan_result->physical); adc_chan_result->physical = div64_s64(adc_chan_result->physical, 10); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_usbin_curr); int32_t qpnp_adc_usb_scaler(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param, uint32_t *low_threshold, uint32_t *high_threshold) Loading drivers/hwmon/qpnp-adc-voltage.c +5 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,11 @@ 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_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, [SCALE_BATT_THERM_TEMP] = {qpnp_adc_batt_therm}, [SCALE_CHRG_TEMP] = {qpnp_adc_scale_chrg_temp}, [SCALE_DIE_TEMP] = {qpnp_adc_scale_die_temp}, [SCALE_I_DEFAULT] = {qpnp_iadc_scale_default}, [SCALE_USBIN_I] = {qpnp_adc_scale_usbin_curr}, }; static struct qpnp_vadc_rscale_fn adc_vadc_rscale_fn[] = { Loading include/linux/qpnp/qpnp-adc.h +135 −2 Original line number Diff line number Diff line /* * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2018, 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 @@ -338,6 +338,7 @@ enum qpnp_adc_calib_type { * %CHAN_PATH_SCALING5: ratio of {1, 8} * %CHAN_PATH_SCALING6: ratio of {10, 81} The actual ratio is (1/8.1). * %CHAN_PATH_SCALING7: ratio of {1, 10} * %CHAN_PATH_SCALING8: ratio of {1, 16} * %CHAN_PATH_NONE: Do not use this pre-scaling ratio type. * * The pre-scaling is applied for signals to be within the voltage range Loading @@ -352,6 +353,7 @@ enum qpnp_adc_channel_scaling_param { PATH_SCALING5, PATH_SCALING6, PATH_SCALING7, PATH_SCALING8, PATH_SCALING_NONE, }; Loading Loading @@ -380,6 +382,12 @@ enum qpnp_adc_channel_scaling_param { * %SCALE_QRD_SKUT1_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUT1 * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_BATT_THERM_TEMP: Conversion to temperature(decidegC) based on btm * parameters. * %SCALE_CHRG_TEMP: Conversion for charger temp. * %SCALE_DIE_TEMP: Conversion for die temp. * %SCALE_I_DEFAULT: Default scaling to convert raw adc code to current (uA). * %SCALE_USBIN_I: Conversion for USB input current. * %SCALE_NONE: Do not use this scaling type. */ enum qpnp_adc_scale_fn_type { Loading @@ -397,6 +405,11 @@ enum qpnp_adc_scale_fn_type { SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_BATT_THERM_TEMP, SCALE_CHRG_TEMP, SCALE_DIE_TEMP, SCALE_I_DEFAULT, SCALE_USBIN_I, SCALE_NONE, }; Loading Loading @@ -1125,7 +1138,8 @@ static const struct qpnp_vadc_scaling_ratio qpnp_vadc_amux_scaling_ratio[] = { {1, 20}, {1, 8}, {10, 81}, {1, 10} {1, 10}, {1, 16} }; /** Loading Loading @@ -1346,6 +1360,23 @@ int32_t qpnp_adc_scale_default(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_iadc_scale_default() - Scales the pre-calibrated digital output * of current ADC to the ADC reference and compensates for the * gain and offset. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_iadc_scale_default(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_pmic_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1383,6 +1414,23 @@ int32_t qpnp_adc_scale_pmi_chg_temp(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_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_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_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading @@ -1400,6 +1448,61 @@ int32_t qpnp_adc_scale_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_chrg_temp() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. The voltage measured by HKADC is related to * the junction temperature according to * Tj = 377.5 degC - (V_adc / 0.004) * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_chrg_temp(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_die_temp() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. The voltage measured by HKADC is related to * the junction temperature according to * Tj = -273.15 degC + (V_adc / 0.002) * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_die_temp(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_usbin_curr() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_usbin_curr(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_qrd_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1906,6 +2009,12 @@ static inline int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_iadc_scale_default(struct qpnp_vadc_chip *vadc, 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_pmic_therm(struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading @@ -1918,12 +2027,36 @@ static inline int32_t qpnp_adc_scale_pmi_chg_temp(struct qpnp_vadc_chip *vadc, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_batt_therm(struct qpnp_vadc_chip *vadc, 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_batt_therm(struct qpnp_vadc_chip *vadc, 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_chrg_temp(struct qpnp_vadc_chip *vadc, 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_die_temp(struct qpnp_vadc_chip *vadc, 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_usbin_curr(struct qpnp_vadc_chip *vadc, 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_qrd_batt_therm( struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading Loading
arch/arm64/boot/dts/qcom/pmi632.dtsi +156 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,162 @@ qcom,secondary-pon-reset; }; pmi632_vadc: vadc@3100 { compatible = "qcom,qpnp-vadc-hc"; reg = <0x3100 0x100>; #address-cells = <1>; #size-cells = <0>; interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>; interrupt-names = "eoc-int-en-set"; qcom,adc-vdd-reference = <1875>; qcom,adc-full-scale-code = <0x70e4>; chan@0 { label = "ref_gnd"; reg = <0>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@1 { label = "ref_1250v"; reg = <1>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@83 { label = "vph_pwr"; reg = <0x83>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <1>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@84 { label = "vbat_sns"; reg = <0x84>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <1>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@6 { label = "die_temp"; reg = <6>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <19>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@7 { label = "usb_in_i"; reg = <7>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <21>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@8 { label = "usb_in_v"; reg = <8>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <8>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@9 { label = "chg_temp"; reg = <9>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "absolute"; qcom,scale-function = <18>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4a { label = "bat_therm"; reg = <0x4a>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <17>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4b { label = "bat_id"; reg = <0x4b>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; chan@4c { label = "xo_therm"; reg = <0x4c>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <0>; qcom,calibration-type = "ratiometric"; qcom,scale-function = <4>; qcom,hw-settle-time = <8>; qcom,fast-avg-setup = <0>; }; chan@1e { label = "mid_chg"; reg = <0x1e>; qcom,decimation = <2>; qcom,pre-div-channel-scaling = <3>; qcom,calibration-type = "absolute"; qcom,scale-function = <0>; qcom,hw-settle-time = <0>; qcom,fast-avg-setup = <0>; qcom,cal-val = <0>; }; }; pmi632_tz: qcom,temp-alarm@2400 { compatible = "qcom,qpnp-temp-alarm"; reg = <0x2400 0x100>; Loading
drivers/hwmon/qpnp-adc-common.c +249 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, 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 @@ -39,9 +39,22 @@ #define PMI_CHG_SCALE_2 391750000000 #define QPNP_VADC_HC_VREF_CODE 0x4000 #define QPNP_VADC_HC_VDD_REFERENCE_MV 1875 #define CHRG_SCALE_1 -250 #define CHRG_SCALE_2 377500000 #define DIE_SCALE_1 500 #define DIE_SCALE_2 -273150000 /* Clamp negative ADC code to 0 */ #define QPNP_VADC_HC_MAX_CODE 0x7FFF /*Invalid current reading*/ #define QPNP_IADC_INV 0x8000 #define IADC_SCALE_1 0xffff #define IADC_SCALE_2 152593 #define USBIN_I_SCALE 25 /* * Units for temperature below (on x axis) is in 0.1DegC as * required by the battery driver. Note the resolution used Loading Loading @@ -590,6 +603,80 @@ static const struct qpnp_vadc_map_pt adcmap_ncp03wf683[] = { {30, 125} }; /* Voltage to temperature */ static const struct qpnp_vadc_map_pt adcmap_batt_therm[] = { {1770, -400}, {1757, -380}, {1743, -360}, {1727, -340}, {1710, -320}, {1691, -300}, {1671, -280}, {1650, -260}, {1627, -240}, {1602, -220}, {1576, -200}, {1548, -180}, {1519, -160}, {1488, -140}, {1456, -120}, {1423, -100}, {1388, -80}, {1353, -60}, {1316, -40}, {1278, -20}, {1240, 0}, {1201, 20}, {1162, 40}, {1122, 60}, {1082, 80}, {1042, 100}, {1003, 120}, {964, 140}, {925, 160}, {887, 180}, {849, 200}, {812, 220}, {777, 240}, {742, 260}, {708, 280}, {675, 300}, {643, 320}, {613, 340}, {583, 360}, {555, 380}, {528, 400}, {502, 420}, {477, 440}, {453, 460}, {430, 480}, {409, 500}, {388, 520}, {369, 540}, {350, 560}, {333, 580}, {316, 600}, {300, 620}, {285, 640}, {271, 660}, {257, 680}, {245, 700}, {233, 720}, {221, 740}, {210, 760}, {200, 780}, {190, 800}, {181, 820}, {173, 840}, {164, 860}, {157, 880}, {149, 900}, {142, 920}, {136, 940}, {129, 960}, {124, 980} }; /* * Voltage to temperature table for 100k pull up for NTCG104EF104 with * 1.875V reference. Loading Loading @@ -899,6 +986,36 @@ int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_tdkntcg_therm); int32_t qpnp_adc_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 batt_thm_voltage = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; if (adc_properties->adc_hc) { /* (code * vref_vadc (1.875V) * 1000) / (scale_code * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; batt_thm_voltage = (int64_t) adc_code; batt_thm_voltage *= (adc_properties->adc_vdd_reference * 1000); batt_thm_voltage = div64_s64(batt_thm_voltage, adc_properties->full_scale_code * 1000); qpnp_adc_map_voltage_temp(adcmap_batt_therm, ARRAY_SIZE(adcmap_batt_therm), batt_thm_voltage, &adc_chan_result->physical); } return 0; } EXPORT_SYMBOL(qpnp_adc_batt_therm); int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading @@ -920,6 +1037,70 @@ int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *chip, } EXPORT_SYMBOL(qpnp_adc_scale_batt_therm); int32_t qpnp_adc_scale_chrg_temp(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((CHRG_SCALE_1) * (adc_chan_result->physical)); adc_chan_result->physical = (int64_t) (adc_chan_result->physical + CHRG_SCALE_2); adc_chan_result->physical = (int64_t) adc_chan_result->physical; adc_chan_result->physical = div64_s64(adc_chan_result->physical, 1000000); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_chrg_temp); int32_t qpnp_adc_scale_die_temp(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((DIE_SCALE_1) * (adc_chan_result->physical)); adc_chan_result->physical = (int64_t) (adc_chan_result->physical + DIE_SCALE_2); adc_chan_result->physical = (int64_t) adc_chan_result->physical; adc_chan_result->physical = div64_s64(adc_chan_result->physical, 1000000); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_die_temp); int32_t qpnp_adc_scale_qrd_batt_therm(struct qpnp_vadc_chip *chip, int32_t adc_code, const struct qpnp_adc_properties *adc_properties, Loading Loading @@ -1279,6 +1460,73 @@ int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, } EXPORT_SYMBOL(qpnp_adc_scale_default); int32_t qpnp_iadc_scale_default(struct qpnp_vadc_chip *vadc, 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 scale_current = 0; if (!chan_properties || !chan_properties->offset_gain_numerator || !chan_properties->offset_gain_denominator || !adc_properties || !adc_chan_result) return -EINVAL; if (adc_properties->adc_hc) { if (adc_code == QPNP_IADC_INV) return -EINVAL; scale_current = (int64_t) adc_code; if (adc_code > QPNP_IADC_INV) { scale_current = ((~scale_current) & IADC_SCALE_1); scale_current++; scale_current = -scale_current; } } scale_current *= IADC_SCALE_2; scale_current = div64_s64(scale_current, 1000); scale_current *= chan_properties->offset_gain_denominator; scale_current = div64_s64(scale_current, chan_properties->offset_gain_numerator); adc_chan_result->measurement = scale_current; /* * Note: adc_chan_result->measurement is in uA. */ adc_chan_result->physical = adc_chan_result->measurement; return 0; } EXPORT_SYMBOL(qpnp_iadc_scale_default); int qpnp_adc_scale_usbin_curr(struct qpnp_vadc_chip *vadc, 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) { int rc = 0; rc = qpnp_adc_scale_default(vadc, adc_code, adc_properties, chan_properties, adc_chan_result); if (rc < 0) return rc; pr_debug("raw_code:%x, v_adc:%lld\n", adc_code, adc_chan_result->physical); adc_chan_result->physical = (int64_t) ((USBIN_I_SCALE) * adc_chan_result->physical); adc_chan_result->physical = div64_s64(adc_chan_result->physical, 10); return 0; } EXPORT_SYMBOL(qpnp_adc_scale_usbin_curr); int32_t qpnp_adc_usb_scaler(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param, uint32_t *low_threshold, uint32_t *high_threshold) Loading
drivers/hwmon/qpnp-adc-voltage.c +5 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,11 @@ 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_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp}, [SCALE_BATT_THERM_TEMP] = {qpnp_adc_batt_therm}, [SCALE_CHRG_TEMP] = {qpnp_adc_scale_chrg_temp}, [SCALE_DIE_TEMP] = {qpnp_adc_scale_die_temp}, [SCALE_I_DEFAULT] = {qpnp_iadc_scale_default}, [SCALE_USBIN_I] = {qpnp_adc_scale_usbin_curr}, }; static struct qpnp_vadc_rscale_fn adc_vadc_rscale_fn[] = { Loading
include/linux/qpnp/qpnp-adc.h +135 −2 Original line number Diff line number Diff line /* * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2018, 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 @@ -338,6 +338,7 @@ enum qpnp_adc_calib_type { * %CHAN_PATH_SCALING5: ratio of {1, 8} * %CHAN_PATH_SCALING6: ratio of {10, 81} The actual ratio is (1/8.1). * %CHAN_PATH_SCALING7: ratio of {1, 10} * %CHAN_PATH_SCALING8: ratio of {1, 16} * %CHAN_PATH_NONE: Do not use this pre-scaling ratio type. * * The pre-scaling is applied for signals to be within the voltage range Loading @@ -352,6 +353,7 @@ enum qpnp_adc_channel_scaling_param { PATH_SCALING5, PATH_SCALING6, PATH_SCALING7, PATH_SCALING8, PATH_SCALING_NONE, }; Loading Loading @@ -380,6 +382,12 @@ enum qpnp_adc_channel_scaling_param { * %SCALE_QRD_SKUT1_BATT_THERM: Conversion to temperature(decidegC) based on * btm parameters for SKUT1 * %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp * %SCALE_BATT_THERM_TEMP: Conversion to temperature(decidegC) based on btm * parameters. * %SCALE_CHRG_TEMP: Conversion for charger temp. * %SCALE_DIE_TEMP: Conversion for die temp. * %SCALE_I_DEFAULT: Default scaling to convert raw adc code to current (uA). * %SCALE_USBIN_I: Conversion for USB input current. * %SCALE_NONE: Do not use this scaling type. */ enum qpnp_adc_scale_fn_type { Loading @@ -397,6 +405,11 @@ enum qpnp_adc_scale_fn_type { SCALE_NCP_03WF683_THERM, SCALE_QRD_SKUT1_BATT_THERM, SCALE_PMI_CHG_TEMP = 16, SCALE_BATT_THERM_TEMP, SCALE_CHRG_TEMP, SCALE_DIE_TEMP, SCALE_I_DEFAULT, SCALE_USBIN_I, SCALE_NONE, }; Loading Loading @@ -1125,7 +1138,8 @@ static const struct qpnp_vadc_scaling_ratio qpnp_vadc_amux_scaling_ratio[] = { {1, 20}, {1, 8}, {10, 81}, {1, 10} {1, 10}, {1, 16} }; /** Loading Loading @@ -1346,6 +1360,23 @@ int32_t qpnp_adc_scale_default(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_iadc_scale_default() - Scales the pre-calibrated digital output * of current ADC to the ADC reference and compensates for the * gain and offset. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_iadc_scale_default(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_pmic_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1383,6 +1414,23 @@ int32_t qpnp_adc_scale_pmi_chg_temp(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_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_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_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading @@ -1400,6 +1448,61 @@ int32_t qpnp_adc_scale_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_chrg_temp() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. The voltage measured by HKADC is related to * the junction temperature according to * Tj = 377.5 degC - (V_adc / 0.004) * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_chrg_temp(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_die_temp() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. The voltage measured by HKADC is related to * the junction temperature according to * Tj = -273.15 degC + (V_adc / 0.002) * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_die_temp(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_usbin_curr() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the * gain and offset. * @dev: Structure device for qpnp vadc * @adc_code: pre-calibrated digital output of the ADC. * @adc_prop: adc properties of the qpnp 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_usbin_curr(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_qrd_batt_therm() - Scales the pre-calibrated digital output * of an ADC to the ADC reference and compensates for the Loading Loading @@ -1906,6 +2009,12 @@ static inline int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_iadc_scale_default(struct qpnp_vadc_chip *vadc, 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_pmic_therm(struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading @@ -1918,12 +2027,36 @@ static inline int32_t qpnp_adc_scale_pmi_chg_temp(struct qpnp_vadc_chip *vadc, const struct qpnp_vadc_chan_properties *chan_prop, struct qpnp_vadc_result *chan_rslt) { return -ENXIO; } static inline int32_t qpnp_adc_batt_therm(struct qpnp_vadc_chip *vadc, 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_batt_therm(struct qpnp_vadc_chip *vadc, 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_chrg_temp(struct qpnp_vadc_chip *vadc, 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_die_temp(struct qpnp_vadc_chip *vadc, 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_usbin_curr(struct qpnp_vadc_chip *vadc, 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_qrd_batt_therm( struct qpnp_vadc_chip *vadc, int32_t adc_code, const struct qpnp_adc_properties *adc_prop, Loading