Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp153793lqs; Thu, 13 Jun 2024 06:43:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8dkudK2SDmNlL39RbRmeHAn0cOUTtd0BZOhmZq7gFgragT6RU0ybI1linNil61WjaVS8srA3BTSIipZVc2XPNcdHYd8CZju/V8DC6pQ== X-Google-Smtp-Source: AGHT+IFLl6DXkYkyPnB08kF7sI8ZSlBNu4/ATOh9EgIRtC7RUVeS88zntFvNbf5HepzzsQKCz2tg X-Received: by 2002:a05:6a21:196:b0:1b6:dd01:ad2c with SMTP id adf61e73a8af0-1b8a9c2c9a5mr5268514637.44.1718286187340; Thu, 13 Jun 2024 06:43:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718286187; cv=pass; d=google.com; s=arc-20160816; b=oklKBMcPN5Nwzvc7MRnvJhOqm2F5htNSa44TenW3rzavJjqUsnQvTz4yR0pi3W1du/ qaj/WlmtTl1ZgmkN5CPMf4DpEDO9TW3nzAD9LMUdDUGIefu3GvtgoweGPq7mmg3nhB25 P3uAXltrNK4GMvZxOpa7HLT0i8G6JBr+K+VYnUynRYXObJAveVls9teoQTwlprwdaYMw HmiFTLit9CTdTDYvpyrefa+Q7ZtevYHazwhLMGO1BmnOFMvwb+raYNIthAod2fEV2Gz/ QLuoSS6oosQwiyWw9+sgscBD/4YtxvYQkaWEpI52Y2iLpHlCsv6wFjUb5y0ZCuYbEYWw YShQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=R/cKWx14xpoqErwPaH2eaTi1rw2DF/KkbsM0RLotWgM=; fh=giUqrzBPdsIHNa4avhmbQXbfduGL9xARJWry0aYuQkM=; b=HWdTr/FV/VXKByga79wLP8hsBAVxvgshoPkykGwIWhxqkjQt5s0VptWZkmhUTwGMaD Bvwzmz1oi6Vqye4xDV2bbGx2ToFpL/xjtVgIyvGe9G1OSUVccLzJLuCWi0S6zR9c5BKy tt/zAmh2GEcZKPsUnadQCiHn2wU2qB6zlJmc0epM786/Io1wuILYo3xcAIZnEtIgXrSk RHl+J0FiMOHcbmpsG116JPlN7uK7o1vzNYmsSEZR6p27b7cRz0Iis0UT2do2w17b5nsk MGHuTXM+SEbyEl7m23X4TNKaCRmD6bW4B+RuHCOjpMyj+DI6OQvdUBfquoAk6oFqPt9v feTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=ClYh467H; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213309-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213309-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a76a5acesi3584205a91.121.2024.06.13.06.43.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:43:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213309-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=ClYh467H; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213309-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213309-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 54A5EB26E4C for ; Thu, 13 Jun 2024 13:26:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CDE7145B07; Thu, 13 Jun 2024 13:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="ClYh467H" 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 8B8E7144D18 for ; Thu, 13 Jun 2024 13:24:16 +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=1718285059; cv=none; b=gSn5cHJyBMMRtAcsVgjN39fuM3iUkVPzQJOvun/Ad13zVntJkkxjPJLy1t1kvlD0O50IOnMk23cO1SUWCOBcwvhjeNSKmW0P+9h6uj7k9TSTbOittCZ9sortJPz9qzYrBhrRPGIdwuF/B9wgunNw42da1QebRkmKxzWWY4c/6gs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718285059; c=relaxed/simple; bh=IzjMEluDdj9W5D1MbEZYeU4rwzK3qTksCGHXnGpVbHQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nokpdYyY7smwd9M5u6iIvIyaLSYC4ouwUfakfyZMe4LcnyPpprSZPv3DRlnCA/8vftJNvc09J85ID5b5Etsnkk2YVioZ75gR4DFbUA53zHD4MK6z6m1NFSaEDDo7TS8ZTILnFSm4UCKlU3N/ISr9Fl7Zw4Nf51IUhso9+BZp3n0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=ClYh467H; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-52bbdb15dd5so1310462e87.3 for ; Thu, 13 Jun 2024 06:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1718285055; x=1718889855; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=R/cKWx14xpoqErwPaH2eaTi1rw2DF/KkbsM0RLotWgM=; b=ClYh467HUncyqyqDJIfwCMnus5446SWCFmPS7uaF/QGkHmg3zdApZ+rxJcPn2npF/2 f5c2B/mAe3C6xMDB2syskx1G7OCfMg6w36vyLn9qWjVuh/oLhBh7UP3wx4/IIW05P1Ka cvWtrZf1w/HbvLvqSjlacPEViTLlS5/JMVqd3ZNTuNscFFQr5EZdA4P/1pO+SukuwXjz pMTcwYp0OcbnJm+FmfREzsRId7o+q2RMQ8uuSgdQFz8DTNi/lx7wz+oz9sYyUFKk8Qg5 f+sUnCVpWYI7Ak9QWWHved1GFjORFuUz1t6223Yq2toYWA33O6mBVVE0ybqkiVwPX4Bu Pv9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718285055; x=1718889855; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R/cKWx14xpoqErwPaH2eaTi1rw2DF/KkbsM0RLotWgM=; b=X76jCzed+tuuxDUJHN57n11ENU78pKADuhNnqwDX307oNb07f6Ipu1NoVXBuChWbme byn7mRwi56X5zkh4m2xXlFYMPrIY0MaVkl855BPqrW6qif61qB2W2fqYV9543uecANtK DdMvV+GofUzFYk94/1TptO013wm6NBSw0fU0hM5KVr9WAIyEug5xljuVdPUh+w8aG810 mc9zW7aqO+qS55GJGKj+SGARi9SjzZBlAvi99sswYXmjz0rxJT42J7cDeuSsze6jU2xt BVr2WKHBtZMf/S31m8J/6tHqXwSxMeU3knFOwV7VrPHfz5MK+O2jacKHqwf88P1FHDi4 sF9A== X-Forwarded-Encrypted: i=1; AJvYcCV9u8a/qK/NMB/s4cEfqHMLVsZ+5amuIPogEmI50QqBJ4wPDTb5OyMSfNMXHgg3C+/OHjVLK7SqGwnvBfdb3/06RZIfk07QMp+GE9Er X-Gm-Message-State: AOJu0YzugLzcJsy6wFznuoCZKqyMnzj3fZuh1ACEIupp69JNG7DCWgZO 5nAdZPzDQNYtgR/7EVV3qk//2VsKJNgfolC9s1xVwcTU4QoelcUb3/PzYIPBGgI= X-Received: by 2002:ac2:5456:0:b0:52c:9a1f:52e7 with SMTP id 2adb3069b0e04-52c9a40587emr2960247e87.58.1718285054549; Thu, 13 Jun 2024 06:24:14 -0700 (PDT) Received: from blaptop.baylibre (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422f5f33c6esm25086225e9.4.2024.06.13.06.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:24:13 -0700 (PDT) From: Alexandre Bailon To: rafael@kernel.org, daniel.lezcano@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: rui.zhang@intel.com, lukasz.luba@arm.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Bailon Subject: [PATCH v4 0/4] thermal: Add support of multiple sensors Date: Thu, 13 Jun 2024 15:24:06 +0200 Message-ID: <20240613132410.161663-1-abailon@baylibre.com> X-Mailer: git-send-email 2.44.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Following this comment [1], this updates thermal_of to support multiple sensors. This series intends to add support of thermal aggregation. One use case for it is using the IPA in the case we have multiple sensors for one performance domain. This has been tested on the mt8195 using s-tui. To test and validate, we heat up the CPU and the heat sink. At some point, we run benchmark tests with different configurations: - Mediatek kernel (IPA + their own thermal aggregation) - Mainline kernel - Mainline kernel with IPA and aggregation enabled With the IPA and the aggregation enabled, we get the best performances with the most stable CPU temperature. The aggregation is configured and enabled using device tree. One thermal zone has to be created with a list of sensors. It will take care of registering a thermal zone for each sensors. The cooling device will only be registered with the aggregating thermal zone. There are still something important missing: a way to check that all aggregated sensors are part of the same performance domain. So far, I don't see how this should be done. Some recommendations would be appreciated. Changes in v2: - Rebased on 6.7 - Separated generic multi sensor and dt specific code - Simplified the code - Drop min / max and only do weighted average (seems more adequate for IPA) Changes in v3: - Rebased on 6.9 - Reworked the way to register a multi sensor thermal zone - Only one thermal zone to define in device tree - Max has been re-added - Enabled it on mt8195 Changes in v4: - Rebased on lastest master (fixed the build issue) - Dropped the average since I don't have any usecase for it [1]: https://patchwork.kernel.org/comment/24723927/ Alexandre Bailon (4): dt-bindings: thermal: Restore the thermal-sensors property thermal: Add support of multi sensors to thermal_core thermal: Add support of multi sensors to thermal_of ARM64: mt8195: Use thermal aggregation for big and little cpu .../bindings/thermal/thermal-zones.yaml | 5 +- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 212 ++----------- drivers/thermal/Makefile | 1 + drivers/thermal/thermal_core.h | 15 + drivers/thermal/thermal_multi.c | 288 ++++++++++++++++++ drivers/thermal/thermal_of.c | 250 ++++++++++++++- include/uapi/linux/thermal.h | 5 + 7 files changed, 579 insertions(+), 197 deletions(-) create mode 100644 drivers/thermal/thermal_multi.c -- 2.44.1