From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Date: Tue, 15 Dec 2015 01:19:16 +0000 Subject: [PATCH 7/8 v5] ARM: shmobile: r8a7791: enable to use thermal-zone Message-Id: <8737v4qzo2.wl%kuninori.morimoto.gx@renesas.com> List-Id: References: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> In-Reply-To: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Simon , Zhang Rui , Eduardo Valentin Cc: Geert Uytterhoeven , Magnus , linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "devicetree@vger.kernel.org" From: Kuninori Morimoto This patch enables to use thermal-zone on r8a7791. This thermal sensor can measure temperature from -40000 to 125000, but over 117000 can be critical on this chip. Thus, default critical temperature is now set as 115000 (this driver is using 5000 steps) (Current critical temperature is using it as 90000, but there is no big reason about it) And it doesn't check thermal zone periodically (same as current behavior). You can exchange it by modifying polling-delay[-passive] property. You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS, but you need to take care to use it, since it will call orderly_poweroff() it it reaches to the value. echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp Signed-off-by: Kuninori Morimoto --- v4 -> v5 - no change arch/arm/boot/dts/r8a7791.dtsi | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index 3776974..9b37c80 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi @@ -69,6 +69,25 @@ }; }; + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + + thermal-sensors = <&thermal>; + + trips { + cpu-crit { + temperature = <115000>; + hysteresis = <0>; + type = "critical"; + }; + }; + cooling-maps { + }; + }; + }; + gic: interrupt-controller@f1001000 { compatible = "arm,gic-400"; #interrupt-cells = <3>; @@ -185,12 +204,15 @@ power-domains = <&cpg_clocks>; }; - thermal@e61f0000 { - compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal"; + thermal: thermal@e61f0000 { + compatible = "renesas,thermal-r8a7791", + "renesas,rcar-gen2-thermal", + "renesas,rcar-thermal"; reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>; interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; clocks = <&mstp5_clks R8A7791_CLK_THERMAL>; power-domains = <&cpg_clocks>; + #thermal-sensor-cells = <0>; }; timer { -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933205AbbLOBT0 (ORCPT ); Mon, 14 Dec 2015 20:19:26 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:11435 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932859AbbLOBTV (ORCPT ); Mon, 14 Dec 2015 20:19:21 -0500 X-IronPort-AV: E=Sophos;i="5.20,429,1444662000"; d="scan'";a="200568196" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <8737v4qzo2.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 7/8 v5] ARM: shmobile: r8a7791: enable to use thermal-zone User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Simon , Zhang Rui , Eduardo Valentin CC: Geert Uytterhoeven , Magnus , , , , "devicetree@vger.kernel.org" In-Reply-To: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> References: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> Content-Type: text/plain; charset="US-ASCII" Date: Tue, 15 Dec 2015 01:19:16 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: HKXPR03CA0035.apcprd03.prod.outlook.com (10.141.129.25) To HK2PR06MB1012.apcprd06.prod.outlook.com (25.161.188.28) X-Microsoft-Exchange-Diagnostics: 1;HK2PR06MB1012;2:a8ffxQgS+gQG5a5HHnMdBSijSje780EpEklufS+3PKuQHgzOC7iaeAxht/P/prZWjZfgzxrdRG2qkuTsImdU1fdfGS9pFZGo3Ii3HJaGnT6YfQ73q56HLKU9fxDg3ZPqT79NRshr9TySrjsqvE5KIg==;3:51FA023nuEv6HvC50cz7HRzIw1oTGhuP15ghwMb6qrgG/WsMH1XHL3eoFKv1DTxcK0RC2oAGPgWNQgCvmb5bsLCIIStivNxBjfSBXD0Kqr2tbdbzcQxwxDjScYCu0IsP;25:sDqAfEzXTw9eBH4aY3Q9UEVrl0+n1BShgReNIf2BnQqd/f4ywJCvwFuZDfhEpeP1yOTBFzbHg+9aKjsPUxtTbpIaoUMaU6PD3qZJTeNydxWFZKJb6lAVuPHn9+SjlUF9RRPORctt+8ZDaZoDuTRina13xnv+EMujfVn9crG7CMXV/Q1WHdRsCmBaDvWjdWygj7aBVhdhVGjMZHgQKmyaxrGzxdX0r+YaAo7h0Y4gFxG8pw//iWnnYCxCBPDZ+8w9 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB1012; X-Microsoft-Exchange-Diagnostics: 1;HK2PR06MB1012;20:nFCnS0NsNasy72WxBo8qtvU94lU9VbQg6AiW47yvHBopil3sBgfAP7qFir8wFv9maRrskYS0CINtA3NhoXnvYAm+kcxDe/7FsT4Q4GFggjgcDQiW984BR/yB7kcXf77DipupHo9zx3s2t4mS/SR3HUT67UxWAI2G3nS4dhauWdx0IY62MuhudBS6aA8Q2zKU5O27ZFPTIP+yyAVf61jb5reVjCVb+kMpSjL4O+vS/wR3K5O5KhcwFcvZXrHS9MIgjlBQWM41yZTOxVE5XLwEsE1BmcNiElh8A8ZKVuzJzvWy5WVEz2MzMWytS8Kv9d4hwGDVnSb7TLtqR6F+KYhmn6T6NHzWFG8D6f8ED2kr+JR5bKYbL+tt1UAexCtawXqvSRrlaMKPSz2+4noTynhghbblcanDsDFcSISJtEy1lc7F8b0Oe4lo8uRgZY/eAwn7M9T8i2M7PbuMPUVFmAu93jGlsuCc/LIpkvfhQKfW7OuwHgwZpyXGFeV+9HrysjaH;4:cRg5FECxmTPpeTxcAcEtUEzFF8TAuZ3BMpK6T4WQF96cAW9cnaijIJoERasf8eNuta2Kzo4cWGE9ayvngnmg0prHS608h0/uQWOXKZ4w2xkKXp4DyoZj2FrC04sXWQ8s+l7aXNEpwaiggIKW9E3QJPcTCcXyYZd4y0x5MehQHmt/dnaIcrMufwYFLnvxLP4ShfwnhhdhB3Swel8tO1MYD6+Xj8LKGgC6wxldi57gDSJlZY4WipTTBaa9QaHIGc8Zq5SNGU3LCjsiMefsvuwUtBAWtajx4NRUWqmRxi0LROe6CPe2bqo5JQD+XHQupjP4/LU0DmU5/uy+J6T1YKv7WUbsU4fNdMdbE13EkFi7OeKrRxsMmixUCUkDfFPEN5TlZI8MDTf/aApDmg41u+NQ2Cd5o+6Yd5addx9CAvOH9es= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001);SRVR:HK2PR06MB1012;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB1012; X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(43544003)(189002)(199003)(229853001)(50466002)(101416001)(53416004)(86362001)(23726003)(586003)(36756003)(40100003)(5001770100001)(5008740100001)(189998001)(42186005)(54356999)(5001960100002)(122386002)(105586002)(76176999)(3846002)(97736004)(4001350100001)(106356001)(81156007)(1096002)(50986999)(5004730100002)(33646002)(83506001)(87976001)(46406003)(6116002)(77096005)(66066001)(69596002)(19580405001)(47776003)(2950100001)(92566002)(19580395003);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR06MB1012;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HK2PR06MB1012;23:oJOS2ZlKXfzcja/UuWk1twzLbQKWOyQybKMY9Q3qc?= =?us-ascii?Q?e0WO1jcexFnykp5RFsgBFlsfya0MGqo1PQrYWawJSs1n7MNoyjB950Nw3WsR?= =?us-ascii?Q?CSOBvfacs4OVZjufbTrzbMiRe9fpD15GKY/e8uS+HuyheCNKYl6jkQ/1HUdv?= =?us-ascii?Q?2mH7gtTwPzCab5aztGEgZ7XBhyUaESlwSU/L37c3rl/LCbdjzwrk/ragoI+8?= =?us-ascii?Q?sUkp/EVJfUdG2O005BZ/q+P8D2Bneun+PKREkdUy1PT53mdZvs4SfPjOhojG?= =?us-ascii?Q?ZKJLmxA0Cm1kXA8u22YAnZ4cJwfxz9NasaaL6piXrfwYyCZmLbHqeUovEUz6?= =?us-ascii?Q?Rst/zZINFcggoYaMOj6Aa+e2fucMqkdg9Fd9uYNhYmxmzhdAJhjzZhRYV7Zo?= =?us-ascii?Q?meLdeWAMpoRSCsc57GfEEa5DFP+XUITVHEbOud1NX1mSs2mk2v+NE+wZuOVz?= =?us-ascii?Q?RPkWaS0HRtj2ytaJZt/6Jprz1e5c20w9QPh1wWqPBZMw0BoGBBcwEH4k/gHj?= =?us-ascii?Q?B+WfHDNZ3c7EXEQ0kseMUN5nwHbmod3dZpFEgK0X4bteW4cfx0r7X6W78oRD?= =?us-ascii?Q?hAlZwuCLgMsM1xyq0k/PD3F+DSX6H8zAVgFOlPgsmiDIZm7RZ1tUWLVfZWK0?= =?us-ascii?Q?94eNCnto27ycU4ApGFKAltru8z43Wi/wTClz3Q4bP0MZM+9rtdncfYtDeBMQ?= =?us-ascii?Q?E3h6i+yxKNDQ6/G+pDpACmNV15i0Hnj315Zv8jwEat7DTZ10+xm9ElbetvBb?= =?us-ascii?Q?E1AXkFdE8IDDb1Qt/Yj4yb0ugmtT1riWuI3QTDQtE7Uw0fbGgcf2p94RaN3A?= =?us-ascii?Q?d1cqgk1pr4B248x69Jp1cJ239q8IPthdbt1itsCiGKvUxc3B4naF3DFZ+0BA?= =?us-ascii?Q?sc2a/dwI/HqWxqxaLjikQzfqcjAg+Wx3EeY8U4LvVtfOOSEdgTvER4sAtGNG?= =?us-ascii?Q?99idNj3CiN/NP8vFd1DaMgWbUcsMDtaY0xlwrnO45AfGNF4KIQ0D5j3aIWHV?= =?us-ascii?Q?33TBaUgfC/7eytj6D90ml8dl0VgezfRgChkTVMyC81yLvTAjESUIMB7gSc9c?= =?us-ascii?Q?zuD7d/1K6zJA1kySAgB79nCxKcYEBMuHbEWx80EeqaUt/RiOvegu87/YAHst?= =?us-ascii?Q?cVlpvhXb1qgSYXdV20Wjl6UNfC6tdWL?= X-Microsoft-Exchange-Diagnostics: 1;HK2PR06MB1012;5:0AUa1C+VZsX8aAAcztiI3Ynwf2VVEcuu9u4ImaGrfM2OtnJf+dZXvIbbmFBnhJfikL9bIYyi0PJSt6dGV780oU9ZpF60gL9Kxwds0GdT6pAzby7MxAO1Qo0Y1tZn5i1JixOhp1gVn8zN0Pqb8puMIQ==;24:YDDWi4pPT9rC/bdaaMAR3ZAB9oLwd03OghebAHtWQtBwwwZP8IwnnEbk/zaJCdkeDaUZ/qz7pUsOrb6w2Ttyo9m9qxopwSJeDLhDMirV7vA=;20:V0s79dum1iIqfXGGU7ZNbaeSN5hxZw3NX78hbdSQKyFFXsQ1DH7jfRLTXffQ9dbvMH/AX2a8gm0ECVkZ2gdNDGW8aWooO6xf9Cr5w9uRur61cH6jS+/9ybnJL/ITJE4pkRy93daYSyIfXOnDj1feLJpUUtpZL3SphDYuTqDdSQM= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 01:19:16.1127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1012 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuninori Morimoto This patch enables to use thermal-zone on r8a7791. This thermal sensor can measure temperature from -40000 to 125000, but over 117000 can be critical on this chip. Thus, default critical temperature is now set as 115000 (this driver is using 5000 steps) (Current critical temperature is using it as 90000, but there is no big reason about it) And it doesn't check thermal zone periodically (same as current behavior). You can exchange it by modifying polling-delay[-passive] property. You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS, but you need to take care to use it, since it will call orderly_poweroff() it it reaches to the value. echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp Signed-off-by: Kuninori Morimoto --- v4 -> v5 - no change arch/arm/boot/dts/r8a7791.dtsi | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index 3776974..9b37c80 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi @@ -69,6 +69,25 @@ }; }; + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + + thermal-sensors = <&thermal>; + + trips { + cpu-crit { + temperature = <115000>; + hysteresis = <0>; + type = "critical"; + }; + }; + cooling-maps { + }; + }; + }; + gic: interrupt-controller@f1001000 { compatible = "arm,gic-400"; #interrupt-cells = <3>; @@ -185,12 +204,15 @@ power-domains = <&cpg_clocks>; }; - thermal@e61f0000 { - compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal"; + thermal: thermal@e61f0000 { + compatible = "renesas,thermal-r8a7791", + "renesas,rcar-gen2-thermal", + "renesas,rcar-thermal"; reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>; interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; clocks = <&mstp5_clks R8A7791_CLK_THERMAL>; power-domains = <&cpg_clocks>; + #thermal-sensor-cells = <0>; }; timer { -- 1.9.1