From patchwork Fri May 10 13:26:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938827 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 31E64112C for ; Fri, 10 May 2019 13:28:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FBFE28BCE for ; Fri, 10 May 2019 13:28:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1321A28BE2; Fri, 10 May 2019 13:28:21 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADA0F28BCE for ; Fri, 10 May 2019 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JQxrQR1b9jc9zmFW/NdkXu9EmmoPWxwdkqrgglKrKMY=; b=fu9thcJGXB0KH6 a4ROhUaFfF7aJmqYxhSgf7Img7nrtIutrm7xilxl6NCIItdKvAmFLElg+eFaYnuJMyk9tHPRzQbuc vxBUnuYF1VYs8pQ7Byr+Hpkv3JSDP+hVHcNYLc69cINi1q9R5eGZhdqZ/3ABaBvdjSxISydZjm9vJ a3iEqpmOhA9xEL5dhxlDGeLRrPmQYreQwer6eEgWdqUAuxwMvXMSebDJCJygaffNEI49fG/SoNeay LqG3j4OsXXf/gEW4xjExzxJmYwa/WWSak0lvJPX8IFCTk8qMombUkj1b24Y4zQQlaTlxihNYEUp0l L8P2bfh+LLyqLafxrWPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5ZQ-0002of-0S; Fri, 10 May 2019 13:28:16 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5YV-0001d0-Cb; Fri, 10 May 2019 13:27:24 +0000 X-UUID: c2ed43a6a6ac450d9c29cab3cf21343f-20190510 X-UUID: c2ed43a6a6ac450d9c29cab3cf21343f-20190510 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1086594668; Fri, 10 May 2019 05:27:13 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:12 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:09 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 1/8] arm64: dts: mt8183: add thermal zone node Date: Fri, 10 May 2019 21:26:59 +0800 Message-ID: <1557494826-6044-2-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062719_713885_3DE712BC X-CRM114-Status: GOOD ( 10.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "michael.kao" , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add thermal zone node to Mediatek MT8183 dts file. Signed-off-by: Michael Kao --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 85 ++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 926df75..52ad47e 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -334,6 +334,88 @@ status = "disabled"; }; + thermal: thermal@1100b000 { + #thermal-sensor-cells = <1>; + compatible = "mediatek,mt8183-thermal"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <0 76 IRQ_TYPE_LEVEL_LOW>; + clocks = <&infracfg CLK_INFRA_THERM>, + <&infracfg CLK_INFRA_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&infracfg MT8183_INFRACFG_AO_THERM_SW_RST>; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + mediatek,hw-reset-temp = <117000>; + nvmem-cells = <&thermal_calibration>; + nvmem-cell-names = "calibration-data"; + }; + + thermal-zones { + cpu_thermal: cpu_thermal { + polling-delay-passive = <1000>; + polling-delay = <1000>; + thermal-sensors = <&thermal 0>; + sustainable-power = <1500>; + }; + + /* The tzts1 ~ tzts6 don't need to polling */ + /* The tzts1 ~ tzts6 don't need to thermal throttle */ + + tzts1: tzts1 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 1>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + + tzts2: tzts2 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 2>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + + tzts3: tzts3 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 3>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + + tzts4: tzts4 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 4>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + + tzts5: tzts5 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 5>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + + tztsABB: tztsABB { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 6>; + sustainable-power = <0>; + trips {}; + cooling-maps {}; + }; + }; + audiosys: syscon@11220000 { compatible = "mediatek,mt8183-audiosys", "syscon"; reg = <0 0x11220000 0 0x1000>; @@ -368,6 +450,9 @@ compatible = "mediatek,mt8183-efuse", "mediatek,efuse"; reg = <0 0x11f10000 0 0x1000>; + thermal_calibration: calib@180 { + reg = <0x180 0xc>; + }; }; mfgcfg: syscon@13000000 { From patchwork Fri May 10 13:27:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938821 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 56A8892A for ; Fri, 10 May 2019 13:27:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40A2328BCE for ; Fri, 10 May 2019 13:27:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31CFE28BED; Fri, 10 May 2019 13:27:53 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBE7F28BCE for ; Fri, 10 May 2019 13:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=atgXALj1Q+G9vQRO+b0U8JiDzpQiPFUODmj460/MGw4=; b=Kb7dYQSpl7rspd D6K0umIa7FTC7Xg1RoI58rA2VIFbXtx7xeybccKa/X0xQbD7aHAU499bhHBPnLlce0x5xiHSOGsYi 3/DA8748RgQW+XGntXbwFY5tLWXNpUG9RUYmo1I0R/ss21tEGnOE8GMLSKAwD2M2pslseGrZW32aL 7LLnIRteTA9lOF/pTQEARRUg7EGJNkOjc4ZME85+rFtfjCNZsFZSJSSsPQgTA+oc1ogPfIUsVSYYD mNnasHzBtriqXVhSK/StkA1ldBML9YIeiIhC9WHbNIlqDIm8TMAJE9zqq6jF0M/iPwfDtJDG/vt5z ntXj7KTR1ykgSe45E+WA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5Yw-0002EX-Dy; Fri, 10 May 2019 13:27:46 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5YU-0001d1-3z; Fri, 10 May 2019 13:27:23 +0000 X-UUID: 6f9a28d8478740a8bbab601701f55e01-20190510 X-UUID: 6f9a28d8478740a8bbab601701f55e01-20190510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 121745635; Fri, 10 May 2019 05:27:14 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:12 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 2/8] arm64: dts: mt8183: add/update dynamic power coefficients Date: Fri, 10 May 2019 21:27:00 +0800 Message-ID: <1557494826-6044-3-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062718_396387_6A5F2E88 X-CRM114-Status: UNSURE ( 8.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "michael.kao" , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add dynamic power coefficients for all cores and update those of CPU0 and CPU4. Signed-off-by: Michael.Kao --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 52ad47e..8f9fd9a 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -58,6 +58,7 @@ compatible = "arm,cortex-a53"; reg = <0x000>; enable-method = "psci"; + dynamic-power-coefficient = <84>; }; cpu1: cpu@1 { @@ -65,6 +66,7 @@ compatible = "arm,cortex-a53"; reg = <0x001>; enable-method = "psci"; + dynamic-power-coefficient = <84>; }; cpu2: cpu@2 { @@ -72,6 +74,7 @@ compatible = "arm,cortex-a53"; reg = <0x002>; enable-method = "psci"; + dynamic-power-coefficient = <84>; }; cpu3: cpu@3 { @@ -79,6 +82,7 @@ compatible = "arm,cortex-a53"; reg = <0x003>; enable-method = "psci"; + dynamic-power-coefficient = <84>; }; cpu4: cpu@100 { @@ -86,6 +90,7 @@ compatible = "arm,cortex-a73"; reg = <0x100>; enable-method = "psci"; + dynamic-power-coefficient = <211>; }; cpu5: cpu@101 { @@ -93,6 +98,7 @@ compatible = "arm,cortex-a73"; reg = <0x101>; enable-method = "psci"; + dynamic-power-coefficient = <211>; }; cpu6: cpu@102 { @@ -100,6 +106,7 @@ compatible = "arm,cortex-a73"; reg = <0x102>; enable-method = "psci"; + dynamic-power-coefficient = <211>; }; cpu7: cpu@103 { @@ -107,6 +114,7 @@ compatible = "arm,cortex-a73"; reg = <0x103>; enable-method = "psci"; + dynamic-power-coefficient = <211>; }; }; From patchwork Fri May 10 13:27:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938839 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 8A83B112C for ; Fri, 10 May 2019 13:29:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78D2428BCE for ; Fri, 10 May 2019 13:29:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C9EC28BE2; Fri, 10 May 2019 13:29:24 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 243C028BCE for ; Fri, 10 May 2019 13:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nRG+pZwiTNQkhC2L6GsfnSWY3v6WxlAfHOjvquwerZw=; b=MS6bwflLfhYJtW S1noxqsUUElH0rSu0whgUZ5jCdMPMLkEU8nHKGkkY9jGAaElKnYdDzYJVP57unMJ2bXxtS68PNXWM 9KsGxt05fIqRm58FqO8ZaC3qF1OaJGmFuBB/BmAUGG6KncLiN81DJZxWoyma71+RZDivqFYu8l0OX Eep159pY0RilB9GXhPr4QasaMYSWxTUy32aGpZu7on/WfDF8hFUZIAvqF7dHTZ4bst86FHhxwkJUa KJcQaus1ZkYmIWizAoXMm4xNbC/e6Bv8CQzzTD2QWyP0FF1lG6zIM5zfPw0piHoCtPhQJeP+FzEue uiaEvN5K+QsxS/Ou482A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5aV-0003ue-Ar; Fri, 10 May 2019 13:29:23 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5aR-0003tD-1U; Fri, 10 May 2019 13:29:20 +0000 X-UUID: 92cc804760f94725af861b0e063b64cf-20190510 X-UUID: 92cc804760f94725af861b0e063b64cf-20190510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 725766648; Fri, 10 May 2019 05:27:26 -0800 Received: from MTKMBS01N2.mediatek.inc (172.21.101.79) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:25 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 3/8] arm64: dts: mt8183: Add #cooling-cells to CPU nodes Date: Fri, 10 May 2019 21:27:01 +0800 Message-ID: <1557494826-6044-4-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 8336847EAA702472685A4546EE562E7D2DA13545CC464BBBB765F6D87EB3AE712000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062919_083457_2F7918CF X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "michael.kao" , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The #cooling-cells property needs to be specified to allow a CPU to be used as cooling device. Signed-off-by: Michael.Kao --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 8f9fd9a..bf8b0a8 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -11,6 +11,8 @@ #include #include #include "mt8183-pinfunc.h" +#include + / { compatible = "mediatek,mt8183"; interrupt-parent = <&sysirq>; @@ -59,6 +61,7 @@ reg = <0x000>; enable-method = "psci"; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu1: cpu@1 { @@ -67,6 +70,7 @@ reg = <0x001>; enable-method = "psci"; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu2: cpu@2 { @@ -75,6 +79,7 @@ reg = <0x002>; enable-method = "psci"; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu3: cpu@3 { @@ -83,6 +88,7 @@ reg = <0x003>; enable-method = "psci"; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu4: cpu@100 { @@ -91,6 +97,7 @@ reg = <0x100>; enable-method = "psci"; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu5: cpu@101 { @@ -99,6 +106,7 @@ reg = <0x101>; enable-method = "psci"; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu6: cpu@102 { @@ -107,6 +115,7 @@ reg = <0x102>; enable-method = "psci"; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu7: cpu@103 { @@ -115,6 +124,7 @@ reg = <0x103>; enable-method = "psci"; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; }; From patchwork Fri May 10 13:27:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938835 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 038BD92A for ; Fri, 10 May 2019 13:28:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E67EC28BCE for ; Fri, 10 May 2019 13:28:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA87528BE2; Fri, 10 May 2019 13:28:57 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E373028BCE for ; Fri, 10 May 2019 13:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r1N9CejIDP8G9MU4TvvnmmgYNr3RB4iskZe9y1bbP2g=; b=S2O3GPNSJxRkMd NmKYSypugvLiVwAq65YV8Dku+YbdqKRxGSeSIlAZpshUyAnJ+q7aDuMHCyLpsmJzCDQljfaR7pDMA 4RdljYLnCR9T1uSpKnx8v+MEZi9TDrB6yUUxoJYKFIPqwk1XgGX9oYPDpLBHH2sXDdqJ4mrkRUc8b eVy3rE3MnC/p3aaMnVlvAqrBcYwrktpacaTaD7IIaY2zqicrO9aFpKhcQwwg+DqtYeUNWEmtsI6lc WxUt444I6F0uGfMGRbDi1TEjSPBqQ/xNu7ndMJ3DXNH2eTmj0fA/DW+FqDGWpWx8B2h2QDmQpNced fdYROWPSm4zzNUAEbFXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5Zz-0003XI-GW; Fri, 10 May 2019 13:28:51 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5YS-0001dB-MW; Fri, 10 May 2019 13:27:20 +0000 X-UUID: 4cd89c691c9145d3b511a75f4fee6ed1-20190510 X-UUID: 4cd89c691c9145d3b511a75f4fee6ed1-20190510 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1002084881; Fri, 10 May 2019 05:27:13 -0800 Received: from mtkmbs03n2.mediatek.inc (172.21.101.182) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:12 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 4/8] arm64: dts: mt8183: Configure CPU cooling Date: Fri, 10 May 2019 21:27:02 +0800 Message-ID: <1557494826-6044-5-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 2520C034CBC41554F88F741CA7C0757D572A3B445141B423EE9FE748D25258A92000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062717_025118_B55D3491 X-CRM114-Status: UNSURE ( 8.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthias Kaehlcke Add two passive trip points at 68°C and 85°C for the CPU temperature. Signed-off-by: Matthias Kaehlcke Signed-off-by: Michael Kao --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index bf8b0a8..29ad660 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -374,6 +374,61 @@ polling-delay = <1000>; thermal-sensors = <&thermal 0>; sustainable-power = <1500>; + + trips { + threshold: trip-point@0 { + temperature = <68000>; + hysteresis = <2000>; + type = "passive"; + }; + + target: trip-point@1 { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit: cpu-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&target>; + 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>; + contribution = <3072>; + }; + map1 { + trip = <&target>; + cooling-device = <&cpu4 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu5 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu6 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu7 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>; + contribution = <1024>; + }; + }; }; /* The tzts1 ~ tzts6 don't need to polling */ From patchwork Fri May 10 13:27:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938833 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 A81A092A for ; Fri, 10 May 2019 13:28:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94B9428BCE for ; Fri, 10 May 2019 13:28:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8893228BE2; Fri, 10 May 2019 13:28:41 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3ED4E28BCE for ; Fri, 10 May 2019 13:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OvlGiLNJB4Ae3OzVtBT1JUyReM28s8cjKuehVicw6Mk=; b=lfoFgok6xdTi// T2KFiPqv8NTXt38YSdCTFSa/dRCUJuBf9aPz56nIq9D1rD3dd9GbO6P/IobJDsUbvMdU9TXB+ORQi aMTWR/bV3cw44s10DdDgnLBtvPsWld+MrPRKCGzi31E0BaeWDUoH4bwH6rb91xn9ISTj6ULcAxygg C/6fM7lTFodizddUtjd//oAt+eNlF6bbCIOm6y6vPoQY2/PS2FLgaRHDN3qBGEDr1pWcpBhOjXojR evLJy6osFUm5c3kFuIVPSy7SvbtxKJTO/hp/tPjtUGFqteYz2fLTEuc9E/A2cO9VbDbqiouG2HJUU rn5dCVFoba3lMzHULOyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5Zk-0003FO-I9; Fri, 10 May 2019 13:28:36 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5YW-0001dB-Hz; Fri, 10 May 2019 13:27:24 +0000 X-UUID: 6064b2eb45cc4036a282093794e2f9e6-20190510 X-UUID: 6064b2eb45cc4036a282093794e2f9e6-20190510 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1567581048; Fri, 10 May 2019 05:27:13 -0800 Received: from mtkmbs03n1.mediatek.inc (172.21.101.181) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:12 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 5/8] arm64: dts: mt8183: Increase polling frequency for CPU thermal zone Date: Fri, 10 May 2019 21:27:03 +0800 Message-ID: <1557494826-6044-6-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062720_969274_4E173092 X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthias Kaehlcke Evaluate the thermal zone every 500ms while not cooling and every 100ms when passive cooling is performed. Signed-off-by: Matthias Kaehlcke Signed-off-by: Michael Kao --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 29ad660..2c4e014 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -370,8 +370,8 @@ thermal-zones { cpu_thermal: cpu_thermal { - polling-delay-passive = <1000>; - polling-delay = <1000>; + polling-delay-passive = <100>; + polling-delay = <500>; thermal-sensors = <&thermal 0>; sustainable-power = <1500>; From patchwork Fri May 10 13:27:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938823 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 A3D35112C for ; Fri, 10 May 2019 13:28:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9288728BCE for ; Fri, 10 May 2019 13:28:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85F5E28BE2; Fri, 10 May 2019 13:28:01 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39D9728BCE for ; Fri, 10 May 2019 13:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UHWhntpqTeH870L2I8bZj+BX5kOuWxZLw+v2jVamEf4=; b=AFJFeVpKxObjYt ORqZp3IERuTd1OdmTUQJzFBYM8iid3PwqKeWi+KARsdMv6XZ2UK0cayYNJOP+HjptD92g5x3RIeXU sw5/Ig7kwmbIn4TU16uPrsU4cXQyV0hVfc2+B4DOGkvWI6d5DE4EGvM/PbNfhmM6a/xnA1zTH2sRM gbWjvP7N9lhMsGPwRr1VmuYjPVJbIiTSymRiAXUQgqlYS3LsEg5ZNm6bdMhe1JYlUWxvBe8ptbjW7 9643jxoogg56FqYuIY9jcv53EVS1JjnZMKgRK5WXNkxJ2x1PvFFYWd5TzlFwHok/4zGtQQ7GgyAkJ vt3958/aB7Q5Zatc0osw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5Z5-0002RF-QY; Fri, 10 May 2019 13:27:55 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5YU-0001dv-3z; Fri, 10 May 2019 13:27:23 +0000 X-UUID: 14d25213d30b4451bed1c7d0b7985027-20190510 X-UUID: 14d25213d30b4451bed1c7d0b7985027-20190510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 499871902; Fri, 10 May 2019 05:27:14 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:13 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:10 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 6/8] thermal: mediatek: mt8183: fix bank number settings Date: Fri, 10 May 2019 21:27:04 +0800 Message-ID: <1557494826-6044-7-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062718_426465_C0222024 X-CRM114-Status: GOOD ( 10.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Kao , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Kao MT8183_NUM_ZONES should be set to 1 because MT8183 doesn't have multiple banks. Fixes: a4ffe6b52d27 ("thermal: mediatek: add support for MT8183") Signed-off-by: Michael Kao --- drivers/thermal/mtk_thermal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 5c07a61..cb41e46 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -216,6 +216,9 @@ enum { /* The total number of temperature sensors in the MT8183 */ #define MT8183_NUM_SENSORS 6 +/* The number of banks in the MT8183 */ +#define MT8183_NUM_ZONES 1 + /* The number of sensing points per bank */ #define MT8183_NUM_SENSORS_PER_ZONE 6 @@ -503,7 +506,7 @@ static const struct mtk_thermal_data mt7622_thermal_data = { static const struct mtk_thermal_data mt8183_thermal_data = { .auxadc_channel = MT8183_TEMP_AUXADC_CHANNEL, - .num_banks = MT8183_NUM_SENSORS_PER_ZONE, + .num_banks = MT8183_NUM_ZONES, .num_sensors = MT8183_NUM_SENSORS, .vts_index = mt8183_vts_index, .cali_val = MT8183_CALIBRATION, From patchwork Fri May 10 13:27:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938831 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 54235112C for ; Fri, 10 May 2019 13:28:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4140B28BDA for ; Fri, 10 May 2019 13:28:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34F4D28BED; Fri, 10 May 2019 13:28:32 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D18FA28BDA for ; Fri, 10 May 2019 13:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A9P48JKSus01UAdYZ2dSRCQ3cduo2U22uAbvegueiXs=; b=g/V5yUMf9ojbPi UU3LiVuZF3B1AE9puMdAu+ws4dpagTEzxvm5e5ITmyKJQsBKfckkkaDQS2aGrrDuskzYLExtWe/aI vJPcFty3yW+z+Wvkz0jwjtVKPV1MnqYIixxwucSXJIRMXoRD0MzKQNUzPCUOPLZKbKZPMSRqDuW6E f6Hyeh/DAowGNi8Ggdu6mzEJ1OnqMP3JYVP7QPc/BueYr67Gjmj3pggz0i7pjw8rtZZFchbdFsWVh Ernn0pQixhv+4FJciHp1Aqhq5O4PaoZJbzgCDErber/lCvK/3EWV+fO5S6Aa67iJPgo5ENk4YhxKB kePEa55d3/Yia/+jKfsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5ZZ-0002zo-5n; Fri, 10 May 2019 13:28:25 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5Ya-0001dB-K7; Fri, 10 May 2019 13:27:28 +0000 X-UUID: fcd2406932a44a64b29da2ff18357c59-20190510 X-UUID: fcd2406932a44a64b29da2ff18357c59-20190510 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 497265855; Fri, 10 May 2019 05:27:16 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:14 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:10 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:11 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 7/8] thermal: mediatek: add another get_temp ops for thermal sensors Date: Fri, 10 May 2019 21:27:05 +0800 Message-ID: <1557494826-6044-8-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062725_349097_1803C67E X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Kao , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Kao Provide thermal zone to read thermal sensor in the SoC. We can read all the thermal sensors value in the SoC by the node /sys/class/thermal/ Signed-off-by: Michael Kao --- drivers/thermal/mtk_thermal.c | 68 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index cb41e46..d5c78b0 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -230,6 +230,11 @@ enum { struct mtk_thermal; +struct mtk_thermal_zone { + struct mtk_thermal *mt; + int id; +}; + struct thermal_bank_cfg { unsigned int num_sensors; const int *sensors; @@ -612,7 +617,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) * not immediately shut down. */ if (temp > 200000) - temp = 0; + temp = -EACCES; if (temp > max) max = temp; @@ -623,7 +628,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) static int mtk_read_temp(void *data, int *temperature) { - struct mtk_thermal *mt = data; + struct mtk_thermal_zone *tz = data; + struct mtk_thermal *mt = tz->mt; int i; int tempmax = INT_MIN; @@ -636,16 +642,48 @@ static int mtk_read_temp(void *data, int *temperature) mtk_thermal_put_bank(bank); } - *temperature = tempmax; return 0; } +static int mtk_read_sensor_temp(void *data, int *temperature) +{ + struct mtk_thermal_zone *tz = data; + struct mtk_thermal *mt = tz->mt; + const struct mtk_thermal_data *conf = mt->conf; + int id = tz->id - 1; + int temp = INT_MIN; + u32 raw; + + if (id < 0) + return -EACCES; + + raw = readl(mt->thermal_base + conf->msr[id]); + + temp = raw_to_mcelsius(mt, id, raw); + + /* + * The first read of a sensor often contains very high bogus + * temperature value. Filter these out so that the system does + * not immediately shut down. + */ + + if (temp > 200000) + return -EACCES; + + *temperature = temp; + return 0; +} + static const struct thermal_zone_of_device_ops mtk_thermal_ops = { .get_temp = mtk_read_temp, }; +static const struct thermal_zone_of_device_ops mtk_thermal_sensor_ops = { + .get_temp = mtk_read_sensor_temp, +}; + static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, u32 apmixed_phys_base, u32 auxadc_phys_base, int ctrl_id) @@ -878,6 +916,7 @@ static int mtk_thermal_probe(struct platform_device *pdev) struct resource *res; u64 auxadc_phys_base, apmixed_phys_base; struct thermal_zone_device *tzdev; + struct mtk_thermal_zone *tz; mt = devm_kzalloc(&pdev->dev, sizeof(*mt), GFP_KERNEL); if (!mt) @@ -959,11 +998,24 @@ static int mtk_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mt); - tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, - &mtk_thermal_ops); - if (IS_ERR(tzdev)) { - ret = PTR_ERR(tzdev); - goto err_disable_clk_peri_therm; + for (i = 0; i < mt->conf->num_sensors + 1; i++) { + tz = kmalloc(sizeof(*tz), GFP_KERNEL); + if (!tz) + return -ENOMEM; + + tz->mt = mt; + tz->id = i; + + tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, i, + tz, (i == 0) ? + &mtk_thermal_ops : &mtk_thermal_sensor_ops); + + if (IS_ERR(tzdev)) { + if (IS_ERR(tzdev) != -EACCES) { + ret = PTR_ERR(tzdev); + goto err_disable_clk_peri_therm; + } + } } return 0; From patchwork Fri May 10 13:27:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 10938843 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 4DE3492A for ; Fri, 10 May 2019 13:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3774328BCE for ; Fri, 10 May 2019 13:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276B728BED; Fri, 10 May 2019 13:29:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABCFD28BCE for ; Fri, 10 May 2019 13:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tLjfLC6U7NDMlc0AVuyAJPTAenIsfFuz2OOxAYDjEKM=; b=kZNJOetCdSLmeL YU2hgu5ZkpWwXmyGwQhSe9HL/oucpg/R2yDHK/dlIl4cM3mQSDemhx8T4JYcxhGvVG7LF2MtjNsnJ QrClVfDQ0Bx9ICSk/Zo3ymkblP/sRU0JaaU933RSq9iGOhikmTDODr0eKFofGDNKB0RQNoEkFn6sh /LaMBigLfOWihdIDLrHb8CW85penFgsl4Z7NbLrAaMdjNBRer76oG8NSHqHCdK2MSmuR6r5+Ke9Xa aJ28zqKuDm9EizHgKLkGKww6/Q4SlXArTjIy3cFXml5Uy8fPZ7RzEC+jj82IYXtTiAVYu75PdIPJ9 PMB1/9AQ1INcPSf41+xQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5aj-0004CI-2c; Fri, 10 May 2019 13:29:37 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP5aR-0003tS-W6; Fri, 10 May 2019 13:29:21 +0000 X-UUID: 965e7d71d4ef4e2d9c223dbc56f912e2-20190510 X-UUID: 965e7d71d4ef4e2d9c223dbc56f912e2-20190510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 373171395; Fri, 10 May 2019 05:27:26 -0800 Received: from MTKMBS01N2.mediatek.inc (172.21.101.79) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 06:27:26 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 May 2019 21:27:11 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 10 May 2019 21:27:11 +0800 From: michael.kao To: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , Subject: [PATCH v2 8/8] thermal: mediatek: use spinlock to protect PTPCORESEL Date: Fri, 10 May 2019 21:27:06 +0800 Message-ID: <1557494826-6044-9-git-send-email-michael.kao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 31D7B78B317839C87C3E2961C6190345EB6543F46075DED937CAA031FAC50A042000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_062920_031948_939230D2 X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "michael.kao" , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The driver of thermal and svs will use the same register for the project which should select bank before reading sensor value. Signed-off-by: Michael.Kao --- drivers/thermal/mtk_thermal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index d5c78b0..6d7e839 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -30,6 +30,7 @@ #include #include #include +#include /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 @@ -267,7 +268,7 @@ struct mtk_thermal { struct clk *clk_peri_therm; struct clk *clk_auxadc; /* lock: for getting and putting banks */ - struct mutex lock; + unsigned long flags; /* Calibration values */ s32 adc_ge; @@ -566,7 +567,7 @@ static void mtk_thermal_get_bank(struct mtk_thermal_bank *bank) u32 val; if (mt->conf->need_switch_bank) { - mutex_lock(&mt->lock); + mt->flags = claim_mtk_svs_lock(); val = readl(mt->thermal_base + PTPCORESEL); val &= ~0xf; @@ -586,7 +587,7 @@ static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank) struct mtk_thermal *mt = bank->mt; if (mt->conf->need_switch_bank) - mutex_unlock(&mt->lock); + release_mtk_svs_lock(mt->flags); } /** @@ -941,8 +942,6 @@ static int mtk_thermal_probe(struct platform_device *pdev) if (ret) return ret; - mutex_init(&mt->lock); - mt->dev = &pdev->dev; auxadc = of_parse_phandle(np, "mediatek,auxadc", 0);