[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220804054638.3197294-5-bhupesh.sharma@linaro.org>
Date: Thu, 4 Aug 2022 11:16:38 +0530
From: Bhupesh Sharma <bhupesh.sharma@...aro.org>
To: linux-pm@...r.kernel.org
Cc: bhupesh.sharma@...aro.org, bhupesh.linux@...il.com,
linux-kernel@...r.kernel.org, bjorn.andersson@...aro.org,
konrad.dybcio@...ainline.org, linux-arm-msm@...r.kernel.org,
daniel.lezcano@...aro.org, robh+dt@...nel.org, rafael@...nel.org,
Amit Kucheria <amitk@...nel.org>,
Thara Gopinath <thara.gopinath@...il.com>
Subject: [PATCH v3 4/4] thermal: qcom: tsens: Add reinit quirk support for tsens v2 controllers
Some Qualcomm tsens v2 controllers like those present on
sm8150 SoC might require re-initialization via trustzone
[via scm call(s)] when it enters a 'bad state' causing
sensor temperatures/interrupts status to be in an
'invalid' state.
Add hooks for the same in the qcom tsens driver.
Devices requiring the same can pass the relevant
compatible string in dt and the driver hook can
be used accordingly.
Cc: Bjorn Andersson <bjorn.andersson@...aro.org>
Cc: Amit Kucheria <amitk@...nel.org>
Cc: Thara Gopinath <thara.gopinath@...il.com>
Cc: linux-pm@...r.kernel.org
Cc: linux-arm-msm@...r.kernel.org
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@...aro.org>
---
drivers/thermal/qcom/tsens-v2.c | 12 ++++++++++++
drivers/thermal/qcom/tsens.c | 3 +++
drivers/thermal/qcom/tsens.h | 2 +-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index f521e4479cc5..431f17f99d34 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -104,6 +104,18 @@ struct tsens_plat_data data_tsens_v2 = {
.fields = tsens_v2_regfields,
};
+/*
+ * For some tsens v2 controllers, its suggested to monitor the
+ * controller health periodically and in case an issue is detected
+ * to reinit tsens controller via trustzone.
+ */
+struct tsens_plat_data data_tsens_v2_reinit = {
+ .ops = &ops_generic_v2,
+ .feat = &tsens_v2_feat,
+ .needs_reinit_wa = true,
+ .fields = tsens_v2_regfields,
+};
+
/* Kept around for backward compatibility with old msm8996.dtsi */
struct tsens_plat_data data_8996 = {
.num_sensors = 13,
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index c2d085fb5447..928b6a44fda8 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1145,6 +1145,9 @@ static const struct of_device_id tsens_table[] = {
}, {
.compatible = "qcom,msm8996-tsens",
.data = &data_8996,
+ }, {
+ .compatible = "qcom,sm8150-tsens",
+ .data = &data_tsens_v2_reinit,
}, {
.compatible = "qcom,tsens-v1",
.data = &data_tsens_v1,
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index 900d2a74d25e..03cc3a790972 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -607,6 +607,6 @@ extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
extern struct tsens_plat_data data_tsens_v1, data_8976;
/* TSENS v2 targets */
-extern struct tsens_plat_data data_8996, data_tsens_v2;
+extern struct tsens_plat_data data_8996, data_tsens_v2_reinit, data_tsens_v2;
#endif /* __QCOM_TSENS_H__ */
--
2.35.3
Powered by blists - more mailing lists