[PATCH v2 5/5] thermal: qcom: tsens: Add reinit quirk support for sm6375 controller
From: Bhupesh Sharma
Date: Sun Jul 24 2022 - 08:25:23 EST
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@xxxxxxxxxx>
Cc: Amit Kucheria <amitk@xxxxxxxxxx>
Cc: Thara Gopinath <thara.gopinath@xxxxxxxxx>
Cc: linux-pm@xxxxxxxxxxxxxxx
Cc: linux-arm-msm@xxxxxxxxxxxxxxx
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@xxxxxxxxxx>
---
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