Lines Matching refs:thermal

135 	struct rockchip_thermal_data *thermal;  member
1200 struct rockchip_thermal_data *thermal = dev; in rockchip_thermal_alarm_irq_thread() local
1203 dev_dbg(&thermal->pdev->dev, "thermal alarm\n"); in rockchip_thermal_alarm_irq_thread()
1205 thermal->chip->irq_ack(thermal->regs); in rockchip_thermal_alarm_irq_thread()
1207 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_alarm_irq_thread()
1208 thermal_zone_device_update(thermal->sensors[i].tzd, in rockchip_thermal_alarm_irq_thread()
1217 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_set_trips() local
1218 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_set_trips()
1220 dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n", in rockchip_thermal_set_trips()
1224 sensor->id, thermal->regs, high); in rockchip_thermal_set_trips()
1230 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_get_temp() local
1231 const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; in rockchip_thermal_get_temp()
1235 sensor->id, thermal->regs, out_temp); in rockchip_thermal_get_temp()
1236 dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", in rockchip_thermal_get_temp()
1249 struct rockchip_thermal_data *thermal) in rockchip_configure_from_dt() argument
1256 thermal->chip->tshut_temp); in rockchip_configure_from_dt()
1257 thermal->tshut_temp = thermal->chip->tshut_temp; in rockchip_configure_from_dt()
1264 thermal->tshut_temp = shut_temp; in rockchip_configure_from_dt()
1270 thermal->chip->tshut_mode == TSHUT_MODE_GPIO ? in rockchip_configure_from_dt()
1272 thermal->tshut_mode = thermal->chip->tshut_mode; in rockchip_configure_from_dt()
1274 thermal->tshut_mode = tshut_mode; in rockchip_configure_from_dt()
1277 if (thermal->tshut_mode > 1) { in rockchip_configure_from_dt()
1279 thermal->tshut_mode); in rockchip_configure_from_dt()
1287 thermal->chip->tshut_polarity == TSHUT_LOW_ACTIVE ? in rockchip_configure_from_dt()
1289 thermal->tshut_polarity = thermal->chip->tshut_polarity; in rockchip_configure_from_dt()
1291 thermal->tshut_polarity = tshut_polarity; in rockchip_configure_from_dt()
1294 if (thermal->tshut_polarity > 1) { in rockchip_configure_from_dt()
1296 thermal->tshut_polarity); in rockchip_configure_from_dt()
1303 thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in rockchip_configure_from_dt()
1304 if (IS_ERR(thermal->grf)) in rockchip_configure_from_dt()
1312 struct rockchip_thermal_data *thermal, in rockchip_thermal_register_sensor() argument
1316 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_register_sensor()
1319 tsadc->set_tshut_mode(id, thermal->regs, thermal->tshut_mode); in rockchip_thermal_register_sensor()
1321 error = tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs, in rockchip_thermal_register_sensor()
1322 thermal->tshut_temp); in rockchip_thermal_register_sensor()
1325 __func__, thermal->tshut_temp, error); in rockchip_thermal_register_sensor()
1327 sensor->thermal = thermal; in rockchip_thermal_register_sensor()
1355 struct rockchip_thermal_data *thermal; in rockchip_thermal_probe() local
1370 thermal = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_thermal_data), in rockchip_thermal_probe()
1372 if (!thermal) in rockchip_thermal_probe()
1375 thermal->pdev = pdev; in rockchip_thermal_probe()
1377 thermal->chip = (const struct rockchip_tsadc_chip *)match->data; in rockchip_thermal_probe()
1378 if (!thermal->chip) in rockchip_thermal_probe()
1382 thermal->regs = devm_ioremap_resource(&pdev->dev, res); in rockchip_thermal_probe()
1383 if (IS_ERR(thermal->regs)) in rockchip_thermal_probe()
1384 return PTR_ERR(thermal->regs); in rockchip_thermal_probe()
1386 thermal->reset = devm_reset_control_array_get(&pdev->dev, false, false); in rockchip_thermal_probe()
1387 if (IS_ERR(thermal->reset)) { in rockchip_thermal_probe()
1388 error = PTR_ERR(thermal->reset); in rockchip_thermal_probe()
1393 thermal->clk = devm_clk_get(&pdev->dev, "tsadc"); in rockchip_thermal_probe()
1394 if (IS_ERR(thermal->clk)) { in rockchip_thermal_probe()
1395 error = PTR_ERR(thermal->clk); in rockchip_thermal_probe()
1400 thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); in rockchip_thermal_probe()
1401 if (IS_ERR(thermal->pclk)) { in rockchip_thermal_probe()
1402 error = PTR_ERR(thermal->pclk); in rockchip_thermal_probe()
1408 error = clk_prepare_enable(thermal->clk); in rockchip_thermal_probe()
1415 error = clk_prepare_enable(thermal->pclk); in rockchip_thermal_probe()
1421 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_probe()
1423 error = rockchip_configure_from_dt(&pdev->dev, np, thermal); in rockchip_thermal_probe()
1430 thermal->chip->initialize(thermal->grf, thermal->regs, in rockchip_thermal_probe()
1431 thermal->tshut_polarity); in rockchip_thermal_probe()
1433 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_probe()
1434 error = rockchip_thermal_register_sensor(pdev, thermal, in rockchip_thermal_probe()
1435 &thermal->sensors[i], in rockchip_thermal_probe()
1436 thermal->chip->chn_id[i]); in rockchip_thermal_probe()
1448 "rockchip_thermal", thermal); in rockchip_thermal_probe()
1455 thermal->chip->control(thermal->regs, true); in rockchip_thermal_probe()
1457 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_probe()
1458 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_probe()
1459 thermal->sensors[i].tzd->tzp->no_hwmon = false; in rockchip_thermal_probe()
1460 error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd); in rockchip_thermal_probe()
1467 platform_set_drvdata(pdev, thermal); in rockchip_thermal_probe()
1472 clk_disable_unprepare(thermal->pclk); in rockchip_thermal_probe()
1474 clk_disable_unprepare(thermal->clk); in rockchip_thermal_probe()
1481 struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); in rockchip_thermal_remove() local
1484 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_remove()
1485 struct rockchip_thermal_sensor *sensor = &thermal->sensors[i]; in rockchip_thermal_remove()
1491 thermal->chip->control(thermal->regs, false); in rockchip_thermal_remove()
1493 clk_disable_unprepare(thermal->pclk); in rockchip_thermal_remove()
1494 clk_disable_unprepare(thermal->clk); in rockchip_thermal_remove()
1501 struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); in rockchip_thermal_suspend() local
1504 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_suspend()
1505 rockchip_thermal_toggle_sensor(&thermal->sensors[i], false); in rockchip_thermal_suspend()
1507 thermal->chip->control(thermal->regs, false); in rockchip_thermal_suspend()
1509 clk_disable(thermal->pclk); in rockchip_thermal_suspend()
1510 clk_disable(thermal->clk); in rockchip_thermal_suspend()
1519 struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); in rockchip_thermal_resume() local
1523 error = clk_enable(thermal->clk); in rockchip_thermal_resume()
1527 error = clk_enable(thermal->pclk); in rockchip_thermal_resume()
1529 clk_disable(thermal->clk); in rockchip_thermal_resume()
1533 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_resume()
1535 thermal->chip->initialize(thermal->grf, thermal->regs, in rockchip_thermal_resume()
1536 thermal->tshut_polarity); in rockchip_thermal_resume()
1538 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_resume()
1539 int id = thermal->sensors[i].id; in rockchip_thermal_resume()
1541 thermal->chip->set_tshut_mode(id, thermal->regs, in rockchip_thermal_resume()
1542 thermal->tshut_mode); in rockchip_thermal_resume()
1544 error = thermal->chip->set_tshut_temp(&thermal->chip->table, in rockchip_thermal_resume()
1545 id, thermal->regs, in rockchip_thermal_resume()
1546 thermal->tshut_temp); in rockchip_thermal_resume()
1549 __func__, thermal->tshut_temp, error); in rockchip_thermal_resume()
1552 thermal->chip->control(thermal->regs, true); in rockchip_thermal_resume()
1554 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_resume()
1555 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_resume()