Lines Matching refs:thermal
140 struct rockchip_thermal_data *thermal; member
969 struct rockchip_thermal_data *thermal = dev; in rockchip_thermal_alarm_irq_thread() local
972 dev_dbg(&thermal->pdev->dev, "thermal alarm\n"); in rockchip_thermal_alarm_irq_thread()
974 thermal->chip->irq_ack(thermal->regs); in rockchip_thermal_alarm_irq_thread()
976 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_alarm_irq_thread()
977 thermal_zone_device_update(thermal->sensors[i].tzd, in rockchip_thermal_alarm_irq_thread()
986 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_set_trips() local
987 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_set_trips()
989 dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n", in rockchip_thermal_set_trips()
993 sensor->id, thermal->regs, high); in rockchip_thermal_set_trips()
999 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_get_temp() local
1000 const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; in rockchip_thermal_get_temp()
1004 sensor->id, thermal->regs, out_temp); in rockchip_thermal_get_temp()
1005 dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", in rockchip_thermal_get_temp()
1018 struct rockchip_thermal_data *thermal) in rockchip_configure_from_dt() argument
1025 thermal->chip->tshut_temp); in rockchip_configure_from_dt()
1026 thermal->tshut_temp = thermal->chip->tshut_temp; in rockchip_configure_from_dt()
1033 thermal->tshut_temp = shut_temp; in rockchip_configure_from_dt()
1039 thermal->chip->tshut_mode == TSHUT_MODE_GPIO ? in rockchip_configure_from_dt()
1041 thermal->tshut_mode = thermal->chip->tshut_mode; in rockchip_configure_from_dt()
1043 thermal->tshut_mode = tshut_mode; in rockchip_configure_from_dt()
1046 if (thermal->tshut_mode > 1) { in rockchip_configure_from_dt()
1048 thermal->tshut_mode); in rockchip_configure_from_dt()
1056 thermal->chip->tshut_polarity == TSHUT_LOW_ACTIVE ? in rockchip_configure_from_dt()
1058 thermal->tshut_polarity = thermal->chip->tshut_polarity; in rockchip_configure_from_dt()
1060 thermal->tshut_polarity = tshut_polarity; in rockchip_configure_from_dt()
1063 if (thermal->tshut_polarity > 1) { in rockchip_configure_from_dt()
1065 thermal->tshut_polarity); in rockchip_configure_from_dt()
1072 thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in rockchip_configure_from_dt()
1073 if (IS_ERR(thermal->grf)) in rockchip_configure_from_dt()
1081 struct rockchip_thermal_data *thermal, in rockchip_thermal_register_sensor() argument
1085 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_register_sensor()
1088 tsadc->set_tshut_mode(id, thermal->regs, thermal->tshut_mode); in rockchip_thermal_register_sensor()
1090 error = tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs, in rockchip_thermal_register_sensor()
1091 thermal->tshut_temp); in rockchip_thermal_register_sensor()
1094 __func__, thermal->tshut_temp, error); in rockchip_thermal_register_sensor()
1096 sensor->thermal = thermal; in rockchip_thermal_register_sensor()
1123 struct rockchip_thermal_data *thermal; in rockchip_thermal_probe() local
1140 thermal = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_thermal_data), in rockchip_thermal_probe()
1142 if (!thermal) in rockchip_thermal_probe()
1145 thermal->pdev = pdev; in rockchip_thermal_probe()
1147 thermal->chip = (const struct rockchip_tsadc_chip *)match->data; in rockchip_thermal_probe()
1148 if (!thermal->chip) in rockchip_thermal_probe()
1152 thermal->regs = devm_ioremap_resource(&pdev->dev, res); in rockchip_thermal_probe()
1153 if (IS_ERR(thermal->regs)) in rockchip_thermal_probe()
1154 return PTR_ERR(thermal->regs); in rockchip_thermal_probe()
1156 thermal->reset = devm_reset_control_get(&pdev->dev, "tsadc-apb"); in rockchip_thermal_probe()
1157 if (IS_ERR(thermal->reset)) { in rockchip_thermal_probe()
1158 error = PTR_ERR(thermal->reset); in rockchip_thermal_probe()
1163 thermal->clk = devm_clk_get(&pdev->dev, "tsadc"); in rockchip_thermal_probe()
1164 if (IS_ERR(thermal->clk)) { in rockchip_thermal_probe()
1165 error = PTR_ERR(thermal->clk); in rockchip_thermal_probe()
1170 thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); in rockchip_thermal_probe()
1171 if (IS_ERR(thermal->pclk)) { in rockchip_thermal_probe()
1172 error = PTR_ERR(thermal->pclk); in rockchip_thermal_probe()
1178 error = clk_prepare_enable(thermal->clk); in rockchip_thermal_probe()
1185 error = clk_prepare_enable(thermal->pclk); in rockchip_thermal_probe()
1191 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_probe()
1193 error = rockchip_configure_from_dt(&pdev->dev, np, thermal); in rockchip_thermal_probe()
1200 thermal->chip->initialize(thermal->grf, thermal->regs, in rockchip_thermal_probe()
1201 thermal->tshut_polarity); in rockchip_thermal_probe()
1203 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_probe()
1204 error = rockchip_thermal_register_sensor(pdev, thermal, in rockchip_thermal_probe()
1205 &thermal->sensors[i], in rockchip_thermal_probe()
1206 thermal->chip->chn_id[i]); in rockchip_thermal_probe()
1218 "rockchip_thermal", thermal); in rockchip_thermal_probe()
1225 thermal->chip->control(thermal->regs, true); in rockchip_thermal_probe()
1227 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_probe()
1228 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_probe()
1230 platform_set_drvdata(pdev, thermal); in rockchip_thermal_probe()
1235 clk_disable_unprepare(thermal->pclk); in rockchip_thermal_probe()
1237 clk_disable_unprepare(thermal->clk); in rockchip_thermal_probe()
1244 struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); in rockchip_thermal_remove() local
1247 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_remove()
1248 struct rockchip_thermal_sensor *sensor = &thermal->sensors[i]; in rockchip_thermal_remove()
1253 thermal->chip->control(thermal->regs, false); in rockchip_thermal_remove()
1255 clk_disable_unprepare(thermal->pclk); in rockchip_thermal_remove()
1256 clk_disable_unprepare(thermal->clk); in rockchip_thermal_remove()
1264 struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); in rockchip_thermal_suspend() local
1267 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_suspend()
1268 rockchip_thermal_toggle_sensor(&thermal->sensors[i], false); in rockchip_thermal_suspend()
1270 thermal->chip->control(thermal->regs, false); in rockchip_thermal_suspend()
1272 clk_disable(thermal->pclk); in rockchip_thermal_suspend()
1273 clk_disable(thermal->clk); in rockchip_thermal_suspend()
1283 struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); in rockchip_thermal_resume() local
1287 error = clk_enable(thermal->clk); in rockchip_thermal_resume()
1291 error = clk_enable(thermal->pclk); in rockchip_thermal_resume()
1293 clk_disable(thermal->clk); in rockchip_thermal_resume()
1297 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_resume()
1299 thermal->chip->initialize(thermal->grf, thermal->regs, in rockchip_thermal_resume()
1300 thermal->tshut_polarity); in rockchip_thermal_resume()
1302 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_resume()
1303 int id = thermal->sensors[i].id; in rockchip_thermal_resume()
1305 thermal->chip->set_tshut_mode(id, thermal->regs, in rockchip_thermal_resume()
1306 thermal->tshut_mode); in rockchip_thermal_resume()
1308 error = thermal->chip->set_tshut_temp(&thermal->chip->table, in rockchip_thermal_resume()
1309 id, thermal->regs, in rockchip_thermal_resume()
1310 thermal->tshut_temp); in rockchip_thermal_resume()
1313 __func__, thermal->tshut_temp, error); in rockchip_thermal_resume()
1316 thermal->chip->control(thermal->regs, true); in rockchip_thermal_resume()
1318 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_resume()
1319 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_resume()