Lines Matching +full:rzg2l +full:- +full:tsu
1 // SPDX-License-Identifier: GPL-2.0
3 * Renesas RZ/G2L TSU Thermal Sensor Driver
67 return ioread32(priv->base + reg); in rzg2l_thermal_read()
73 iowrite32(data, priv->base + reg); in rzg2l_thermal_write()
84 * TSU repeats measurement at 20 microseconds intervals and 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()
129 * Before setting the START bit, TSU should be in normal operating in rzg2l_thermal_init()
130 * mode. As per the HW manual, it will take 60 µs to place the TSU in rzg2l_thermal_init()
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()
165 struct device *dev = &pdev->dev; in rzg2l_thermal_probe()
170 return -ENOMEM; in rzg2l_thermal_probe()
172 priv->base = devm_platform_ioremap_resource(pdev, 0); in rzg2l_thermal_probe()
173 if (IS_ERR(priv->base)) in rzg2l_thermal_probe()
174 return PTR_ERR(priv->base); in rzg2l_thermal_probe()
176 priv->dev = dev; in rzg2l_thermal_probe()
177 priv->rstc = devm_reset_control_get_exclusive(dev, NULL); in rzg2l_thermal_probe()
178 if (IS_ERR(priv->rstc)) in rzg2l_thermal_probe()
179 return dev_err_probe(dev, PTR_ERR(priv->rstc), in rzg2l_thermal_probe()
182 ret = reset_control_deassert(priv->rstc); in rzg2l_thermal_probe()
189 priv->calib0 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(0)); in rzg2l_thermal_probe()
190 if (priv->calib0 & OTPTSUTRIM_EN_MASK) in rzg2l_thermal_probe()
191 priv->calib0 &= OTPTSUTRIM_MASK; in rzg2l_thermal_probe()
193 priv->calib0 = SW_CALIB0_VAL; in rzg2l_thermal_probe()
195 priv->calib1 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(1)); in rzg2l_thermal_probe()
196 if (priv->calib1 & OTPTSUTRIM_EN_MASK) in rzg2l_thermal_probe()
197 priv->calib1 &= OTPTSUTRIM_MASK; in rzg2l_thermal_probe()
199 priv->calib1 = SW_CALIB1_VAL; in rzg2l_thermal_probe()
204 dev_err(dev, "Failed to start TSU"); in rzg2l_thermal_probe()
216 priv->zone = zone; in rzg2l_thermal_probe()
217 ret = thermal_add_hwmon_sysfs(priv->zone); in rzg2l_thermal_probe()
221 dev_dbg(dev, "TSU probed with %s calibration values", in rzg2l_thermal_probe()
232 { .compatible = "renesas,rzg2l-tsu", },
247 MODULE_DESCRIPTION("Renesas RZ/G2L TSU Thermal Sensor Driver");