Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp530009pxb; Thu, 19 Aug 2021 05:33:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIseAhpCAvpQFh0xsLepEQt9VNJcWk6su0U9I1y4bqS6hTDqfWUliLmcCQvOF4UH5WjBb+ X-Received: by 2002:a17:906:69d0:: with SMTP id g16mr15370489ejs.20.1629376383325; Thu, 19 Aug 2021 05:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629376383; cv=none; d=google.com; s=arc-20160816; b=jUiAKYdK9bDFiUrO5Pb7EGjNgJu9fByIAiewty5edPAcCxLqLrSq4PgjWue9VoVq1V d0EIN3VFKDlteXisFfBZTClnSdfI4+7OHUcVc6owv+/Hc86fV3HmufhOLdIsZRSs07JC PylTwcQe0sNS5FwmYOzmk/U+0bvecI+v28V4gDOoxPlRZMBw4ocDdNvlz2vbxAAmA54z tXihqrJzLcO9LXBysDXxjvVEqOavgYBKO5dwL/dYClqieT1/3EqPVCPhQ1IQTg3/Vb48 n/bZ6eaJ3pJocTARgk/7xOaGOGqcDQ/+K6i8k7cK8RU4d6WV7Yzj74rCoWQWqKKqaNyb xCdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=thNi9bubmA4Tx9D8MJEICSqpjS4wd2YINGUxGWioadI=; b=FZfaLy1koOPT1uUZ5MiJtrfodCO4d3/wpBQt6BMN7HGrCTBuVxiySg/L9Tp19v4YMB 5Yjzc8NKF/gWuIrHkAV7koG1INeHApR9DSInHVk29bOsGmf/BoVRevAuAGgxp3dCM0kx 2JbaqcdDgssw/xmg29bgS/oZ+jbbvaVPzgyLDAocL8q0H3+nkx5JMwta/6adSMWXZwlQ 4sHVaeVa3YOyxkepQlz83Ny+z0IMDMkp7RJMDHVh8obrM7S8z3tCJQIxMDYdiwHZhM6/ xfs+dXdsJQY5CFWEjTOahPbo134gcj2am77+vGjQsoacAfnTgZ7RlmFeV+8v7+7aDMcU 5zkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=E7npIvUf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si2933964ejt.108.2021.08.19.05.32.38; Thu, 19 Aug 2021 05:33:03 -0700 (PDT) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=E7npIvUf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239624AbhHSMbV (ORCPT + 99 others); Thu, 19 Aug 2021 08:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239566AbhHSMbU (ORCPT ); Thu, 19 Aug 2021 08:31:20 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F35AC061757 for ; Thu, 19 Aug 2021 05:30:44 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id j12-20020a05600c1c0c00b002e6d80c902dso3935812wms.4 for ; Thu, 19 Aug 2021 05:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=thNi9bubmA4Tx9D8MJEICSqpjS4wd2YINGUxGWioadI=; b=E7npIvUfVTRCT96ITsr1YFQtm98XRcMqj4nRGFn2dOmRKAfQoVDp7wFZn4rq8S63n7 CxsIASdUvnrkgNZd0PLo5TJVEyWpDYgJvesvuoklOVgLcC73/cBswqQw9SMJD9MzlltN HGUistDWMMAGMseixDku3FT1fdGgnTxBAarmNWCsXoclNY3kfrlITg0hTeT+ZcSj33I1 5Lcw2oqoHjR89RcgojPTm7c5mJvGs2b1aWpWFJ8mkxrJKx+HTN3QEYUE6ouT+VDC41v/ 8vgrTTS1dGX21Uk2vSphSBuZvbolHMr3Un52a14PbmU37UVdnM70E8fiOG98MUzp+v4L se2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=thNi9bubmA4Tx9D8MJEICSqpjS4wd2YINGUxGWioadI=; b=t4JIpew5dr3Gwxjk6DF5OWbnK7qreBztd1hsxj1Pax9KFpHey49QiM3BJpKmPMzwz8 Ql71L36K8rbJI7Cm1JVKD5Rew/9Fp0a28rVnt+ssAOXymrxlNSeY8oViXStQxah5NO63 haLCJkYy3Y+sOJYLY2HzCAyEYzJuPxqmukqDyFd37g2WgRB4IlyFmbjrpqBSf4rt8CkZ OiUV11qgTzAP1Ca0wRApMpTLp1snir5f/mIWkI5RdOzkTHC71jMA20gJFdE7YNNwYYJf LoVUfaJBOoIdwxzxqq5RHhPwPQ1iFSeePCHIhHXvl8S1Go/CsQVdaewGU3ip5tHnq3e1 WtIw== X-Gm-Message-State: AOAM533/npxqeu7/oDLV/mPJsuff/1XRCpVNmy+o76f0cEZy/dFaHlFa xDCU5r3VDz7dsXaapjy+dT9IYg== X-Received: by 2002:a05:600c:3ba9:: with SMTP id n41mr13082704wms.111.1629376242901; Thu, 19 Aug 2021 05:30:42 -0700 (PDT) Received: from alex-xps13.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id y10sm8146814wmo.18.2021.08.19.05.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 05:30:42 -0700 (PDT) From: Alexandre Bailon To: rui.zhang@intel.com, daniel.lezcano@linaro.org, amitk@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ben.tseng@mediatek.com, khilman@baylibre.com, Alexandre Bailon Subject: [RFC PATCH 0/2] Add a generic virtual thermal sensor Date: Thu, 19 Aug 2021 14:32:13 +0200 Message-Id: <20210819123215.591593-1-abailon@baylibre.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series add a virtual thermal sensor that uses the hardware thermal sensors, aggregate them to return a temperature. My first aptempt was to do the aggregation in the thermal zone but it was not that easy to do, and, there were some case that would have been conflictual such as setting differents trip for a regular zone and a multisensor zone. Instead, I made a virtual thermal sensor that could registered in a thermal zone, and have its own properties. It could be added in the device tree, with the list of sensors to aggregate, and the type of aggregation to be done. As example: soc_max_sensor: soc_max_sensor { compatible = "generic,thermal-aggregator"; #thermal-sensor-cells = <1>; type = "max"; thermal-sensors = <&lvts 0>, <&lvts 1>, <&lvts 2>, <&lvts 3>, <&lvts 4>, <&lvts 5>, <&lvts 6>, <&lvts 7>, <&lvts 8>, <&lvts 9>, <&lvts 10>, <&lvts 11>, <&lvts 12>, <&lvts 13>, <&lvts 14>, <&lvts 15>, <&lvts 16>; }; The current series build and work but it would require to be completed aswell a lot of cleanup. Before working on it, I would like to get some feedback and I know if that would an acceptable solution and continue that way. Follows the following discussion: https://patchwork.kernel.org/project/linux-mediatek/patch/20210617114707.10618-3-ben.tseng@mediatek.com/ Alexandre Bailon (2): thermal: provide a way to get thermal sensor from a device tree node thermal: add a virtual sensor to aggregate temperatures drivers/thermal/Kconfig | 8 ++ drivers/thermal/Makefile | 1 + drivers/thermal/thermal_aggregator.c | 134 +++++++++++++++++++++++++++ drivers/thermal/thermal_of.c | 43 +++++++++ include/linux/thermal.h | 12 +++ 5 files changed, 198 insertions(+) create mode 100644 drivers/thermal/thermal_aggregator.c -- 2.31.1