Lines Matching +full:- +full:thermal

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Kirkwood thermal sensor driver
14 #include <linux/thermal.h>
21 /* Kirkwood Thermal Sensor Dev Structure */
26 static int kirkwood_get_temp(struct thermal_zone_device *thermal, in kirkwood_get_temp() argument
30 struct kirkwood_thermal_priv *priv = thermal_zone_device_priv(thermal); in kirkwood_get_temp()
32 reg = readl_relaxed(priv->sensor); in kirkwood_get_temp()
37 return -EIO; in kirkwood_get_temp()
42 * Celsius = (322-reg)/1.3625 in kirkwood_get_temp()
46 *temp = ((3220000000UL - (10000000UL * reg)) / 13625); in kirkwood_get_temp()
56 { .compatible = "marvell,kirkwood-thermal" },
62 struct thermal_zone_device *thermal = NULL; in kirkwood_thermal_probe() local
66 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in kirkwood_thermal_probe()
68 return -ENOMEM; in kirkwood_thermal_probe()
70 priv->sensor = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in kirkwood_thermal_probe()
71 if (IS_ERR(priv->sensor)) in kirkwood_thermal_probe()
72 return PTR_ERR(priv->sensor); in kirkwood_thermal_probe()
74 thermal = thermal_tripless_zone_device_register("kirkwood_thermal", in kirkwood_thermal_probe()
76 if (IS_ERR(thermal)) { in kirkwood_thermal_probe()
77 dev_err(&pdev->dev, in kirkwood_thermal_probe()
78 "Failed to register thermal zone device\n"); in kirkwood_thermal_probe()
79 return PTR_ERR(thermal); in kirkwood_thermal_probe()
81 ret = thermal_zone_device_enable(thermal); in kirkwood_thermal_probe()
83 thermal_zone_device_unregister(thermal); in kirkwood_thermal_probe()
84 dev_err(&pdev->dev, "Failed to enable thermal zone device\n"); in kirkwood_thermal_probe()
88 platform_set_drvdata(pdev, thermal); in kirkwood_thermal_probe()
115 MODULE_DESCRIPTION("kirkwood thermal driver");