Received: by 10.192.165.148 with SMTP id m20csp4592141imm; Tue, 8 May 2018 10:51:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZobzKfpz9Ws84R91aoY4+j4UPG0SDCqe7XKuDlk1AhnDXanhwkoc241cJnqXaL5N1Vb0F3q X-Received: by 2002:a17:902:7e06:: with SMTP id b6-v6mr42366539plm.151.1525801900834; Tue, 08 May 2018 10:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525801900; cv=none; d=google.com; s=arc-20160816; b=HAMK0sYKN0NC3EWqnCqKh6JmyxhuJA23UqSjlqfSxLlgAZclZWRq9rD+8mxQmRr/Sf Fm/aKsCs/IDEGW7ydve9vzsRJiPbitSAv4fRx2z639Dj8htxFvrbybLHE0XDiLLVeKp4 M+eGVACA4OQEaioJkJjXMqGGQEwHBHek5Tr1ggacMePK+CZy1alsk4DPpEGfgJjHhrL8 5Wl5GOkbWX30bdfMZXCMhJnNCpeM8BCgduRtsSxugtseAHNvFKNW4lCTL/QKJEFkL+Md H+uqLvLNcYI11gdwz0VkopeeOQetFKRycJBPB6GG5OfOJyXYIQ8aBkB8EYSg552anXFa rcRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=+ePN83wy4I+gzK59aIuVYc4x7V7tkiSbBhh8YmGQpyc=; b=YIY7JcnyPmmTUho+DGew3va857cTlHkJa1cmIJhae3Sb1eqmOvFM1uUply9T5F5CqZ uo8OS/a0a/H724FMVkLwlSiZ7AVJqObbsbLws742M3WriugiMszK3Syfp0WoqZutr7wa 9vaZWFsI6ncn5c+Gs38Baxq56ye1xY06HiKhi0YOV5l4Jg+5/SxfdfoEVJeH/47NuSRJ JfyuJKzhDbpqsfcsdIGMpAw6b8SE/OlKYRho2Rk1mh3IeEMNEereoU6LUHOGm9mb9l07 H1HYGlZ8oTONhhjIgDyZj1H5sHXve5p0lxIEhtDGv6P96SfYot/EQ8sXab0OPHxhEKCL ewBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=cPzl0ozC; dkim=pass header.i=@codeaurora.org header.s=default header.b=cPzl0ozC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si24873530pfl.223.2018.05.08.10.51.26; Tue, 08 May 2018 10:51:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=cPzl0ozC; dkim=pass header.i=@codeaurora.org header.s=default header.b=cPzl0ozC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755417AbeEHRtI (ORCPT + 99 others); Tue, 8 May 2018 13:49:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38762 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751806AbeEHRtG (ORCPT ); Tue, 8 May 2018 13:49:06 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BE62D6085F; Tue, 8 May 2018 17:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525801745; bh=O0qQ8ZfKdTgL+EdbxkFFg6+c1L/K9GumFSPXBAHTpwI=; h=From:To:Cc:Subject:Date:From; b=cPzl0ozCD1Dwo8KMHLMju895ARRTg01s9Eg+tcrM3nLNl1wEK3pVrLDS07PNIJtN1 Ymy6imuaoqXpEEVRmk1BXZUfJ0A9IxIIXDDRtv9/YGxU6ir8/JhCt3XoMu3bop501V H1JShSv+A+9QO5J5ZDnVsLqFCgXCKbnfP7RWNQvk= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5FC516085F; Tue, 8 May 2018 17:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525801745; bh=O0qQ8ZfKdTgL+EdbxkFFg6+c1L/K9GumFSPXBAHTpwI=; h=From:To:Cc:Subject:Date:From; b=cPzl0ozCD1Dwo8KMHLMju895ARRTg01s9Eg+tcrM3nLNl1wEK3pVrLDS07PNIJtN1 Ymy6imuaoqXpEEVRmk1BXZUfJ0A9IxIIXDDRtv9/YGxU6ir8/JhCt3XoMu3bop501V H1JShSv+A+9QO5J5ZDnVsLqFCgXCKbnfP7RWNQvk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5FC516085F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org From: Lina Iyer To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, daniel.lezcano@linaro.org, amit.kucheria@linaro.org, Lina Iyer Subject: [PATCH RFC 0/4] drivers/thermal: support for multiple TZ for sensor Date: Tue, 8 May 2018 11:48:55 -0600 Message-Id: <20180508174859.26539-1-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an attempt at introducing multiple thermal zones for each thermal sensor. The usecase behind this is that, a sensor may involved in monitoring a region that could have different mitigative actions. For example, a sensor placed between audio and camera IP, will involve different mitigative actions on these blocks. Sometimes it is also desirable to employ different governors and different mitigative strategies for the same sensor. For example, using step-wise governor for temperatures > 0 and a userspace governor for temperatures < 0 degC. The idea presented in this patchset involves linking thermal zones together that share the same underlying sensor. The sensor still interacts with one thermal zone that we deem as the primary thermal sensor. The low thresholds set on a sensor is the max of min thresholds for the high trip threshold while the low trip thresholds for the sensor is the min of max thresholds from the different thermal zones of the sensor around the current sensor temperature. When the sensor temperature crosses the threshold, the thermal zone is notified and the new thresholds is evaluated again. These patches continue to return a struct thermal_zone * back to the sensor when the sensor registers. While this prevents breaking the existing interaction, it is not very clean and optimal. This is something to think about as we review the patches. The breakdown of the patches in this set is - - Patch #1 refactors the current data structures to help with the new support - Patch #2 allows probing and set up of multiple thermal zones when a sensor is registered. - Patch #3 aggregates across multiple thermal zones to figure out the mitigation and set new thresholds on the sensor. Sensor low and high thresholds are set based on thresholds from any thermal zone of the sensor. - Patch #4 notifies the framework and the related thermal zones when the sensor is tripped Please consider reviewing these patches. We have seen benefits of this idea and is implemented and used in mobile products. Lina Iyer (4): drivers: of-thermal: abstract sensor related information drivers: of-thermal: allow multiple thermal zones for a sensor drivers: of-thermal: aggregate sensor trips across thermal zones drivers: of-thermal: notify framework when sensor is tripped drivers/thermal/of-thermal.c | 205 ++++++++++++++++++++++++++---- drivers/thermal/thermal_helpers.c | 37 +++--- include/linux/thermal.h | 10 ++ 3 files changed, 209 insertions(+), 43 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project