Lines Matching +full:ao +full:- +full:secure
1 // SPDX-License-Identifier: GPL-2.0+
10 * U = ---------, Uptat = ---------
13 * Temperature = A * ( Uptat + u_efuse / 2^16 )- B
116 pdata->data->calibration_parameters; in amlogic_thermal_code_to_millicelsius()
120 uefuse = pdata->trim_info & TSENSOR_TRIM_SIGN_MASK ? in amlogic_thermal_code_to_millicelsius()
121 ~(pdata->trim_info & TSENSOR_TRIM_TEMP_MASK) + 1 : in amlogic_thermal_code_to_millicelsius()
122 (pdata->trim_info & TSENSOR_TRIM_TEMP_MASK); in amlogic_thermal_code_to_millicelsius()
124 factor = param->n * temp_code; in amlogic_thermal_code_to_millicelsius()
127 Uptat = temp_code * param->m; in amlogic_thermal_code_to_millicelsius()
132 temp = (Uptat + uefuse) * param->A; in amlogic_thermal_code_to_millicelsius()
134 temp = (temp - param->B) * 100; in amlogic_thermal_code_to_millicelsius()
144 regmap_read(pdata->sec_ao_map, pdata->data->u_efuse_off, in amlogic_thermal_initialize()
145 &pdata->trim_info); in amlogic_thermal_initialize()
147 ver = TSENSOR_TRIM_VERSION(pdata->trim_info); in amlogic_thermal_initialize()
150 ret = -EINVAL; in amlogic_thermal_initialize()
151 dev_err(&pdata->pdev->dev, in amlogic_thermal_initialize()
163 ret = clk_prepare_enable(data->clk); in amlogic_thermal_enable()
167 regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, in amlogic_thermal_enable()
175 regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, in amlogic_thermal_disable()
177 clk_disable_unprepare(data->clk); in amlogic_thermal_disable()
188 return -EINVAL; in amlogic_thermal_get_temp()
190 regmap_read(pdata->regmap, TSENSOR_STAT0, &tval); in amlogic_thermal_get_temp()
230 .compatible = "amlogic,g12a-ddr-thermal",
234 .compatible = "amlogic,g12a-cpu-thermal",
244 struct device *dev = &pdev->dev; in amlogic_thermal_probe()
250 return -ENOMEM; in amlogic_thermal_probe()
252 pdata->data = of_device_get_match_data(dev); in amlogic_thermal_probe()
253 pdata->pdev = pdev; in amlogic_thermal_probe()
260 pdata->regmap = devm_regmap_init_mmio(dev, base, in amlogic_thermal_probe()
261 pdata->data->regmap_config); in amlogic_thermal_probe()
262 if (IS_ERR(pdata->regmap)) in amlogic_thermal_probe()
263 return PTR_ERR(pdata->regmap); in amlogic_thermal_probe()
265 pdata->clk = devm_clk_get(dev, NULL); in amlogic_thermal_probe()
266 if (IS_ERR(pdata->clk)) { in amlogic_thermal_probe()
267 if (PTR_ERR(pdata->clk) != -EPROBE_DEFER) in amlogic_thermal_probe()
269 return PTR_ERR(pdata->clk); in amlogic_thermal_probe()
272 pdata->sec_ao_map = syscon_regmap_lookup_by_phandle in amlogic_thermal_probe()
273 (pdev->dev.of_node, "amlogic,ao-secure"); in amlogic_thermal_probe()
274 if (IS_ERR(pdata->sec_ao_map)) { in amlogic_thermal_probe()
276 return PTR_ERR(pdata->sec_ao_map); in amlogic_thermal_probe()
279 pdata->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, in amlogic_thermal_probe()
283 if (IS_ERR(pdata->tzd)) { in amlogic_thermal_probe()
284 ret = PTR_ERR(pdata->tzd); in amlogic_thermal_probe()
289 if (devm_thermal_add_hwmon_sysfs(pdata->tzd)) in amlogic_thermal_probe()
290 dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); in amlogic_thermal_probe()