Lines Matching +full:sparx5 +full:- +full:temp
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Sparx5 SoC temperature sensor driver
31 u32 val = readl(hwmon->base + TEMP_CFG); in s5_temp_enable()
32 u32 clk = clk_get_rate(hwmon->clk) / USEC_PER_SEC; in s5_temp_enable()
38 writel(val, hwmon->base + TEMP_CFG); in s5_temp_enable()
42 u32 attr, int channel, long *temp) in s5_read() argument
50 stat = readl_relaxed(hwmon->base + TEMP_STAT); in s5_read()
52 return -EAGAIN; in s5_read()
56 * Temp(C) = TEMP_SENSOR_STAT.TEMP / 4096 * 352.2 - 109.4 in s5_read()
58 value = DIV_ROUND_CLOSEST(value * 3522, 4096) - 1094; in s5_read()
65 *temp = value; in s5_read()
68 rc = -EOPNOTSUPP; in s5_read()
91 HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
110 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); in s5_temp_probe()
112 return -ENOMEM; in s5_temp_probe()
114 hwmon->base = devm_platform_ioremap_resource(pdev, 0); in s5_temp_probe()
115 if (IS_ERR(hwmon->base)) in s5_temp_probe()
116 return PTR_ERR(hwmon->base); in s5_temp_probe()
118 hwmon->clk = devm_clk_get_enabled(&pdev->dev, NULL); in s5_temp_probe()
119 if (IS_ERR(hwmon->clk)) in s5_temp_probe()
120 return PTR_ERR(hwmon->clk); in s5_temp_probe()
124 hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, in s5_temp_probe()
134 { .compatible = "microchip,sparx5-temp" },
142 .name = "sparx5-temp",
150 MODULE_DESCRIPTION("Sparx5 SoC temperature sensor driver");