Lines Matching +full:thermal +full:- +full:calibration
1 // SPDX-License-Identifier: GPL-2.0
3 * Renesas RZ/G2L TSU Thermal Sensor Driver
17 #include <linux/thermal.h>
24 /* default calibration values, if FUSE values are missing */
67 return ioread32(priv->base + reg); in rzg2l_thermal_read()
73 iowrite32(data, priv->base + reg); in rzg2l_thermal_write()
78 struct rzg2l_thermal_priv *priv = tz->devdata; in rzg2l_thermal_get_temp()
107 * where calib0 and calib1 are the calibration values. in rzg2l_thermal_get_temp()
109 val = ((dsensor - priv->calib1) * (MCELSIUS(165) / in rzg2l_thermal_get_temp()
110 (priv->calib0 - priv->calib1))) - MCELSIUS(40); in rzg2l_thermal_get_temp()
139 return readl_poll_timeout(priv->base + TSU_SS, reg_val, in rzg2l_thermal_init()
146 struct rzg2l_thermal_priv *priv = dev_get_drvdata(&pdev->dev); in rzg2l_thermal_reset_assert_pm_disable_put()
148 pm_runtime_put(&pdev->dev); in rzg2l_thermal_reset_assert_pm_disable_put()
149 pm_runtime_disable(&pdev->dev); in rzg2l_thermal_reset_assert_pm_disable_put()
150 reset_control_assert(priv->rstc); in rzg2l_thermal_reset_assert_pm_disable_put()
155 struct rzg2l_thermal_priv *priv = dev_get_drvdata(&pdev->dev); in rzg2l_thermal_remove()
157 thermal_remove_hwmon_sysfs(priv->zone); in rzg2l_thermal_remove()
167 struct device *dev = &pdev->dev; in rzg2l_thermal_probe()
172 return -ENOMEM; in rzg2l_thermal_probe()
174 priv->base = devm_platform_ioremap_resource(pdev, 0); in rzg2l_thermal_probe()
175 if (IS_ERR(priv->base)) in rzg2l_thermal_probe()
176 return PTR_ERR(priv->base); in rzg2l_thermal_probe()
178 priv->dev = dev; in rzg2l_thermal_probe()
179 priv->rstc = devm_reset_control_get_exclusive(dev, NULL); in rzg2l_thermal_probe()
180 if (IS_ERR(priv->rstc)) in rzg2l_thermal_probe()
181 return dev_err_probe(dev, PTR_ERR(priv->rstc), in rzg2l_thermal_probe()
184 ret = reset_control_deassert(priv->rstc); in rzg2l_thermal_probe()
191 priv->calib0 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(0)); in rzg2l_thermal_probe()
192 if (priv->calib0 & OTPTSUTRIM_EN_MASK) in rzg2l_thermal_probe()
193 priv->calib0 &= OTPTSUTRIM_MASK; in rzg2l_thermal_probe()
195 priv->calib0 = SW_CALIB0_VAL; in rzg2l_thermal_probe()
197 priv->calib1 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(1)); in rzg2l_thermal_probe()
198 if (priv->calib1 & OTPTSUTRIM_EN_MASK) in rzg2l_thermal_probe()
199 priv->calib1 &= OTPTSUTRIM_MASK; in rzg2l_thermal_probe()
201 priv->calib1 = SW_CALIB1_VAL; in rzg2l_thermal_probe()
213 dev_err(dev, "Can't register thermal zone"); in rzg2l_thermal_probe()
218 priv->zone = zone; in rzg2l_thermal_probe()
219 priv->zone->tzp->no_hwmon = false; in rzg2l_thermal_probe()
220 ret = thermal_add_hwmon_sysfs(priv->zone); in rzg2l_thermal_probe()
224 dev_dbg(dev, "TSU probed with %s calibration values", in rzg2l_thermal_probe()
235 { .compatible = "renesas,rzg2l-tsu", },
250 MODULE_DESCRIPTION("Renesas RZ/G2L TSU Thermal Sensor Driver");