diff mbox series

[v3,2/6] thermal: qcom: tsens-v0_1: Fix mdm9607 slope values

Message ID 20230315103950.2679317-3-stephan.gerhold@kernkonzept.com
State Superseded
Headers show
Series thermal: qcom: tsens: Fix MDM9607, add MSM8909 | expand

Commit Message

Stephan Gerhold March 15, 2023, 10:39 a.m. UTC
According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses
a non-standard slope value of 3000 (instead of 3200) for all sensors.
Fill it properly similar to the 8939 code added recently.

[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875

Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607")
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
---
Changes in v3: Drop now unused ops_v0_1 definition
Changes in v2: New patch
---
 drivers/thermal/qcom/tsens-v0_1.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

Comments

Konrad Dybcio March 17, 2023, 12:39 a.m. UTC | #1
On 15.03.2023 11:39, Stephan Gerhold wrote:
> According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses
> a non-standard slope value of 3000 (instead of 3200) for all sensors.
> Fill it properly similar to the 8939 code added recently.
> 
> [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875
> 
FWIW there's a 4.9 release for 9607

https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.2.3.6.c5-03900-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi
> Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
> Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607")
> Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
> Changes in v3: Drop now unused ops_v0_1 definition
> Changes in v2: New patch
> ---
>  drivers/thermal/qcom/tsens-v0_1.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
> index 106d26076e3f..1b454de3928d 100644
> --- a/drivers/thermal/qcom/tsens-v0_1.c
> +++ b/drivers/thermal/qcom/tsens-v0_1.c
> @@ -222,6 +222,16 @@ static int __init init_8939(struct tsens_priv *priv) {
>  	return init_common(priv);
>  }
>  
> +static int __init init_9607(struct tsens_priv *priv)
> +{
> +	int i;
> +
> +	for (i = 0; i < priv->num_sensors; ++i)
> +		priv->sensor[i].slope = 3000;
> +
> +	return init_common(priv);
> +}
> +
>  /* v0.1: 8916, 8939, 8974, 9607 */
>  
>  static struct tsens_features tsens_v0_1_feat = {
> @@ -271,12 +281,6 @@ static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
>  	[TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
>  };
>  
> -static const struct tsens_ops ops_v0_1 = {
> -	.init		= init_common,
> -	.calibrate	= tsens_calibrate_common,
> -	.get_temp	= get_temp_common,
> -};
> -
>  static const struct tsens_ops ops_8916 = {
>  	.init		= init_common,
>  	.calibrate	= calibrate_8916,
> @@ -320,9 +324,15 @@ struct tsens_plat_data data_8974 = {
>  	.fields	= tsens_v0_1_regfields,
>  };
>  
> +static const struct tsens_ops ops_9607 = {
> +	.init		= init_9607,
> +	.calibrate	= tsens_calibrate_common,
> +	.get_temp	= get_temp_common,
> +};
> +
>  struct tsens_plat_data data_9607 = {
>  	.num_sensors	= 5,
> -	.ops		= &ops_v0_1,
> +	.ops		= &ops_9607,
>  	.feat		= &tsens_v0_1_feat,
>  	.fields	= tsens_v0_1_regfields,
>  };
Stephan Gerhold March 17, 2023, 3:07 p.m. UTC | #2
On Fri, Mar 17, 2023 at 01:39:25AM +0100, Konrad Dybcio wrote:
> On 15.03.2023 11:39, Stephan Gerhold wrote:
> > According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses
> > a non-standard slope value of 3000 (instead of 3200) for all sensors.
> > Fill it properly similar to the 8939 code added recently.
> > 
> > [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875
> > 
> FWIW there's a 4.9 release for 9607
> 
> https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.2.3.6.c5-03900-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi

You seem to have linked 3.18 too?

I don't see tsens support for mdm9607 in msm-4.9, although maybe I'm
looking at the wrong branch. :D

Thanks,
Stephan
Konrad Dybcio March 17, 2023, 5:37 p.m. UTC | #3
On 17.03.2023 16:07, Stephan Gerhold wrote:
> On Fri, Mar 17, 2023 at 01:39:25AM +0100, Konrad Dybcio wrote:
>> On 15.03.2023 11:39, Stephan Gerhold wrote:
>>> According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses
>>> a non-standard slope value of 3000 (instead of 3200) for all sensors.
>>> Fill it properly similar to the 8939 code added recently.
>>>
>>> [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875
>>>
>> FWIW there's a 4.9 release for 9607
>>
>> https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.2.3.6.c5-03900-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi
> 
> You seem to have linked 3.18 too?
> 
> I don't see tsens support for mdm9607 in msm-4.9, although maybe I'm
> looking at the wrong branch. :D
Yeah wrong link

and wrong kernel, it's actually 4.14

https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/637e99f66c270385149d1f0041758c24c4f84aaf/arch/arm64/boot/dts/qcom/mdm9607.dtsi

Konrad
> 
> Thanks,
> Stephan
diff mbox series

Patch

diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index 106d26076e3f..1b454de3928d 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -222,6 +222,16 @@  static int __init init_8939(struct tsens_priv *priv) {
 	return init_common(priv);
 }
 
+static int __init init_9607(struct tsens_priv *priv)
+{
+	int i;
+
+	for (i = 0; i < priv->num_sensors; ++i)
+		priv->sensor[i].slope = 3000;
+
+	return init_common(priv);
+}
+
 /* v0.1: 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
@@ -271,12 +281,6 @@  static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
 	[TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
 };
 
-static const struct tsens_ops ops_v0_1 = {
-	.init		= init_common,
-	.calibrate	= tsens_calibrate_common,
-	.get_temp	= get_temp_common,
-};
-
 static const struct tsens_ops ops_8916 = {
 	.init		= init_common,
 	.calibrate	= calibrate_8916,
@@ -320,9 +324,15 @@  struct tsens_plat_data data_8974 = {
 	.fields	= tsens_v0_1_regfields,
 };
 
+static const struct tsens_ops ops_9607 = {
+	.init		= init_9607,
+	.calibrate	= tsens_calibrate_common,
+	.get_temp	= get_temp_common,
+};
+
 struct tsens_plat_data data_9607 = {
 	.num_sensors	= 5,
-	.ops		= &ops_v0_1,
+	.ops		= &ops_9607,
 	.feat		= &tsens_v0_1_feat,
 	.fields	= tsens_v0_1_regfields,
 };