Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1510052pxu; Thu, 17 Dec 2020 11:38:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzC67+pr2dMZRIzkHTitfOJw7rkQzLNi6x/u8nxoga6VjWe7alc52PKichpPObjR+rAv3j2 X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr905095edb.339.1608233921413; Thu, 17 Dec 2020 11:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608233921; cv=none; d=google.com; s=arc-20160816; b=GffO3s77wKK/vdCdEhQj0kP7ojeznvp1Qr5RgDEUh9gragjsxETvbfLUR4j7dfuBQ6 haiqgsDRJZwxz7TjoxZzwYxGN229PzDyM3aJay9PEOXaA+oqVh4w4Up0RyytrWlioyEL ZKQVuKsFD26asNHSkYSV9qagpAt6B8Sm8E8hLl14tlIlAJzV0NxLTO79JI07QhhYBYbK ZB3CMMbYA6dNS7o+MxHv+ezddKK42sQNtLM6bQF6/F2Yw2vXFrjKuuAUOpGowDpmrQUx 7rd8g42A+O5khuu81BmOBuleM8nvyJYeQBQqxUbYlRVr20cOSX367rCEUPxeaob+1eK3 Qgrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6oOm24In2gplgsGMpCabJu/CznURFMD1RnI7ZTKSVZA=; b=rp6/UQunELXH8pu0jWM+ObHjt74H/vJ5nWBOE6xx6xkDWTWbd74L1mBKBq8wq/gcQU /lcegF5XuO1p9OlIETX1q9KJTGOg2Vp61Sr2fCDimZ/jLv5wDY/Nj+9leFM8XMDR/3Cc IyRlLLrTC5eWeHWel2dmyUMdLCejorYatc7vBuHvi4WGa45TFpwqa/J2Nc0UaMdqdTtO u46XsQxheAJp4RTA2xquVX/mb4pPUCSexRqWcWmjXRRYymkvBbaOkxrkRk0jk9XzIdPx XXBRmoWQxbfZAZA8zZhzEJGJfDR71YpcgpqWKQ/fg0WydcueUqzhzZvPVPEEwe/uDU1P DmhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYxCU38s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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. [23.128.96.18]) by mx.google.com with ESMTP id cq3si4848013edb.72.2020.12.17.11.38.18; Thu, 17 Dec 2020 11:38:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYxCU38s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1728188AbgLQTg5 (ORCPT + 99 others); Thu, 17 Dec 2020 14:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728189AbgLQTg5 (ORCPT ); Thu, 17 Dec 2020 14:36:57 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5622C061282 for ; Thu, 17 Dec 2020 11:36:16 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id t30so9721827wrb.0 for ; Thu, 17 Dec 2020 11:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6oOm24In2gplgsGMpCabJu/CznURFMD1RnI7ZTKSVZA=; b=EYxCU38suOXjV47ydNpqlSUba1JRYG/aaI35yaJpn1UB+BtzvlRpADO93fzVKy4t36 GXDLRzlEn1BYLHTJGeAeqCidRcIMChrWngyKaOn4n3Lo29932Dg9omdUJcjDTAwCVkgh ta58l29XjSHsRigG3HpDtBAEBVaBmuzih2JNgRoFRFYXa9bEBvBJ5hZC2Srp8gPI8mVa uxVtLO0NA79ZScJlXdTUzkgYBE8Tqjur0dClttztc+oLkYcGroJOHdhhPsrsjuIEAO0T /5F6Wcrc0LxkQR8X/uEnQJlAqKc4CbCNzPl9TN1TZtQafiA6+T03sTUGb4huYEgjoWFX KmZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6oOm24In2gplgsGMpCabJu/CznURFMD1RnI7ZTKSVZA=; b=atO0CuCAMvkl7y2KxRt9Vp3IHhKQaoXUnZHjTzJ8SOO2Cf/wyKuzyVPcQACMA/6tKb JjmQC+kgyCdF+spdT2tfRMrPWiqhcWEQ22KdyGwmus3zHNzhoHxcmWil2y0jWjL5Oc5u 3eGod5rTpXEPeEcQubEwxv7PBurOLLOCYCnKbbImLW6k/juE+yiNlAWWiKt1RJWB6Sdg Ydt9KEfpjhNzRMIhXT5rd8uXnXawe22iQAapaH343j91wB5JKL+8/EOBBep7OFX11d57 dBa7Q1UrlwAKciVA1OfZ5W9THI1OX53wVffw8asVuyQ/FQKUVlpt38jYBjp1YUUwtbs3 B4TA== X-Gm-Message-State: AOAM5338Z8YlsBUYfErnvVjbaOyaAyjSyWoICOP46sLI0nfDIjcqQCL2 4X0YGg5r22POJlXDpqluX2lGjw== X-Received: by 2002:a5d:5146:: with SMTP id u6mr433624wrt.46.1608233775160; Thu, 17 Dec 2020 11:36:15 -0800 (PST) Received: from ?IPv6:2a01:e34:ed2f:f020:ccb6:ce78:2bcd:4ead? ([2a01:e34:ed2f:f020:ccb6:ce78:2bcd:4ead]) by smtp.googlemail.com with ESMTPSA id o124sm6076543wmb.5.2020.12.17.11.36.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Dec 2020 11:36:14 -0800 (PST) Subject: Re: [PATCH v2 47/48] ARM: tegra: ventana: Support CPU voltage scaling and thermal throttling To: Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Mauro Carvalho Chehab , Rob Herring , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Michael Turquette Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-48-digetx@gmail.com> <91139f8b-0b83-dd8a-ba53-8e7a499e6344@linaro.org> From: Daniel Lezcano Message-ID: <776e0e84-e395-2bfb-f1ee-c34864b1cf16@linaro.org> Date: Thu, 17 Dec 2020 20:36:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/12/2020 20:01, Dmitry Osipenko wrote: > 17.12.2020 21:28, Daniel Lezcano пишет: >> On 17/12/2020 19:06, Dmitry Osipenko wrote: >>> Enable CPU voltage scaling and thermal throttling on Tegra20 Ventana board. >>> >>> Signed-off-by: Dmitry Osipenko >>> --- >>> arch/arm/boot/dts/tegra20-ventana.dts | 40 ++++++++++++++++++++++++++- >>> 1 file changed, 39 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts >>> index 14ace2ef749c..c2d9f38960bc 100644 >>> --- a/arch/arm/boot/dts/tegra20-ventana.dts >>> +++ b/arch/arm/boot/dts/tegra20-ventana.dts >>> @@ -2,8 +2,10 @@ >>> /dts-v1/; >>> >>> #include >>> +#include >>> #include "tegra20.dtsi" >>> #include "tegra20-cpu-opp.dtsi" >>> +#include "tegra20-cpu-opp-microvolt.dtsi" >>> >>> / { >>> model = "NVIDIA Tegra20 Ventana evaluation board"; >>> @@ -527,9 +529,10 @@ ldo_rtc { >>> }; >>> }; >>> >>> - temperature-sensor@4c { >>> + nct1008: temperature-sensor@4c { >>> compatible = "onnn,nct1008"; >>> reg = <0x4c>; >>> + #thermal-sensor-cells = <1>; >>> }; >>> }; >>> >>> @@ -615,10 +618,13 @@ clk32k_in: clock@0 { >>> >>> cpus { >>> cpu0: cpu@0 { >>> + cpu-supply = <&vdd_cpu>; >>> operating-points-v2 = <&cpu0_opp_table>; >>> + #cooling-cells = <2>; >>> }; >>> >>> cpu@1 { >>> + cpu-supply = <&vdd_cpu>; >>> operating-points-v2 = <&cpu0_opp_table>; >>> }; >>> }; >>> @@ -717,4 +723,36 @@ sound { >>> <&tegra_car TEGRA20_CLK_CDEV1>; >>> clock-names = "pll_a", "pll_a_out0", "mclk"; >>> }; >>> + >>> + thermal-zones { >>> + cpu-thermal { >>> + polling-delay-passive = <1000>; /* milliseconds */ >>> + polling-delay = <5000>; /* milliseconds */ >>> + >>> + thermal-sensors = <&nct1008 1>; >>> + >>> + trips { >>> + trip0: cpu-alert0 { >>> + /* start throttling at 50C */ >>> + temperature = <50000>; >>> + hysteresis = <200>; >> >> Did you mean <2000> ? > > The <200> is correct. > > Please see this commit for example: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2b22393b27670b45a2c870bce3df6579efd9a86a Ok, thanks for the pointer. >>> + type = "passive"; >>> + }; >>> + >>> + trip1: cpu-crit { >>> + /* shut down at 60C */ >>> + temperature = <60000>; >>> + hysteresis = <2000>; >> >> I think you can drop the hysteresis here, when the critical temperature >> is reached, there is an emergency shutdown. > > Yes, perhaps you're right. Hysteresis doesn't make sense for a critical > trip. I'll improve it in the next revision, thanks. > >> 50°C and 60°C sound very low values, no ? > > Tegra20 CPU is very cold in comparison to later generations, it should > stay under 50°C even at a full load. Interesting, thanks. >>> + type = "critical"; >>> + }; >>> + }; >>> + >>> + cooling-maps { >>> + map0 { >>> + trip = <&trip0>; >>> + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; >> >> You should add all CPUs here. > > > All CPU cores are coupled on Tegra in regards to CPUFreq, hence I think > it won't make any difference if secondary CPU cores will be added here, > isn't it? The explanation is in the description of commit ef4734500407ce4d -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog