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: 881606 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dPq51w+p"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zw8VH5hMMz9sYG for ; Tue, 6 Mar 2018 06:04:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751835AbeCETEm (ORCPT ); Mon, 5 Mar 2018 14:04:42 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:43199 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838AbeCETEk (ORCPT ); Mon, 5 Mar 2018 14:04:40 -0500 Received: by mail-qt0-f193.google.com with SMTP id d26so21627706qtk.10 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=NLjX9CQxyNpV6MZMSQqnfm5jSwcCw3iLNUZuQ/LQImjyIKTcCjSfiXvrn2wQ5wAPI3 vJiJ3JWyBIpR3yKAtM5elp/RNXwUVQyYNDKxrzaSE4rf25wv22iRdzaPKpalA5Ycn5tJ M1FLIpE41UKHIq/saE9xkRoWlRNXNH3P/kvUigbJfGYxKUOCuYfbttrYe8xTciq8rmFg UtA5eQxaUsl+JGGlzyCtgbT5yNCTuNAHIiexXOdqcF9TaCTFCj4VMc8TyU7UOyNPUEND p5Z0gMWG2snfH7QVIVOf8PsHqqvVSbX4MFOaI1CK1HRXQrcfFBX4jZFUkrEDoRO+qypH 9HSw== X-Gm-Message-State: AElRT7EG5/Jg+Y/hA8dY9CfpZ0CacVi0junqBpwwjJmndsVK+7n8TbX7 8pXaRfm8ZOn89QiaD4md20KCUbolRkY= 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: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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;