From patchwork Wed Nov 25 01:45:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7694781 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D07519F443 for ; Wed, 25 Nov 2015 01:46:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6524207C9 for ; Wed, 25 Nov 2015 01:46:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 304C2207D0 for ; Wed, 25 Nov 2015 01:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbbKYBpX (ORCPT ); Tue, 24 Nov 2015 20:45:23 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:19521 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753721AbbKYBpU (ORCPT ); Tue, 24 Nov 2015 20:45:20 -0500 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 25 Nov 2015 10:45:18 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 3750044110; Wed, 25 Nov 2015 10:45:18 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 1E5FC1806F; Wed, 25 Nov 2015 10:45:18 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 18BC31800A; Wed, 25 Nov 2015 10:45:18 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id LAP03954; Wed, 25 Nov 2015 10:45:17 +0900 X-IronPort-AV: E=Sophos;i="5.20,340,1444662000"; d="scan'";a="199244711" Received: from mail-pu1apc01lp0016.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.16]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 25 Nov 2015 10:45:16 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HKXPR06MB1016.apcprd06.prod.outlook.com (10.161.181.156) with Microsoft SMTP Server (TLS) id 15.1.331.20; Wed, 25 Nov 2015 01:45:14 +0000 Message-ID: <87io4q97s7.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] thermal: rcar: enable to set tripN-temp via DT User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Zhang Rui , Eduardo Valentin , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala CC: , , , Ryusuke Sakato , "osd2@lm.renesas.com" , In-Reply-To: <5655059C.40509@renesas.com> References: <564D14A1.70806@renesas.com> <87h9kiilbe.wl%kuninori.morimoto.gx@renesas.com> <56545CE5.3040502@renesas.com> <87mvu37wv2.wl%kuninori.morimoto.gx@renesas.com> <5655059C.40509@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Wed, 25 Nov 2015 01:45:14 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: HKXPR03CA0028.apcprd03.prod.outlook.com (10.141.129.18) To HKXPR06MB1016.apcprd06.prod.outlook.com (25.161.181.156) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 2:N66eNjA8/Bu5CD99s1lf5iztE56/USYH4vZKhMCX4cGzzubT6Ce+7BRQH5aZd0Y6eHjo2f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N4E+ITkt2vBnCc; 4:qyiS3wxaIWm28x90X/W3jZ4XbFFaBfCZQ6sGhiq8bxTxpN1uZlHnWoEklMRASW4KfR6jsTviThTGEJP5D2dm70AswO9qh7a3okOeq8SqIRlqF5KsTbgf52wf87TKX7GcdQ+99xtt0UZyp1SsO2KBIpSVOw+jAwyww84qGpTfboccu/LmIEdVUqW2exm1tHaAfQtc9vDuxwr6F/RVEpix02mlkm69UPXGehB9rAfh3V3U9tlCC8xVolYmo3O7UaGyzTNz/7NXSG9EFRC1Ic7EWFADcxUqMiKvAlIW4oeZKf/TwusXDtomcNVSNmGjAa/lW6LIRojcIXyfPUPbOHEujg4lEbMlgXihoxN3AXeVwhdT3a/xLDq07MJYIwq/6t1uv1g+5TDuFS17XXCr2o4i2pd+7i53j4BCFcokK2 /RSTrVoXGI7mfjWdWcBRauIrDo X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:HKXPR06MB1016; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB1016; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(40100003)(93886004)(46406003)(47776003)(66066001)(33646002)(5007970100001)(83506001)(92566002)(77096005)(23726003)(586003)(575784001)(87976001)(42186005)(19580395003)(86362001)(4001350100001)(106356001)(50466002)(5004730100002)(53416004)(76176999)(97736004)(229853001)(2950100001)(189998001)(81156007)(54356999)(5001920100001)(105586002)(101416001)(122386002)(36756003)(6116002)(19580405001)(5001770100001)(5008740100001)(3846002)(69596002)(50986999)(5001960100002); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB1016; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1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t1AntiP6Oc+BpuBpA?= =?us-ascii?Q?eEB945PfI4QIfvR6g+QEthlrBwiWFHZLCqSIZ1D33zEItmI4gyIsd+N2T71M?= =?us-ascii?Q?Q/PrbmwTFdk/n3W1xJIHMgGm4ydv1Q0tSfhcdpPW3IEkuv6uGewRH2sQgkRx?= =?us-ascii?Q?dm6VBWbuyl+VZWLmIuJ/Kg7XLLiVZu1Rw1QTqitWjwgqNhLhhjPx9bMSdRNb?= =?us-ascii?Q?takU/Xh3ClObS8AWqAzNQYEdJy+Lqg0fHnTMDtkdISHW6mmZu9B7SgbO4gJQ?= =?us-ascii?Q?9v5Hwo12CH+qyS+3Y/+MBykuLWgbTjuDDxLeWX+jYNISZj5OncYGDR5ThGNS?= =?us-ascii?Q?eLbdGUPcn0t5aHVh+t+cqOMbM42fkPTh8Sb?= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 5:NQ5qBRsZr41hm6j+ZnuiBO61vCJnsKhvT4xAnRGGiS5f9NEYLhO1HqLfRlAOdYUvEvIXXCsw12n9KhHaMgI2DEcRao1m7HVPQlgQo6InbloHPwuuN2GVqP/kZ2LCzVXCnJy7KVHX0hjrTQIo5NNDOg==; 24:ZGz6S90F5IvnFJwGwjcS4AVC2LRvPsHhhujoC6tIf/pXRjOhXDbzltKGNQk4K4aB3zrSGbYWgCQxcb6Ijd03PRWUiBBc5nKljdBnyVL7K94=; 20:6jJWAe8rQy7+mvcyuyLUGFgLknFztyN4kl8P9+JsEN7rS7EYGTC706LwCogzDofsm+hybCok+o44akn9Sfmf+WaX+K4T9o9YBF+domhzhCgB2tLPjgyXi/9NEMphY+7fvOp1QgT7cJKFxlJgV9CcxEg6aLsKqMOpDqxegUubKiM= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2015 01:45:14.2912 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB1016 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current rcar thermal driver is using 90 degrees as trip temp, but it should be based on each SoC / platform. This patch enables to set trip temp via DT. (It uses db8500-thermal style for it) It will use 90 degrees as default trip temp if DT doesn't have it. Signed-off-by: Kuninori Morimoto --- .../devicetree/bindings/thermal/rcar-thermal.txt | 2 ++ drivers/thermal/rcar_thermal.c | 34 ++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt index 332e625..6c57f7e 100644 --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt @@ -18,6 +18,8 @@ Required properties: Option properties: - interrupts : use interrupt +- tripN-temp : temperature of trip point N. it will use 90000 as default + if DT doesn't have tripN-temp Example (non interrupt support): diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 5d4ae7d..d1d0b58 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -63,6 +63,7 @@ struct rcar_thermal_priv { struct mutex lock; struct list_head list; int id; + int trip_temp; u32 ctemp; }; @@ -222,7 +223,7 @@ static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone, /* see rcar_thermal_get_temp() */ switch (trip) { - case 0: /* +90 <= temp */ + case 0: *type = THERMAL_TRIP_CRITICAL; break; default: @@ -241,8 +242,8 @@ static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone, /* see rcar_thermal_get_temp() */ switch (trip) { - case 0: /* +90 <= temp */ - *temp = MCELSIUS(90); + case 0: + *temp = priv->trip_temp; break; default: dev_err(dev, "rcar driver trip error\n"); @@ -361,6 +362,30 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data) /* * platform functions */ +static void rcar_thermal_of_parse(struct rcar_thermal_priv *priv) +{ + struct device *dev = rcar_priv_to_dev(priv); + struct device_node *np = dev->of_node; + char prop_name[32]; + s32 val; + + /* + * let's use db8500 thermal style + */ + sprintf(prop_name, "trip%d-temp", priv->id); + if (of_property_read_s32(np, prop_name, &val)) + return; + + if (val < -45000 || + val > 125000) { + dev_err(dev, "unsupported trip temp, use default\n"); + return; + } + + /* overwrite trip temp */ + priv->trip_temp = val; +} + static int rcar_thermal_probe(struct platform_device *pdev) { struct rcar_thermal_common *common; @@ -418,11 +443,14 @@ static int rcar_thermal_probe(struct platform_device *pdev) priv->common = common; priv->id = i; + priv->trip_temp = MCELSIUS(90); /* default*/ mutex_init(&priv->lock); INIT_LIST_HEAD(&priv->list); INIT_DELAYED_WORK(&priv->work, rcar_thermal_work); rcar_thermal_update_temp(priv); + rcar_thermal_of_parse(priv); + priv->zone = thermal_zone_device_register("rcar_thermal", 1, 0, priv, &rcar_thermal_zone_ops, NULL, 0,