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: 130739 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3035444lja; Mon, 5 Mar 2018 11:04:43 -0800 (PST) X-Google-Smtp-Source: AG47ELuWGTO7ynbO1kTWwqD9MVnV2D3MD4/F8i9H4pbWjBONYWr9JNmBR4JrcwVZT+sICL3LQShs X-Received: by 10.99.138.74 with SMTP id y71mr13213396pgd.419.1520276683363; Mon, 05 Mar 2018 11:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520276683; cv=none; d=google.com; s=arc-20160816; b=Nt8h1fJZTqWjbk4U+A9bqeoDNERwqBd9u66mN4PanKwyQwYi+kzKf9C4qhBm7lv5WH lYOnd56fGYH8ywFnmJ2udUI3UuK8AjfE26tWIrujtqziJKg9074swjEXSy6b6tBMGKBM EwXOl0ecHD0lsJeDdoOJEmK7hPGJ8fJ4QvbnbzEgjw/fhonDHIEPHbU8lruVCotdoP6L Pbvq3YnNUiJEokMt8ZJaGRMZsDsXyKZsWX+xShtESHJPY4Hbcj2ORF0vXRTSPAq8zc3a YgEfiV2PsW8UJqhr7h1sNRPQ5eCosYvWR6Bs6msmgLue+NHPLIJ75xRMNC4T5GH795Mg 6rLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=llU7CSX3ZCd4D3MyfKN0pttnXP9GU9UeAKDnGsXoEZA=; b=sTQMXv1FF1UR9wh21mLM9gVUOxJUroDEgiGDySbD4cTJzfMVC4BoKTNoK627yG/DRt gTVlLAKiyV02bvPBRpfE7mrlrR5eKAJDrIJ7ltvF8XWKYpPoP9pE0GVagXLZjsjV9ft9 g7mkh2EZ6+jtuATAOJ4IG25HOxazbQeYqtosHvNLAxl9qAITyBsHsvcQoStbIPmJzaio 5mly555QO38ffVipfbvWVOpgPrnQCubVzUes0sdWydZo3aXgoFYEJwoS7m3lkJWoUQLJ /BOVkzafdx9zy1LWtoSdFFoV4Vu5bgbmXq4DSyUtUzwLJB3s5gGOIEL3GiwjchnFRL3H ExNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dPq51w+p; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si7958067pla.678.2018.03.05.11.04.42; Mon, 05 Mar 2018 11:04:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dPq51w+p; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbeCETEl (ORCPT + 11 others); 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-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 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(+) -- 2.7.4 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;