Re: [PATCH 6/6] thermal/drivers/tsens: Add IPQ5332 support

From: Praveenkumar I
Date: Mon Jul 10 2023 - 09:47:28 EST



On 7/10/2023 4:54 PM, Dmitry Baryshkov wrote:
On 10/07/2023 13:37, Praveenkumar I wrote:
IPQ5332 uses tsens v2.3.3 IP and it is having combined interrupt as
like IPQ8074. But as the SoCs does not have RPM, kernel needs to
take care of sensor enablement and calibration. Hence introduced
new ops and data for IPQ5332 and reused the feature_config from
IPQ8074.

Signed-off-by: Praveenkumar I <quic_ipkumar@xxxxxxxxxxx>
---
  drivers/thermal/qcom/tsens-v2.c | 13 +++++++++++++
  drivers/thermal/qcom/tsens.c    |  3 +++
  drivers/thermal/qcom/tsens.h    |  2 +-
  3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index db48b1d95348..8b6e3876fd2c 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -237,6 +237,19 @@ struct tsens_plat_data data_ipq8074 = {
      .fields    = tsens_v2_regfields,
  };
  +static const struct tsens_ops ops_ipq5332_v2 = {

Please drop v2. It is unclear if it refers to tsens being v2 or being specific to ipq5332 v2.
Sure, will drop v2.

+    .init        = init_common,
+    .get_temp    = get_temp_tsens_valid,
+    .calibrate    = tsens_v2_calibration,
+};
+
+struct tsens_plat_data data_ipq5332 = {
+    .sensors_to_en    = 0xF800,

This doesn't seem to match the offsets that you have enabled in the DTSI.
In order to overcome the DT binding check failure, added all the available QFPROM offsets in the DTSI. Else DT binding check failing on "nvmem-cell-names".

+    .ops        = &ops_ipq5332_v2,
+    .feat        = &ipq8074_feat,
+    .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 169690355dad..e8ba2901cda8 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1140,6 +1140,9 @@ static const struct of_device_id tsens_table[] = {
      }, {
          .compatible = "qcom,ipq8074-tsens",
          .data = &data_ipq8074,
+    }, {
+        .compatible = "qcom,ipq5332-tsens",
+        .data = &data_ipq5332,
      }, {
          .compatible = "qcom,mdm9607-tsens",
          .data = &data_9607,
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index f8897bc8944e..36040f9beebc 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -701,6 +701,6 @@ extern struct tsens_plat_data data_8226, data_8909, data_8916, data_8939, data_8
  extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
    /* TSENS v2 targets */
-extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2;
+extern struct tsens_plat_data data_8996, data_ipq8074, data_ipq5332, data_tsens_v2;
    #endif /* __QCOM_TSENS_H__ */

--
Thanks,
Praveenkumar