Lines Matching +full:thermal +full:- +full:sensor
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2014-2016, Fuzhou Rockchip Electronics Co., Ltd
4 * Caesar Wang <wxt@rock-chips.com>
12 #include <linux/nvmem-consumer.h>
19 #include <linux/thermal.h>
56 * struct chip_tsadc_table - hold information about chip-specific differences
70 * struct rockchip_tsadc_chip - hold the private data of tsadc chip
74 * @tshut_temp: the hardware-controlled shutdown temperature value, with no trim
75 * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
76 * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
82 * @set_tshut_temp: set the hardware-controlled shutdown temperature
83 * @set_tshut_mode: set the hardware-controlled shutdown mode
85 * @table: the chip-specific conversion table
88 /* The sensor id of chip correspond to the ADC channel */
95 /* The hardware-controlled tshut property */
100 /* Chip-wide methods */
106 /* Per-sensor methods */
117 /* Per-table methods */
122 * struct rockchip_thermal_sensor - hold the information of thermal sensor
123 * @thermal: pointer to the platform/configuration data
124 * @tzd: pointer to a thermal zone
125 * @of_node: pointer to the device_node representing this sensor, if any
126 * @id: identifier of the thermal sensor
127 * @trim_temp: per-sensor trim temperature value
130 struct rockchip_thermal_data *thermal; member
138 * struct rockchip_thermal_data - hold the private data of thermal driver
140 * @pdev: platform device of thermal
142 * @sensors: array of thermal sensors
147 * @trim_base: major component of sensor trim value, in Celsius
148 * @trim_base_frac: minor component of sensor trim value, in Decicelsius
149 * @trim: fallback thermal trim value for each channel
150 * @tshut_temp: the hardware-controlled shutdown temperature value, with no trim
151 * @trim_temp: the fallback trim temperature for the whole sensor
152 * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
153 * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
179 * TSADC Sensor Register description:
277 * struct tsadc_table - code to temperature conversion table
281 * code to temperature mapping of the temperature sensor is a piece wise linear
292 {0, -40000},
293 {374, -40000},
294 {382, -35000},
295 {389, -30000},
296 {397, -25000},
297 {405, -20000},
298 {413, -15000},
299 {421, -10000},
300 {429, -5000},
331 {0, -40000},
332 {588, -40000},
333 {593, -35000},
334 {598, -30000},
335 {603, -25000},
336 {608, -20000},
337 {613, -15000},
338 {618, -10000},
339 {623, -5000},
370 {TSADCV2_DATA_MASK, -40000},
371 {3800, -40000},
372 {3792, -35000},
373 {3783, -30000},
374 {3774, -25000},
375 {3765, -20000},
376 {3756, -15000},
377 {3747, -10000},
378 {3737, -5000},
409 {0, -40000},
410 {296, -40000},
411 {304, -35000},
412 {313, -30000},
413 {322, -25000},
414 {331, -20000},
415 {340, -15000},
416 {349, -10000},
417 {359, -5000},
448 {0, -40000},
449 {106, -40000},
450 {108, -35000},
451 {110, -30000},
452 {112, -25000},
453 {114, -20000},
454 {116, -15000},
455 {118, -10000},
456 {120, -5000},
487 {0, -40000},
488 {402, -40000},
489 {410, -35000},
490 {419, -30000},
491 {427, -25000},
492 {436, -20000},
493 {444, -15000},
494 {453, -10000},
495 {461, -5000},
526 {0, -40000},
527 {1584, -40000},
528 {1620, -35000},
529 {1652, -30000},
530 {1688, -25000},
531 {1720, -20000},
532 {1756, -15000},
533 {1788, -10000},
534 {1824, -5000},
565 {0, -40000},
566 {215, -40000},
579 u32 error = table->data_mask; in rk_tsadcv2_temp_to_code()
582 high = (table->length - 1) - 1; /* ignore the last check for table */ in rk_tsadcv2_temp_to_code()
586 if (temp < table->id[low].temp || temp > table->id[high].temp) in rk_tsadcv2_temp_to_code()
590 if (temp == table->id[mid].temp) in rk_tsadcv2_temp_to_code()
591 return table->id[mid].code; in rk_tsadcv2_temp_to_code()
592 else if (temp < table->id[mid].temp) in rk_tsadcv2_temp_to_code()
593 high = mid - 1; in rk_tsadcv2_temp_to_code()
605 num = abs(table->id[mid + 1].code - table->id[mid].code); in rk_tsadcv2_temp_to_code()
606 num *= temp - table->id[mid].temp; in rk_tsadcv2_temp_to_code()
607 denom = table->id[mid + 1].temp - table->id[mid].temp; in rk_tsadcv2_temp_to_code()
609 switch (table->mode) { in rk_tsadcv2_temp_to_code()
611 return table->id[mid].code - (num / denom); in rk_tsadcv2_temp_to_code()
613 return table->id[mid].code + (num / denom); in rk_tsadcv2_temp_to_code()
615 pr_err("%s: unknown table mode: %d\n", __func__, table->mode); in rk_tsadcv2_temp_to_code()
629 unsigned int high = table->length - 1; in rk_tsadcv2_code_to_temp()
634 WARN_ON(table->length < 2); in rk_tsadcv2_code_to_temp()
636 switch (table->mode) { in rk_tsadcv2_code_to_temp()
638 code &= table->data_mask; in rk_tsadcv2_code_to_temp()
639 if (code <= table->id[high].code) in rk_tsadcv2_code_to_temp()
640 return -EAGAIN; /* Incorrect reading */ in rk_tsadcv2_code_to_temp()
643 if (code >= table->id[mid].code && in rk_tsadcv2_code_to_temp()
644 code < table->id[mid - 1].code) in rk_tsadcv2_code_to_temp()
646 else if (code < table->id[mid].code) in rk_tsadcv2_code_to_temp()
649 high = mid - 1; in rk_tsadcv2_code_to_temp()
655 code &= table->data_mask; in rk_tsadcv2_code_to_temp()
656 if (code < table->id[low].code) in rk_tsadcv2_code_to_temp()
657 return -EAGAIN; /* Incorrect reading */ in rk_tsadcv2_code_to_temp()
660 if (code <= table->id[mid].code && in rk_tsadcv2_code_to_temp()
661 code > table->id[mid - 1].code) in rk_tsadcv2_code_to_temp()
663 else if (code > table->id[mid].code) in rk_tsadcv2_code_to_temp()
666 high = mid - 1; in rk_tsadcv2_code_to_temp()
672 pr_err("%s: unknown table mode: %d\n", __func__, table->mode); in rk_tsadcv2_code_to_temp()
673 return -EINVAL; in rk_tsadcv2_code_to_temp()
678 * assume that the relationship between sensor readings and in rk_tsadcv2_code_to_temp()
682 num = table->id[mid].temp - table->id[mid - 1].temp; in rk_tsadcv2_code_to_temp()
683 num *= abs(table->id[mid - 1].code - code); in rk_tsadcv2_code_to_temp()
684 denom = abs(table->id[mid - 1].code - table->id[mid].code); in rk_tsadcv2_code_to_temp()
685 *temp = table->id[mid - 1].temp + (num / denom); in rk_tsadcv2_code_to_temp()
691 * rk_tsadcv2_initialize - initialize TASDC Controller.
694 * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
728 * rk_tsadcv3_initialize - initialize TASDC Controller.
731 * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
903 * rk_tsadcv3_control - the tsadc controller is enabled or disabled.
908 * tsadc_q_sel bit on TSADCV2_AUTO_CON[1]. The (1024 - tsadc_q) as output
964 * set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm in rk_tsadcv2_alarm_temp()
977 if (alarm_value == table->data_mask) in rk_tsadcv2_alarm_temp()
978 return -ERANGE; in rk_tsadcv2_alarm_temp()
980 writel_relaxed(alarm_value & table->data_mask, in rk_tsadcv2_alarm_temp()
997 * set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm in rk_tsadcv3_alarm_temp()
1008 if (alarm_value == table->data_mask) in rk_tsadcv3_alarm_temp()
1009 return -ERANGE; in rk_tsadcv3_alarm_temp()
1010 writel_relaxed(alarm_value & table->data_mask, in rk_tsadcv3_alarm_temp()
1024 if (tshut_value == table->data_mask) in rk_tsadcv2_tshut_temp()
1025 return -ERANGE; in rk_tsadcv2_tshut_temp()
1043 if (tshut_value == table->data_mask) in rk_tsadcv3_tshut_temp()
1044 return -ERANGE; in rk_tsadcv3_tshut_temp()
1094 return code - base_code; in rk_tsadcv2_get_trim_code()
1367 { .compatible = "rockchip,px30-tsadc",
1371 .compatible = "rockchip,rv1108-tsadc",
1375 .compatible = "rockchip,rk3228-tsadc",
1379 .compatible = "rockchip,rk3288-tsadc",
1383 .compatible = "rockchip,rk3328-tsadc",
1387 .compatible = "rockchip,rk3366-tsadc",
1391 .compatible = "rockchip,rk3368-tsadc",
1395 .compatible = "rockchip,rk3399-tsadc",
1399 .compatible = "rockchip,rk3568-tsadc",
1403 .compatible = "rockchip,rk3576-tsadc",
1407 .compatible = "rockchip,rk3588-tsadc",
1415 rockchip_thermal_toggle_sensor(struct rockchip_thermal_sensor *sensor, bool on) in rockchip_thermal_toggle_sensor() argument
1417 struct thermal_zone_device *tzd = sensor->tzd; in rockchip_thermal_toggle_sensor()
1427 struct rockchip_thermal_data *thermal = dev; in rockchip_thermal_alarm_irq_thread() local
1430 dev_dbg(&thermal->pdev->dev, "thermal alarm\n"); in rockchip_thermal_alarm_irq_thread()
1432 thermal->chip->irq_ack(thermal->regs); in rockchip_thermal_alarm_irq_thread()
1434 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_alarm_irq_thread()
1435 thermal_zone_device_update(thermal->sensors[i].tzd, in rockchip_thermal_alarm_irq_thread()
1443 struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); in rockchip_thermal_set_trips() local
1444 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_set_trips() local
1445 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_set_trips()
1447 dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n", in rockchip_thermal_set_trips()
1448 __func__, sensor->id, low, high); in rockchip_thermal_set_trips()
1450 return tsadc->set_alarm_temp(&tsadc->table, in rockchip_thermal_set_trips()
1451 sensor->id, thermal->regs, high + sensor->trim_temp); in rockchip_thermal_set_trips()
1456 struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); in rockchip_thermal_get_temp() local
1457 struct rockchip_thermal_data *thermal = sensor->thermal; in rockchip_thermal_get_temp() local
1458 const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; in rockchip_thermal_get_temp()
1461 retval = tsadc->get_temp(&tsadc->table, in rockchip_thermal_get_temp()
1462 sensor->id, thermal->regs, out_temp); in rockchip_thermal_get_temp()
1463 *out_temp -= sensor->trim_temp; in rockchip_thermal_get_temp()
1474 * rockchip_get_efuse_value - read an OTP cell from a device node
1475 * @np: pointer to the device node with the nvmem-cells property
1503 ret = -ERANGE; in rockchip_get_efuse_value()
1518 struct rockchip_thermal_data *thermal) in rockchip_get_trim_configuration() argument
1520 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_get_trim_configuration()
1525 thermal->trim_base = 0; in rockchip_get_trim_configuration()
1526 thermal->trim_base_frac = 0; in rockchip_get_trim_configuration()
1527 thermal->trim = 0; in rockchip_get_trim_configuration()
1529 if (!tsadc->get_trim_code) in rockchip_get_trim_configuration()
1534 if (ret == -ENOENT) { in rockchip_get_trim_configuration()
1545 if (ret == -ENOENT) { in rockchip_get_trim_configuration()
1553 thermal->trim_base = trim_base; in rockchip_get_trim_configuration()
1554 thermal->trim_base_frac = trim_base_frac; in rockchip_get_trim_configuration()
1558 * absence of per-channel trim values in rockchip_get_trim_configuration()
1561 thermal->trim = trim; in rockchip_get_trim_configuration()
1563 trim_code = tsadc->get_trim_code(&tsadc->table, trim, in rockchip_get_trim_configuration()
1565 thermal->trim_temp = thermal->chip->trim_slope * trim_code; in rockchip_get_trim_configuration()
1573 struct rockchip_thermal_data *thermal) in rockchip_configure_from_dt() argument
1577 if (of_property_read_u32(np, "rockchip,hw-tshut-temp", &shut_temp)) { in rockchip_configure_from_dt()
1580 thermal->chip->tshut_temp); in rockchip_configure_from_dt()
1581 thermal->tshut_temp = thermal->chip->tshut_temp; in rockchip_configure_from_dt()
1586 return -ERANGE; in rockchip_configure_from_dt()
1588 thermal->tshut_temp = shut_temp; in rockchip_configure_from_dt()
1591 if (of_property_read_u32(np, "rockchip,hw-tshut-mode", &tshut_mode)) { in rockchip_configure_from_dt()
1594 thermal->chip->tshut_mode == TSHUT_MODE_GPIO ? in rockchip_configure_from_dt()
1596 thermal->tshut_mode = thermal->chip->tshut_mode; in rockchip_configure_from_dt()
1598 thermal->tshut_mode = tshut_mode; in rockchip_configure_from_dt()
1601 if (thermal->tshut_mode > 1) { in rockchip_configure_from_dt()
1603 thermal->tshut_mode); in rockchip_configure_from_dt()
1604 return -EINVAL; in rockchip_configure_from_dt()
1607 if (of_property_read_u32(np, "rockchip,hw-tshut-polarity", in rockchip_configure_from_dt()
1610 "Missing tshut-polarity property, using default (%s)\n", in rockchip_configure_from_dt()
1611 thermal->chip->tshut_polarity == TSHUT_LOW_ACTIVE ? in rockchip_configure_from_dt()
1613 thermal->tshut_polarity = thermal->chip->tshut_polarity; in rockchip_configure_from_dt()
1615 thermal->tshut_polarity = tshut_polarity; in rockchip_configure_from_dt()
1618 if (thermal->tshut_polarity > 1) { in rockchip_configure_from_dt()
1619 dev_err(dev, "Invalid tshut-polarity specified: %d\n", in rockchip_configure_from_dt()
1620 thermal->tshut_polarity); in rockchip_configure_from_dt()
1621 return -EINVAL; in rockchip_configure_from_dt()
1627 thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in rockchip_configure_from_dt()
1628 if (IS_ERR(thermal->grf)) in rockchip_configure_from_dt()
1631 rockchip_get_trim_configuration(dev, np, thermal); in rockchip_configure_from_dt()
1638 struct rockchip_thermal_data *thermal, in rockchip_thermal_register_sensor() argument
1639 struct rockchip_thermal_sensor *sensor, in rockchip_thermal_register_sensor() argument
1642 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_register_sensor()
1643 struct device *dev = &pdev->dev; in rockchip_thermal_register_sensor()
1644 int trim = thermal->trim; in rockchip_thermal_register_sensor()
1649 if (thermal->trim_temp) in rockchip_thermal_register_sensor()
1650 trim_temp = thermal->trim_temp; in rockchip_thermal_register_sensor()
1652 if (tsadc->get_trim_code && sensor->of_node) { in rockchip_thermal_register_sensor()
1653 error = rockchip_get_efuse_value(sensor->of_node, "trim", &trim); in rockchip_thermal_register_sensor()
1654 if (error < 0 && error != -ENOENT) { in rockchip_thermal_register_sensor()
1655 dev_err(dev, "failed reading trim of sensor %d: %pe\n", in rockchip_thermal_register_sensor()
1660 trim_code = tsadc->get_trim_code(&tsadc->table, trim, in rockchip_thermal_register_sensor()
1661 thermal->trim_base, in rockchip_thermal_register_sensor()
1662 thermal->trim_base_frac); in rockchip_thermal_register_sensor()
1663 trim_temp = thermal->chip->trim_slope * trim_code; in rockchip_thermal_register_sensor()
1667 sensor->trim_temp = trim_temp; in rockchip_thermal_register_sensor()
1669 dev_dbg(dev, "trim of sensor %d is %d\n", id, sensor->trim_temp); in rockchip_thermal_register_sensor()
1671 tshut_temp = min(thermal->tshut_temp + sensor->trim_temp, RK_MAX_TEMP); in rockchip_thermal_register_sensor()
1673 tsadc->set_tshut_mode(id, thermal->regs, thermal->tshut_mode); in rockchip_thermal_register_sensor()
1675 error = tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs, tshut_temp); in rockchip_thermal_register_sensor()
1680 sensor->thermal = thermal; in rockchip_thermal_register_sensor()
1681 sensor->id = id; in rockchip_thermal_register_sensor()
1682 sensor->tzd = devm_thermal_of_zone_register(dev, id, sensor, in rockchip_thermal_register_sensor()
1684 if (IS_ERR(sensor->tzd)) { in rockchip_thermal_register_sensor()
1685 error = PTR_ERR(sensor->tzd); in rockchip_thermal_register_sensor()
1686 dev_err(dev, "failed to register sensor %d: %d\n", in rockchip_thermal_register_sensor()
1695 * rockchip_thermal_reset_controller - Reset TSADC Controller, reset all tsadc registers.
1707 struct device_node *np = pdev->dev.of_node; in rockchip_thermal_probe()
1708 struct rockchip_thermal_data *thermal; in rockchip_thermal_probe() local
1717 return -EINVAL; in rockchip_thermal_probe()
1719 thermal = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_thermal_data), in rockchip_thermal_probe()
1721 if (!thermal) in rockchip_thermal_probe()
1722 return -ENOMEM; in rockchip_thermal_probe()
1724 thermal->pdev = pdev; in rockchip_thermal_probe()
1726 thermal->chip = device_get_match_data(&pdev->dev); in rockchip_thermal_probe()
1727 if (!thermal->chip) in rockchip_thermal_probe()
1728 return -EINVAL; in rockchip_thermal_probe()
1730 thermal->sensors = devm_kcalloc(&pdev->dev, thermal->chip->chn_num, in rockchip_thermal_probe()
1731 sizeof(*thermal->sensors), GFP_KERNEL); in rockchip_thermal_probe()
1732 if (!thermal->sensors) in rockchip_thermal_probe()
1733 return -ENOMEM; in rockchip_thermal_probe()
1735 thermal->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in rockchip_thermal_probe()
1736 if (IS_ERR(thermal->regs)) in rockchip_thermal_probe()
1737 return PTR_ERR(thermal->regs); in rockchip_thermal_probe()
1739 thermal->reset = devm_reset_control_array_get_exclusive(&pdev->dev); in rockchip_thermal_probe()
1740 if (IS_ERR(thermal->reset)) in rockchip_thermal_probe()
1741 return dev_err_probe(&pdev->dev, PTR_ERR(thermal->reset), in rockchip_thermal_probe()
1744 thermal->clk = devm_clk_get_enabled(&pdev->dev, "tsadc"); in rockchip_thermal_probe()
1745 if (IS_ERR(thermal->clk)) in rockchip_thermal_probe()
1746 return dev_err_probe(&pdev->dev, PTR_ERR(thermal->clk), in rockchip_thermal_probe()
1749 thermal->pclk = devm_clk_get_enabled(&pdev->dev, "apb_pclk"); in rockchip_thermal_probe()
1750 if (IS_ERR(thermal->pclk)) in rockchip_thermal_probe()
1751 return dev_err_probe(&pdev->dev, PTR_ERR(thermal->pclk), in rockchip_thermal_probe()
1754 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_probe()
1756 error = rockchip_configure_from_dt(&pdev->dev, np, thermal); in rockchip_thermal_probe()
1758 return dev_err_probe(&pdev->dev, error, in rockchip_thermal_probe()
1761 thermal->chip->initialize(thermal->grf, thermal->regs, in rockchip_thermal_probe()
1762 thermal->tshut_polarity); in rockchip_thermal_probe()
1766 if (chn < thermal->chip->chn_num) in rockchip_thermal_probe()
1767 thermal->sensors[chn].of_node = child; in rockchip_thermal_probe()
1769 dev_warn(&pdev->dev, in rockchip_thermal_probe()
1770 "sensor address (%d) too large, ignoring its trim\n", in rockchip_thermal_probe()
1776 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_probe()
1777 error = rockchip_thermal_register_sensor(pdev, thermal, in rockchip_thermal_probe()
1778 &thermal->sensors[i], in rockchip_thermal_probe()
1779 thermal->chip->chn_offset + i); in rockchip_thermal_probe()
1781 return dev_err_probe(&pdev->dev, error, in rockchip_thermal_probe()
1782 "failed to register sensor[%d].\n", i); in rockchip_thermal_probe()
1785 error = devm_request_threaded_irq(&pdev->dev, irq, NULL, in rockchip_thermal_probe()
1788 "rockchip_thermal", thermal); in rockchip_thermal_probe()
1790 return dev_err_probe(&pdev->dev, error, in rockchip_thermal_probe()
1793 thermal->chip->control(thermal->regs, true); in rockchip_thermal_probe()
1795 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_probe()
1796 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_probe()
1797 error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd); in rockchip_thermal_probe()
1799 dev_warn(&pdev->dev, in rockchip_thermal_probe()
1800 "failed to register sensor %d with hwmon: %d\n", in rockchip_thermal_probe()
1804 platform_set_drvdata(pdev, thermal); in rockchip_thermal_probe()
1811 struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); in rockchip_thermal_remove() local
1814 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_remove()
1815 struct rockchip_thermal_sensor *sensor = &thermal->sensors[i]; in rockchip_thermal_remove() local
1817 thermal_remove_hwmon_sysfs(sensor->tzd); in rockchip_thermal_remove()
1818 rockchip_thermal_toggle_sensor(sensor, false); in rockchip_thermal_remove()
1821 thermal->chip->control(thermal->regs, false); in rockchip_thermal_remove()
1826 struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); in rockchip_thermal_suspend() local
1829 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_suspend()
1830 rockchip_thermal_toggle_sensor(&thermal->sensors[i], false); in rockchip_thermal_suspend()
1832 thermal->chip->control(thermal->regs, false); in rockchip_thermal_suspend()
1834 clk_disable(thermal->pclk); in rockchip_thermal_suspend()
1835 clk_disable(thermal->clk); in rockchip_thermal_suspend()
1844 struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); in rockchip_thermal_resume() local
1845 const struct rockchip_tsadc_chip *tsadc = thermal->chip; in rockchip_thermal_resume()
1846 struct rockchip_thermal_sensor *sensor; in rockchip_thermal_resume() local
1851 error = clk_enable(thermal->clk); in rockchip_thermal_resume()
1855 error = clk_enable(thermal->pclk); in rockchip_thermal_resume()
1857 clk_disable(thermal->clk); in rockchip_thermal_resume()
1861 rockchip_thermal_reset_controller(thermal->reset); in rockchip_thermal_resume()
1863 tsadc->initialize(thermal->grf, thermal->regs, thermal->tshut_polarity); in rockchip_thermal_resume()
1865 for (i = 0; i < thermal->chip->chn_num; i++) { in rockchip_thermal_resume()
1866 sensor = &thermal->sensors[i]; in rockchip_thermal_resume()
1868 tshut_temp = min(thermal->tshut_temp + sensor->trim_temp, in rockchip_thermal_resume()
1871 tsadc->set_tshut_mode(sensor->id, thermal->regs, in rockchip_thermal_resume()
1872 thermal->tshut_mode); in rockchip_thermal_resume()
1874 error = tsadc->set_tshut_temp(&thermal->chip->table, in rockchip_thermal_resume()
1875 sensor->id, thermal->regs, in rockchip_thermal_resume()
1882 thermal->chip->control(thermal->regs, true); in rockchip_thermal_resume()
1884 for (i = 0; i < thermal->chip->chn_num; i++) in rockchip_thermal_resume()
1885 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); in rockchip_thermal_resume()
1897 .name = "rockchip-thermal",
1907 MODULE_DESCRIPTION("ROCKCHIP THERMAL Driver");
1910 MODULE_ALIAS("platform:rockchip-thermal");