From patchwork Fri Aug 7 07:09:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmctWWloIFdhbmcgKOeOi+W0h+aHvyk=?= X-Patchwork-Id: 505011 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D8E0C1402A0 for ; Fri, 7 Aug 2015 17:10:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=FysFStaX; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b=mTNAAf0E; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754002AbbHGHKB (ORCPT ); Fri, 7 Aug 2015 03:10:01 -0400 Received: from mail-yk0-f176.google.com ([209.85.160.176]:35623 "EHLO mail-yk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753451AbbHGHKA (ORCPT ); Fri, 7 Aug 2015 03:10:00 -0400 Received: by ykcq64 with SMTP id q64so77338262ykc.2 for ; Fri, 07 Aug 2015 00:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:cc:content-type; bh=J2Z3kyNgviBL5UzanJPhWgyjZG86j5aTp3PIlNGSUB8=; b=FysFStaXCd7jgk0eosdZB7/we2lKCZ4lj69sJeMGiWUTjbjmsWBEs6PLOSicblN6C9 0lpvNFWMdDQzW+V6+5iAUWu+zCXJQuKOg2wib1ZaAoLX3bNydCk4nXxE/fQdAPxSvi9e dZgdwmfKgXUPQ1XLk52mssA3EBbK3eHVEhE2+OVQNPfmfW4MLqeW/1WVRGo6kGTGImbH wE7iv9L2wYJ+0UbLHIf1e6XgD4koZg0DKI59WPAY75/9SzAtyalRBvaMfaubWnXvyttI Q4Rs41pskon1O5LsIqYJEUSuBtj9R/FL7oJqJJgR0ez3Qu2mg+JQsOUZhBIw7386d3iD WZCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:from:date:message-id:subject:to:cc:content-type; bh=J2Z3kyNgviBL5UzanJPhWgyjZG86j5aTp3PIlNGSUB8=; b=mTNAAf0Ej82IUNtdIxFp2J+ZW4riAjtyYOeLZ+WiZzt5z5zGjO11Cv7iYqrWzUiQe5 gUm0RwV+98SaBOv6MYKFVSJ/P6tA2uPZQKhBaBMw0jkaH/AFEvp2aXPU2Py81uvivpBQ 5Ksz7IbnFDKGU4lMiPxMUeVFISlF3SZNnIWek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:cc:content-type; bh=J2Z3kyNgviBL5UzanJPhWgyjZG86j5aTp3PIlNGSUB8=; b=MQZMNLD9VI58WBWvd2D2RRp6t4T8y6cTFk5WDtw7Lsji8jfKwTbxPnMLe8jAj//+6X 9etP1axv+WfN8mFDUlOH8PY1To1/HINZisVIWU9u4yayjS3YgiZJJZ2quBO0rYtxa8F/ 1eNkK5XB2mGPto3IeOHZBHLi9cqFQmBvJsZyWtTzhhU3VhvjzacaKzR4gyyVsSUXM9hw ylvmr1Knku7lH0kTMmOr1qXezfqpVy3QwokARBFMEFWTjJPoVRzp4QWe6m2B3LLotONS IeUCIpTDoogtxqwyMJEx46MNQTdTDhVscyaD+PS30iFKS9bfCzCMXtOKxNi0J1kzd3Q4 WwXw== X-Gm-Message-State: ALoCoQlsbscHQdrPLUOxDmWVsmzhfkeozueIWOyOjstJCsg/Z0mhZkkwDHGoIQ1nmvo5DuIBaOTN X-Received: by 10.129.51.14 with SMTP id z14mr6234494ywz.65.1438931399366; Fri, 07 Aug 2015 00:09:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.55.129 with HTTP; Fri, 7 Aug 2015 00:09:39 -0700 (PDT) From: =?UTF-8?B?Q2h1bmctWWloIFdhbmcgKOeOi+W0h+aHvyk=?= Date: Fri, 7 Aug 2015 15:09:39 +0800 X-Google-Sender-Auth: tJIEwNXlSJddZ9f0ntP4uUR2Glw Message-ID: Subject: [PATCH] thermal: of: Introduce governor selection in dts To: linux-kernel@vger.kernel.org Cc: Zhang Rui , Eduardo Valentin , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Chung-yih Wang Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org As there could be more thermal zones on a system and more variety in thermal governors provided in kernel, this patch provides flexibility of governor selection for a thermal zone declared in device tree. Change-Id: Ie4a75d762709cbbe9f1806dae325d13f71982e78 Signed-off-by: Chung-yih Wang --- Documentation/devicetree/bindings/thermal/thermal.txt | 9 +++++++++ drivers/thermal/of-thermal.c | 10 ++++++++++ 2 files changed, 19 insertions(+) -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/thermal/thermal.txt b/Documentation/devicetree/bindings/thermal/thermal.txt index 8a49362..30a5d41 100644 --- a/Documentation/devicetree/bindings/thermal/thermal.txt +++ b/Documentation/devicetree/bindings/thermal/thermal.txt @@ -174,6 +174,13 @@ Optional property: 2000mW, while on a 10'' tablet is around 4500mW. +- thermal-governor-name: The name of governor used to control the + thermal zone instead of the default one + specified in kernel config. For reference, if + default governor is step_wise, one could + select power_allocator for cpu_thermal zone + in dts. + Note: The delay properties are bound to the maximum dT/dt (temperature derivative over time) in two situations for a thermal zone: (i) - when passive cooling is activated (polling-delay-passive); and @@ -555,6 +562,8 @@ thermal-zones { sustainable-power = <2500>; + thermal-governor-name = "power_allocator"; + trips { /* Trips are based on resulting linear equation */ cpu_trip: cpu-trip { diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index b295b2b..45570ac 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -882,6 +882,7 @@ int __init of_parse_thermal_zones(void) } for_each_child_of_node(np, child) { + const char *governor_name; struct thermal_zone_device *zone; struct thermal_zone_params *tzp; int i, mask = 0; @@ -909,6 +910,15 @@ int __init of_parse_thermal_zones(void) goto exit_free; } + /* Select a preferred governor if declared */ + if (!of_property_read_string(child, + "thermal-governor-name", + &governor_name)) { + strncpy(tzp->governor_name, + governor_name, + sizeof(tzp->governor_name) - 1); + } + /* No hwmon because there might be hwmon drivers registering */ tzp->no_hwmon = true;