summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorNuno Sá <nuno.sa@analog.com>2021-08-11 14:48:51 +0300
committerGuenter Roeck <linux@roeck-us.net>2021-08-18 00:54:26 +0300
commita3933625de28e730c7822d2b14f896125577abe8 (patch)
treeb89f0ddeb4cc7ee8367553f34e7a0606e88c7c5d /drivers/hwmon
parent76b72736f574ec38b3e94603ea5f74b1853f26b0 (diff)
downloadlinux-a3933625de28e730c7822d2b14f896125577abe8.tar.xz
hwmon: (axi-fan-control) Make sure the clock is enabled
The core will only work if it's clock is enabled. This patch is a minor enhancement to make sure that's the case. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210811114853.159298-2-nuno.sa@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/axi-fan-control.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hwmon/axi-fan-control.c b/drivers/hwmon/axi-fan-control.c
index e3f6b03e6764..901d1588234d 100644
--- a/drivers/hwmon/axi-fan-control.c
+++ b/drivers/hwmon/axi-fan-control.c
@@ -351,6 +351,11 @@ static int axi_fan_control_init(struct axi_fan_control_data *ctl,
return ret;
}
+static void axi_fan_control_clk_disable(void *clk)
+{
+ clk_disable_unprepare(clk);
+}
+
static const struct hwmon_channel_info *axi_fan_control_info[] = {
HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT),
HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_FAULT | HWMON_F_LABEL),
@@ -406,6 +411,14 @@ static int axi_fan_control_probe(struct platform_device *pdev)
return PTR_ERR(clk);
}
+ ret = clk_prepare_enable(clk);
+ if (ret)
+ return ret;
+
+ ret = devm_add_action_or_reset(&pdev->dev, axi_fan_control_clk_disable, clk);
+ if (ret)
+ return ret;
+
ctl->clk_rate = clk_get_rate(clk);
if (!ctl->clk_rate)
return -EINVAL;