Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: "Matti Lehtimäki" <matti.lehtimaki@gmail.com>
To: linux-arm-msm@vger.kernel.org
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org,
	"Matti Lehtimäki" <matti.lehtimaki@gmail.com>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konrad.dybcio@linaro.org>,
	"Amit Kucheria" <amitk@kernel.org>,
	"Thara Gopinath" <thara.gopinath@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226
Date: Sun,  7 May 2023 23:12:21 +0300	[thread overview]
Message-ID: <20230507201225.89694-4-matti.lehtimaki@gmail.com> (raw)
In-Reply-To: <20230507201225.89694-1-matti.lehtimaki@gmail.com>

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

Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
---
 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(-)

diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index e89c6f39a3ae..ad57ab94546b 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -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,
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 8020ead2794e..eb33a8bf0488 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -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,
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index dba9cd38f637..433eba370998 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -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;
-- 
2.34.1


  parent reply	other threads:[~2023-05-07 20:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07 20:12 [PATCH 0/6] Enable MSM8226 TSENS support Matti Lehtimäki
2023-05-07 20:12 ` [PATCH 1/6] dt-bindings: nvmem: qfprom: Add compatible for MSM8226 Matti Lehtimäki
2023-05-07 20:19   ` Luca Weiss
2023-05-07 21:25   ` Rob Herring
2023-05-08  9:04     ` Konrad Dybcio
2023-05-10 13:57   ` Krzysztof Kozlowski
2023-07-13 10:11   ` Srinivas Kandagatla
2023-05-07 20:12 ` [PATCH 2/6] dt-bindings: thermal: tsens: " Matti Lehtimäki
2023-05-07 20:22   ` Luca Weiss
2023-05-07 21:25   ` Rob Herring
2023-05-10 13:57   ` Krzysztof Kozlowski
2023-06-05 14:39   ` Daniel Lezcano
2023-05-07 20:12 ` Matti Lehtimäki [this message]
2023-05-07 20:26   ` [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support " Luca Weiss
2023-05-07 20:40   ` Dmitry Baryshkov
2023-05-07 21:11     ` Matti Lehtimäki
2023-05-07 22:49       ` Dmitry Baryshkov
2023-06-05 14:39   ` Daniel Lezcano
2023-05-07 20:12 ` [PATCH 4/6] ARM: dts: msm8226: Add qfprom node Matti Lehtimäki
2023-05-07 20:27   ` Luca Weiss
2023-05-07 20:50   ` Dmitry Baryshkov
2023-05-10 13:58   ` Krzysztof Kozlowski
2023-05-10 14:14     ` Dmitry Baryshkov
2023-05-07 20:12 ` [PATCH 5/6] ARM: dts: msm8226: Add tsens node and related nvmem cells Matti Lehtimäki
2023-05-07 20:31   ` Luca Weiss
2023-05-07 20:41   ` Dmitry Baryshkov
2023-05-07 20:12 ` [PATCH 6/6] ARM: dts: msm8226: Add thermal zones node Matti Lehtimäki
2023-05-07 20:48   ` Dmitry Baryshkov
2023-06-13 23:48 ` (subset) [PATCH 0/6] Enable MSM8226 TSENS support Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230507201225.89694-4-matti.lehtimaki@gmail.com \
    --to=matti.lehtimaki@gmail.com \
    --cc=agross@kernel.org \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox