From patchwork Mon Mar 23 12:15:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77EA414B4 for ; Mon, 23 Mar 2020 12:16:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 547312080C for ; Mon, 23 Mar 2020 12:16:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TDlTT1ka"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="iBSVdMlk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 547312080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=7YIDY5P7sHEJoVeVRbpi8xqJTp9lk1X9W3sgcV3ObpE=; b=TDlTT1kaXoRZFx oST/33emDzOmw0lOseXxmAFsMeXFcOTthxjkTH+835QYLmsXAs/sLAdn6rG+dNkHTiBtqC1colMRM GlYeHOHwZy0o7jqVTC1BBfARVnWb39aCNCHUZNE0ndZ+Yi3AseOvh2HrjawWcFnWqHoeO46yE4dvh d04nxrpFkPX0HqBUwUux15smKP4IXTo6yoI8B340XKwZ8ablECDqOxVrBULMg91ga384rUcYJqyfF uT7nd1M5Q1eRMPQggPUeAarQtUQy8m2kCEHTlFI0SAVmI7G+u6lDE+afLw6NLTdYje1ba38Z0fhoA xceU8G8AKd2LOD58HUCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM0c-0007g9-Ep; Mon, 23 Mar 2020 12:16:46 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzh-0006oU-6C; Mon, 23 Mar 2020 12:15:50 +0000 X-UUID: 32e858f50b8148efbbc32786bb006e89-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=kFXOGIrbZvG1pMcA5nWeAzPVOClsgKfC1+JFMevkUH0=; b=iBSVdMlk8WSou9EekUafwNmqIWJ6Ccnk4GAn23OJCnVcLGaw/TnEMktIiQFfCINSWUmNHCorRR63/PwxnW8M4cqTLGLOUagHeB2SMBt0np0yic0K5wdit5/tZzjyreW7G7rKenHcyU9ovY+m4fA0UI58ZPVdviBIr8YhWUY+bJ8=; X-UUID: 32e858f50b8148efbbc32786bb006e89-20200323 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2046566071; Mon, 23 Mar 2020 04:15:42 -0800 Received: from mtkmbs05n1.mediatek.inc (172.21.101.15) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:40 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:14:16 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:37 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,1/7] arm64: dts: mt8183: add thermal zone node Date: Mon, 23 Mar 2020 20:15:31 +0800 Message-ID: <20200323121537.22697-2-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051549_246471_F1D0B258 X-CRM114-Status: GOOD ( 10.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 From: "michael.kao" Add thermal zone node to Mediatek MT8183 dts file. 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 | 84 ++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 433c62efab2d..59f97217aaa8 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -638,6 +638,86 @@ status = "disabled"; }; + thermal: thermal@1100b000 { + #thermal-sensor-cells = <1>; + compatible = "mediatek,mt8183-thermal"; + reg = <0 0x1100b000 0 0x1000>; + 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>; + nvmem-cells = <&thermal_calibration>; + nvmem-cell-names = "calibration-data"; + }; + + thermal-zones { + cpu_thermal: cpu_thermal { + polling-delay-passive = <100>; + polling-delay = <500>; + thermal-sensors = <&thermal 0>; + sustainable-power = <5000>; + }; + + /* 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 = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts2: tzts2 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 2>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts3: tzts3 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 3>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts4: tzts4 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 4>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts5: tzts5 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 5>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tztsABB: tztsABB { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 6>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + }; + audiosys: syscon@11220000 { compatible = "mediatek,mt8183-audiosys", "syscon"; reg = <0 0x11220000 0 0x1000>; @@ -648,6 +728,10 @@ compatible = "mediatek,mt8183-efuse", "mediatek,efuse"; reg = <0 0x11f10000 0 0x1000>; + + thermal_calibration: calib@180 { + reg = <0x180 0xc>; + }; }; mfgcfg: syscon@13000000 { From patchwork Mon Mar 23 12:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54B2E14B4 for ; Mon, 23 Mar 2020 12:16:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32082208D6 for ; Mon, 23 Mar 2020 12:16:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aE82y2Wf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="m4wa/aWu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32082208D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=lltQ0JgVIgyP/OOZ5jnC+H4lFJ366PfvlawJ6pdimPo=; b=aE82y2WfBniDP5 Q1+x3tzgTpNo72F3LO8tGdESH2G6RR8EzP7nwcuJMwaxeEBqBb5uRMTU5gY4TmY+N3hseZEqRjv81 +R2xB8HH+sHzSUp0hzBVFKKCc7AKQDEUtBuOEdSpe6Q6utKpzWW/pa8CoaFtfySSmb83bKjovi+pf Oc4pnydstkDAQ1msF0pyvteOZq9f99V1X3r/c4j6TpuMjaldi9vN06iEgKlLM689JflbdQWwLC91q oY/gHWO+UnVp4Hu5M+32N30k8mlbI9T7DmPJFibNnkADIPxmqIp8134ZMQpvPB3p4LccmhnZyMJ2v YVitDyPBtLOErLy+ofmw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM0N-0007SE-12; Mon, 23 Mar 2020 12:16:31 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzg-0006oQ-LD; Mon, 23 Mar 2020 12:15:49 +0000 X-UUID: af6f2b025d46434eb4c5018f2f9d0a9f-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=t4KDU3gSGbmIBW1rfyL1Ets87sk3PSbQi3QOVB4Qbp0=; b=m4wa/aWu/KVS6/eZ2BS+RbH2oPKQiHlKWukwP93/jOan0aFMkJFqWdRHEE05Z+qilQgu/Jn2hSP/q7rf1DM0r220s4TOsF+Kx35YugPkp0hdDU1Rf7j3vpvvO4Ds3q7geOnJeLNxkHQhOxP831NbO8vdtnvjfcyAGvXk/QQhLyo=; X-UUID: af6f2b025d46434eb4c5018f2f9d0a9f-20200323 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 273426992; Mon, 23 Mar 2020 04:15:42 -0800 Received: from mtkmbs05n2.mediatek.inc (172.21.101.140) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:40 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:14:29 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,2/7] arm64: dts: mt8183: add dynamic power coefficients Date: Mon, 23 Mar 2020 20:15:32 +0800 Message-ID: <20200323121537.22697-3-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051548_698558_EAE74589 X-CRM114-Status: UNSURE ( 8.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 From: "michael.kao" 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 59f97217aaa8..2e2527c3369a 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -75,6 +75,7 @@ reg = <0x000>; enable-method = "psci"; capacity-dmips-mhz = <741>; + dynamic-power-coefficient = <84>; }; cpu1: cpu@1 { @@ -83,6 +84,7 @@ reg = <0x001>; enable-method = "psci"; capacity-dmips-mhz = <741>; + dynamic-power-coefficient = <84>; }; cpu2: cpu@2 { @@ -91,6 +93,7 @@ reg = <0x002>; enable-method = "psci"; capacity-dmips-mhz = <741>; + dynamic-power-coefficient = <84>; }; cpu3: cpu@3 { @@ -99,6 +102,7 @@ reg = <0x003>; enable-method = "psci"; capacity-dmips-mhz = <741>; + dynamic-power-coefficient = <84>; }; cpu4: cpu@100 { @@ -107,6 +111,7 @@ reg = <0x100>; enable-method = "psci"; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <211>; }; cpu5: cpu@101 { @@ -115,6 +120,7 @@ reg = <0x101>; enable-method = "psci"; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <211>; }; cpu6: cpu@102 { @@ -123,6 +129,7 @@ reg = <0x102>; enable-method = "psci"; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <211>; }; cpu7: cpu@103 { @@ -131,6 +138,7 @@ reg = <0x103>; enable-method = "psci"; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <211>; }; }; From patchwork Mon Mar 23 12:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28BFB174A for ; Mon, 23 Mar 2020 12:17:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 066AE20788 for ; Mon, 23 Mar 2020 12:17:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K4TtkAMv"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="rPdY3Nmz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 066AE20788 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=ky8QhQjNUBg8kMHjas6T0fvK1oxedAZhv/bXmetFg4g=; b=K4TtkAMvOI++4E OFPSNZJOnviB1p0DUnI3UTjwCghjDo4auxIPBq9v8Sd1QRGi/Y2NaWKTP/3T0bTRDvZMZQ9GFIUzQ 5JDAtc1kIFdwc0vNHmWtyVCTjiExOEwZGG8gkqvYng2Mk0Ro6R+9U/CsEbBCNJfbyaiJoemUlp9mZ 7gu8GiS+VcX0QQOu5+RnO5gIIFVETuOuj3/IVGkGLQKbV7hNrW55IHwHPLCB9EoPtmED5mjXhkdcb XCvpXo17IOlFkDUBRBnQrgsMqK/bDmlp9czE+HjgjsRSvlslpZLDuqTiE9IkdxoIn5oTDKpRuIlN9 yDnNxc8cYXceL/O59iOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM0y-0008EO-D0; Mon, 23 Mar 2020 12:17:08 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzi-0006oQ-0G; Mon, 23 Mar 2020 12:15:51 +0000 X-UUID: 83dd833d5e2546ba8d7b445546dd1581-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=EmHqXxabAN0b2S2sXgJ4k8NzH+sbwvHDZlDKyy7WAIc=; b=rPdY3Nmz4WYS5bVakeNHhbsrK4+OCGZAVBDxcJN+obltT4mY20xl0C1U7kibm5SZljwNXDs9sE28jGgelsT/WaN5E6cYfL6L3DY2OtXcMJo21HHZqE68/O7BNB0CjdvsysHFyR2DUHYjPa0hdIB5M2GWX8qtPktK+9l3noCL8OE=; X-UUID: 83dd833d5e2546ba8d7b445546dd1581-20200323 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1355925800; Mon, 23 Mar 2020 04:15:42 -0800 Received: from mtkmbs05n1.mediatek.inc (172.21.101.15) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:41 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:14:16 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,3/7] arm64: dts: mt8183: Add #cooling-cells to CPU nodes Date: Mon, 23 Mar 2020 20:15:33 +0800 Message-ID: <20200323121537.22697-4-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051550_062977_A074F9BC X-CRM114-Status: UNSURE ( 9.00 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 From: "michael.kao" 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 2e2527c3369a..182fa6264e0d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -11,6 +11,7 @@ #include #include #include "mt8183-pinfunc.h" +#include / { compatible = "mediatek,mt8183"; @@ -76,6 +77,7 @@ enable-method = "psci"; capacity-dmips-mhz = <741>; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu1: cpu@1 { @@ -85,6 +87,7 @@ enable-method = "psci"; capacity-dmips-mhz = <741>; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu2: cpu@2 { @@ -94,6 +97,7 @@ enable-method = "psci"; capacity-dmips-mhz = <741>; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu3: cpu@3 { @@ -103,6 +107,7 @@ enable-method = "psci"; capacity-dmips-mhz = <741>; dynamic-power-coefficient = <84>; + #cooling-cells = <2>; }; cpu4: cpu@100 { @@ -112,6 +117,7 @@ enable-method = "psci"; capacity-dmips-mhz = <1024>; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu5: cpu@101 { @@ -121,6 +127,7 @@ enable-method = "psci"; capacity-dmips-mhz = <1024>; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu6: cpu@102 { @@ -130,6 +137,7 @@ enable-method = "psci"; capacity-dmips-mhz = <1024>; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; cpu7: cpu@103 { @@ -139,6 +147,7 @@ enable-method = "psci"; capacity-dmips-mhz = <1024>; dynamic-power-coefficient = <211>; + #cooling-cells = <2>; }; }; From patchwork Mon Mar 23 12:15:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5B1F174A for ; Mon, 23 Mar 2020 12:16:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1C3B2078B for ; Mon, 23 Mar 2020 12:16:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mn6N7AxO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="WVq7BLBF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1C3B2078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=qIOmLx1uiuFhRjH+zvlLdzX5MeNbWdj/BN9U7sY9b2w=; b=mn6N7AxO5LeE8w 7QaRWhiVuW0jYL+vZvDGIzxbCJW39f6HwiIvRP0MtoL/QIR8msK7WteuG8cPN50QoKsCbf890PA65 +VD94ILRIE5YnYpANqAe9/Tk/udU3BwLM7NmV3shfzNglS2lgkhdlC1bI+RrJxis/1FJ/oj9/8h5w FqJXuxZ14Gozpi6UgeKSTGvREKFFHRRdtHJvmhAK1t7dzkBZjof72cHhOozS34v+swqVf/lXYkhU/ QMcDRTpP1+CrPcZr4YM9AvhU8Phmaw1ZlJAhck6mbFYxYtWtT8AZLDsJz4odk1rSo6v7Dy2JFtlkG jPT+4wzciD9pSKQmff4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzx-00076Y-RA; Mon, 23 Mar 2020 12:16:05 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzf-0006oU-Pl; Mon, 23 Mar 2020 12:15:49 +0000 X-UUID: 39c0cdbfd99e499f8bec9a809d2759fc-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Syxtl64f/oiHmFDozNPlTQ/y9hPgVybUbznOPaoIJLs=; b=WVq7BLBFAVRGwysc2XISyaUEeWklgVbg4nAC5J1+72gq0s9hqfPeGmaRE22VMMS1//scEXCwM/w2NiRmYfM1w/gCV5GHYrM61lrM1uMi3Gk54jHUdmXeeOw+ppDb1tFtb4mqWae3A6+n1zBecWPV5UL3zXJfOayjRB7PA1wGfMU=; X-UUID: 39c0cdbfd99e499f8bec9a809d2759fc-20200323 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1296781111; Mon, 23 Mar 2020 04:15:42 -0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:40 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:15:38 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,4/7] arm64: dts: mt8183: Configure CPU cooling Date: Mon, 23 Mar 2020 20:15:34 +0800 Message-ID: <20200323121537.22697-5-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051547_837041_830AE7ED X-CRM114-Status: UNSURE ( 8.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 From: Matthias Kaehlcke Add two passive trip points at 68°C and 80°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 182fa6264e0d..59ab2957d85d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -675,6 +675,61 @@ polling-delay = <500>; thermal-sensors = <&thermal 0>; sustainable-power = <5000>; + + trips { + threshold: trip-point@0 { + temperature = <68000>; + hysteresis = <2000>; + type = "passive"; + }; + + target: trip-point@1 { + temperature = <80000>; + 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 Mon Mar 23 12:15:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452787 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32E8B14B4 for ; Mon, 23 Mar 2020 12:15:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 10C4E20788 for ; Mon, 23 Mar 2020 12:15:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r7ZS/2Es"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="azDZ7UXt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10C4E20788 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=FnlbXpmcm9qHrNO01kI3TwG0QgABOx4F3VA+xlSBi+4=; b=r7ZS/2EspJ9E1J tzoHQEO5xWeP8tNdbT2Ax4HyYSNk2I0AtgBmZKEGsQYtEg5l1mOwCJWyEaHqaaem99MMz+bz/DMWI cmuFqd7qeYdCIr0JWP5BdthXT7TnUYnilZit/eX3SUnKJyft7d0AcA78RNtFfItsz1KzSO4YAihCN BVJScnvhcnpEQVe8Sj5tM7rHUUTJVs8Xw2jCjcdqOkxr7gAJuJs8lRwiLtawmLNQqyeStuP96CEUg aw8h52+8u/ULV8TGDxCCmKifylGcWG6oDkDPJX5FvOfBGQgE5Kxs0MUBcKp1GWw3n6o5CdxX918w+ hfXCPebsA3nBuT8HOzfg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzi-0006rY-J3; Mon, 23 Mar 2020 12:15:50 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzf-0006oQ-Bi; Mon, 23 Mar 2020 12:15:48 +0000 X-UUID: 843f4fe2c512486187b8584ec479d9e6-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Wxu/rJjKNum6u7NU44aKieD1zc3Y+wnpPlval5gEFNw=; b=azDZ7UXtLWoEyREFg4MhpmsOwv1FesvpT5dD9uJlt9p5/b+C0PosyEaEgPElTU0i5J9jqWbnUis0zGpoCkZIYqrwkao5/ITbDGiS0eM5/cxyTe3FbJ6InuD2YWY3qYspegvFhd3dKevXlPhLqrXHisC3daXn3AgENQdhABjS72E=; X-UUID: 843f4fe2c512486187b8584ec479d9e6-20200323 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 125437713; Mon, 23 Mar 2020 04:15:42 -0800 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:41 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:15:38 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,5/7] thermal: mediatek: mt8183: fix bank number settings Date: Mon, 23 Mar 2020 20:15:35 +0800 Message-ID: <20200323121537.22697-6-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051547_412169_29C6AA1A X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 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 Signed-off-by: Hsin-Yi Wang --- 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 76e30603d4d5..6b7ef1993d7e 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -211,6 +211,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 @@ -497,7 +500,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 Mon Mar 23 12:15:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C615C174A for ; Mon, 23 Mar 2020 12:17:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A43A820788 for ; Mon, 23 Mar 2020 12:17:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FpURV8Xf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Mrh0SgYK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A43A820788 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=HxOpxUJjvVUK5LQaaxCtFn05HzfCe+PTNnRYe9UWGIU=; b=FpURV8XfLUT6A3 LYi2Sfp0GiYJ+tU/5YDPaFd/RnnkUU0lbNZATbIcjjQkqH1ZnMpkOHvd+w5Ui/FERETuChKchAMWD 7R4a5lbOi1XBDzVJNpZ7CglvnE6PPSgOycExRzonLc5H0XgPjOvikMEFY/RK3TkKds3HLeOKiYGyj fRPJBOTdeyNS8iSfS1+tqyPxM7li+f5Z71RkaGQEw/D4YL0tKeuBhgm3a0PcSrT+mR3ZTFCuQ2m0O iZ7PXKqgbYoD9DHjzMeYELbUzr28332Bb7+4S+3Nf0GA2IZX2ILX8sC8nzkwuLYrqR9Sk1gbR6+sD XvvxzK21jI5TTNH1Ntwg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM0o-000813-JZ; Mon, 23 Mar 2020 12:16:58 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGLzg-0006ob-Rj; Mon, 23 Mar 2020 12:15:50 +0000 X-UUID: c702a28a20b0465ea9ea6ff645699541-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=6afKyor9AgACuTa8Oqf4MptvrGy9B10niDpAuK601p8=; b=Mrh0SgYK2mztGt3Sfq9lLr6Ow8t3HhXjV2eiphMsnsOwBoM1NKtuL4dOa9JWbT2T4Y1p7v2Wkl2DG9rKxt3EeglYhrR3qvMg5A5Ev8tEfVTWGzAdAHPL3P9WmEwWhfCuEdwDj9AvvziCX+DI6XThTO7AXV5IOHfe7XEBpjXjFqY=; X-UUID: c702a28a20b0465ea9ea6ff645699541-20200323 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1374918066; Mon, 23 Mar 2020 04:15:43 -0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:41 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:15:38 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4, 6/7] thermal: mediatek: add another get_temp ops for thermal sensors Date: Mon, 23 Mar 2020 20:15:36 +0800 Message-ID: <20200323121537.22697-7-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_051548_923252_53D6E305 X-CRM114-Status: GOOD ( 16.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 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/ In mtk_thermal_bank_temperature, return -EAGAIN instead of -EACCESS on the first read of sensor that often are bogus values. This can avoid following warning on boot: thermal thermal_zone6: failed to read out thermal zone (-13) Signed-off-by: Michael Kao Signed-off-by: Hsin-Yi Wang --- drivers/thermal/mtk_thermal.c | 74 +++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 6b7ef1993d7e..9eaca432920e 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -225,6 +225,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; @@ -607,7 +612,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) * not immediately shut down. */ if (temp > 200000) - temp = 0; + temp = -EAGAIN; if (temp > max) max = temp; @@ -618,7 +623,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; @@ -637,10 +643,44 @@ static int mtk_read_temp(void *data, int *temperature) 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 -EAGAIN; + + *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) @@ -873,6 +913,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) @@ -954,11 +995,30 @@ 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 (PTR_ERR(tzdev) == -ENODEV) { + dev_warn(&pdev->dev, + "sensor %d not registered in thermal zone in dt\n", + i); + continue; + } + if (PTR_ERR(tzdev) == -EACCES) { + ret = PTR_ERR(tzdev); + goto err_disable_clk_peri_therm; + } + } } return 0; From patchwork Mon Mar 23 12:15:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kao X-Patchwork-Id: 11452837 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C49014B4 for ; Mon, 23 Mar 2020 12:25:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F0E92076A for ; Mon, 23 Mar 2020 12:25:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="thHZUVVA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="cmVwT66z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F0E92076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=k5LtF6/Y0cC3bCT4doMX7v+Abqwkbs6U5QqYdFcDDTI=; b=thHZUVVAa3a/Wp ms/KFLXbi9RuClnOLs80d0QqgeSCYaxCTviKUZX7X0l7lRNfa/f5ZjuKjvuW4ehnUPWX5pSF1nndj KFgXqsuRBiVDgMo0fTUUjjAUHuaAByiuUNQkeqy25QPo/cm1Cop1xacCyVix4qQH3DPndsDtEw5OW +TjB20QBeVnOYaxM+XTSumV6llQVLJypcCFbNDALLSMRxqkII2W8VHJnNIAF3iKSXVLpRsB8FveKE LJrT+Ax4zBBIdnKtxaRfikhkFFsovW4LOgG9/JbqUgalL77nCbd0Dd+jpFTM4xBggdek1OYiWElsr 0zCrUbcBDUedUncMMVsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM9R-00048J-Aj; Mon, 23 Mar 2020 12:25:53 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGM9O-000416-3U; Mon, 23 Mar 2020 12:25:51 +0000 X-UUID: 2ae090e2eaa04f7f819671a2c38b36f7-20200323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=OpxxJeIDsgbTPxV5pYutQeAaj6ZyRkN0vPxx1mGgvNU=; b=cmVwT66zko3CtmkTKdLpFb/l4CokMb79IrH35ezxrKz0zoajl8jQYAaBn5BSsjRtKPr0OcAeK9QhPsFPeFo/WmeWiwi7cmZJQXvyAzYGBYa5HWHvnVPEUKyUdUXkdoFOJS8PYnA9yk8i3MxqxZmEAxew/89SNnZ8RwHqSfZu2tw=; X-UUID: 2ae090e2eaa04f7f819671a2c38b36f7-20200323 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1744028295; Mon, 23 Mar 2020 04:25:43 -0800 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 05:15:41 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 23 Mar 2020 20:15:39 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 23 Mar 2020 20:15:38 +0800 From: Michael Kao To: Matthias Brugger , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , , , , Subject: [v4,7/7] thermal: mediatek: use spinlock to protect PTPCORESEL Date: Mon, 23 Mar 2020 20:15:37 +0800 Message-ID: <20200323121537.22697-8-michael.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200323121537.22697-1-michael.kao@mediatek.com> References: <20200323121537.22697-1-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-20200323_052550_160166_B511C505 X-CRM114-Status: GOOD ( 11.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 From: "michael.kao" 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 9eaca432920e..594ad4f0f8cd 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -22,6 +22,7 @@ #include #include #include +#include /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 @@ -262,7 +263,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; @@ -561,7 +562,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; @@ -581,7 +582,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); } /** @@ -938,8 +939,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);