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: 13667603 X-Patchwork-Delegate: daniel.lezcano@linaro.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA69622EE8; Sat, 18 May 2024 12:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034373; cv=none; b=XqiNKTe3C9lWb/GBQXHiRW6dv7UkST8Bgu2Tcj/NFhauMkeIA+2khnIa3ZqNW+Uo2FrZwvVFJdInYZz7FlOQJFxYS2IGs8f+JH7qpvcuVmPe0Rtb9UJaiu/VLIRodLvoobR13wFbjLH4tM9xl2ZNA+488qHTSvjURu2VPsWEch4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034373; c=relaxed/simple; bh=2gq4nbz/zVcBtPtB6vTGsOpFaQvv6Hw5NAMu06fIFKg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f9e809On/FYCW3C6UVAC9ey4tkGlJES1qzORFu4s0BFAGJv8mcIOjkmMvfgMdsIDqYIN7yZDONQ0qxl8n/wWs3zgLq6IpTuErOs5kB1YxdSNc6UsjAo6Ol7MRVmugYJvMqPx2LM0nuH7XEoeMSV77mmUvYCxT0h4E02iA/QT71o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZHiwqUQE; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZHiwqUQE" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-51fc01b6fe7so1594570e87.0; 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=vger.kernel.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=ZHiwqUQE7Uc59nXbdDfufQcQJa83E/0Ic9Np0L9l1ZH1uNA2nbRpD9/4WFK9V1qpjj CLaugB9taQH0ImeCf9TrJLYXvIKpHFH/q2puSb7FPd8Tu08sQtInrxX/M4CoZ3H23bBi nDPCEEEAq+S/jIz3lA/InTHhA4uoz+db9bwy65UoBubQgyxgCpFSwC7RpvfV9tzuI90W NDKxkXssfkjw1zgwYwTYoPn7d3JFewJ/jeybewZIlZpmqT4y25syfJBFO1ifMS7jXpCR XYPKBIZzS47/5ILIVb+n5SdFQyzZNYw46QmlTkgQ64m037RIG4Oa//KYqPgz7AZVEZZd nQYg== 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=XJrtaGfjWcYJZZyy6h01pON0o6GpBX6gBda6sF1Kpigz4LphuwtD7/mlIshBIePk3d 3S0aw+MKIH2INfa6RtzLyqkd60Q0qV8EaQBmH2vfFrMQzdzyxSpn1Qz5NJrLuWH9i9Nj gU379nvXtD3QmlaBYrm3QA4sf2bdU+5IKxLhxpkS1AyMiVc5ZqkLH1dz7wIYnm6hkviQ V9oKM3QkSJPg8T4Z8zCZ6yXSl31brmcvyHCi0Vxz0NojfWcv4MxgbCK6DIXsaM9Q8sH3 1P/VAziQ9cGnQAqUOXg6ei0LAIfCpSeUtPFeVg8f03gg04LKWplChw5BoR60u9scb6wF T9YQ== X-Forwarded-Encrypted: i=1; AJvYcCXfpkzy/H9KFW/x9PBI/jW+BjPR23mbEqZ8dZ5On+i5UfWN5bqRljOqH3SvhoK99tvuysv/RmoBxXhgFC8HUpMiiHHDjMhmQao5qs4yHWWn43C1R8vvSI8hh3e1iu89ZjfV07wm0PKN+Q== X-Gm-Message-State: AOJu0YwMOW7q+jALGKNrlex2QJP+lQZtIdEyJc8ev6H6EFZEuKwB3zOu jg4TKJ8Q358FzpF2TtrdIAuUj72waupB9RX7J+thi4Y65auppXJV 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() Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 13667604 X-Patchwork-Delegate: daniel.lezcano@linaro.org Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71F2634CDE; Sat, 18 May 2024 12:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034374; cv=none; b=qac0wDCIzPwzcrJQ8B1laMNOPtiTdcXRr7ubHHkfZgVL1a/KMtkVuVcJkiFTqIO66NBwu8j1p5U48f8b1gAncGem5yql4ip1mUqcLqoLBml7sU94Y/z/ZiRdAwxRA2qoYk8B7E6hWJLtW6bKAR0WoKDeEzPWtxpfjkyL6i+wt9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034374; c=relaxed/simple; bh=WRxhGYiTKb94c2UADnH+lMucCo+wriGkpGMAo7KQlbM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=efQSHkt3/1wRi6BX4GhmE2rTD5blUBkQbmKzHQElatRTHxPiZ2+uL73YPFtIzLoujA5CsGnV4j4qUZt0+5VdRTJ1Cdt/OenWPaad5Pk4IS4jTesJG8nTKgudxdkLB9+c08EfifTywCvv6ej9zACjBuF1rIqBsPuKivh8Xb7+yGs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XoREmVsX; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XoREmVsX" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4202cea98daso8365075e9.0; 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=vger.kernel.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=XoREmVsXlivbxihwyTeIpgVLZoH0tol9/0nb6obX5HZ5sTi5LF4hDKAxKRgmxqraV3 CzeHaimLWAlK815wENXMREKski1ZrC86+aV2G6SaqactN3YDk7UUkGiFXesjC9BJivv8 tR67HhUS8s2aZuLOALrdlZRCsel880W2onwd5zg+7Wd3StnitIBtfM4SDBcM3Mnd6gtc jLyDSAJd/hpODGp4WhSmJSKOfP7V4G3oMHzmyOsOZpU4uIbg9VnoNOh0FBNLd5PDel9T CtPW+w379vg9P8/frSWqKVHo+aJvXQsbphv2sFirtdBiQ2kljSnOUhOloW0EULMKIWib vbPw== 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=vWag/Cb1fS37sv5gT/QwqN4YYRrsvAVqYkv596T4Op+4p8UvW7ey7eOPaNgQVv121t VHFI0wMAPI5Z7mH4nKilIq5U9IeOmvO8+MYpJv2/7lqwz0A3pdiXc6rVAY0bP+xtnq0J DC95mDBl/1U4HoR6QlofI7rmgC98HGr770Ys30wewzBTk/C6Rpd5miSkjeQJ7uMuaX4r vg1G481nD4TMBbCDUGXWPAzY8+WccroJI3pRWrNbo7aSEV2EOmhx3y09Tz5a3/wBI5cv 5DpaU2CbA5ZI/RWQj33dkbKcDherEr1a+9homGvCceBy3mFfqlA1X+qNUZiS2pDnMMDv gE4g== X-Forwarded-Encrypted: i=1; AJvYcCVcyETG6joEv6hLIr2+n5SEU3iDhF03/W+dXKnHehpwh8qKM+IjAB1pWQSTW/sRKfc5k4WT/I2FM+aUiVotZRwUBwtvJ3TQFWwBjMRRAw/4lfITUxF8rpoSh3YpYWxSYhc2MzsdYqhV0w== X-Gm-Message-State: AOJu0YyW+UKMSA4xakbxtAq/G4ZsI/KmtUW+5pi6fZugmGUrlfRWShfB 3poiaALR99NVB2zwtpIeqHXSrmK1x7KqP5Vx0DMdiegwXYHFrLwX 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 13667605 X-Patchwork-Delegate: daniel.lezcano@linaro.org Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C7B238F86; Sat, 18 May 2024 12:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034374; cv=none; b=UvFqvANDpyo/NCZLqdb1gkG9XQdA9Zrio/lGG9aaxLz82AWspBnX0pVBCDdHdgBke64hIQwZTOrm92OCKBgVijq3OpDXdUJd6BFalaQCyOJXB5Zp8mOF/MIu2bHw/Dc3JwjSAMmWZ76b7ee3Rb5lNBwgnXwzBQZYO3LXjSVHKXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716034374; c=relaxed/simple; bh=puCzSyBrPHewwjdEAZq1RTx7Q2v3HQBbD2CoRPBEE3U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nnJS+a/mfYLpwwPcGve/bAJcwf8VsBC3ivyWH9cISH7aOgCLZWGupJEkBTRVWRO/eyH6r5K5gHECmHXeEPs3PoBERVlk2FYYRNJT0BTD2F8PJqlTVJ+PYZVpDQU0jSxx6XL69yMz9ovkk904WklfdtEbBP4MNPDYbW5zgBbHQEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JKAN9kP5; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JKAN9kP5" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-51f72a29f13so1859475e87.3; 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=vger.kernel.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=JKAN9kP5ZusZhA12zRuB65WHsNocMAl3YIwgRzAUB0k37H0uD+NVmFMz+zs3Af4J0r d3rW7jt0DaKYolfpiyWk26OVsot/KlJksYWhXbqhlO+1MrsDkcVn+LkrrivQrNKGdYpb pvq9eOVEVe6BjC/UJynMs0lx+172yDJhpaVLjkFYxhuA0P6NWVhSalHroyLdBORaVe1r qdiJpipD17F/6pMPx2EkWkKLLOrPmh2H0UrBzIUfGo0s0hR7WyyWyn+6PfklbNUpIdDY PPDUhCizGYTeDrcCJyS5ifosGJySgJQVp7aBNTb6yvZUARbpmBFc/abTEwhGiKgueIx7 TPyw== 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=YxHuP7KUwcveu7MpB9b3AaS41ije01KhON9wKvf+5E/VseO8fmjVk9mplSqx/OIX0F gkT4/maQOdxINL6DIlscwKh/PKgNpIChkZH1a9wd1NM+KbeC+RGZ0RV8U09PXeRIllHs 4QJ8xVWzNaUiVZ7ssxLRdT/Q9IcYMbkPETOQXCmMj/l1WbAF/mawflV6cP3gL4Lco9vD 5nE9Rxy2IJMMoelBEPlwvxKnzbcxCdc0fmhCeiHvOpXga+GXdJo+QXgEgsMU3BbfbgXO 1Bn5TeY4FibyBDybdYfqvFqVjCUlhHQDA2EtLuzamcPG8vXMOvncD4SP//qfSK5TwIiz P3Mg== X-Forwarded-Encrypted: i=1; AJvYcCXyvKAZvINSHESjRl3nm2UfQ222MW8oL5LabBwSONBN4Gr68Pjm49ry4tns4xuDCQgIREEatBLya8bsht9jB2lrOsbV7KF9KGtQJEUQyuc6N3DCvNSF3NZ+Z2XeNhRL8gaIWwifEqYxxw== X-Gm-Message-State: AOJu0Yw9gHEd5octGSqVvBJLUcFAQq2NwtmP9TkD5+m46+fNqq6E5TJC WGiaJD1e/fw5F9E6qLY65Fbp36MVm8TTBgd/FX3ImCbXw140Tv+o 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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";