From patchwork Sat May 18 12:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Rapha=C3=ABl_Gallais-Pou?= X-Patchwork-Id: 13667599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F5A5C25B74 for ; Sat, 18 May 2024 12:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DFepISt85SN7Nf8rTGBFRrCIIxDchLoNpPLjU50OzV8=; b=tlEvHmJFCROyZy T23j84CkAVQCw4ycNUm/QK5bf480RpuP9UsqmAZ6WPlpCzZ3Kb8+ROD92bUOwlaB9ZW3nzDUtJZst 1LI/8Mp0OKHAne0W/SS03lJgLL3yvXvQ4chDuZyJBagS6DIzIhicsykgjtb5S+BQAmDJFwfLAveeS nlKtucQoPhEFbNhEMa9yroMxDEagOW1o12khGGsUsk/IeDmVhh9tTtFm1wNT9qz651Z85Lix13IJx 4THKAkYp0DVDDpNQksPi45IR2L2W054AOfbLJd8gvUSA6nKuipZvwmOupBQxiZc1RUrQvlTyW3oZ/ svMIIYUyaOXfijLVMuIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Iw1-0000000A2U3-1YiE; Sat, 18 May 2024 12:13:09 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Ivo-0000000A2Q5-2jyX for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2024 12:13:00 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso3299630e87.2 for ; Sat, 18 May 2024 05:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716034370; x=1716639170; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iZK4uEAHMWC7+OzKf8O0ygaLmakDxoLTPfLX2sxqysQ=; b=HBcQTfK3OeSX6c2cbcfklvl8VOSpcJD1lVuIQGew30U5ZwRtQemaQimXIDRjiSl/h7 b/QRoSrm9zd7Eq6c0OhnBSAAu4RN12wDBrq/rsJt54Ic5ljN6b/Asbiz+KAfTXNzKS7A xLJztppxgKrcPt2npyTFAdF77NS4JRWtdzWxhG07HxV2hE8ifIenzWxpRnqgmYkzMN03 calJWaavtl5zgXVPBZktwKdhIWP+WRovul/hkGlhE8LQG74AwGo7Des9/a7BTJd1xIkw weE5oj8tGekDVUZugV59/lshc0rK0gjSa9gWdt9vAGW2rDbtIvFIb6uV+fyXIA7qxO6d wyPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716034370; x=1716639170; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZK4uEAHMWC7+OzKf8O0ygaLmakDxoLTPfLX2sxqysQ=; b=V6wZkB4GGmgsI0BbIwn3j9eQFvOSb3l4Siy/oUDKcdY0gEJaE6uVZAyqXiB8BfQgXR EmdEfZin6HRupwrBryTffAT5a63GIjunfBurnPhDhPJ8P9qDelB/9lnCZrkr4gyL0jwd NEC8w/XyGmIqmR/sOY6/aSNqSHzhAwHdFmysV6cjwanlDQ5WLDeH6Yml/JYnTbK5EQMi P/EwUso5+qYqqCfvosWBo39Vd1DTH9hlo8YTMV+OqaLWKGNPH8XxieQIGCj67toq1ckV SI1rF6T6pblQ5j5vK47w2dlQJifanG8JUVJ0pADFxrMXDFaGiqLz+I4Wah0QXZ1dgPo2 bTSg== X-Forwarded-Encrypted: i=1; AJvYcCV6yq3QWRYj60A6r5ClkWiv/Zh27z4zgqTHTLkB954oK1vzZKUnMjlG9dkUZfe0ue7+DKd1DKYpaqM6T+N/cqVocOH6ZArwWniGeZLkctIAB93SV+k= X-Gm-Message-State: AOJu0YzpC/kGodbP+A667A9x070HPWNPJX6esAWoxEmXvB/yGvzZT/o8 n6myCNFvdqvF0hxMdynrsC+H30p+Quz63HYrbyM+9Q/stkZ6aPYo X-Google-Smtp-Source: AGHT+IEgVLnhmwBYh/F3A7zypWfD3dPLiM8lgaXLecPRLfLx6gkZ5jPCjuVL5Z1h01pYyi0ORRYBqg== X-Received: by 2002:ac2:46e2:0:b0:523:8744:54ae with SMTP id 2adb3069b0e04-52387445634mr6715047e87.63.1716034369520; Sat, 18 May 2024 05:12:49 -0700 (PDT) Received: from localhost ([2001:861:3385:e20:6384:4cf:52c5:3194]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-523713d5081sm1636086e87.244.2024.05.18.05.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:12:49 -0700 (PDT) From: Raphael Gallais-Pou Date: Sat, 18 May 2024 14:12:04 +0200 Subject: [PATCH 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() MIME-Version: 1.0 Message-Id: <20240518-thermal-v1-1-7dfca3ed454b@gmail.com> References: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> In-Reply-To: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240518_051256_787797_75C8ADA3 X-CRM114-Status: GOOD ( 15.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Remove those guards on every ST thermal related drivers. Signed-off-by: Raphael Gallais-Pou Reviewed-by: Patrice Chotard --- drivers/thermal/st/st_thermal.c | 4 +--- drivers/thermal/st/st_thermal_memmap.c | 2 +- drivers/thermal/st/stm_thermal.c | 8 +++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 2a105409864e..5f33543a3a54 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(st_thermal_unregister); -#ifdef CONFIG_PM_SLEEP static int st_thermal_suspend(struct device *dev) { struct st_thermal_sensor *sensor = dev_get_drvdata(dev); @@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev) return 0; } -#endif -SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); +DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); EXPORT_SYMBOL_GPL(st_thermal_pm_ops); MODULE_AUTHOR("STMicroelectronics (R&D) Limited "); diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c index 29c2269b0fb3..28b380013956 100644 --- a/drivers/thermal/st/st_thermal_memmap.c +++ b/drivers/thermal/st/st_thermal_memmap.c @@ -180,7 +180,7 @@ static void st_mmap_remove(struct platform_device *pdev) static struct platform_driver st_mmap_thermal_driver = { .driver = { .name = "st_thermal_mmap", - .pm = &st_thermal_pm_ops, + .pm = pm_sleep_ptr(&st_thermal_pm_ops), .of_match_table = st_mmap_thermal_of_match, }, .probe = st_mmap_probe, diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 34785b9276fc..ffd988600ed6 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor) return ret; } -#ifdef CONFIG_PM_SLEEP static int stm_thermal_suspend(struct device *dev) { struct stm_thermal_sensor *sensor = dev_get_drvdata(dev); @@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, - stm_thermal_suspend, stm_thermal_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, + stm_thermal_suspend, stm_thermal_resume); static const struct thermal_zone_device_ops stm_tz_ops = { .get_temp = stm_thermal_get_temp, @@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev) static struct platform_driver stm_thermal_driver = { .driver = { .name = "stm_thermal", - .pm = &stm_thermal_pm_ops, + .pm = pm_sleep_ptr(&stm_thermal_pm_ops), .of_match_table = stm_thermal_of_match, }, .probe = stm_thermal_probe, From patchwork Sat May 18 12:12:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Rapha=C3=ABl_Gallais-Pou?= X-Patchwork-Id: 13667600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E87E4C25B74 for ; Sat, 18 May 2024 12:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cug7jwc7dBD/9HFXDHjVwCHUKII08Ti3PjxFcjFmgaQ=; b=25LZIpbaOca0Ri nrFyOKlhvohawBOsiHD+KLCUP0z3RUwmZ1fkjX0OkQP+WEW4BIRpLsMRF7zApRLj+S+xfMhdHyvmm Z5hPAMkCRR2LsJRRjscVYiiK/mVNen0IpLX18Edlyd+XVKMCbVDS2M8VLqls1+dytb68CLiIugaIN +jHP9ILJmXUqdSVeR6Yqioauzx/iJOaVTlZ35/p0G5OKVpdLzXdAdBZmXLJkgfsZmbNvVbj9LAhKH eNM68FhcEKhUanIwKzbaR8iw2Wt1T1KPHEIhfHCroJqZV80cOW1odzF6aRS3hA+I+Y0ww8LlDhZBJ XxNzyNwM03Nfe0KHKi1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Iw2-0000000A2Ue-10UH; Sat, 18 May 2024 12:13:10 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Ivo-0000000A2Q7-2kKi for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2024 12:13:00 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4202959b060so8251145e9.2 for ; Sat, 18 May 2024 05:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716034371; x=1716639171; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IGJsrqgkoxohMyaFQCRQCQrzlTAn771GcCI5VxzoLbQ=; b=FrpEnv/BtiZaiPMNJWQgBcPfN2fjGgbKYk3Q9FHh1RsGD32SwtVCx+tTbmfot81CYy 0t/mj3XOVAIpIaBk8+FP501LEHLrJnxjTf6HXlgBcBAqTP27/lj0VATSYia5lcW4Vwdj /zpCeysjKgXsc95YJeKCFojC8W4WkWiQjXOdD8U+VMJ0MTZR1Uc2pNPvaC+okEewKGF7 BrCOzd06MG1kBxt6wTxQOELBL3z5BNz5TSoXLr1dGvzzeEZSBYXmlrWHlYY8kCUjm7Ls IlgG4LmFhMgGtYeUEb1HLQvTO/bB9TkCGSLccgw4dNEVPoM4bFBlsbOq4VjCmlq1N9+4 YPnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716034371; x=1716639171; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IGJsrqgkoxohMyaFQCRQCQrzlTAn771GcCI5VxzoLbQ=; b=X2M4s26T95D4vO4JVnceyJzDgsX7FLG6yOabD9SfdxV9XyvkJEA24iqqS7M4ukonCe FHLQOK+O+mJerrxv2zergp3a0XW0UvRe0bWZ18WosJ0VTVlvsyXzH5P9/58D+Tom1/OE ACfH65E58ctuh5+momGFje8gb4svIOGZwSBU8nAVzeLEMOQOUoJNqaS0r19F0DMxZrej C7eyiaGS+ViVkbGjfk1oYZVP/TCOjLN+A8PFbIFfyH9UkVvlWJz+vOAKPDpJSnulGUW2 qnwReb0f9EWTpvivrySi/aSQw76D+Pc53j0z+LaOOQk0xs8jNfcKMqtjikbZaqF5fWRs S9Kg== X-Forwarded-Encrypted: i=1; AJvYcCWkPuktLU7NFPYPgXyrlC4a80Oq2QZ5imbF/z3MM95PR8pHiOJS8rZwDVB/v1INChoa6yEeBJmP1C4TtS0efAWOwfaAOOwTF4QtWSjN+ZthKxmtvuc= X-Gm-Message-State: AOJu0YyaEAoL6o4m/Fx/qGNDEXQKK4mypAwdNfBgTSviDYHsjF9cuRWF 4sdMWYl1PpHsEEQRIx+YrhtLqorE+ORnB2wotZTE5l9tDp0MBi2n X-Google-Smtp-Source: AGHT+IE/IhYubC0E9IZHEWKwQe0B3qG0jCm6OSbLvY0zrTBrXxj/mkuhSbi+Le/nYtJXLiXMiTQwEw== X-Received: by 2002:a05:600c:3144:b0:420:1db0:53c1 with SMTP id 5b1f17b1804b1-4201db054a9mr89916045e9.41.1716034370365; Sat, 18 May 2024 05:12:50 -0700 (PDT) Received: from localhost ([2001:861:3385:e20:6384:4cf:52c5:3194]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42017166c64sm215580105e9.8.2024.05.18.05.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:12:50 -0700 (PDT) From: Raphael Gallais-Pou Date: Sat, 18 May 2024 14:12:05 +0200 Subject: [PATCH 2/3] thermal: sti: depend on THERMAL_OF subsystem MIME-Version: 1.0 Message-Id: <20240518-thermal-v1-2-7dfca3ed454b@gmail.com> References: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> In-Reply-To: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240518_051256_838275_9BE2CDC7 X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Switch to thermal_of_zone to handle thermal-zones. Replace thermal_zone_device_register() by devm_thermal_of_zone_register() and remove ops st_thermal_get_trip_type, st_thermal_get_trip_temp. Signed-off-by: Raphael Gallais-Pou --- drivers/thermal/st/Kconfig | 1 + drivers/thermal/st/st_thermal.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/st/Kconfig b/drivers/thermal/st/Kconfig index ecbdf4ef00f4..2d08147876ee 100644 --- a/drivers/thermal/st/Kconfig +++ b/drivers/thermal/st/Kconfig @@ -5,6 +5,7 @@ config ST_THERMAL tristate "Thermal sensors on STMicroelectronics STi series of SoCs" + depends on THERMAL_OF help Support for thermal sensors on STMicroelectronics STi series of SoCs. diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 5f33543a3a54..60e70de724d4 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -12,6 +12,7 @@ #include #include "st_thermal.h" +#include "../thermal_hwmon.h" /* The Thermal Framework expects millidegrees */ #define mcelsius(temp) ((temp) * 1000) @@ -203,23 +204,21 @@ int st_thermal_register(struct platform_device *pdev, trip.type = THERMAL_TRIP_CRITICAL; sensor->thermal_dev = - thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor, - &st_tz_ops, NULL, 0, polling_delay); + devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops); if (IS_ERR(sensor->thermal_dev)) { - dev_err(dev, "failed to register thermal zone device\n"); + dev_err(dev, "failed to register thermal of zone\n"); ret = PTR_ERR(sensor->thermal_dev); goto sensor_off; } - ret = thermal_zone_device_enable(sensor->thermal_dev); - if (ret) - goto tzd_unregister; platform_set_drvdata(pdev, sensor); - return 0; + /* + * devm_thermal_of_zone_register() doesn't enable hwmon by default + * Enable it here + */ + return devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev); -tzd_unregister: - thermal_zone_device_unregister(sensor->thermal_dev); sensor_off: st_thermal_sensor_off(sensor); @@ -232,7 +231,8 @@ void st_thermal_unregister(struct platform_device *pdev) struct st_thermal_sensor *sensor = platform_get_drvdata(pdev); st_thermal_sensor_off(sensor); - thermal_zone_device_unregister(sensor->thermal_dev); + thermal_remove_hwmon_sysfs(sensor->thermal_dev); + devm_thermal_of_zone_unregister(sensor->dev, sensor->thermal_dev); } EXPORT_SYMBOL_GPL(st_thermal_unregister); From patchwork Sat May 18 12:12:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Rapha=C3=ABl_Gallais-Pou?= X-Patchwork-Id: 13667601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74EFFC25B74 for ; Sat, 18 May 2024 12:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lSBHbMtSZTo5ud+fIZ7wBZlHiIL0OajmndwhagOgbvM=; b=FG3vBX0B4Imwyx PVNM/vy6J/EzNH4/LSfthF+y/5vCrO48oWij3XcAHa6KmF8A/XREusXD+3VhMnoRusAT50rJxwC8Q 4h2VS67irn7KgCNTJhjPhF/u/h25ZznUF7DJgBfnnhvDZtiQn9hGBWdOlIx4XYJXgWsg7LyIu1HdZ mbXVphaOrcIbbus+tqWdr7JhIS6duxiaJq8cBjLY+e8P+BpAARVeTwgGe/mWVy/ix1nPH6PvL/Hc5 Ln7GQveEN7Lz4oc8t9h/j5uxxZctwfTjhez6JrZjJrFaoVcY1kJygb1sRu0YEImVDdTry5VEWc/n5 uia1YUgTrp6dVSOZtrWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Ivt-0000000A2Rz-0Sgg; Sat, 18 May 2024 12:13:01 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Ivo-0000000A2Q8-2ixz for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2024 12:12:59 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso3299647e87.2 for ; Sat, 18 May 2024 05:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716034371; x=1716639171; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=c+CcrlNbsHEM5IbBF+aEvbweCw5RwAqEr0nCDuf0P80=; b=AOPPh+dQPqusWXiE6cC/WCmwq8UwNnC3exTysSqoY4J8ooT5GBamNo3Jmn0ANMRQm0 1+fZEIr2fEAP8mpcgMzIFcL+hSrKYXEDXHDmg7vW4GGad9KpFQ/IhReuRATFAwTQFbe9 2TYfh/T7cwlzpn2OxLZx0+EJpGm74Zwwk7ZjA5V9+LjNUm+qGvT3Q92S2FuEWuLfnLwL qO77xsJbOGVaHG04n0N9OesDfAhLBmfJ8UDxGZ4WzjOYanPcx/QFH1tUQRWsJRyJx4fJ l/xbd3c/iGUrhKFFyCNOSMGfVfgfHQVlbKDXvkrA/kRc7Bv+ZxClDCfdl33v+mz/ryJT bLPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716034371; x=1716639171; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c+CcrlNbsHEM5IbBF+aEvbweCw5RwAqEr0nCDuf0P80=; b=aI3lBn5DACfvBQ82PpOdL0g8LAUDZAGAqlavnW7MWRbzq0gS+wA3g7NUdaxfh+B/kH KkGze8SlBdYWCCCFfE+xcV0cspCxra0sv+yjoOlj44DAULs50otpftsw5QojnUOmAamU ljHC3JiSKoM2RchLRbNeSEC3I9Ge6UJfCFCFbK63ESeiEi1Rpkx7XJTSUD6W7j8wYBUI 99tD4vWBMFzUN7InbgSiYK+oePC/CehHt1tPciR6l7eP7pL/3iG9u2I+BFZosF8HZP5+ nqTLwMwyHX3zuAflSVuqknrCLYJ/26zuHIB1I6R6AsMLKWNoXfyT8NVk1jBWvTHPzrkx eVaQ== X-Forwarded-Encrypted: i=1; AJvYcCWe1QGvgOasv5s62sku6Fe245Um3zr2SVHhs9eB4c9gvpgVeSKTOJQiUFYlSlRU1RFvuC93csFkLmsSPzL8BGNyuzLPgDcIMdQNcUe9MD32zpcKa9I= X-Gm-Message-State: AOJu0YwLnw+rWQn9pga5bKPJU1WNuKWwaL14/pxMs6EIsg5NYAc2ATFZ RSKQHd9jA5EAGOMl2iG62vd41jDce//5sRUHqdSqJPvSEtDLzTZK X-Google-Smtp-Source: AGHT+IGCqom0f/JiQFDnaCldSas0fyciwxHluc+scNBqYPHfPb0Rl7baW0X6/IEtd7zm1t+AwIBO0A== X-Received: by 2002:a05:6512:1304:b0:51c:5171:bbed with SMTP id 2adb3069b0e04-5221006e625mr19978831e87.15.1716034371324; Sat, 18 May 2024 05:12:51 -0700 (PDT) Received: from localhost ([2001:861:3385:e20:6384:4cf:52c5:3194]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f38d8688sm3543568e87.213.2024.05.18.05.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:12:51 -0700 (PDT) From: Raphael Gallais-Pou Date: Sat, 18 May 2024 14:12:06 +0200 Subject: [PATCH 3/3] ARM: dts: sti: add thermal-zones support on stih418 MIME-Version: 1.0 Message-Id: <20240518-thermal-v1-3-7dfca3ed454b@gmail.com> References: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> In-Reply-To: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240518_051256_755235_9CB56CA9 X-CRM114-Status: GOOD ( 15.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a 'thermal-zones' node for stih418. A thermal-zone needs three components: - thermal sensors, described in an earlier commit[1] - cooling devices, specified for each CPU - a thermal zone, describing the overall behavior. The thermal zone needs references to both CPUs and thermal sensors, which phandle are also added. The thermal management will then be achieved on CPUs using the cpufreq framework. [1] https://lore.kernel.org/lkml/20240320-thermal-v3-2-700296694c4a@gmail.com/ Signed-off-by: Raphael Gallais-Pou Reviewed-by: Patrice Chotard --- arch/arm/boot/dts/st/stih407-family.dtsi | 6 +++-- arch/arm/boot/dts/st/stih418.dtsi | 41 +++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/st/stih407-family.dtsi b/arch/arm/boot/dts/st/stih407-family.dtsi index 29302e74aa1d..35a55aef7f4b 100644 --- a/arch/arm/boot/dts/st/stih407-family.dtsi +++ b/arch/arm/boot/dts/st/stih407-family.dtsi @@ -33,7 +33,7 @@ delta_reserved: rproc@44000000 { cpus { #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; @@ -52,8 +52,9 @@ cpu@0 { clock-latency = <100000>; cpu0-supply = <&pwm_regulator>; st,syscfg = <&syscfg_core 0x8e0>; + #cooling-cells = <2>; }; - cpu@1 { + cpu1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <1>; @@ -66,6 +67,7 @@ cpu@1 { 1200000 0 800000 0 500000 0>; + #cooling-cells = <2>; }; }; diff --git a/arch/arm/boot/dts/st/stih418.dtsi b/arch/arm/boot/dts/st/stih418.dtsi index b35b9b7a7ccc..6622ffa8ecfa 100644 --- a/arch/arm/boot/dts/st/stih418.dtsi +++ b/arch/arm/boot/dts/st/stih418.dtsi @@ -6,23 +6,26 @@ #include "stih418-clock.dtsi" #include "stih407-family.dtsi" #include "stih410-pinctrl.dtsi" +#include / { cpus { #address-cells = <1>; #size-cells = <0>; - cpu@2 { + cpu2: cpu@2 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <2>; /* u-boot puts hpen in SBC dmem at 0xa4 offset */ cpu-release-addr = <0x94100A4>; + #cooling-cells = <2>; }; - cpu@3 { + cpu3: cpu@3 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <3>; /* u-boot puts hpen in SBC dmem at 0xa4 offset */ cpu-release-addr = <0x94100A4>; + #cooling-cells = <2>; }; }; @@ -44,6 +47,38 @@ usb2_picophy2: phy3 { reset-names = "global", "port"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <250>; /* 250ms */ + polling-delay = <1000>; /* 1000ms */ + + thermal-sensors = <&thermal>; + + trips { + cpu_crit: cpu-crit { + temperature = <95000>; /* 95C */ + hysteresis = <2000>; + type = "critical"; + }; + cpu_alert: cpu-alert { + temperature = <85000>; /* 85C */ + hysteresis = <2000>; + type = "passive"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + soc { rng11: rng@8a8a000 { status = "disabled"; @@ -107,7 +142,7 @@ mmc0: sdhci@9060000 { assigned-clock-rates = <200000000>; }; - thermal@91a0000 { + thermal: thermal@91a0000 { compatible = "st,stih407-thermal"; reg = <0x91a0000 0x28>; clock-names = "thermal";