Lines Matching refs:sen

150 				       struct sprd_thermal_sensor *sen)  in sprd_thm_sensor_calibration()  argument
172 sen->cal_slope = (thm->var_data->ideal_k * ratio) / 1000; in sprd_thm_sensor_calibration()
173 sen->cal_offset = thm->var_data->ideal_b + (dt_offset - 128) * 250; in sprd_thm_sensor_calibration()
178 static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen, in sprd_thm_rawdata_to_temp() argument
188 return sen->cal_slope * rawdata - sen->cal_offset; in sprd_thm_rawdata_to_temp()
191 static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen) in sprd_thm_temp_to_rawdata() argument
202 val = (temp + sen->cal_offset) / sen->cal_slope; in sprd_thm_temp_to_rawdata()
209 struct sprd_thermal_sensor *sen = devdata; in sprd_thm_read_temp() local
212 data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & in sprd_thm_read_temp()
215 *temp = sprd_thm_rawdata_to_temp(sen, data); in sprd_thm_read_temp()
283 struct sprd_thermal_sensor *sen) in sprd_thm_sensor_init() argument
287 otp_rawdata = sprd_thm_temp_to_rawdata(SPRD_THM_OTP_TEMP, sen); in sprd_thm_sensor_init()
288 hot_rawdata = sprd_thm_temp_to_rawdata(SPRD_THM_HOT_TEMP, sen); in sprd_thm_sensor_init()
292 SPRD_THM_SEN_OVERHEAT_ALARM_EN(sen->id), in sprd_thm_sensor_init()
293 SPRD_THM_SEN_OVERHEAT_ALARM_EN(sen->id)); in sprd_thm_sensor_init()
296 sprd_thm_update_bits(thm->base + SPRD_THM_THRES(sen->id), in sprd_thm_sensor_init()
302 sprd_thm_update_bits(thm->base + SPRD_THM_CTL, SPRD_THM_SEN(sen->id), in sprd_thm_sensor_init()
303 SPRD_THM_SEN(sen->id)); in sprd_thm_sensor_init()
321 static void sprd_thm_toggle_sensor(struct sprd_thermal_sensor *sen, bool on) in sprd_thm_toggle_sensor() argument
323 struct thermal_zone_device *tzd = sen->tzd; in sprd_thm_toggle_sensor()
336 struct sprd_thermal_sensor *sen; in sprd_thm_probe() local
388 sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL); in sprd_thm_probe()
389 if (!sen) { in sprd_thm_probe()
394 sen->data = thm; in sprd_thm_probe()
395 sen->dev = &pdev->dev; in sprd_thm_probe()
397 ret = of_property_read_u32(sen_child, "reg", &sen->id); in sprd_thm_probe()
403 ret = sprd_thm_sensor_calibration(sen_child, thm, sen); in sprd_thm_probe()
409 sprd_thm_sensor_init(thm, sen); in sprd_thm_probe()
411 sen->tzd = devm_thermal_zone_of_sensor_register(sen->dev, in sprd_thm_probe()
412 sen->id, in sprd_thm_probe()
413 sen, in sprd_thm_probe()
415 if (IS_ERR(sen->tzd)) { in sprd_thm_probe()
417 sen->id); in sprd_thm_probe()
418 ret = PTR_ERR(sen->tzd); in sprd_thm_probe()
422 thm->sensor[sen->id] = sen; in sprd_thm_probe()