All of lore.kernel.org
 help / color / mirror / Atom feed
From: prabhakar.mahadev-lad.rj@bp.renesas.com (Lad Prabhakar)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y-cip 03/12] thermal: rcar_thermal: update calculation formula for R-Car Gen3 SoCs
Date: Thu, 16 Jan 2020 15:11:13 +0000	[thread overview]
Message-ID: <1579187482-4626-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)
In-Reply-To: <1579187482-4626-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com>

From: Yoshihiro Kaneko <ykaneko0929@gmail.com>

commit 20386f0d84a22214d1f037dedfffb6709dd0117a upstream.

Update calculation for the R-Car Gen3 and RZ/G2 SoCs which have a
thermal IP block controlled by this driver. That is the:

* R-Car D3 (r8a77995)
* R-Car E2 (r8a77990)
* R-Car V3M (r8a77970)
* RZ/G2E (r8a774c0)

The calculation update is as documented in the R-Car Gen3 User's Manual,
v1.50 Nov 2018:

- When CTEMP is less than 24
   T = CTEMP[5:0] * 5.5 - 72
- When CTEMP is equal to/greater than 24
   T = CTEMP[5:0] * 5 - 60

This was inspired by a patch in the BSP by Van Do <van.do.xw@renesas.com>

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas S?derlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/thermal/rcar_thermal.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 5735e36..84baeb2 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -52,6 +52,7 @@ struct rcar_thermal_chip {
 	unsigned int irq_per_ch : 1;
 	unsigned int needs_suspend_resume : 1;
 	unsigned int nirqs;
+	unsigned int ctemp_bands;
 };
 
 static const struct rcar_thermal_chip rcar_thermal = {
@@ -60,6 +61,7 @@ static const struct rcar_thermal_chip rcar_thermal = {
 	.irq_per_ch = 0,
 	.needs_suspend_resume = 0,
 	.nirqs = 1,
+	.ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen2_thermal = {
@@ -68,6 +70,7 @@ static const struct rcar_thermal_chip rcar_gen2_thermal = {
 	.irq_per_ch = 0,
 	.needs_suspend_resume = 0,
 	.nirqs = 1,
+	.ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen3_thermal = {
@@ -80,6 +83,7 @@ static const struct rcar_thermal_chip rcar_gen3_thermal = {
 	 * interrupts to detect a temperature change, rise or fall.
 	 */
 	.nirqs = 2,
+	.ctemp_bands = 2,
 };
 
 struct rcar_thermal_priv {
@@ -255,7 +259,12 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
 		return ret;
 
 	mutex_lock(&priv->lock);
-	tmp =  MCELSIUS((priv->ctemp * 5) - 65);
+	if (priv->chip->ctemp_bands == 1)
+		tmp = MCELSIUS((priv->ctemp * 5) - 65);
+	else if (priv->ctemp < 24)
+		tmp = MCELSIUS(((priv->ctemp * 55) - 720) / 10);
+	else
+		tmp = MCELSIUS((priv->ctemp * 5) - 60);
 	mutex_unlock(&priv->lock);
 
 	if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
-- 
2.7.4

  parent reply	other threads:[~2020-01-16 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 15:11 [cip-dev] [PATCH 4.19.y-cip 00/12] Renesas RZ/G2E backport IPA support along with minor fixes Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 01/12] dt-bindings: can: rcar_can: document r8a77965 support Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 02/12] dt-bindings: can: rcar_can: Complete documentation for RZ/G2[EM] Lad Prabhakar
2020-01-16 15:11 ` Lad Prabhakar [this message]
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 04/12] arm64: dts: renesas: r8a774c0: Create thermal zone to support IPA Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 05/12] arm64: dts: renesas: r8a774c0: Add dynamic power coefficient Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 06/12] arm64: dts: renesas: r8a774c0: Clean up CPU compatibles Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 07/12] arm64: dts: renesas: r8a774c0: Add missing assigned-clocks for CAN[01] Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 08/12] arm64: dts: renesas: r8a774c0: Fix register range of display node Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 09/12] arm64: dts: renesas: Update 'vsps' properties for readability Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 10/12] arm64: dts: renesas: r8a774c0: cat874: Add definition for 12V regulator Lad Prabhakar
2020-01-16 15:29   ` Pavel Machek
2020-01-16 19:37     ` Prabhakar Mahadev Lad
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 11/12] arm64: dts: renesas: Use ip=on for bootargs Lad Prabhakar
2020-01-16 15:11 ` [cip-dev] [PATCH 4.19.y-cip 12/12] arm64: dts: renesas: r8a774c0: cat874: Sort nodes Lad Prabhakar
2020-01-16 15:25 ` [cip-dev] [PATCH 4.19.y-cip 00/12] Renesas RZ/G2E backport IPA support along with minor fixes Pavel Machek
2020-01-20  1:46   ` nobuhiro1.iwamatsu at toshiba.co.jp
2020-01-20  9:47     ` Pavel Machek

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=1579187482-4626-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.