From patchwork Fri Dec 2 09:11:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Di Shen X-Patchwork-Id: 28801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp731621wrr; Fri, 2 Dec 2022 01:23:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sX/lZnh5Q+EyYAqyvth9AmZdixf7AYmgDPHVCUX3t2fFOo++FYBUPzAHtYeJa41V8ALH0 X-Received: by 2002:a63:cf0e:0:b0:477:b603:f754 with SMTP id j14-20020a63cf0e000000b00477b603f754mr41810829pgg.232.1669972985525; Fri, 02 Dec 2022 01:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669972985; cv=none; d=google.com; s=arc-20160816; b=V1tA9diRyb7GrLnI982Yo08v7bwENrdMKTt4TYv4I844WJJleEeF67dBqThIffv0QV 2mFln9oIrDFylKFhLqlC9sA+O0zDOQuiLIgk9yDniWy2bcm+PrgPET3z4yYMeIFjRaWa O1iQKoqvdujm3VfOL+xR8JFvvcgPZpK7BM/Pk9ZzNYw02HY6iiiIh4Sg3sEZN2YUMghg /99loAHZbScrbzYagYEy4XCi3J0R6Mkz7NrAbB5Lfr0yI6OBgK4cKuq/OLSTDmxvEBMh ZwnykmDzvkuzsbwhQviIi/oR3WstfVMVJh4kwlPlOd59hv88b+LwNG1EMVTT9w0dMKMm ANTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=f6GNNWTkNUAllXnWxsgjwFdjHGgJzTemKDrQlBo0T3M=; b=huPPOKqu3AFWN7ICN3lF8T3MxjuCkKR4QcVcaUTOB/JoTYqK/vtNqY6aON5Hyae++t kRmCW2yeGKcD+K5cM3/DTIkFhVS5kRvQ97y310RlyVmq091gf7z+f6Lg85pOo323ck4j yH5OmhMDEy+ymUiuqBbCP2UdFtwiZ6xzz3n183PvDt1AatjGQtLkwrjKwfyWGMZagvsj R1KLea7zuABUkTNAUbfA19TNBsVbPFHjLzUTgMl8JLOilJTZdHz9GNqNqAX5v8GYvqn/ w1dPwDPApSj2P57ibFXSAxjagq2pRwf+2e6N9EMjjGaRGegIiHtpnmo3QrPydmcBllKu YjIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a63e644000000b0045466821a09si6728204pgj.371.2022.12.02.01.22.51; Fri, 02 Dec 2022 01:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232881AbiLBJMk (ORCPT + 99 others); Fri, 2 Dec 2022 04:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232288AbiLBJMj (ORCPT ); Fri, 2 Dec 2022 04:12:39 -0500 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B04CEC1F; Fri, 2 Dec 2022 01:12:36 -0800 (PST) Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTPS id 2B29BagW034842 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Fri, 2 Dec 2022 17:11:36 +0800 (CST) (envelope-from Di.Shen@unisoc.com) Received: from bj10906pcu1.spreadtrum.com (10.0.74.51) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 2 Dec 2022 17:11:33 +0800 From: Di Shen To: , , , CC: , , , Subject: [PATCH V2] thermal/of: Allow users to set governor for a thermal zone in DT Date: Fri, 2 Dec 2022 17:11:11 +0800 Message-ID: <20221202091111.1682-1-di.shen@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <202212020239.CufwkKiR-lkp@intel.com> References: <202212020239.CufwkKiR-lkp@intel.com> MIME-Version: 1.0 X-Originating-IP: [10.0.74.51] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 2B29BagW034842 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751001948524861128?= X-GMAIL-MSGID: =?utf-8?q?1751093593288941473?= The governor of all thermal zones can be initialized in thermal_zone_device_register_with_trips(), but it is always the def_governor, this means the governor of all thermal zones are the same. Allow users to set governor for a specific thermal zone in DT, in this way, users can use different policies for thermal management. Signed-off-by: Di Shen --- drivers/thermal/thermal_of.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index d4b6335ace15..4a29ac3be2ac 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -355,6 +355,7 @@ static struct thermal_zone_params *thermal_of_parameters_init(struct device_node int coef[2]; int ncoef = ARRAY_SIZE(coef); int prop, ret; + const char *governor_name; tzp = kzalloc(sizeof(*tzp), GFP_KERNEL); if (!tzp) @@ -365,6 +366,11 @@ static struct thermal_zone_params *thermal_of_parameters_init(struct device_node if (!of_property_read_u32(np, "sustainable-power", &prop)) tzp->sustainable_power = prop; + if (!of_property_read_string(np, "policy", &governor_name)) { + strncpy(tzp->governor_name, governor_name, THERMAL_NAME_LENGTH - 1); + tzp->governor_name[THERMAL_NAME_LENGTH - 1] = '\0'; + } + /* * For now, the thermal framework supports only one sensor per * thermal zone. Thus, we are considering only the first two