Lines Matching +full:resistance +full:- +full:temp +full:- +full:table
1 // SPDX-License-Identifier: GPL-2.0
11 #include "qcom-vadc-common.h"
15 {1758, -40},
16 {1742, -35},
17 {1719, -30},
18 {1691, -25},
19 {1654, -20},
20 {1608, -15},
21 {1551, -10},
22 {1483, -5},
52 * Voltage to temperature table for 100k pull up for NTCG104EF104 with
56 { 1831, -40000 },
57 { 1814, -35000 },
58 { 1791, -30000 },
59 { 1761, -25000 },
60 { 1723, -20000 },
61 { 1675, -15000 },
62 { 1616, -10000 },
63 { 1545, -5000 },
108 * Resistance to temperature table for 100k pull up for NTCG104EF104.
111 { 4250657, -40960 },
112 { 3962085, -39936 },
113 { 3694875, -38912 },
114 { 3447322, -37888 },
115 { 3217867, -36864 },
116 { 3005082, -35840 },
117 { 2807660, -34816 },
118 { 2624405, -33792 },
119 { 2454218, -32768 },
120 { 2296094, -31744 },
121 { 2149108, -30720 },
122 { 2012414, -29696 },
123 { 1885232, -28672 },
124 { 1766846, -27648 },
125 { 1656598, -26624 },
126 { 1553884, -25600 },
127 { 1458147, -24576 },
128 { 1368873, -23552 },
129 { 1285590, -22528 },
130 { 1207863, -21504 },
131 { 1135290, -20480 },
132 { 1067501, -19456 },
133 { 1004155, -18432 },
134 { 944935, -17408 },
135 { 889550, -16384 },
136 { 837731, -15360 },
137 { 789229, -14336 },
138 { 743813, -13312 },
139 { 701271, -12288 },
140 { 661405, -11264 },
141 { 624032, -10240 },
142 { 588982, -9216 },
143 { 556100, -8192 },
144 { 525239, -7168 },
145 { 496264, -6144 },
146 { 469050, -5120 },
147 { 443480, -4096 },
148 { 419448, -3072 },
149 { 396851, -2048 },
150 { 375597, -1024 },
330 return -EINVAL; in qcom_vadc_map_voltage_temp()
332 /* Check if table is descending or ascending */ in qcom_vadc_map_voltage_temp()
340 /* table entry is less than measured*/ in qcom_vadc_map_voltage_temp()
341 /* value and table is descending, stop */ in qcom_vadc_map_voltage_temp()
345 /* table entry is greater than measured*/ in qcom_vadc_map_voltage_temp()
346 /*value and table is ascending, stop */ in qcom_vadc_map_voltage_temp()
355 *output = pts[tablesize - 1].y; in qcom_vadc_map_voltage_temp()
357 /* result is between search_index and search_index-1 */ in qcom_vadc_map_voltage_temp()
359 *output = (((s32)((pts[i].y - pts[i - 1].y) * in qcom_vadc_map_voltage_temp()
360 (input - pts[i - 1].x)) / in qcom_vadc_map_voltage_temp()
361 (pts[i].x - pts[i - 1].x)) + in qcom_vadc_map_voltage_temp()
362 pts[i - 1].y); in qcom_vadc_map_voltage_temp()
373 *scale_voltage = (adc_code - calib_graph->gnd); in qcom_vadc_scale_calib()
374 *scale_voltage *= calib_graph->dx; in qcom_vadc_scale_calib()
375 *scale_voltage = div64_s64(*scale_voltage, calib_graph->dy); in qcom_vadc_scale_calib()
377 *scale_voltage += calib_graph->dx; in qcom_vadc_scale_calib()
392 voltage = voltage * prescale->den; in qcom_vadc_scale_volt()
393 result = div64_s64(voltage, prescale->num); in qcom_vadc_scale_volt()
429 u64 temp; /* Temporary variable for do_div */ in qcom_vadc_scale_die_temp() local
434 temp = voltage * prescale->den; in qcom_vadc_scale_die_temp()
435 do_div(temp, prescale->num * 2); in qcom_vadc_scale_die_temp()
436 voltage = temp; in qcom_vadc_scale_die_temp()
455 voltage = voltage * prescale->den; in qcom_vadc_scale_chg_temp()
456 voltage = div64_s64(voltage, prescale->num); in qcom_vadc_scale_chg_temp()
470 s64 voltage, temp, adc_vdd_ref_mv = 1875; in qcom_vadc_scale_code_voltage_factor() local
483 voltage = div64_s64(voltage, data->full_scale_code_volt); in qcom_vadc_scale_code_voltage_factor()
485 voltage *= prescale->den; in qcom_vadc_scale_code_voltage_factor()
486 temp = prescale->num * factor; in qcom_vadc_scale_code_voltage_factor()
487 voltage = div64_s64(voltage, temp); in qcom_vadc_scale_code_voltage_factor()
500 s64 resistance = adc_code; in qcom_vadc7_scale_hw_calib_therm() local
504 return -EINVAL; in qcom_vadc7_scale_hw_calib_therm()
506 /* (ADC code * R_PULLUP (100Kohm)) / (full_scale_code - ADC code)*/ in qcom_vadc7_scale_hw_calib_therm()
507 resistance *= R_PU_100K; in qcom_vadc7_scale_hw_calib_therm()
508 resistance = div64_s64(resistance, RATIO_MAX_ADC7 - adc_code); in qcom_vadc7_scale_hw_calib_therm()
512 resistance, &result); in qcom_vadc7_scale_hw_calib_therm()
542 /* Map voltage to temperature from look-up table */ in qcom_vadc_scale_hw_calib_therm()
566 int voltage, vtemp0, temp, i; in qcom_vadc7_scale_hw_calib_die_temp() local
576 if (adcmap7_die_temp[ARRAY_SIZE(adcmap7_die_temp) - 1].x <= voltage) { in qcom_vadc7_scale_hw_calib_die_temp()
585 vtemp0 = adcmap7_die_temp[i - 1].x; in qcom_vadc7_scale_hw_calib_die_temp()
586 voltage = voltage - vtemp0; in qcom_vadc7_scale_hw_calib_die_temp()
587 temp = div64_s64(voltage * DIE_TEMP_ADC7_SCALE_FACTOR, in qcom_vadc7_scale_hw_calib_die_temp()
588 adcmap7_die_temp[i - 1].y); in qcom_vadc7_scale_hw_calib_die_temp()
589 temp += DIE_TEMP_ADC7_SCALE_1 + (DIE_TEMP_ADC7_SCALE_2 * (i - 1)); in qcom_vadc7_scale_hw_calib_die_temp()
590 *result_mdec = temp; in qcom_vadc7_scale_hw_calib_die_temp()
602 *result_mdec = PMIC5_SMB_TEMP_CONSTANT - *result_mdec; in qcom_vadc_scale_hw_smb_temp()
614 *result_mdec = PMIC5_CHG_TEMP_SCALE_FACTOR - *result_mdec; in qcom_vadc_scale_hw_chg5_temp()
644 return -EINVAL; in qcom_vadc_scale()
657 return -EINVAL; in qcom_adc5_hw_scale()
669 return -EINVAL; in qcom_vadc_decimation_from_dt()