aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/rockchip_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/rockchip_thermal.c')
-rw-r--r--drivers/thermal/rockchip_thermal.c46
1 files changed, 4 insertions, 42 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index bda1ca199abd..343c2f5c5a25 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1,15 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2014-2016, Fuzhou Rockchip Electronics Co., Ltd
* Caesar Wang <wxt@rock-chips.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
*/
#include <linux/clk.h>
@@ -172,9 +164,6 @@ struct rockchip_thermal_data {
int tshut_temp;
enum tshut_mode tshut_mode;
enum tshut_polarity tshut_polarity;
- struct pinctrl *pinctrl;
- struct pinctrl_state *gpio_state;
- struct pinctrl_state *otp_state;
};
/**
@@ -1283,8 +1272,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
return error;
}
- thermal->chip->control(thermal->regs, false);
-
error = clk_prepare_enable(thermal->clk);
if (error) {
dev_err(&pdev->dev, "failed to enable converter clock: %d\n",
@@ -1310,30 +1297,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
thermal->chip->initialize(thermal->grf, thermal->regs,
thermal->tshut_polarity);
- if (thermal->tshut_mode == TSHUT_MODE_GPIO) {
- thermal->pinctrl = devm_pinctrl_get(&pdev->dev);
- if (IS_ERR(thermal->pinctrl)) {
- dev_err(&pdev->dev, "failed to find thermal pinctrl\n");
- return PTR_ERR(thermal->pinctrl);
- }
-
- thermal->gpio_state = pinctrl_lookup_state(thermal->pinctrl,
- "gpio");
- if (IS_ERR_OR_NULL(thermal->gpio_state)) {
- dev_err(&pdev->dev, "failed to find thermal gpio state\n");
- return -EINVAL;
- }
-
- thermal->otp_state = pinctrl_lookup_state(thermal->pinctrl,
- "otpout");
- if (IS_ERR_OR_NULL(thermal->otp_state)) {
- dev_err(&pdev->dev, "failed to find thermal otpout state\n");
- return -EINVAL;
- }
-
- pinctrl_select_state(thermal->pinctrl, thermal->otp_state);
- }
-
for (i = 0; i < thermal->chip->chn_num; i++) {
error = rockchip_thermal_register_sensor(pdev, thermal,
&thermal->sensors[i],
@@ -1404,8 +1367,8 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
clk_disable(thermal->pclk);
clk_disable(thermal->clk);
- if (thermal->tshut_mode == TSHUT_MODE_GPIO)
- pinctrl_select_state(thermal->pinctrl, thermal->gpio_state);
+
+ pinctrl_pm_select_sleep_state(dev);
return 0;
}
@@ -1450,8 +1413,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
for (i = 0; i < thermal->chip->chn_num; i++)
rockchip_thermal_toggle_sensor(&thermal->sensors[i], true);
- if (thermal->tshut_mode == TSHUT_MODE_GPIO)
- pinctrl_select_state(thermal->pinctrl, thermal->otp_state);
+ pinctrl_pm_select_default_state(dev);
return 0;
}