Thermal: Add reset logic for power optimization for K515 [1/1]

PD#SWPL-111294

Problem:
Need to reset the sensor in standby mode.

Solution:
Add reset logic

Verify:
T5M pass

Change-Id: I069fbfb608cdd9ca2b17d59d89e5f1c5a1da7bb9
Signed-off-by: binbin.wang <binbin.wang@amlogic.com>
This commit is contained in:
binbin.wang
2023-02-15 03:18:38 +00:00
committed by gerrit autosubmit
parent d32c605b30
commit 38b22eced8
2 changed files with 26 additions and 0 deletions
@@ -1948,6 +1948,8 @@
clocks = <&clkc CLKID_TS_CLK>;
clock-names = "ts_comp";
#thermal-sensor-cells = <1>;
reset-names = "ts_rst";
resets = <&reset RESET_TS_CPU>;
};
top_tsensor: top_tsensor@fe01c000 {
@@ -1962,6 +1964,8 @@
clocks = <&clkc CLKID_TS_CLK>;
clock-names = "ts_comp";
#thermal-sensor-cells = <1>;
reset-names = "ts_rst";
resets = <&reset RESET_TS_VPU>;
};
meson_cooldev: meson-cooldev@0 {
+22
View File
@@ -23,6 +23,7 @@
#include "thermal_hwmon.h"
#include "cpucore_cooling.h"
#include "meson_cooldev.h"
#include <linux/reset.h>
/*r1p1 thermal sensor version*/
#define R1P1_TS_CFG_REG1 (0x1 * 4)
@@ -135,6 +136,7 @@ struct meson_tsensor_data {
u32 trim_info;
struct thermal_zone_device *tzd;
unsigned int ntrip;
struct reset_control *rst;
int (*tsensor_hw_initialize)(struct platform_device *pdev);
int (*tsensor_trips_initialize)(struct platform_device *pdev);
void (*tsensor_control)(struct platform_device *pdev,
@@ -646,6 +648,10 @@ static int meson_map_dt_data(struct platform_device *pdev)
return -ENODEV;
}
data->rst = devm_reset_control_get(&pdev->dev, "ts_rst");
if (IS_ERR(data->rst))
dev_warn(&pdev->dev, "Does not support reset func..\n");
if (of_address_to_resource(pdev->dev.of_node, 0, &res)) {
dev_err(&pdev->dev, "failed to get Resource 0\n");
return -ENODEV;
@@ -1002,12 +1008,28 @@ static int __maybe_unused meson_tsensor_hw_resume(struct device *dev)
#ifdef CONFIG_PM_SLEEP
static int meson_tsensor_suspend(struct device *dev)
{
struct meson_tsensor_data *data =
platform_get_drvdata(to_platform_device(dev));
meson_tsensor_control(to_platform_device(dev), false);
if (!IS_ERR(data->rst)) {
dev_warn(dev, "reset sensor...\n");
reset_control_assert(data->rst);
}
return 0;
}
static int meson_tsensor_resume(struct device *dev)
{
struct meson_tsensor_data *data =
platform_get_drvdata(to_platform_device(dev));
if (!IS_ERR(data->rst)) {
dev_warn(dev, "Release sensor's reset...\n");
if (reset_control_deassert(data->rst))
dev_err(dev, "Release sensor's reset failed!!!...\n");
}
meson_tsensor_hw_resume(dev);
return 0;