All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abhilash Kesavan <a.kesavan@samsung.com>
To: rui.zhang@intel.com, edubezval@gmail.com, linux-pm@vger.kernel.org
Cc: b.zolnierkie@samsung.com, amit.daniel@samsung.com,
	kesavan.abhilash@gmail.com
Subject: [PATCH 3/4] thermal: exynos: modify the prototype for code_to_temp function
Date: Fri, 14 Nov 2014 16:48:01 +0530	[thread overview]
Message-ID: <1415963882-3460-4-git-send-email-a.kesavan@samsung.com> (raw)
In-Reply-To: <1415963882-3460-1-git-send-email-a.kesavan@samsung.com>

Exynos7 has a 9 bit code associated with a temperature as against
8 bits used in earlier SoCs. Modify the code_to_temp function to
support this.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
---
 drivers/thermal/samsung/exynos_tmu.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 49d3bcb..9695638 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -64,7 +64,7 @@ struct exynos_tmu_data {
 	struct work_struct irq_work;
 	struct mutex lock;
 	struct clk *clk, *clk_sec, *sclk;
-	u8 temp_error1, temp_error2;
+	u16 temp_error1, temp_error2;
 	struct regulator *regulator;
 	struct thermal_sensor_conf *reg_conf;
 };
@@ -100,7 +100,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp)
  * Calculate a temperature value from a temperature code.
  * The unit of the temperature is degree Celsius.
  */
-static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code)
+static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code)
 {
 	struct exynos_tmu_platform_data *pdata = data->pdata;
 	int temp;
@@ -336,13 +336,14 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
 {
 	struct exynos_tmu_platform_data *pdata = data->pdata;
 	const struct exynos_tmu_registers *reg = pdata->registers;
-	u8 temp_code;
+	u16 temp_code;
 	int temp;
 
 	mutex_lock(&data->lock);
 	clk_enable(data->clk);
 
-	temp_code = readb(data->base + reg->tmu_cur_temp);
+	temp_code = readw(data->base + reg->tmu_cur_temp);
+	temp_code &= reg->triminfo_mask;
 
 	if (data->soc == SOC_ARCH_EXYNOS4210)
 		/* temp_code should range between 75 and 175 */
-- 
1.7.9.5


  parent reply	other threads:[~2014-11-14 11:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 11:17 [PATCH 0/4] Add TMU support for Exynos7 Abhilash Kesavan
2014-11-14 11:17 ` [PATCH 1/4] thermal: exynos: add optional sclk support Abhilash Kesavan
2014-11-14 11:18 ` [PATCH 2/4] thermal: exynos: add a triminfo_mask field in exynos_tmu_register structure Abhilash Kesavan
2014-11-14 11:18 ` Abhilash Kesavan [this message]
2014-11-14 11:18 ` [PATCH 4/4] thermal: exynos: Add TMU support for Exynos7 SoC Abhilash Kesavan
2014-11-14 12:19 ` [PATCH 0/4] Add TMU support for Exynos7 Bartlomiej Zolnierkiewicz
2014-11-14 12:30   ` Abhilash Kesavan
2014-11-14 13:02     ` Lukasz Majewski
2014-11-14 14:07       ` Abhilash Kesavan
2014-11-14 14:50         ` Lukasz Majewski
2014-11-18  8:08         ` Lukasz Majewski
2014-11-18  8:14           ` Abhilash Kesavan
2014-11-19 13:18             ` Eduardo Valentin
2014-11-20 13:05               ` Abhilash Kesavan
2014-11-20 13:22                 ` Lukasz Majewski
2014-11-20 14:49                   ` Abhilash Kesavan
2014-11-22  7:45                     ` Abhilash Kesavan
2014-11-24  9:24                       ` Lukasz Majewski
2014-11-24 10:50                         ` Abhilash Kesavan
2014-11-24 11:04                           ` Lukasz Majewski
2014-11-24 11:09                             ` Abhilash Kesavan

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=1415963882-3460-4-git-send-email-a.kesavan@samsung.com \
    --to=a.kesavan@samsung.com \
    --cc=amit.daniel@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=edubezval@gmail.com \
    --cc=kesavan.abhilash@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /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.