[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220724122424.2509021-6-bhupesh.sharma@linaro.org>
Date:   Sun, 24 Jul 2022 17:54:24 +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 v2 5/5] thermal: qcom: tsens: Add reinit quirk support for sm6375 controller
tsens controller(s) on Qualcomm sm6375 SoC might start in
an unknown state or start with TSENS_EN indicating
a 'disabled' state when they enter linux world.
In such cases, it is useful to try and reinit them via
trustzone [via scm call(s)], at the very start.
Add hooks for the same in the qcom tsens driver.
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.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 928b6a44fda8..0141ea43c290 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1083,6 +1083,16 @@ int __init init_common(struct tsens_priv *priv)
 	if (tsens_version(priv) >= VER_0_1)
 		tsens_enable_irq(priv);
 
+	/*
+	 * For some tsens controllers, which start in
+	 * an unknown state or start with TSENS_EN indicating
+	 * a 'disabled' state, its useful to try and reinit
+	 * them via trustzone, at the very start.
+	 */
+	if (priv->needs_reinit_wa &&
+	    (of_device_is_compatible(dev->of_node, "qcom,sm6375-tsens")))
+		__tsens_reinit_worker(priv);
+
 	tsens_debug_init(op);
 
 err_put_device:
@@ -1145,6 +1155,9 @@ static const struct of_device_id tsens_table[] = {
 	}, {
 		.compatible = "qcom,msm8996-tsens",
 		.data = &data_8996,
+	}, {
+		.compatible = "qcom,sm6375-tsens",
+		.data = &data_tsens_v2_reinit,
 	}, {
 		.compatible = "qcom,sm8150-tsens",
 		.data = &data_tsens_v2_reinit,
-- 
2.35.3
Powered by blists - more mailing lists