Skip to contentSkip to conversation

Enable MSM8226 TSENS support

PATCH Applied Matti Lehtimäki 9 participants 29 messages May 7, 2023 – Jul 13, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Enable MSM8226 TSENS support

Add support for tsens in MSM8226. Add qfprom compatible for MSM8226. Add device tree nodes for qfprom, tsens and thermal zones for MSM8226.

Matti Lehtimäki (6):
dt-bindings: nvmem: qfprom: Add compatible for MSM8226
dt-bindings: thermal: tsens: Add compatible for MSM8226 thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226
ARM: dts: msm8226: Add qfprom node
ARM: dts: msm8226: Add tsens node and related nvmem cells
ARM: dts: msm8226: Add thermal zones node

 .../bindings/nvmem/qcom,qfprom.yaml           |   1 +
 .../bindings/thermal/qcom-tsens.yaml          |   1 +
 arch/arm/boot/dts/qcom-msm8226.dtsi           | 164 ++++++++++++++++++
 drivers/thermal/qcom/tsens-v0_1.c             |  27 ++-
 drivers/thermal/qcom/tsens.c                  |   3 +
 drivers/thermal/qcom/tsens.h                  |   2 +-
 6 files changed, 196 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/6 dt-bindings: nvmem: qfprom: Add compatible for MSM8226

Document QFPROM compatible for MSM8226.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 2173fe82317d..0baf7819ab46 100644
@@ -20,6 +20,7 @@ properties:
           - qcom,apq8084-qfprom
           - qcom,ipq8064-qfprom
           - qcom,ipq8074-qfprom
+          - qcom,msm8226-qfprom
           - qcom,msm8916-qfprom
           - qcom,msm8974-qfprom
           - qcom,msm8976-qfprom
Signature · 1 line
2.34.1
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] dt-bindings: nvmem: qfprom: Add compatible for MSM8226

Quoted 3 lines · On Sonntag, 7. Mai 2023 22:12:19 CEST Matti Lehtimäki wrote:

Document QFPROM compatible for MSM8226.

Quoted 17 lines
---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml index 2173fe82317d..0baf7819ab46 100644

Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
@@ -20,6 +20,7 @@ properties:
           - qcom,apq8084-qfprom
           - qcom,ipq8064-qfprom
           - qcom,ipq8074-qfprom
+          - qcom,msm8226-qfprom
           - qcom,msm8916-qfprom
           - qcom,msm8974-qfprom
           - qcom,msm8976-qfprom
maintainer
#3 lore raw

Re: [PATCH 1/6] dt-bindings: nvmem: qfprom: Add compatible for MSM8226

In reply to Matti Lehtimäki
Quoted 7 lines · Matti Lehtimäki

