Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2407798rwb; Fri, 2 Dec 2022 09:20:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf7/AAYl1m9PLJ86+4PIrBSzbAN2AI0INleV14AAPYjBMHqyzNQhJkdpGbEwrr7+h2k4jlng X-Received: by 2002:a17:907:778c:b0:7ad:79c0:4669 with SMTP id ky12-20020a170907778c00b007ad79c04669mr62502720ejc.395.1670001616265; Fri, 02 Dec 2022 09:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670001616; cv=none; d=google.com; s=arc-20160816; b=A3vqpPBph6SnGRvZkXJfELRmgUmyuudW0Uo3hdZq3QnDlSivUi+WIhaLFzCEQXQ1qH g3UsxiKbfy+lSiF1s6NNPZZn1s8cxJrqDa55yj5Caib+E0uXLV7+fPAVM7l7uQKTe3pw uRxehCB9Kqnex2o30Q3bdaBBA8Lx6kBsS7I4vv0N7Ppp9yNoAfZj8npjYK/qonQBbYhT jfcOBxTiZ2sgrQR+q/isxS3uCGaC9yD6xtLU/EBsJq7mwd1d2xBkp7bQ6WMU6qk4KlWC +dr5xq0RM7zHPGtmVCJYawFQf7xDZvRVfH6D0ch3oaEbWBccfS5+MM8LUwFbQZqDPiTv oBcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z13o93FN7D1j2NkYRyzv9m7Pw23zMPbciB0POjT5L7A=; b=iJvMj30XjJSK1cKq1g29H/+mLfnjvhfLI4MoObAW6XLBXMcfZJAAC0TcU+qlJYVyoR JB2EmysMPpKAvYwmNTNhxXD0Yk2kcZFZM3VAK3yL0sZPxWTF1uK1nvtVwN60f/59sFMi WQYG5So9++47yc3WeFTMpBm7i58/ajh6hOYU+yPByak70m3Agi49EPPI0WsbR2HAMMYk iaNU1zY0XkZ2JRZc1QHfXwirVi451XB2USyKpAI6K2LOxSzqQ8mvoabWS83swl9yxMzi dr1xB6746k+Hp9R3Iw1gyivRoknteEjR+MrVCEugdkDQ0Xy0RQ0DRFVa4BBryTqxquwB cJdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="bP+UQd/6"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa37-20020a17090786a500b007839bfdaa33si7446162ejc.358.2022.12.02.09.19.54; Fri, 02 Dec 2022 09:20:16 -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; dkim=pass header.i=@chromium.org header.s=google header.b="bP+UQd/6"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbiLBRHT (ORCPT + 82 others); Fri, 2 Dec 2022 12:07:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234338AbiLBRHF (ORCPT ); Fri, 2 Dec 2022 12:07:05 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8313D6782 for ; Fri, 2 Dec 2022 09:06:57 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id x11so1479512ilo.13 for ; Fri, 02 Dec 2022 09:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Z13o93FN7D1j2NkYRyzv9m7Pw23zMPbciB0POjT5L7A=; b=bP+UQd/6n708vkEXktjaqMOGhcISnVo7L1NghuYqEUABmfP7jUxc7cMm/aIRqYZUnH i3g8dM6PGFZXxAZ0re3tM8O7sjjgwmnc/kMZvPZEHbg25u9ueBSqjnFmTMugoe8SYo2Z 0zvAexNicdokiPwRVC3fjlbAIx/P6FB2BihFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z13o93FN7D1j2NkYRyzv9m7Pw23zMPbciB0POjT5L7A=; b=rR2B4tPW0fcouo5phGwEJ0M+mGshLkv6DB8cOKjGcPnjWAezHDvnYnvSKEjKUjWr8C 5G578igjKcvjGu8ExRr52Gv7MxFjrFQwNbYmir8xoJB8+lGgPFG3uYx7wpA17AYGuZvu X70w4xLlDxUiuimN491VS4EtaNe3LOirGNK6U+5JITFGVfFJHGunvQEniV+TGtPpLBIp utk03HDN5qQVng6Gx5CGr57KOKHPDCD2KpN17cY+ipVlNanASFTDGMoWBOdwpHjhT2HI 3kDpc2LF5VIw/xqY/Ra+DeAAp6reLKYXgWrx293vNtTkFlkA8vst5jIJe71Px+uw/jyi eXhA== X-Gm-Message-State: ANoB5pmSLykRYrPwXTAyqzuFUUJJl+4jTllmTRu0h3wJ5gCjvs+bYgfP OeSWwLcXR8W2ivDpPumKEWEvkA== X-Received: by 2002:a05:6e02:152c:b0:303:a2:5654 with SMTP id i12-20020a056e02152c00b0030300a25654mr16509329ilu.203.1670000817219; Fri, 02 Dec 2022 09:06:57 -0800 (PST) Received: from localhost (30.23.70.34.bc.googleusercontent.com. [34.70.23.30]) by smtp.gmail.com with UTF8SMTPSA id x14-20020a0566022c4e00b006a102cb4900sm2870557iov.39.2022.12.02.09.06.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Dec 2022 09:06:56 -0800 (PST) Date: Fri, 2 Dec 2022 17:06:56 +0000 From: Matthias Kaehlcke To: Di Shen Cc: rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xuewen.yan@unisoc.com Subject: Re: [PATCH V2] thermal/of: Allow users to set governor for a thermal zone in DT Message-ID: References: <202212020239.CufwkKiR-lkp@intel.com> <20221202091111.1682-1-di.shen@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221202091111.1682-1-di.shen@unisoc.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On Fri, Dec 02, 2022 at 05:11:11PM +0800, Di Shen wrote: > 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. There have been other attempts in the past of adding this to the device tree (e.g. [1]), which were rejected since the DT should describe the hardware, not policy. Userspace can configure thermal zones to use a non-default governor through sysfs. [1] https://lore.kernel.org/all/3b80853abb45a9e067cf7a16754b07bb67712457.1520274879.git.amit.kucheria@linaro.org/ > > 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 > -- > 2.17.1 >