Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "thermal: rockchip: fix up the tsadc pinctrl setting error"

This reverts commit 28694e009e512451ead5519dd801f9869acb1f60.

The commit causes multiple issues in that:
- the added call to ->control does potentially run unclocked
causing a hang of the machine
- the added pinctrl-states are undocumented in the binding
- the added pinctrl-states are not backwards compatible, breaking
old devicetrees.

Fixes: 28694e009e51 ("thermal: rockchip: fix up the tsadc pinctrl setting error")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reported-by: kernelci.org bot <bot@kernelci.org>
Reported-by: Enric Balletbo Serra <eballetbo@gmail.com>
Reported-by: Vicente Bergas <vicencb@gmail.com>
Reported-by: Jack Mitchell <ml@embed.me.uk>
Reported-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

authored by

Heiko Stuebner and committed by
Eduardo Valentin
0f5ee062 4dde821e

+3 -33
+3 -33
drivers/thermal/rockchip_thermal.c
··· 172 172 int tshut_temp; 173 173 enum tshut_mode tshut_mode; 174 174 enum tshut_polarity tshut_polarity; 175 - struct pinctrl *pinctrl; 176 - struct pinctrl_state *gpio_state; 177 - struct pinctrl_state *otp_state; 178 175 }; 179 176 180 177 /** ··· 1280 1283 return error; 1281 1284 } 1282 1285 1283 - thermal->chip->control(thermal->regs, false); 1284 - 1285 1286 error = clk_prepare_enable(thermal->clk); 1286 1287 if (error) { 1287 1288 dev_err(&pdev->dev, "failed to enable converter clock: %d\n", ··· 1304 1309 1305 1310 thermal->chip->initialize(thermal->grf, thermal->regs, 1306 1311 thermal->tshut_polarity); 1307 - 1308 - if (thermal->tshut_mode == TSHUT_MODE_GPIO) { 1309 - thermal->pinctrl = devm_pinctrl_get(&pdev->dev); 1310 - if (IS_ERR(thermal->pinctrl)) { 1311 - dev_err(&pdev->dev, "failed to find thermal pinctrl\n"); 1312 - return PTR_ERR(thermal->pinctrl); 1313 - } 1314 - 1315 - thermal->gpio_state = pinctrl_lookup_state(thermal->pinctrl, 1316 - "gpio"); 1317 - if (IS_ERR_OR_NULL(thermal->gpio_state)) { 1318 - dev_err(&pdev->dev, "failed to find thermal gpio state\n"); 1319 - return -EINVAL; 1320 - } 1321 - 1322 - thermal->otp_state = pinctrl_lookup_state(thermal->pinctrl, 1323 - "otpout"); 1324 - if (IS_ERR_OR_NULL(thermal->otp_state)) { 1325 - dev_err(&pdev->dev, "failed to find thermal otpout state\n"); 1326 - return -EINVAL; 1327 - } 1328 - 1329 - pinctrl_select_state(thermal->pinctrl, thermal->otp_state); 1330 - } 1331 1312 1332 1313 for (i = 0; i < thermal->chip->chn_num; i++) { 1333 1314 error = rockchip_thermal_register_sensor(pdev, thermal, ··· 1375 1404 1376 1405 clk_disable(thermal->pclk); 1377 1406 clk_disable(thermal->clk); 1378 - if (thermal->tshut_mode == TSHUT_MODE_GPIO) 1379 - pinctrl_select_state(thermal->pinctrl, thermal->gpio_state); 1407 + 1408 + pinctrl_pm_select_sleep_state(dev); 1380 1409 1381 1410 return 0; 1382 1411 } ··· 1421 1450 for (i = 0; i < thermal->chip->chn_num; i++) 1422 1451 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); 1423 1452 1424 - if (thermal->tshut_mode == TSHUT_MODE_GPIO) 1425 - pinctrl_select_state(thermal->pinctrl, thermal->otp_state); 1453 + pinctrl_pm_select_default_state(dev); 1426 1454 1427 1455 return 0; 1428 1456 }