Lines Matching refs:table
104 int (*get_temp)(struct chip_tsadc_table table,
106 void (*set_tshut_temp)(struct chip_tsadc_table table,
111 struct chip_tsadc_table table; member
248 static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table, in rk_tsadcv2_temp_to_code() argument
254 high = table.length - 1; in rk_tsadcv2_temp_to_code()
257 if (temp < table.id[low].temp || temp > table.id[high].temp) in rk_tsadcv2_temp_to_code()
261 if (temp == table.id[mid].temp) in rk_tsadcv2_temp_to_code()
262 return table.id[mid].code; in rk_tsadcv2_temp_to_code()
263 else if (temp < table.id[mid].temp) in rk_tsadcv2_temp_to_code()
273 static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code, in rk_tsadcv2_code_to_temp() argument
277 unsigned int high = table.length - 1; in rk_tsadcv2_code_to_temp()
282 WARN_ON(table.length < 2); in rk_tsadcv2_code_to_temp()
284 switch (table.mode) { in rk_tsadcv2_code_to_temp()
286 code &= table.data_mask; in rk_tsadcv2_code_to_temp()
287 if (code < table.id[high].code) in rk_tsadcv2_code_to_temp()
291 if (code >= table.id[mid].code && in rk_tsadcv2_code_to_temp()
292 code < table.id[mid - 1].code) in rk_tsadcv2_code_to_temp()
294 else if (code < table.id[mid].code) in rk_tsadcv2_code_to_temp()
303 code &= table.data_mask; in rk_tsadcv2_code_to_temp()
304 if (code < table.id[low].code) in rk_tsadcv2_code_to_temp()
308 if (code >= table.id[mid - 1].code && in rk_tsadcv2_code_to_temp()
309 code < table.id[mid].code) in rk_tsadcv2_code_to_temp()
311 else if (code > table.id[mid].code) in rk_tsadcv2_code_to_temp()
329 num = table.id[mid].temp - v2_code_table[mid - 1].temp; in rk_tsadcv2_code_to_temp()
330 num *= abs(table.id[mid - 1].code - code); in rk_tsadcv2_code_to_temp()
331 denom = abs(table.id[mid - 1].code - table.id[mid].code); in rk_tsadcv2_code_to_temp()
332 *temp = table.id[mid - 1].temp + (num / denom); in rk_tsadcv2_code_to_temp()
392 static int rk_tsadcv2_get_temp(struct chip_tsadc_table table, in rk_tsadcv2_get_temp() argument
399 return rk_tsadcv2_code_to_temp(table, val, temp); in rk_tsadcv2_get_temp()
402 static void rk_tsadcv2_tshut_temp(struct chip_tsadc_table table, in rk_tsadcv2_tshut_temp() argument
407 tshut_value = rk_tsadcv2_temp_to_code(table, temp); in rk_tsadcv2_tshut_temp()
448 .table = {
472 .table = {
524 retval = tsadc->get_temp(tsadc->table, in rockchip_thermal_get_temp()
602 tsadc->set_tshut_temp(tsadc->table, id, thermal->regs, in rockchip_thermal_register_sensor()
821 thermal->chip->set_tshut_temp(thermal->chip->table, in rockchip_thermal_resume()