Lines Matching +full:resistance +full:- +full:temp +full:- +full:table

1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/fixp-arith.h>
6 #include <linux/iio/adc/qcom-vadc-common.h>
14 * struct vadc_map_pt - Map the graph representation for ADC channel
17 * resistance.
26 {1758, -40000 },
27 {1742, -35000 },
28 {1719, -30000 },
29 {1691, -25000 },
30 {1654, -20000 },
31 {1608, -15000 },
32 {1551, -10000 },
33 {1483, -5000 },
63 * Voltage to temperature table for 100k pull up for NTCG104EF104 with
67 { 1831, -40000 },
68 { 1814, -35000 },
69 { 1791, -30000 },
70 { 1761, -25000 },
71 { 1723, -20000 },
72 { 1675, -15000 },
73 { 1616, -10000 },
74 { 1545, -5000 },
113 { 512400, -20000 },
114 { 473100, -40000 },
115 { 433700, -60000 },
119 * Resistance to temperature table for 100k pull up for NTCG104EF104.
122 { 4250657, -40960 },
123 { 3962085, -39936 },
124 { 3694875, -38912 },
125 { 3447322, -37888 },
126 { 3217867, -36864 },
127 { 3005082, -35840 },
128 { 2807660, -34816 },
129 { 2624405, -33792 },
130 { 2454218, -32768 },
131 { 2296094, -31744 },
132 { 2149108, -30720 },
133 { 2012414, -29696 },
134 { 1885232, -28672 },
135 { 1766846, -27648 },
136 { 1656598, -26624 },
137 { 1553884, -25600 },
138 { 1458147, -24576 },
139 { 1368873, -23552 },
140 { 1285590, -22528 },
141 { 1207863, -21504 },
142 { 1135290, -20480 },
143 { 1067501, -19456 },
144 { 1004155, -18432 },
145 { 944935, -17408 },
146 { 889550, -16384 },
147 { 837731, -15360 },
148 { 789229, -14336 },
149 { 743813, -13312 },
150 { 701271, -12288 },
151 { 661405, -11264 },
152 { 624032, -10240 },
153 { 588982, -9216 },
154 { 556100, -8192 },
155 { 525239, -7168 },
156 { 496264, -6144 },
157 { 469050, -5120 },
158 { 443480, -4096 },
159 { 419448, -3072 },
160 { 396851, -2048 },
161 { 375597, -1024 },
352 return -EINVAL; in qcom_vadc_map_voltage_temp()
360 *output = pts[tablesize - 1].y; in qcom_vadc_map_voltage_temp()
363 *output = fixp_linear_interpolate(pts[i - 1].x, pts[i - 1].y, in qcom_vadc_map_voltage_temp()
377 * Table must be sorted, find the interval of 'y' which contains value in qcom_vadc_map_temp_voltage()
386 return pts[tablesize - 1].x; in qcom_vadc_map_temp_voltage()
389 return fixp_linear_interpolate(pts[i - 1].y, pts[i - 1].x, in qcom_vadc_map_temp_voltage()
398 *scale_voltage = (adc_code - calib_graph->gnd); in qcom_vadc_scale_calib()
399 *scale_voltage *= calib_graph->dx; in qcom_vadc_scale_calib()
400 *scale_voltage = div64_s64(*scale_voltage, calib_graph->dy); in qcom_vadc_scale_calib()
402 *scale_voltage += calib_graph->dx; in qcom_vadc_scale_calib()
417 voltage *= prescale->denominator; in qcom_vadc_scale_volt()
418 result = div64_s64(voltage, prescale->numerator); in qcom_vadc_scale_volt()
452 u64 temp; /* Temporary variable for do_div */ in qcom_vadc_scale_die_temp() local
457 temp = voltage * prescale->denominator; in qcom_vadc_scale_die_temp()
458 do_div(temp, prescale->numerator * 2); in qcom_vadc_scale_die_temp()
459 voltage = temp; in qcom_vadc_scale_die_temp()
478 voltage *= prescale->denominator; in qcom_vadc_scale_chg_temp()
479 voltage = div64_s64(voltage, prescale->numerator); in qcom_vadc_scale_chg_temp()
497 volt *= prescale->numerator * factor * full_scale_code_volt; in qcom_vadc_scale_voltage_code()
498 volt = div64_s64(volt, (s64)prescale->denominator * adc_vdd_ref_mv * 1000); in qcom_vadc_scale_voltage_code()
508 s64 voltage, temp, adc_vdd_ref_mv = 1875; in qcom_vadc_scale_code_voltage_factor() local
521 voltage = div64_s64(voltage, data->full_scale_code_volt); in qcom_vadc_scale_code_voltage_factor()
523 voltage *= prescale->denominator; in qcom_vadc_scale_code_voltage_factor()
524 temp = prescale->numerator * factor; in qcom_vadc_scale_code_voltage_factor()
525 voltage = div64_s64(voltage, temp); in qcom_vadc_scale_code_voltage_factor()
538 s64 resistance = adc_code; in qcom_vadc7_scale_hw_calib_therm() local
542 return -EINVAL; in qcom_vadc7_scale_hw_calib_therm()
544 /* (ADC code * R_PULLUP (100Kohm)) / (full_scale_code - ADC code)*/ in qcom_vadc7_scale_hw_calib_therm()
545 resistance *= R_PU_100K; in qcom_vadc7_scale_hw_calib_therm()
546 resistance = div64_s64(resistance, RATIO_MAX_ADC7 - adc_code); in qcom_vadc7_scale_hw_calib_therm()
550 resistance, &result); in qcom_vadc7_scale_hw_calib_therm()
580 /* Map voltage to temperature from look-up table */ in qcom_vadc_scale_hw_calib_therm()
620 *result_mdec = PMIC5_SMB_TEMP_CONSTANT - *result_mdec; in qcom_vadc_scale_hw_smb_temp()
632 *result_mdec = PMIC5_CHG_TEMP_SCALE_FACTOR - *result_mdec; in qcom_vadc_scale_hw_chg5_temp()
662 return -EINVAL; in qcom_vadc_scale()
668 u32 full_scale_code_volt, int temp) in qcom_adc_tm5_temp_volt_scale() argument
675 temp); in qcom_adc_tm5_temp_volt_scale()
680 u16 qcom_adc_tm5_gen2_temp_res_scale(int temp) in qcom_adc_tm5_gen2_temp_res_scale() argument
682 int64_t resistance; in qcom_adc_tm5_gen2_temp_res_scale() local
684 resistance = qcom_vadc_map_temp_voltage(adcmap7_100k, in qcom_adc_tm5_gen2_temp_res_scale()
685 ARRAY_SIZE(adcmap7_100k), temp); in qcom_adc_tm5_gen2_temp_res_scale()
687 return div64_s64(resistance * RATIO_MAX_ADC7, resistance + R_PU_100K); in qcom_adc_tm5_gen2_temp_res_scale()
701 return -EINVAL; in qcom_adc5_hw_scale()
719 return -EINVAL; in qcom_adc5_prescaling_from_dt()
735 return -EINVAL; in qcom_adc5_hw_settle_time_from_dt()
742 return -EINVAL; in qcom_adc5_avg_samples_from_dt()
757 return -EINVAL; in qcom_adc5_decimation_from_dt()
765 return -EINVAL; in qcom_vadc_decimation_from_dt()