Document QFPROM compatible for MSM8226.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.example.dtb: pcie-ep@33800000: Unevaluated properties are not allowed ('assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' were unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/rockchip-isp1.example.dtb: camera@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.example.dtb: camera-sensor@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml

doc reference errors (make refcheckdocs):
Documentation/usb/gadget_uvc.rst: Documentation/userspace-api/media/v4l/pixfmt-packed.yuv.rst
MAINTAINERS: Documentation/devicetree/bindings/pwm/pwm-apple.yaml

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#4 lore raw

Re: [PATCH 1/6] dt-bindings: nvmem: qfprom: Add compatible for MSM8226

Quoted 23 lines · Rob Herring
Quoted 7 lines · Matti Lehtimäki

Document QFPROM compatible for MSM8226.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.example.dtb: pcie-ep@33800000: Unevaluated properties are not allowed ('assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' were unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/rockchip-isp1.example.dtb: camera@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.example.dtb: camera-sensor@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml

Quoted 3 lines

doc reference errors (make refcheckdocs):
Documentation/usb/gadget_uvc.rst: Documentation/userspace-api/media/v4l/pixfmt-packed.yuv.rst
MAINTAINERS: Documentation/devicetree/bindings/pwm/pwm-apple.yaml

Rob, your bot seems to have picked up a false positive

Konrad

Quoted 16 lines

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#6 lore raw

Re: [PATCH 1/6] dt-bindings: nvmem: qfprom: Add compatible for MSM8226

In reply to Matti Lehtimäki
Quoted 4 lines · Matti Lehtimäki

Document QFPROM compatible for MSM8226.

---

Applied thanks,

--srini

Quoted 15 lines
  Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
  1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 2173fe82317d..0baf7819ab46 100644
@@ -20,6 +20,7 @@ properties:
            - qcom,apq8084-qfprom
            - qcom,ipq8064-qfprom
            - qcom,ipq8074-qfprom
+          - qcom,msm8226-qfprom
            - qcom,msm8916-qfprom
            - qcom,msm8974-qfprom
            - qcom,msm8976-qfprom
#7 lore raw

PATCH 2/6 dt-bindings: thermal: tsens: Add compatible for MSM8226

In reply to Matti Lehtimäki

Qualcomm MSM8226 has tsens v0.1 block.

---
 Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +1 -0
index 926e9c51c93c..d6b2957d5137 100644
@@ -29,6 +29,7 @@ properties:
         items:
           - enum:
               - qcom,mdm9607-tsens
+              - qcom,msm8226-tsens
               - qcom,msm8916-tsens
               - qcom,msm8939-tsens
               - qcom,msm8974-tsens
Signature · 1 line
2.34.1
Reviewed-by on v1 2/6
#8 lore raw

Re: [PATCH 2/6] dt-bindings: thermal: tsens: Add compatible for MSM8226

Quoted 3 lines · On Sonntag, 7. Mai 2023 22:12:20 CEST Matti Lehtimäki wrote:

Qualcomm MSM8226 has tsens v0.1 block.

Quoted 17 lines
---
 Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 926e9c51c93c..d6b2957d5137 100644

Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +1 -0
@@ -29,6 +29,7 @@ properties:
         items:
           - enum:
               - qcom,mdm9607-tsens
+              - qcom,msm8226-tsens
               - qcom,msm8916-tsens
               - qcom,msm8939-tsens
               - qcom,msm8974-tsens
maintainer
#9 lore raw

Re: [PATCH 2/6] dt-bindings: thermal: tsens: Add compatible for MSM8226

In reply to Matti Lehtimäki
Quoted 7 lines · Matti Lehtimäki

Qualcomm MSM8226 has tsens v0.1 block.

---
 Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 +
 1 file changed, 1 insertion(+)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.example.dtb: pcie-ep@33800000: Unevaluated properties are not allowed ('assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' were unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/rockchip-isp1.example.dtb: camera@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.example.dtb: camera-sensor@3c: port:endpoint:data-lanes: [[1]] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml

doc reference errors (make refcheckdocs):
Documentation/usb/gadget_uvc.rst: Documentation/userspace-api/media/v4l/pixfmt-packed.yuv.rst
MAINTAINERS: Documentation/devicetree/bindings/pwm/pwm-apple.yaml

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#11 lore raw

Re: [PATCH 2/6] dt-bindings: thermal: tsens: Add compatible for MSM8226

In reply to Matti Lehtimäki
Quoted 4 lines · Matti Lehtimäki

Qualcomm MSM8226 has tsens v0.1 block.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#12 lore raw

PATCH 3/6 thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

In reply to Matti Lehtimäki

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

---
 drivers/thermal/qcom/tsens-v0_1.c | 27 ++++++++++++++++++++++++++-
 drivers/thermal/qcom/tsens.c      |  3 +++
 drivers/thermal/qcom/tsens.h      |  2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens-v0_1.c +26 -1
index e89c6f39a3ae..ad57ab94546b 100644
@@ -243,6 +243,18 @@ static int calibrate_8974(struct tsens_priv *priv)
 	return 0;
 }
 
+static int __init init_8226(struct tsens_priv *priv)
+{
+	priv->sensor[0].slope = 2901;
+	priv->sensor[1].slope = 2846;
+	priv->sensor[2].slope = 3038;
+	priv->sensor[3].slope = 2955;
+	priv->sensor[4].slope = 2901;
+	priv->sensor[5].slope = 2846;
+
+	return init_common(priv);
+}
+
 static int __init init_8939(struct tsens_priv *priv) {
 	priv->sensor[0].slope = 2911;
 	priv->sensor[1].slope = 2789;
@@ -258,7 +270,7 @@ static int __init init_8939(struct tsens_priv *priv) {
 	return init_common(priv);
 }
 
-/* v0.1: 8916, 8939, 8974, 9607 */
+/* v0.1: 8226, 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
 	.ver_major	= VER_0_1,
@@ -313,6 +325,19 @@ static const struct tsens_ops ops_v0_1 = {
 	.get_temp	= get_temp_common,
 };
 
+static const struct tsens_ops ops_8226 = {
+	.init		= init_8226,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
+struct tsens_plat_data data_8226 = {
+	.num_sensors	= 6,
+	.ops		= &ops_8226,
+	.feat		= &tsens_v0_1_feat,
+	.fields	= tsens_v0_1_regfields,
+};
+
 static const struct tsens_ops ops_8916 = {
 	.init		= init_common,
 	.calibrate	= calibrate_8916,
drivers/thermal/qcom/tsens.c +3 -0
index 8020ead2794e..eb33a8bf0488 100644
@@ -1095,6 +1095,9 @@ static const struct of_device_id tsens_table[] = {
 	}, {
 		.compatible = "qcom,mdm9607-tsens",
 		.data = &data_9607,
+	}, {
+		.compatible = "qcom,msm8226-tsens",
+		.data = &data_8226,
 	}, {
 		.compatible = "qcom,msm8916-tsens",
 		.data = &data_8916,
drivers/thermal/qcom/tsens.h +1 -1
index dba9cd38f637..433eba370998 100644
@@ -635,7 +635,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp);
 extern struct tsens_plat_data data_8960;
 
 /* TSENS v0.1 targets */
-extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
+extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974, data_9607;
 
 /* TSENS v1 targets */
 extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
Signature · 1 line
2.34.1
Reviewed-by on v1 3/6
#13 lore raw

Re: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

Quoted 2 lines · On Sonntag, 7. Mai 2023 22:12:21 CEST Matti Lehtimäki wrote:

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

Matches the configuration found in msm8226-v2.dtsi in msm-3.10 kernel.

Quoted 88 lines
---
 drivers/thermal/qcom/tsens-v0_1.c | 27 ++++++++++++++++++++++++++-
 drivers/thermal/qcom/tsens.c      |  3 +++
 drivers/thermal/qcom/tsens.h      |  2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/thermal/qcom/tsens-v0_1.c index e89c6f39a3ae..ad57ab94546b 100644

drivers/thermal/qcom/tsens-v0_1.c +26 -1
@@ -243,6 +243,18 @@ static int calibrate_8974(struct tsens_priv *priv)
 	return 0;
 }
 
+static int __init init_8226(struct tsens_priv *priv)
+{
+	priv->sensor[0].slope = 2901;
+	priv->sensor[1].slope = 2846;
+	priv->sensor[2].slope = 3038;
+	priv->sensor[3].slope = 2955;
+	priv->sensor[4].slope = 2901;
+	priv->sensor[5].slope = 2846;
+
+	return init_common(priv);
+}
+
 static int __init init_8939(struct tsens_priv *priv) {
 	priv->sensor[0].slope = 2911;
 	priv->sensor[1].slope = 2789;
@@ -258,7 +270,7 @@ static int __init init_8939(struct tsens_priv *priv) {
 	return init_common(priv);
 }
 
-/* v0.1: 8916, 8939, 8974, 9607 */
+/* v0.1: 8226, 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
 	.ver_major	= VER_0_1,
@@ -313,6 +325,19 @@ static const struct tsens_ops ops_v0_1 = {
 	.get_temp	= get_temp_common,
 };
 
+static const struct tsens_ops ops_8226 = {
+	.init		= init_8226,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
+struct tsens_plat_data data_8226 = {
+	.num_sensors	= 6,
+	.ops		= &ops_8226,
+	.feat		= &tsens_v0_1_feat,
+	.fields	= tsens_v0_1_regfields,
+};
+
 static const struct tsens_ops ops_8916 = {
 	.init		= init_common,
 	.calibrate	= calibrate_8916,
drivers/thermal/qcom/tsens.c +3 -0
index 8020ead2794e..eb33a8bf0488 100644
@@ -1095,6 +1095,9 @@ static const struct of_device_id tsens_table[] = {
 	}, {
 		.compatible = "qcom,mdm9607-tsens",
 		.data = &data_9607,
+	}, {
+		.compatible = "qcom,msm8226-tsens",
+		.data = &data_8226,
 	}, {
 		.compatible = "qcom,msm8916-tsens",
 		.data = &data_8916,
drivers/thermal/qcom/tsens.h +1 -1
index dba9cd38f637..433eba370998 100644
@@ -635,7 +635,7 @@ int get_temp_common(const struct tsens_sensor *s, int
 *temp); extern struct tsens_plat_data data_8960;
 
 /* TSENS v0.1 targets */
-extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
+extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974,
 data_9607;
 
 /* TSENS v1 targets */

extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;

Reviewed-by on v1 3/6
#14 lore raw

Re: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

In reply to Matti Lehtimäki
Quoted 2 lines · Matti Lehtimäki

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

Note, the driver from 3.10 also provides custom data for non-calibrated mode. We can either ignore that (in the hope that all devices leaving the factory are calibrated), or fix it in the manner close to 8x74.

Quoted 87 lines
---
  drivers/thermal/qcom/tsens-v0_1.c | 27 ++++++++++++++++++++++++++-
  drivers/thermal/qcom/tsens.c      |  3 +++
  drivers/thermal/qcom/tsens.h      |  2 +-
  3 files changed, 30 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens-v0_1.c +26 -1
index e89c6f39a3ae..ad57ab94546b 100644
@@ -243,6 +243,18 @@ static int calibrate_8974(struct tsens_priv *priv)
  	return 0;
  }
 
+static int __init init_8226(struct tsens_priv *priv)
+{
+	priv->sensor[0].slope = 2901;
+	priv->sensor[1].slope = 2846;
+	priv->sensor[2].slope = 3038;
+	priv->sensor[3].slope = 2955;
+	priv->sensor[4].slope = 2901;
+	priv->sensor[5].slope = 2846;
+
+	return init_common(priv);
+}
+
  static int __init init_8939(struct tsens_priv *priv) {
  	priv->sensor[0].slope = 2911;
  	priv->sensor[1].slope = 2789;
@@ -258,7 +270,7 @@ static int __init init_8939(struct tsens_priv *priv) {
  	return init_common(priv);
  }
 
-/* v0.1: 8916, 8939, 8974, 9607 */
+/* v0.1: 8226, 8916, 8939, 8974, 9607 */
 
  static struct tsens_features tsens_v0_1_feat = {
  	.ver_major	= VER_0_1,
@@ -313,6 +325,19 @@ static const struct tsens_ops ops_v0_1 = {
  	.get_temp	= get_temp_common,
  };
 
+static const struct tsens_ops ops_8226 = {
+	.init		= init_8226,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
+struct tsens_plat_data data_8226 = {
+	.num_sensors	= 6,
+	.ops		= &ops_8226,
+	.feat		= &tsens_v0_1_feat,
+	.fields	= tsens_v0_1_regfields,
+};
+
  static const struct tsens_ops ops_8916 = {
  	.init		= init_common,
  	.calibrate	= calibrate_8916,
drivers/thermal/qcom/tsens.c +3 -0
index 8020ead2794e..eb33a8bf0488 100644
@@ -1095,6 +1095,9 @@ static const struct of_device_id tsens_table[] = {
  	}, {
  		.compatible = "qcom,mdm9607-tsens",
  		.data = &data_9607,
+	}, {
+		.compatible = "qcom,msm8226-tsens",
+		.data = &data_8226,
  	}, {
  		.compatible = "qcom,msm8916-tsens",
  		.data = &data_8916,
drivers/thermal/qcom/tsens.h +1 -1
index dba9cd38f637..433eba370998 100644
@@ -635,7 +635,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp);
  extern struct tsens_plat_data data_8960;
 
  /* TSENS v0.1 targets */
-extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
+extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974, data_9607;
 
  /* TSENS v1 targets */
  extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
Signature · 2 lines
With best wishes
Dmitry
#15 lore raw

Re: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

Quoted 7 lines · Dmitry Baryshkov
Quoted 2 lines · Matti Lehtimäki

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

Note, the driver from 3.10 also provides custom data for non-calibrated mode. We can either ignore that (in the hope that all devices leaving the factory are calibrated), or fix it in the manner close to 8x74.

That is true, 3.10 kernel does support non-calibrated mode. I can add support for that in a new version if that is wanted.

#16 lore raw

Re: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

Quoted 11 lines · Matti Lehtimäki
Quoted 7 lines · Dmitry Baryshkov
Quoted 2 lines · Matti Lehtimäki

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

Note, the driver from 3.10 also provides custom data for non-calibrated mode. We can either ignore that (in the hope that all devices leaving the factory are calibrated), or fix it in the manner close to 8x74.

That is true, 3.10 kernel does support non-calibrated mode. I can add support for that in a new version if that is wanted.

If there are no other comments, I'd suggest sending that as a follow up (if sending it at all). The tsens driver provides some default values for non-calibrated mode, so it is a minor issue.

Signature · 2 lines
With best wishes
Dmitry
#17 lore raw

Re: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226

In reply to Matti Lehtimäki
Quoted 5 lines · Matti Lehtimäki

The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#18 lore raw

PATCH 4/6 ARM: dts: msm8226: Add qfprom node

In reply to Matti Lehtimäki

Add missing QFPROM definition for MSM8226 SoC.

---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/qcom-msm8226.dtsi +7 -0
index c373081bc21b..c34b8f3139ae 100644
@@ -505,6 +505,13 @@ restart@fc4ab000 {
 			reg = <0xfc4ab000 0x4>;
 		};
 
+		qfprom: qfprom@fc4bc000 {
+			compatible = "qcom,msm8226-qfprom", "qcom,qfprom";
+			reg = <0xfc4bc000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+		};
+
 		spmi_bus: spmi@fc4cf000 {
 			compatible = "qcom,spmi-pmic-arb";
 			reg-names = "core", "intr", "cnfg";
Signature · 1 line
2.34.1
Reviewed-by on v1 4/6
#19 lore raw

Re: [PATCH 4/6] ARM: dts: msm8226: Add qfprom node

Quoted 3 lines · On Sonntag, 7. Mai 2023 22:12:22 CEST Matti Lehtimäki wrote:

Add missing QFPROM definition for MSM8226 SoC.

Quoted 10 lines
---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/qcom-msm8226.dtsi index c373081bc21b..c34b8f3139ae 100644

arch/arm/boot/dts/qcom-msm8226.dtsi restart@fc4ab000 { · line 509

Quoted 5 lines
arch/arm/boot/dts/qcom-msm8226.dtsi +2 -0
@@ -505,6 +505,13 @@ restart@fc4ab000 {
 			reg = <0xfc4ab000 0x4>;
 		};
 
+		qfprom: qfprom@fc4bc000 {
+			compatible = "qcom,msm8226-qfprom", 

"qcom,qfprom";

Quoted 8 lines
arch/arm/boot/dts/qcom-msm8226.dtsi +5 -0
+			reg = <0xfc4bc000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+		};
+
 		spmi_bus: spmi@fc4cf000 {
 			compatible = "qcom,spmi-pmic-arb";
 			reg-names = "core", "intr", "cnfg";
#21 lore raw

Re: [PATCH 4/6] ARM: dts: msm8226: Add qfprom node

In reply to Matti Lehtimäki
Quoted 12 lines · Matti Lehtimäki

Add missing QFPROM definition for MSM8226 SoC.

---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/qcom-msm8226.dtsi +0 -0
index c373081bc21b..c34b8f3139ae 100644

arch/arm/boot/dts/qcom-msm8226.dtsi restart@fc4ab000 { · line 508

Quoted 4 lines
arch/arm/boot/dts/qcom-msm8226.dtsi +1 -0
@@ -505,6 +505,13 @@ restart@fc4ab000 {
 			reg = <0xfc4ab000 0x4>;
 		};
 
+		qfprom: qfprom@fc4bc000 {

We usually call this efuse@

qfprom is Qualcomm specific.

Best regards,
Krzysztof

#22 lore raw

Re: [PATCH 4/6] ARM: dts: msm8226: Add qfprom node

Quoted 17 lines · Krzysztof Kozlowski
Quoted 15 lines · Matti Lehtimäki

Add missing QFPROM definition for MSM8226 SoC.

---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/qcom-msm8226.dtsi +0 -0
index c373081bc21b..c34b8f3139ae 100644
@@ -505,6 +505,13 @@ restart@fc4ab000 {
                      reg = <0xfc4ab000 0x4>;
              };
 
Quoted 3 lines

arch/arm/boot/dts/qcom-msm8226.dtsi restart@fc4ab000 { · line 508

Quoted 1 line
arch/arm/boot/dts/qcom-msm8226.dtsi +1 -0
+             qfprom: qfprom@fc4bc000 {

We usually call this efuse@

We have 5 efuse@ and 14 qfprom@ (next/master). But that probably means that we should rename existing qfprom@ to efuse@.

Quoted 6 lines

qfprom is Qualcomm specific.

Best regards,
Krzysztof

Signature · 2 lines
With best wishes
Dmitry
#23 lore raw

PATCH 5/6 ARM: dts: msm8226: Add tsens node and related nvmem cells

In reply to Matti Lehtimäki

Specify pre-parsed per-sensor calibration nvmem cells in the qfprom device node rather than parsing the whole data blob in the driver.

---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 113 ++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
arch/arm/boot/dts/qcom-msm8226.dtsi +113 -0
index c34b8f3139ae..a0c3d25eea65 100644
@@ -500,6 +500,34 @@ data-pins {
 			};
 		};
 
+		tsens: thermal-sensor@fc4a9000 {
+			compatible = "qcom,msm8226-tsens", "qcom,tsens-v0_1";
+			reg = <0xfc4a9000 0x1000>, /* TM */
+			      <0xfc4a8000 0x1000>; /* SROT */
+			nvmem-cells = <&tsens_mode>,
+				      <&tsens_base1>, <&tsens_base2>,
+				      <&tsens_s0_p1>, <&tsens_s0_p2>,
+				      <&tsens_s1_p1>, <&tsens_s1_p2>,
+				      <&tsens_s2_p1>, <&tsens_s2_p2>,
+				      <&tsens_s3_p1>, <&tsens_s3_p2>,
+				      <&tsens_s4_p1>, <&tsens_s4_p2>,
+				      <&tsens_s5_p1>, <&tsens_s5_p2>,
+				      <&tsens_s6_p1>, <&tsens_s6_p2>;
+			nvmem-cell-names = "mode",
+					   "base1", "base2",
+					   "s0_p1", "s0_p2",
+					   "s1_p1", "s1_p2",
+					   "s2_p1", "s2_p2",
+					   "s3_p1", "s3_p2",
+					   "s4_p1", "s4_p2",
+					   "s5_p1", "s5_p2",
+					   "s6_p1", "s6_p2";
+			#qcom,sensors = <6>;
+			interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "uplow";
+			#thermal-sensor-cells = <1>;
+		};
+
 		restart@fc4ab000 {
 			compatible = "qcom,pshold";
 			reg = <0xfc4ab000 0x4>;
@@ -510,6 +538,91 @@ qfprom: qfprom@fc4bc000 {
 			reg = <0xfc4bc000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
+
+			tsens_base1: base1@1c1 {
+				reg = <0x1c1 0x2>;
+				bits = <5 8>;
+			};
+
+			tsens_s0_p1: s0-p1@1c2 {
+				reg = <0x1c2 0x2>;
+				bits = <5 6>;
+			};
+
+			tsens_s1_p1: s1-p1@1c4 {
+				reg = <0x1c4 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s2_p1: s2-p1@1c4 {
+				reg = <0x1c4 0x2>;
+				bits = <6 6>;
+			};
+
+			tsens_s3_p1: s3-p1@1c5 {
+				reg = <0x1c5 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s4_p1: s4-p1@1c6 {
+				reg = <0x1c6 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s5_p1: s5-p1@1c7 {
+				reg = <0x1c7 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s6_p1: s6-p1@1ca {
+				reg = <0x1ca 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_base2: base2@1cc {
+				reg = <0x1cc 0x1>;
+				bits = <0 8>;
+			};
+
+			tsens_s0_p2: s0-p2@1cd {
+				reg = <0x1cd 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s1_p2: s1-p2@1cd {
+				reg = <0x1cd 0x2>;
+				bits = <6 6>;
+			};
+
+			tsens_s2_p2: s2-p2@1ce {
+				reg = <0x1ce 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s3_p2: s3-p2@1cf {
+				reg = <0x1cf 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s4_p2: s4-p2@446 {
+				reg = <0x446 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s5_p2: s5-p2@447 {
+				reg = <0x447 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s6_p2: s6-p2@44e {
+				reg = <0x44e 0x1>;
+				bits = <1 6>;
+			};
+
+			tsens_mode: mode@44f {
+				reg = <0x44f 0x1>;
+				bits = <5 3>;
+			};
 		};
 
 		spmi_bus: spmi@fc4cf000 {
Signature · 1 line
2.34.1
Reviewed-by on v1 5/6
#24 lore raw

Re: [PATCH 5/6] ARM: dts: msm8226: Add tsens node and related nvmem cells

Quoted 2 lines · On Sonntag, 7. Mai 2023 22:12:23 CEST Matti Lehtimäki wrote:

Specify pre-parsed per-sensor calibration nvmem cells in the qfprom device node rather than parsing the whole data blob in the driver.

I haven't double checked all the qfprom offsets but since you verified it twice on your side, I believe you ;)

Quoted 138 lines
---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 113 ++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/qcom-msm8226.dtsi index c34b8f3139ae..a0c3d25eea65 100644

arch/arm/boot/dts/qcom-msm8226.dtsi +113 -0
@@ -500,6 +500,34 @@ data-pins {
 			};
 		};
 
+		tsens: thermal-sensor@fc4a9000 {
+			compatible = "qcom,msm8226-tsens", "qcom,tsens-v0_1";
+			reg = <0xfc4a9000 0x1000>, /* TM */
+			      <0xfc4a8000 0x1000>; /* SROT */
+			nvmem-cells = <&tsens_mode>,
+				      <&tsens_base1>, <&tsens_base2>,
+				      <&tsens_s0_p1>, <&tsens_s0_p2>,
+				      <&tsens_s1_p1>, <&tsens_s1_p2>,
+				      <&tsens_s2_p1>, <&tsens_s2_p2>,
+				      <&tsens_s3_p1>, <&tsens_s3_p2>,
+				      <&tsens_s4_p1>, <&tsens_s4_p2>,
+				      <&tsens_s5_p1>, <&tsens_s5_p2>,
+				      <&tsens_s6_p1>, <&tsens_s6_p2>;
+			nvmem-cell-names = "mode",
+					   "base1", "base2",
+					   "s0_p1", "s0_p2",
+					   "s1_p1", "s1_p2",
+					   "s2_p1", "s2_p2",
+					   "s3_p1", "s3_p2",
+					   "s4_p1", "s4_p2",
+					   "s5_p1", "s5_p2",
+					   "s6_p1", "s6_p2";
+			#qcom,sensors = <6>;
+			interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "uplow";
+			#thermal-sensor-cells = <1>;
+		};
+
 		restart@fc4ab000 {
 			compatible = "qcom,pshold";
 			reg = <0xfc4ab000 0x4>;
@@ -510,6 +538,91 @@ qfprom: qfprom@fc4bc000 {
 			reg = <0xfc4bc000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
+
+			tsens_base1: base1@1c1 {
+				reg = <0x1c1 0x2>;
+				bits = <5 8>;
+			};
+
+			tsens_s0_p1: s0-p1@1c2 {
+				reg = <0x1c2 0x2>;
+				bits = <5 6>;
+			};
+
+			tsens_s1_p1: s1-p1@1c4 {
+				reg = <0x1c4 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s2_p1: s2-p1@1c4 {
+				reg = <0x1c4 0x2>;
+				bits = <6 6>;
+			};
+
+			tsens_s3_p1: s3-p1@1c5 {
+				reg = <0x1c5 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s4_p1: s4-p1@1c6 {
+				reg = <0x1c6 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s5_p1: s5-p1@1c7 {
+				reg = <0x1c7 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s6_p1: s6-p1@1ca {
+				reg = <0x1ca 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_base2: base2@1cc {
+				reg = <0x1cc 0x1>;
+				bits = <0 8>;
+			};
+
+			tsens_s0_p2: s0-p2@1cd {
+				reg = <0x1cd 0x1>;
+				bits = <0 6>;
+			};
+
+			tsens_s1_p2: s1-p2@1cd {
+				reg = <0x1cd 0x2>;
+				bits = <6 6>;
+			};
+
+			tsens_s2_p2: s2-p2@1ce {
+				reg = <0x1ce 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s3_p2: s3-p2@1cf {
+				reg = <0x1cf 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s4_p2: s4-p2@446 {
+				reg = <0x446 0x2>;
+				bits = <4 6>;
+			};
+
+			tsens_s5_p2: s5-p2@447 {
+				reg = <0x447 0x1>;
+				bits = <2 6>;
+			};
+
+			tsens_s6_p2: s6-p2@44e {
+				reg = <0x44e 0x1>;
+				bits = <1 6>;
+			};
+
+			tsens_mode: mode@44f {
+				reg = <0x44f 0x1>;
+				bits = <5 3>;
+			};
 		};
 
 		spmi_bus: spmi@fc4cf000 {
Reviewed-by on v1 5/6
#25 lore raw

Re: [PATCH 5/6] ARM: dts: msm8226: Add tsens node and related nvmem cells

In reply to Matti Lehtimäki
Quoted 7 lines · Matti Lehtimäki

Specify pre-parsed per-sensor calibration nvmem cells in the qfprom device node rather than parsing the whole data blob in the driver.

---
  arch/arm/boot/dts/qcom-msm8226.dtsi | 113 ++++++++++++++++++++++++++++
  1 file changed, 113 insertions(+)

I did not manually check all the offsets, but they look sane to me.

Signature · 2 lines
With best wishes
Dmitry
#26 lore raw

PATCH 6/6 ARM: dts: msm8226: Add thermal zones node

In reply to Matti Lehtimäki

Add thermal zones present on MSM8226 SoC.

---
 arch/arm/boot/dts/qcom-msm8226.dtsi | 44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm/boot/dts/qcom-msm8226.dtsi +44 -0
index a0c3d25eea65..f68556b15183 100644
@@ -752,6 +752,50 @@ smd-edge {
 		};
 	};
 
+	thermal-zones {
+		cpu0-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 5>;
+
+			trips {
+				cpu_alert0: trip0 {
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit0: trip1 {
+					temperature = <110000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu1-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 2>;
+
+			trips {
+				cpu_alert1: trip0 {
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit1: trip1 {
+					temperature = <110000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 2
Signature · 1 line
2.34.1
#28 lore raw

Re: (subset) [PATCH 0/6] Enable MSM8226 TSENS support

In reply to Matti Lehtimäki
Quoted 11 lines · Matti Lehtimäki

Add support for tsens in MSM8226. Add qfprom compatible for MSM8226. Add device tree nodes for qfprom, tsens and thermal zones for MSM8226.

Matti Lehtimäki (6):
dt-bindings: nvmem: qfprom: Add compatible for MSM8226
dt-bindings: thermal: tsens: Add compatible for MSM8226 thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226
ARM: dts: msm8226: Add qfprom node
ARM: dts: msm8226: Add tsens node and related nvmem cells
ARM: dts: msm8226: Add thermal zones node

Quoted 1 line

[...]

Applied, thanks!

[4/6] ARM: dts: msm8226: Add qfprom node

      commit: 16a9fa7ab27b69be3a34b97ff8c7b034fcc73b88
[5/6] ARM: dts: msm8226: Add tsens node and related nvmem cells
      commit: 0f8861c9fc7cc9af6d6f65d6657aa9cf2531b29c
[6/6] ARM: dts: msm8226: Add thermal zones node
      commit: 8d4236f62f3acbc6a0def79106c13fe7344d8238

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>