linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Durgadoss R <durgadoss.r@intel.com>
To: lenb@kernel.org, rui.zhang@intel.com
Cc: linux-acpi@vger.kernel.org, eduardo.valentin@ti.com,
	amit.kachhap@linaro.org, Durgadoss R <durgadoss.r@intel.com>
Subject: [PATCH 4/4] RFC Thermal: Platform layer changes to provide thermal data
Date: Mon, 11 Jun 2012 23:09:34 +0530	[thread overview]
Message-ID: <1339436374-26881-5-git-send-email-durgadoss.r@intel.com> (raw)
In-Reply-To: <1339436374-26881-1-git-send-email-durgadoss.r@intel.com>

This patch shows how can we add platform specific thermal data
required by the enhanced thermal framework.
This is just an example patch, and _not_ for merge.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
---
 arch/x86/platform/mrst/mrst.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index e31bcd8..eeb3cd0 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -30,6 +30,7 @@
 #include <linux/mfd/intel_msic.h>
 #include <linux/gpio.h>
 #include <linux/i2c/tc35876x.h>
+#include <linux/thermal.h>
 
 #include <asm/setup.h>
 #include <asm/mpspec_def.h>
@@ -78,6 +79,27 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
 EXPORT_SYMBOL_GPL(sfi_mrtc_array);
 int sfi_mrtc_num;
 
+#define MRST_THERMAL_ZONES	3
+struct thermal_zone_params tzp[MRST_THERMAL_ZONES] = {
+	{ .thermal_zone_name = "CPU",
+	.throttle_policy = THERMAL_FAIR_SHARE,
+	.num_cdevs = 2,
+	.cdevs_name = {"CPU", "Battery"},
+	.weights = {80, 20}, },
+
+	{ .thermal_zone_name = "Battery",
+	.throttle_policy = THERMAL_FAIR_SHARE,
+	.num_cdevs = 1,
+	.cdevs_name = {"Battery"},
+	.weights = {100}, },
+
+	{ .thermal_zone_name = "Skin",
+	.throttle_policy = THERMAL_FAIR_SHARE,
+	.num_cdevs = 2,
+	.cdevs_name = {"Display", "Battery"},
+	.weights = {50, 50}, }
+};
+
 static void mrst_power_off(void)
 {
 }
@@ -983,10 +1005,27 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 	return 0;
 }
 
+static int mrst_get_thermal_params(struct thermal_zone_device *tz)
+{
+	int i;
+
+	for (i = 0; i < MRST_THERMAL_ZONES; i++) {
+		if (!strcmp(tzp[i].thermal_zone_name, tz->type)) {
+			tz->tzp = &tzp[i];
+			return 0;
+		}
+	}
+	return -ENODEV;
+}
+
 static int __init mrst_platform_init(void)
 {
 	sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio);
 	sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs);
+
+	/* Set platform thermal data pointer */
+	get_platform_thermal_params = mrst_get_thermal_params;
+
 	return 0;
 }
 arch_initcall(mrst_platform_init);
-- 
1.7.0.4


  parent reply	other threads:[~2012-06-12  5:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11 17:39 [PATCH 0/4] Thermal Framework Enhancements Durgadoss R
2012-06-11 17:39 ` [PATCH 1/4] RFC Thermal: Enhance Generic Thermal layer with policies Durgadoss R
2012-06-12 12:46   ` Eduardo Valentin
2012-06-12 16:09     ` R, Durgadoss
2012-06-11 17:39 ` [PATCH 2/4] RFC Thermal: Introduce fair-share thermal governor Durgadoss R
2012-06-12 12:55   ` Eduardo Valentin
2012-06-12 14:49     ` R, Durgadoss
2012-06-11 17:39 ` [PATCH 3/4] RFC Thermal: Introduce a step-wise " Durgadoss R
2012-06-12 12:59   ` Eduardo Valentin
2012-06-12 14:46     ` R, Durgadoss
2012-06-11 17:39 ` Durgadoss R [this message]
2012-06-12 13:02   ` [PATCH 4/4] RFC Thermal: Platform layer changes to provide thermal data Eduardo Valentin
2012-06-12 14:40     ` R, Durgadoss
2012-06-12  7:44 ` [PATCH 0/4] Thermal Framework Enhancements Zhang Rui
2012-06-12  8:59   ` R, Durgadoss
2012-06-13  0:50     ` Zhang Rui
2012-06-12 13:12 ` Eduardo Valentin
2012-06-12 14:28   ` R, Durgadoss

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=1339436374-26881-5-git-send-email-durgadoss.r@intel.com \
    --to=durgadoss.r@intel.com \
    --cc=amit.kachhap@linaro.org \
    --cc=eduardo.valentin@ti.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).