From patchwork Mon Mar 5 18:36:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10259487 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0F076016D for ; Mon, 5 Mar 2018 19:04:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D119E28BE7 for ; Mon, 5 Mar 2018 19:04:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C444828BED; Mon, 5 Mar 2018 19:04:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF8EA28BE4 for ; Mon, 5 Mar 2018 19:04:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbeCETEl (ORCPT ); Mon, 5 Mar 2018 14:04:41 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:44818 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835AbeCETEk (ORCPT ); Mon, 5 Mar 2018 14:04:40 -0500 Received: by mail-qt0-f194.google.com with SMTP id g60so21614607qtd.11 for ; Mon, 05 Mar 2018 11:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=llU7CSX3ZCd4D3MyfKN0pttnXP9GU9UeAKDnGsXoEZA=; b=dPq51w+p0GLmXfXWgr51m0rK+Cr7vRRJuNK6DrQUly06pX54WV+V55nThFc5QsntgL bXoE80tJyYh+sVlTop46fSetxSB/8/hj6Pq8d26aVHNM9blyDLc47OqB7o6JJbJp+jnK BkoUvtXUGG+KBiX0nwHZGAidIyZQPWARsg8qw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=llU7CSX3ZCd4D3MyfKN0pttnXP9GU9UeAKDnGsXoEZA=; b=l9OAOjvJQYsT/93Zbg8KEkD1nVxyIPyB7NupUi/DhMFhIf3pllv96cYekiIevGcHI3 QViowJFF3tjJ638U3CM5DTiAxd0oZxN00LCpRNG/8v/Za9PW3SeYCFT4MJ8VV4VxVM6G lo8VhuWvyEYnYSRIvUxJrKJbCKqHAmMLG31jP9PRtzG2J0f+wdNc1GFY0Tf8V2jYjsuM 4tz+wxZAUWDkKe9++UQCALy+frBm9PPc+hq/iC60Hs+QMwodGy2d8PZk7+HDozRKKN/k 7EfYfBY5JLNQJuedeIzPZ3NTcN/5LG6hez+Z3bxqggZkRi92Fwu0wfF+XydgP6VKx4ga 9o3w== X-Gm-Message-State: AElRT7GX70fPPpHNYd0OHbgvdDE3uuKJMV7b99wuEXyKtAsJHqYkTBU2 BrNiQp7Ok6ayCt0RUfvWrZWuSQ== X-Google-Smtp-Source: AG47ELuj3Ibf70+EaqVaoPO6WSdt8TaRbY7/YvCwBv/zEpxdXeyZbYOqZf90mnyfCGB8FQ++LOCdjQ== X-Received: by 10.237.32.66 with SMTP id 60mr25010844qta.332.1520276679958; Mon, 05 Mar 2018 11:04:39 -0800 (PST) Received: from localhost ([103.249.91.80]) by smtp.gmail.com with ESMTPSA id d184sm9524820qka.68.2018.03.05.11.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 11:04:38 -0800 (PST) From: Amit Kucheria To: devicetree@vger.kernel.org Cc: Ram Chandrasekar , ilina@codeaurora.org, Zhang Rui , Eduardo Valentin , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: of: Allow selection of thermal governor in DT Date: Tue, 6 Mar 2018 00:06:45 +0530 Message-Id: <3b80853abb45a9e067cf7a16754b07bb67712457.1520274879.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ram Chandrasekar There is currently no way for the governor to be selected for each thermal zone in devicetree. This results in the default governor being used for all thermal zones even though no such restriction exists in the core code. Add support for specifying the thermal governor to be used for a thermal zone in the devicetree. The devicetree config should specify the governor name as a string that matches any available governors. If not specified, we maintain the current behaviour of using the default governor. Signed-off-by: Ram Chandrasekar Signed-off-by: Amit Kucheria --- Documentation/devicetree/bindings/thermal/thermal.txt | 8 ++++++++ drivers/thermal/of-thermal.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/thermal.txt b/Documentation/devicetree/bindings/thermal/thermal.txt index 1719d47..fced9d3 100644 --- a/Documentation/devicetree/bindings/thermal/thermal.txt +++ b/Documentation/devicetree/bindings/thermal/thermal.txt @@ -168,6 +168,14 @@ Optional property: by means of sensor ID. Additional coefficients are interpreted as constant offset. +- thermal-governor: Thermal governor to be used for this thermal zone. + Expected values are: + "step_wise": Use step wise governor. + "fair_share": Use fair share governor. + "user_space": Use user space governor. + "power_allocator": Use power allocator governor. + Type: string + - sustainable-power: An estimate of the sustainable power (in mW) that the Type: unsigned thermal zone can dissipate at the desired Size: one cell control temperature. For reference, the diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index e09f035..a884b01 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -974,6 +974,7 @@ int __init of_parse_thermal_zones(void) struct thermal_zone_params *tzp; int i, mask = 0; u32 prop; + const char *governor_name; tz = thermal_of_build_thermal_zone(child); if (IS_ERR(tz)) { @@ -996,6 +997,11 @@ int __init of_parse_thermal_zones(void) /* No hwmon because there might be hwmon drivers registering */ tzp->no_hwmon = true; + if (!of_property_read_string(child, "thermal-governor", + &governor_name)) + strlcpy(tzp->governor_name, governor_name, + THERMAL_NAME_LENGTH); + if (!of_property_read_u32(child, "sustainable-power", &prop)) tzp->sustainable_power = prop;