From patchwork Mon Aug 27 04:28:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: durgadoss.r@intel.com X-Patchwork-Id: 1376261 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id AB88A3FC71 for ; Mon, 27 Aug 2012 04:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751291Ab2H0E3d (ORCPT ); Mon, 27 Aug 2012 00:29:33 -0400 Received: from mga09.intel.com ([134.134.136.24]:4000 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771Ab2H0E3c (ORCPT ); Mon, 27 Aug 2012 00:29:32 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 26 Aug 2012 21:29:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,318,1344236400"; d="scan'208";a="191657132" Received: from dr3-desktop.iind.intel.com ([10.223.107.36]) by orsmga002.jf.intel.com with ESMTP; 26 Aug 2012 21:29:30 -0700 From: Durgadoss R To: lenb@kernel.org, rui.zhang@intel.com Cc: linux-acpi@vger.kernel.org, eduardo.valentin@ti.com, Durgadoss R Subject: [PATCHv2 14/14] Thermal: Platform layer changes to provide thermal data Date: Mon, 27 Aug 2012 09:58:26 +0530 Message-Id: <1346041706-29642-15-git-send-email-durgadoss.r@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346041706-29642-1-git-send-email-durgadoss.r@intel.com> References: <1346041706-29642-1-git-send-email-durgadoss.r@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org This patch shows how can we add platform specific thermal data required by the thermal framework. This is just an example patch, and _not_ for merge. Signed-off-by: Durgadoss R --- arch/x86/platform/mrst/mrst.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index fd41a92..91587bf 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -78,6 +79,37 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; EXPORT_SYMBOL_GPL(sfi_mrtc_array); int sfi_mrtc_num; +static int thermal_match(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev) +{ + if (!strcmp(tz->type, "CPU")) { + if (!strcmp(cdev->type, "CPU") || + !strcmp(cdev->type, "Battery")) + return 0; + } + return 1; +} + +static struct thermal_bind_params tz_cpu_params[2] = { + {.cdev = NULL, + .weight = 80, + .trip_mask = 0x0F, + .match = thermal_match, }, + + { .cdev = NULL, + .weight = 80, + .trip_mask = 0x0F, + .match = thermal_match, }, + }; + +#define MRST_THERMAL_ZONES 1 +struct thermal_zone_params tzp[MRST_THERMAL_ZONES] = { + { .zone_name = "CPU", + .throttle_policy = THERMAL_FAIR_SHARE, + .num_tbps = 2, + .tbp = tz_cpu_params, } +}; + static void mrst_power_off(void) { } @@ -983,10 +1015,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);