From patchwork Tue Jul 31 18:59:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10551197 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 660CA1708 for ; Tue, 31 Jul 2018 18:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 576BB2B30A for ; Tue, 31 Jul 2018 18:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B08B2B376; Tue, 31 Jul 2018 18:59:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E23C52B377 for ; Tue, 31 Jul 2018 18:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729772AbeGaUlY (ORCPT ); Tue, 31 Jul 2018 16:41:24 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38978 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732118AbeGaUlY (ORCPT ); Tue, 31 Jul 2018 16:41:24 -0400 Received: by mail-pg1-f196.google.com with SMTP id a11-v6so9537981pgw.6 for ; Tue, 31 Jul 2018 11:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pregnSMfkOaGBP4vqZw3v3Rj/ItF+UeK9Knvf5WfDP4=; b=ZY6tr+zYY40u8HIGlHlv7yUWn4nd25P9iTfaiSsJk0cobiYOamYX5s9xCpzYB6XMyv O9s+4uj0n05Wjf+zetTSTyamcEimvSziJ3UZiTjet5j2z3HW1KnBnVSjdef402dHCCqt LUngiV0pXnXmV5QF/u406B8pLXIM6P4IvQiLw= 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=pregnSMfkOaGBP4vqZw3v3Rj/ItF+UeK9Knvf5WfDP4=; b=JdxI4tYZqNeRDxsJz8P7Xp/q05cETgscyEzxmPdZybFoaYWmFtm8bwr5gAXphd+YSS PZ0oN5tSeRRm2N6PN0MfXs8kzHzsQ7xvkonuC61n9Dwq5yKk+vTXEkgc6Tf81/mP30IO 4/KpQXHLg1VYgVDN00TLZvWrcDiWRWFyKS6Cry63MJOFQk+yDNwHlihxI8hlztHO4w8N HUvK/TxCw1TtW465lmVD41td/wI7MKzj7cu1OhB09fllGqT9gYtywQpHwHviH2xht4Xk TkVcRetIHJ0pggV5OCkQvZTuKbTM5YsINLyqXXoAzwZ+7cPUY/kgy5GEADXp5ijkN4sr Tu3g== X-Gm-Message-State: AOUpUlE4OzrC6rb/NGbN1AB4quiJ+2E7NdriIgmP5O6qLxTiw07J6VE/ Y9ELoKS0qugUXzw1G/zAz5X1NA== X-Google-Smtp-Source: AAOMgpd8xxnEWfHqO2sUp+cEmFEzipR/+YKCkPW+qO2/mgpwGOvmtbpEcEIPjXdIVhWmcfUNUZmgUQ== X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr23605077pfn.77.1533063583758; Tue, 31 Jul 2018 11:59:43 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id e132-v6sm27797567pfc.49.2018.07.31.11.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 11:59:43 -0700 (PDT) From: Matthias Kaehlcke To: Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin Cc: linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, David Collins , Douglas Anderson , Stephen Boyd , Matthias Kaehlcke Subject: [PATCH v6 1/5] dt-bindings: thermal: qcom-spmi-temp-alarm: Fix documentation of 'reg' Date: Tue, 31 Jul 2018 11:59:13 -0700 Message-Id: <20180731185917.176074-1-mka@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The documentation claims that the 'reg' property consists of two values, the SPMI address and the length of the controller's registers. However the SPMI bus to which it is added specifies "#size-cells = <0>;". Remove the controller register length from the documentation of the field and the example. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson Reviewed-by: Rob Herring Acked-by: Eduardo Valentin --- Changes in v6: - patch added to the series --- .../devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt b/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt index 290ec06fa33a..86fb41fe772f 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt +++ b/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt @@ -6,8 +6,7 @@ interrupt signal and status register to identify high PMIC die temperature. Required properties: - compatible: Should contain "qcom,spmi-temp-alarm". -- reg: Specifies the SPMI address and length of the controller's - registers. +- reg: Specifies the SPMI address. - interrupts: PMIC temperature alarm interrupt. - #thermal-sensor-cells: Should be 0. See thermal.txt for a description. @@ -20,7 +19,7 @@ Example: pm8941_temp: thermal-alarm@2400 { compatible = "qcom,spmi-temp-alarm"; - reg = <0x2400 0x100>; + reg = <0x2400>; interrupts = <0 0x24 0 IRQ_TYPE_EDGE_RISING>; #thermal-sensor-cells = <0>; From patchwork Tue Jul 31 18:59:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10551213 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 240191822 for ; Tue, 31 Jul 2018 19:00:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15FDC2B3A2 for ; Tue, 31 Jul 2018 19:00:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 142122B3A3; Tue, 31 Jul 2018 19:00:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1C4F2B3AD for ; Tue, 31 Jul 2018 19:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732233AbeGaUl0 (ORCPT ); Tue, 31 Jul 2018 16:41:26 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34032 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732207AbeGaUlZ (ORCPT ); Tue, 31 Jul 2018 16:41:25 -0400 Received: by mail-pf1-f193.google.com with SMTP id k19-v6so6549015pfi.1 for ; Tue, 31 Jul 2018 11:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XWHD3U11wghvwRII1kRUIs8QoNbRmHkZbA9xigt5SRw=; b=VtKNsFx2fc4xr3o3dPJ+5VUohYwrqfLv+Nz4/VQ6QNzrkXlR5hx6vBnYUJbhiFQfor tlObU1KQ9ZDN9Amr1kPyYq0pZAKphBl3Krt/5fn8kG9SjDmGeYDocJzvLM8yJWgPuipe ruVm1RLrL/HC2wvq70MbYskCB8Bb3LjraFb/8= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=XWHD3U11wghvwRII1kRUIs8QoNbRmHkZbA9xigt5SRw=; b=aSOqOVOWLknIDJvkBHDs/pUMPteb96gBH/bIQJlQJb5KcBWWjjzHyccUDr/fobkTay fDjj3Hey01iS1D8wRvjLHu/kk+E1IV3k2BNi3OZuW36xI1Y2D65n58jlJS0HzdsW6YO+ DVRC2569bGjWskdEzesymz8mKkUoHh+haOdFWYYw605Hcp/XrJvZji5d94wbr1aiiL25 eTe/wDW3L0qqBhwrWUiBhNlzCobG4GC5Xt5EdvF13ziGZjQiZP3ezhIA3PJq+1u92E1h ehe+aDCcpjMLLgRqCb9BCJIDhN81su2UeKbJNoZwZK7ivri0lSb676jcU/Ptpj5Lv03o WnIA== X-Gm-Message-State: AOUpUlH7iJdjdyQ68G81Im8Xw474EeZsrgpiPsBCs2SH+5EKSk2TlS9x cp06OKT/mbOAn4nuaJGWLd/rRg== X-Google-Smtp-Source: AAOMgpcqwTmDD5Ozvi7ayuWDmQ9nKxaf3SQSygz6tb6gXrX94F7Q864clnedanKKUMCy8q4QEVrOxw== X-Received: by 2002:aa7:824d:: with SMTP id e13-v6mr23441782pfn.97.1533063585006; Tue, 31 Jul 2018 11:59:45 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id e132-v6sm27797567pfc.49.2018.07.31.11.59.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 11:59:44 -0700 (PDT) From: Matthias Kaehlcke To: Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin Cc: linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, David Collins , Douglas Anderson , Stephen Boyd , Matthias Kaehlcke Subject: [PATCH v6 2/5] dt-bindings: thermal: qcom-spmi-temp-alarm: Improve thermal zone in example Date: Tue, 31 Jul 2018 11:59:14 -0700 Message-Id: <20180731185917.176074-2-mka@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180731185917.176074-1-mka@chromium.org> References: <20180731185917.176074-1-mka@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current example for a thermal zone isn't very useful as reference since it would result in a hardware shutdown at 145°C, instead of allowing the system to try to shutdown gracefully. Without an ADC channel a maximum of two trip points is useful in practice for this sensor, with temperatures corresponding to the stage 1 and stage 2 'hardware trip points'. A critical trip point at stage 2 may allow the system to shutdown before a hardware shutdown at stage 3 kicks in. It should be noted though that by default the chip performs a 'partial shutdown' when the temperature reaches stage 2, which may prevent an orderly shutdown. The 'partial shutdown' can be disabled by software. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson Reviewed-by: Rob Herring --- Changes in v6: - patch added to the series --- .../bindings/thermal/qcom-spmi-temp-alarm.txt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt b/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt index 86fb41fe772f..0273a92a2a84 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt +++ b/Documentation/devicetree/bindings/thermal/qcom-spmi-temp-alarm.txt @@ -35,19 +35,14 @@ Example: thermal-sensors = <&pm8941_temp>; trips { - passive { - temperature = <1050000>; + stage1 { + temperature = <105000>; hysteresis = <2000>; type = "passive"; }; - alert { + stage2 { temperature = <125000>; hysteresis = <2000>; - type = "hot"; - }; - crit { - temperature = <145000>; - hysteresis = <2000>; type = "critical"; }; }; From patchwork Tue Jul 31 18:59:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10551205 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FA3913BF for ; Tue, 31 Jul 2018 19:00:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 809562B30A for ; Tue, 31 Jul 2018 19:00:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 743B72B376; Tue, 31 Jul 2018 19:00:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B30DF2B30A for ; Tue, 31 Jul 2018 19:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732271AbeGaUl2 (ORCPT ); Tue, 31 Jul 2018 16:41:28 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36217 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732249AbeGaUl1 (ORCPT ); Tue, 31 Jul 2018 16:41:27 -0400 Received: by mail-pl0-f67.google.com with SMTP id e11-v6so7570242plb.3 for ; Tue, 31 Jul 2018 11:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q/YRFKb3RzI0H1RpA3VS7FFvDUztiE2CUhFcLa1cepw=; b=Co+P6W3x0rRIdXLxPhw37GtUJOLtELbw1BmXWuPGvPEKehgO3bw176RwaVhdSJeoTq UeUUlzE5ieYrVo4IhMQwUQJiyj4RQhSRZ0/0FwucGnrwIiLHj6egBZPsypuqicCx+3Cm OGVruMmy1k05jzDM3VdMejFzp30WxfnJ63Fnw= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q/YRFKb3RzI0H1RpA3VS7FFvDUztiE2CUhFcLa1cepw=; b=YD+fh+irgdtSu4ey/DpSe8Wrw2Itse7qZ/cJb/9E3tTjZMYBOCgLbbNWZmE2lGjbN9 HtCez8RpuAwx2TZ+pnlhL3XQIw4yAnzl+jNX+UH61gpFpyZzbLm12VC3lszF1amlmp1U IeMu3OG7YyibGb9ocAgTvMGao6hOpB58DdIQON/lHIi7qBXRFusHvUpTVATlsXqZ14t6 7tGLVwQ/JCfXO5PDNsW1IL9ySIIH43lwma7nijM87MX3PgwGQGI+U2hdKb/6tj3Z+AAV jN8mb/FoCho5WA38QkS4ywk0D+rWtit6NcpMc1/TmhvnvcF8IcEBOUB3aub1rY7kLBrd jLSw== X-Gm-Message-State: AOUpUlEAtXbYylkstDGvxPANi0idQ6aPGEJ5WzYL01yUynGLMrB3N62K ORLKK+roTGEQ0bSztogivUuShw== X-Google-Smtp-Source: AAOMgpfFW4Gt+KqY6N9twDF2khBOVOCCmU1VN/EIeExomBUxU0dkXXQoHw/waIKKKq9W4QhBIxRXzw== X-Received: by 2002:a17:902:184:: with SMTP id b4-v6mr21941058plb.340.1533063586567; Tue, 31 Jul 2018 11:59:46 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id e132-v6sm27797567pfc.49.2018.07.31.11.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 11:59:45 -0700 (PDT) From: Matthias Kaehlcke To: Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin Cc: linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, David Collins , Douglas Anderson , Stephen Boyd , Matthias Kaehlcke Subject: [PATCH v6 3/5] thermal: qcom-spmi: Use PMIC thermal stage 2 for critical trip points Date: Tue, 31 Jul 2018 11:59:15 -0700 Message-Id: <20180731185917.176074-3-mka@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180731185917.176074-1-mka@chromium.org> References: <20180731185917.176074-1-mka@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are three thermal stages defined in the PMIC: stage 1: warning stage 2: system should shut down stage 3: emergency shut down By default the PMIC assumes that the OS isn't doing anything and thus at stage 2 it does a partial PMIC shutdown and at stage 3 it kills all power. When switching between thermal stages the PMIC generates an interrupt which is handled by the driver. The partial PMIC shutdown at stage 2 can be disabled by software, which allows the OS to initiate a shutdown at stage 2 with a thermal zone configured accordingly. If a critical trip point is configured in the thermal zone the driver adjusts the stage 1-3 temperature thresholds to (closely) match the critical temperature with a stage 2 threshold (125/130/135/140 °C). If a suitable match is found the partial shutdown at stage 2 is disabled. If for some reason the system doesn't shutdown at stage 2 the emergency shutdown at stage 3 kicks in. The partial shutdown at stage 2 remains enabled in these cases: - no critical trip point defined - the temperature of the critical trip point is < 125°C - the temperature of the critical trip point is > 140°C and no ADC channel is configured (thus the OS is not notified when the critical temperature is reached) Suggested-by: Douglas Anderson Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson --- Changes in v6: - fixed condition to check if ADC is configured in qpnp_tm_update_critical_trip_temp() - changed °C in logs to C - removed needless evaluation of qpnp_tm_write() return value in qpnp_tm_update_critical_trip_temp() - move assignment of chip->initialized to true to qpnp_tm_init(), where the lock is held - call thermal_zone_device_update() after initialization is completed - split some #define + comment in two lines to avoid exceeding chars per line limit - removed extra closing parenthesis in qpnp_tm_get_temp() - remove unnecessary parentheses around conditions in qpnp_tm_update_critical_trip_temp() and qpnp_tm_get_critical_trip_temp() - fixed indentation of call devm_thermal_zone_of_sensor_register() call in qpnp_tm_probe() Changes in v5: - patch added to the series --- drivers/thermal/qcom-spmi-temp-alarm.c | 158 ++++++++++++++++++++++--- 1 file changed, 140 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c index ad4f3a8d6560..b2d5d5bf4a9b 100644 --- a/drivers/thermal/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom-spmi-temp-alarm.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_core.h" + #define QPNP_TM_REG_TYPE 0x04 #define QPNP_TM_REG_SUBTYPE 0x05 #define QPNP_TM_REG_STATUS 0x08 @@ -37,9 +39,11 @@ #define STATUS_GEN2_STATE_MASK GENMASK(6, 4) #define STATUS_GEN2_STATE_SHIFT 4 -#define SHUTDOWN_CTRL1_OVERRIDE_MASK GENMASK(7, 6) +#define SHUTDOWN_CTRL1_OVERRIDE_S2 BIT(6) #define SHUTDOWN_CTRL1_THRESHOLD_MASK GENMASK(1, 0) +#define SHUTDOWN_CTRL1_RATE_25HZ BIT(3) + #define ALARM_CTRL_FORCE_ENABLE BIT(7) /* @@ -56,12 +60,19 @@ #define TEMP_THRESH_STEP 5000 /* Threshold step: 5 C */ #define THRESH_MIN 0 +#define THRESH_MAX 3 + +/* Stage 2 Threshold Min: 125 C */ +#define STAGE2_THRESHOLD_MIN 125000 +/* Stage 2 Threshold Max: 140 C */ +#define STAGE2_THRESHOLD_MAX 140000 /* Temperature in Milli Celsius reported during stage 0 if no ADC is present */ #define DEFAULT_TEMP 37000 struct qpnp_tm_chip { struct regmap *map; + struct device *dev; struct thermal_zone_device *tz_dev; unsigned int subtype; long temp; @@ -69,6 +80,10 @@ struct qpnp_tm_chip { unsigned int stage; unsigned int prev_stage; unsigned int base; + /* protects .thresh, .stage and chip registers */ + struct mutex lock; + bool initialized; + struct iio_channel *adc; }; @@ -125,6 +140,8 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip) unsigned int stage, stage_new, stage_old; int ret; + WARN_ON(!mutex_is_locked(&chip->lock)); + ret = qpnp_tm_get_temp_stage(chip); if (ret < 0) return ret; @@ -163,8 +180,15 @@ static int qpnp_tm_get_temp(void *data, int *temp) if (!temp) return -EINVAL; + if (!chip->initialized) { + *temp = DEFAULT_TEMP; + return 0; + } + if (!chip->adc) { + mutex_lock(&chip->lock); ret = qpnp_tm_update_temp_no_adc(chip); + mutex_unlock(&chip->lock); if (ret < 0) return ret; } else { @@ -180,8 +204,72 @@ static int qpnp_tm_get_temp(void *data, int *temp) return 0; } +static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip, + int temp) +{ + u8 reg; + bool disable_s2_shutdown = false; + + WARN_ON(!mutex_is_locked(&chip->lock)); + + /* + * Default: S2 and S3 shutdown enabled, thresholds at + * 105C/125C/145C, monitoring at 25Hz + */ + reg = SHUTDOWN_CTRL1_RATE_25HZ; + + if (temp == THERMAL_TEMP_INVALID || + temp < STAGE2_THRESHOLD_MIN) { + chip->thresh = THRESH_MIN; + goto skip; + } + + if (temp <= STAGE2_THRESHOLD_MAX) { + chip->thresh = THRESH_MAX - + ((STAGE2_THRESHOLD_MAX - temp) / + TEMP_THRESH_STEP); + disable_s2_shutdown = true; + } else { + chip->thresh = THRESH_MAX; + + if (chip->adc) + disable_s2_shutdown = true; + else + dev_warn(chip->dev, + "No ADC is configured and critical temperature is above the maximum stage 2 threshold of 140 C! Configuring stage 2 shutdown at 140 C.\n"); + } + +skip: + reg |= chip->thresh; + if (disable_s2_shutdown) + reg |= SHUTDOWN_CTRL1_OVERRIDE_S2; + + return qpnp_tm_write(chip, QPNP_TM_REG_SHUTDOWN_CTRL1, reg); +} + +static int qpnp_tm_set_trip_temp(void *data, int trip, int temp) +{ + struct qpnp_tm_chip *chip = data; + const struct thermal_trip *trip_points; + int ret; + + trip_points = of_thermal_get_trip_points(chip->tz_dev); + if (!trip_points) + return -EINVAL; + + if (trip_points[trip].type != THERMAL_TRIP_CRITICAL) + return 0; + + mutex_lock(&chip->lock); + ret = qpnp_tm_update_critical_trip_temp(chip, temp); + mutex_unlock(&chip->lock); + + return ret; +} + static const struct thermal_zone_of_device_ops qpnp_tm_sensor_ops = { .get_temp = qpnp_tm_get_temp, + .set_trip_temp = qpnp_tm_set_trip_temp, }; static irqreturn_t qpnp_tm_isr(int irq, void *data) @@ -193,6 +281,29 @@ static irqreturn_t qpnp_tm_isr(int irq, void *data) return IRQ_HANDLED; } +static int qpnp_tm_get_critical_trip_temp(struct qpnp_tm_chip *chip) +{ + int ntrips; + const struct thermal_trip *trips; + int i; + + ntrips = of_thermal_get_ntrips(chip->tz_dev); + if (ntrips <= 0) + return THERMAL_TEMP_INVALID; + + trips = of_thermal_get_trip_points(chip->tz_dev); + if (!trips) + return THERMAL_TEMP_INVALID; + + for (i = 0; i < ntrips; i++) { + if (of_thermal_is_trip_valid(chip->tz_dev, i) && + trips[i].type == THERMAL_TRIP_CRITICAL) + return trips[i].temperature; + } + + return THERMAL_TEMP_INVALID; +} + /* * This function initializes the internal temp value based on only the * current thermal stage and threshold. Setup threshold control and @@ -203,17 +314,20 @@ static int qpnp_tm_init(struct qpnp_tm_chip *chip) unsigned int stage; int ret; u8 reg = 0; + int crit_temp; + + mutex_lock(&chip->lock); ret = qpnp_tm_read(chip, QPNP_TM_REG_SHUTDOWN_CTRL1, ®); if (ret < 0) - return ret; + goto out; chip->thresh = reg & SHUTDOWN_CTRL1_THRESHOLD_MASK; chip->temp = DEFAULT_TEMP; ret = qpnp_tm_get_temp_stage(chip); if (ret < 0) - return ret; + goto out; chip->stage = ret; stage = chip->subtype == QPNP_TM_SUBTYPE_GEN1 @@ -224,21 +338,19 @@ static int qpnp_tm_init(struct qpnp_tm_chip *chip) (stage - 1) * TEMP_STAGE_STEP + TEMP_THRESH_MIN; - /* - * Set threshold and disable software override of stage 2 and 3 - * shutdowns. - */ - chip->thresh = THRESH_MIN; - reg &= ~(SHUTDOWN_CTRL1_OVERRIDE_MASK | SHUTDOWN_CTRL1_THRESHOLD_MASK); - reg |= chip->thresh & SHUTDOWN_CTRL1_THRESHOLD_MASK; - ret = qpnp_tm_write(chip, QPNP_TM_REG_SHUTDOWN_CTRL1, reg); + crit_temp = qpnp_tm_get_critical_trip_temp(chip); + ret = qpnp_tm_update_critical_trip_temp(chip, crit_temp); if (ret < 0) - return ret; + goto out; /* Enable the thermal alarm PMIC module in always-on mode. */ reg = ALARM_CTRL_FORCE_ENABLE; ret = qpnp_tm_write(chip, QPNP_TM_REG_ALARM_CTRL, reg); + chip->initialized = true; + +out: + mutex_unlock(&chip->lock); return ret; } @@ -257,6 +369,9 @@ static int qpnp_tm_probe(struct platform_device *pdev) return -ENOMEM; dev_set_drvdata(&pdev->dev, chip); + chip->dev = &pdev->dev; + + mutex_init(&chip->lock); chip->map = dev_get_regmap(pdev->dev.parent, NULL); if (!chip->map) @@ -302,6 +417,18 @@ static int qpnp_tm_probe(struct platform_device *pdev) chip->subtype = subtype; + /* + * Register the sensor before initializing the hardware to be able to + * read the trip points. get_temp() returns the default temperature + * before the hardware initialization is completed. + */ + chip->tz_dev = devm_thermal_zone_of_sensor_register( + &pdev->dev, 0, chip, &qpnp_tm_sensor_ops); + if (IS_ERR(chip->tz_dev)) { + dev_err(&pdev->dev, "failed to register sensor\n"); + return PTR_ERR(chip->tz_dev); + } + ret = qpnp_tm_init(chip); if (ret < 0) { dev_err(&pdev->dev, "init failed\n"); @@ -313,12 +440,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) if (ret < 0) return ret; - chip->tz_dev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, chip, - &qpnp_tm_sensor_ops); - if (IS_ERR(chip->tz_dev)) { - dev_err(&pdev->dev, "failed to register sensor\n"); - return PTR_ERR(chip->tz_dev); - } + thermal_zone_device_update(chip->tz_dev, THERMAL_EVENT_UNSPECIFIED); return 0; } From patchwork Tue Jul 31 18:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10551209 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E396613BF for ; Tue, 31 Jul 2018 19:00:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDB582B397 for ; Tue, 31 Jul 2018 19:00:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBE782B3CB; Tue, 31 Jul 2018 19:00:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 748FC2B3AB for ; Tue, 31 Jul 2018 19:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732261AbeGaUlm (ORCPT ); Tue, 31 Jul 2018 16:41:42 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43782 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732258AbeGaUl2 (ORCPT ); Tue, 31 Jul 2018 16:41:28 -0400 Received: by mail-pl0-f66.google.com with SMTP id x6-v6so7559768plv.10 for ; Tue, 31 Jul 2018 11:59:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=76XyzsmzEYZUY9NhKGrjYdT4OLrEbkvqeBkWmOp81tA=; b=YIGhx81P/2phOt/nHVvSBH8lAIqeUugAMCkLpm9K3wf4j+LfT6LRqfwwNupLKJbsBA rC+W2T94o+qqBg7P784xIAYHTthBjujhSoAOrxNCnjvcGct+oRQfs7aNTElaTFzLTuxs MDjb9YTzoNStgVrY63KEsC6ieAHi+QXoY0u7w= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=76XyzsmzEYZUY9NhKGrjYdT4OLrEbkvqeBkWmOp81tA=; b=nrssUL7FeuYfAKLb01F1c4NXVc8rhMdD3R0bqYscK8uTU90Hsp+zokXJgiZAoOEtkB 9dwSjlQP/e7yMOr2JoEhj5vk6Wj5tpkn+RgLMk/9PzGK7J9mUxpU/+Xk8yuWJtl3tUwG kIyyDVg18i9TKLQWkBwxqbnnIikzduBrlljqpgvA9Up7QptcGdxtj17XBNvBYqtsmcqz OBKrnKszSRhEd0X84US9xLW2mXwXUz4iSa0n6RgbDGG8if7zTBlFZhSAbl8oFsy09Pcg fQ/06pJ0kvJ6hmyvvcr1rMWipZlhE3kjzofrP8WJO6h/ytIKMU4FrUTjDScw/aN+LKgY mvNg== X-Gm-Message-State: AOUpUlHL2Lr5pNCiX9VfGDR1rNGaquPnArUJysoJL0cYrcYHnzncXXhm hb/A9cd2Ickc1LwmzTtxSmO1Gg== X-Google-Smtp-Source: AAOMgpe/BvLtSVL6R09niZyDsp8FYv0+oMpussKWmcqvWK5kzxLt2peegWCQ9ISqpC4uTB7D3gb5sA== X-Received: by 2002:a17:902:4203:: with SMTP id g3-v6mr14187523pld.30.1533063587830; Tue, 31 Jul 2018 11:59:47 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id e132-v6sm27797567pfc.49.2018.07.31.11.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 11:59:47 -0700 (PDT) From: Matthias Kaehlcke To: Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin Cc: linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, David Collins , Douglas Anderson , Stephen Boyd , Matthias Kaehlcke Subject: [PATCH v6 4/5] arm64: dts: qcom: pm8998: Add spmi-temp-alarm node Date: Tue, 31 Jul 2018 11:59:16 -0700 Message-Id: <20180731185917.176074-4-mka@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180731185917.176074-1-mka@chromium.org> References: <20180731185917.176074-1-mka@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds the spmi-temp-alarm node to pm8998 based on the examples in the bindings. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson --- Changes in v6: - none Changes in v5: - added tag 'Reviewed-by: Douglas Anderson ' Changes in v4: - none Changes in v3: - changed node name from 'qcom,temp-alarm@2400' to 'temp-alarm@2400' - removed controller register length value from 'reg' Changes in v2: - none --- arch/arm64/boot/dts/qcom/pm8998.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/pm8998.dtsi b/arch/arm64/boot/dts/qcom/pm8998.dtsi index 92bed1e7d4bb..7eea94701b23 100644 --- a/arch/arm64/boot/dts/qcom/pm8998.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8998.dtsi @@ -11,6 +11,13 @@ #address-cells = <1>; #size-cells = <0>; + pm8998_temp: temp-alarm@2400 { + compatible = "qcom,spmi-temp-alarm"; + reg = <0x2400>; + interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <0>; + }; + pm8998_gpio: gpios@c000 { compatible = "qcom,pm8998-gpio", "qcom,spmi-gpio"; reg = <0xc000>; From patchwork Tue Jul 31 18:59:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10551203 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FC081708 for ; Tue, 31 Jul 2018 18:59:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C6B2B2E5 for ; Tue, 31 Jul 2018 18:59:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E81B22B376; Tue, 31 Jul 2018 18:59:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98A702B2E5 for ; Tue, 31 Jul 2018 18:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732274AbeGaUlh (ORCPT ); Tue, 31 Jul 2018 16:41:37 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:44207 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732284AbeGaUl3 (ORCPT ); Tue, 31 Jul 2018 16:41:29 -0400 Received: by mail-pl0-f65.google.com with SMTP id m16-v6so7563177pls.11 for ; Tue, 31 Jul 2018 11:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gF9UpcqWCQAPpTAYxBGWl2YKXDfCJhhLRmXour3w3OY=; b=TQWFdBoE6fDW3+ojfccdOKCF4n+hPOnUqIpUomM77kF65HNnzRy3s4Cg4XdoQEj9m+ R5zj9gOIqHAuT9bBPI0Rd4m6QEuy7PnlUmbtzdvOpzExAM5cTIYqmOHLCu3IvMa+akjK n7WbASlFcJDSJo2EZHIJQap9WLiZV/vWZeU4E= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=gF9UpcqWCQAPpTAYxBGWl2YKXDfCJhhLRmXour3w3OY=; b=caXqUCVXMnuphpQNXUNopi/Wj4PaETPCqfdA2fzSDjkOTgAcp38UbSC3vPp8lq35xV s18C2BcpKEjoYjMHxsbzHehv2dV9buE/n9UArwWvZm8W8QkJDNhoZgQNQvmPpR8A0IqA I6eBvgcvvDjRTFKnO6Zz23G9PmVzBPLtzKExCU9j4pVRFTfjdhgs6xxKBare4E9TGApT 2TN9UfMvpn52E6aIH03DZI10OVUKthhYKwoIsZdcOzeyo/w31C9/V3LRJ55J5WyP+L6j oJeU/QGi0ZbEdqU1kGqBBCrZRCSVNE+kUSlDSaafBDCljqNfNYDO7qVSLxxtxVe0uQZT f6Mw== X-Gm-Message-State: AOUpUlFV+QxTzedVeAJdPMUFhU2b0hTph2cGYsS2Ux4j8sCh+pVodrb1 bMiwNRhmlVFyc1J9qy2WfTd8Xg== X-Google-Smtp-Source: AAOMgpcqzJc3hmXPEdwz13ByOlAarWASYs+m/Q4qcT9wftzAhBtfdbuPziO/G7gZsw26X4RIlk7YDw== X-Received: by 2002:a17:902:aa07:: with SMTP id be7-v6mr21362210plb.109.1533063589092; Tue, 31 Jul 2018 11:59:49 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id e132-v6sm27797567pfc.49.2018.07.31.11.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 11:59:48 -0700 (PDT) From: Matthias Kaehlcke To: Andy Gross , David Brown , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin Cc: linux-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, David Collins , Douglas Anderson , Stephen Boyd , Matthias Kaehlcke Subject: [PATCH v6 5/5] arm64: dts: qcom: pm8998: Add pm8998 thermal zone Date: Tue, 31 Jul 2018 11:59:17 -0700 Message-Id: <20180731185917.176074-5-mka@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180731185917.176074-1-mka@chromium.org> References: <20180731185917.176074-1-mka@chromium.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The thermal zone uses spmi-temp-alarm as sensor, the trip points correspond to the PMIC thermal stages 1 and 2. The critical trip point at 125°C disables the partial PMIC shutdown at stage 2. Without an IIO input the sensor only reports a limited number of temperatures: - 37°C for temperatures below 105°C - 107°C for temperatures >= 105°C and < 125°C - 127°C for temperatures >= 125°C (the numbers correspond to a stage 1 threshold of 105°C) Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson --- Changes in v6: - added 'Reviewed-by: Douglas Anderson ' tag Changes in v5: - removed 'stage2-shutdown-disabled' property from spmi-temp-alarm - updated commit message Changes in v4: - updated trip point temperatures to match stage 1 and 2 ones - disabled stage 2 shutdown - updated commit message Changes in v3: - moved 'thermal-zones' node to the beginning of the .dtsi Changes in v2: - defined 'thermal-zones' node in pm8998.dtsi instead of using a label to refer to it - use 105°C hardware trip point as critical trip point - reduced number of trip points to 2 - lowered temperature of passive trip point - updated trip point names and added labels - updated commit message --- arch/arm64/boot/dts/qcom/pm8998.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/pm8998.dtsi b/arch/arm64/boot/dts/qcom/pm8998.dtsi index 7eea94701b23..34c259ba3919 100644 --- a/arch/arm64/boot/dts/qcom/pm8998.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8998.dtsi @@ -3,6 +3,31 @@ #include #include +#include + +/ { + thermal-zones { + pm8998 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&pm8998_temp>; + + trips { + pm8998_alert0: pm8998-alert0 { + temperature = <105000>; + hysteresis = <2000>; + type = "passive"; + }; + pm8998_crit: pm8998-crit { + temperature = <125000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; +}; &spmi_bus { pm8998_lsid0: pmic@0 {