diff mbox series

[v4,08/20] thermal/drivers/tsens: fix slope values for msm8939

Message ID 20221221020520.1326964-9-dmitry.baryshkov@linaro.org (mailing list archive)
State Superseded, archived
Delegated to: Daniel Lezcano
Headers show
Series thermal/drivers/tsens: specify nvmem cells in DT rather than parsing them manually | expand

Commit Message

Dmitry Baryshkov Dec. 21, 2022, 2:05 a.m. UTC
According to the vendor kernels (msm-3.10, 3.14 and 3.18), msm8939
uses non-standard slope values for calibrating the sensors. Fill them
accordingly.

Fixes: 332bc8ebab2c ("thermal: qcom: tsens-v0_1: Add support for MSM8939")
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/thermal/qcom/tsens-v0_1.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Konrad Dybcio Dec. 21, 2022, 8:14 p.m. UTC | #1
On 21.12.2022 03:05, Dmitry Baryshkov wrote:
> According to the vendor kernels (msm-3.10, 3.14 and 3.18), msm8939
> uses non-standard slope values for calibrating the sensors. Fill them
> accordingly.
> 
> Fixes: 332bc8ebab2c ("thermal: qcom: tsens-v0_1: Add support for MSM8939")
> Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/thermal/qcom/tsens-v0_1.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
> index 57ac23f9d9b7..be173220a939 100644
> --- a/drivers/thermal/qcom/tsens-v0_1.c
> +++ b/drivers/thermal/qcom/tsens-v0_1.c
> @@ -534,6 +534,20 @@ static int calibrate_9607(struct tsens_priv *priv)
>  	return 0;
>  }
>  
> +static int __init init_8939(struct tsens_priv *priv) {
> +	priv->sensor[0].slope = 2911;
> +	priv->sensor[1].slope = 2789;
> +	priv->sensor[2].slope = 2906;
> +	priv->sensor[3].slope = 2763;
> +	priv->sensor[4].slope = 2922;
> +	priv->sensor[5].slope = 2867;
> +	priv->sensor[6].slope = 2833;
> +	priv->sensor[7].slope = 2838;
> +	priv->sensor[8].slope = 2840;
> +
> +	return init_common(priv);
> +}
> +
>  /* v0.1: 8916, 8939, 8974, 9607 */
>  
>  static struct tsens_features tsens_v0_1_feat = {
> @@ -599,7 +613,7 @@ struct tsens_plat_data data_8916 = {
>  };
>  
>  static const struct tsens_ops ops_8939 = {
> -	.init		= init_common,
> +	.init		= init_8939,
>  	.calibrate	= calibrate_8939,
>  	.get_temp	= get_temp_common,
>  };
diff mbox series

Patch

diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index 57ac23f9d9b7..be173220a939 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -534,6 +534,20 @@  static int calibrate_9607(struct tsens_priv *priv)
 	return 0;
 }
 
+static int __init init_8939(struct tsens_priv *priv) {
+	priv->sensor[0].slope = 2911;
+	priv->sensor[1].slope = 2789;
+	priv->sensor[2].slope = 2906;
+	priv->sensor[3].slope = 2763;
+	priv->sensor[4].slope = 2922;
+	priv->sensor[5].slope = 2867;
+	priv->sensor[6].slope = 2833;
+	priv->sensor[7].slope = 2838;
+	priv->sensor[8].slope = 2840;
+
+	return init_common(priv);
+}
+
 /* v0.1: 8916, 8939, 8974, 9607 */
 
 static struct tsens_features tsens_v0_1_feat = {
@@ -599,7 +613,7 @@  struct tsens_plat_data data_8916 = {
 };
 
 static const struct tsens_ops ops_8939 = {
-	.init		= init_common,
+	.init		= init_8939,
 	.calibrate	= calibrate_8939,
 	.get_temp	= get_temp_common,
 };