Lines Matching +full:sparx5 +full:- +full:temp
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Sparx5 SoC temperature sensor driver
38 u32 val = readl(hwmon->base + TEMP_CFG); in s5_temp_enable()
39 u32 clk = clk_get_rate(hwmon->clk) / USEC_PER_SEC; in s5_temp_enable()
45 writel(val, hwmon->base + TEMP_CFG); in s5_temp_enable()
49 u32 attr, int channel, long *temp) in s5_read() argument
57 stat = readl_relaxed(hwmon->base + TEMP_STAT); in s5_read()
59 return -EAGAIN; in s5_read()
63 * Temp(C) = TEMP_SENSOR_STAT.TEMP / 4096 * 352.2 - 109.4 in s5_read()
65 value = DIV_ROUND_CLOSEST(value * 3522, 4096) - 1094; in s5_read()
72 *temp = value; in s5_read()
75 rc = -EOPNOTSUPP; in s5_read()
98 HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
118 hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); in s5_temp_probe()
120 return -ENOMEM; in s5_temp_probe()
122 hwmon->base = devm_platform_ioremap_resource(pdev, 0); in s5_temp_probe()
123 if (IS_ERR(hwmon->base)) in s5_temp_probe()
124 return PTR_ERR(hwmon->base); in s5_temp_probe()
126 hwmon->clk = devm_clk_get(&pdev->dev, NULL); in s5_temp_probe()
127 if (IS_ERR(hwmon->clk)) in s5_temp_probe()
128 return PTR_ERR(hwmon->clk); in s5_temp_probe()
130 ret = clk_prepare_enable(hwmon->clk); in s5_temp_probe()
134 ret = devm_add_action_or_reset(&pdev->dev, s5_temp_clk_disable, in s5_temp_probe()
135 hwmon->clk); in s5_temp_probe()
141 hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, in s5_temp_probe()
151 { .compatible = "microchip,sparx5-temp" },
159 .name = "sparx5-temp",
167 MODULE_DESCRIPTION("Sparx5 SoC temperature sensor driver");