From patchwork Tue Jul 19 10:01:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9236675 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 29AD56075D for ; Tue, 19 Jul 2016 10:02:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AC2A20072 for ; Tue, 19 Jul 2016 10:02:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EF572521F; Tue, 19 Jul 2016 10:02:04 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0414B20072 for ; Tue, 19 Jul 2016 10:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753124AbcGSKBs (ORCPT ); Tue, 19 Jul 2016 06:01:48 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:51517 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752887AbcGSKBo (ORCPT ); Tue, 19 Jul 2016 06:01:44 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie4.idc.renesas.com with ESMTP; 19 Jul 2016 19:01:41 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 0BA954D935; Tue, 19 Jul 2016 19:01:42 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id E065C480A4; Tue, 19 Jul 2016 19:01:41 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id DB94A480A3; Tue, 19 Jul 2016 19:01:41 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id VAA06323; Tue, 19 Jul 2016 19:01:41 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="215406445" Received: from mail-hk2apc01lp0214.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.214]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 19 Jul 2016 19:01:40 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7s1iiIQuBxQOu6ZD+T7QiA6qbav0kgbVfSNDBcf7yhY=; b=hf1XzQXOZjGHS5I62L7tSDatcM2aexvXhtMZHJ7FnbzjjRArxgEyO8cSvrh3MRsIYTo9BMwOPl9nITCcD/eW8LD/ltso4rIxzIVLQYwQz9yW9CGnc2D7kOBHEXTZLnUBQmXUxzXllQiqICVXas3fHw6HKLJdyoYkLUhX314nX+E= 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 PS1PR0601MB1449.apcprd06.prod.outlook.com (10.165.210.153) with Microsoft SMTP Server (TLS) id 15.1.539.14; Tue, 19 Jul 2016 10:01:37 +0000 Message-ID: <871t2qlzr5.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/2] thermal: rcar-thermal: enable hwmon when thermal_zone User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Zhang Rui , "edubezval@gmail.com" CC: Geert Uytterhoeven , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-pm@vger.kernel.org" , "yoshihiro.shimoda.uh@renesas.com" , "cm-hiep@jinso.co.jp" , hucBui In-Reply-To: <874m7mlzto.wl%kuninori.morimoto.gx@renesas.com> References: <874m7mlzto.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 19 Jul 2016 10:01:37 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OSXPR01CA0081.jpnprd01.prod.outlook.com (10.167.144.49) To PS1PR0601MB1449.apcprd06.prod.outlook.com (10.165.210.153) X-MS-Office365-Filtering-Correlation-Id: 2fabed27-5634-4529-b36f-08d3afbbacfa X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 2:JD9+fM/vdDwcSLdirrcQHKqgk8gWYR3/BrmRh6TCslqJdZS4EhrwHfedh2JdNJRFoViv8uFgB9DUoW6ecOEDECPuRG8SybUMC/OwWECpFAAYE3xaPvvuuAYxf3sbUK0o47/qX5S+0iN2QhUY3vyN5hq4Gl78TiuJGLE+UMMFRJsGbZBBdAmqr95VouMr5AhQ; 3:9YBCX/puQ2vQXPwjLduY0EFDQq+PJiP8fe5RiRvaVowzC7xUCCoapm2HAqHDUBd/ta6o8RdZeM3ltojvjKpWpOZ486mqYdPY4l2utTIfKExxgLSRcMC+nhF8UUpje4pm; 25:0fD5a7csKFgIvWM0k9j9R9zR2LNqZovphoM2VHklocMZI/LTxP45tpPaixiaMBlVyKdZenAPqBRWWewQvsIhlDdkTTT3HVrpjruX//H7OWSeP35Xs/vfLq+9923cnc7twA1qAb5mHQdeIxjycCm5Usunh2LcvDyUby0bDkKLGzK8474Dqg+Assa32l8xdui9DlcmkoEtC7Y5BOnzqrtDY3Pcr7Uql+mrtt0QsWoQeF0QXgIyqFQ8hE5wRVIs7ilMb/fT52guqkV45xYlb5eP3gn3h8ym/XSqBFwV1NO1A3XgFzVxiaUnbG91nxILI+TXnCFK4vIUVfUfg92cFr2tlAiK4zRHrWNViVyI2XA5oiL0DOOBQLVvkTJ6VRJkxsmlw8TfKQPLMmjPCnD/jUG5KgoKbmt2Ckkfy691l7Bdml8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1449; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 31:7DfR1/2hWtEuOxUiLql1rBZJKpFmyKKJHJLrS6WI6JcU2xBmRI/WZ9k8tr59A2gYWf7OdIMe3Olgzjq/LDOp3xccjJFndtXOkwbZf6kt54gOhDKarnsjvEKINu0/kZnBVZAVdwXwJIMKUoLbqM9tyY+jzql+YMA2BNHpyZXukaUcvMRNnpS2yI4YJIcVaJCaLYtOZY8ylx1DW3UKZUxq+A==; 20:3Hy6DKSLySLf5sJ0aPQe8+K5MljnIbtrkSyP5K4jxdjTAKIlzeNNa0gN34Nz8sOQO/WRARsINuysL5ezxNWjhTs1qv2SHYBOKNLCew8ituBh31M+C6oOktddZCsNXqCd772m4vTpMdqlVNO6Kd0Z77xVTT9eXFxisJb6ji/YENvkSEdWero6Jc9u+wHKqeXe//JsFhhGdyMiIKyr5iKK01yizLl7l5Fy7euf5A5RZdmyRo2V4s55qpxp1Qk2EzsLb1qCcJkWqJ48gYbLbmbuQz1L5ElVa3rLDfFX7w8xrfezjbcNkqe4G3v+4dT8TF/P2RCas4uC18exdd9AkRXdNQqq3VK/BR/38z/J0c+6AhjRsRG7MFwp2CCIKef2c3MuyCbjKM+bHgVj90oN/uAG1QskwG7ldGeVSLtG5XiYnjtUFC2oTsRJ8Pa1mkhsS+bG7F/pjYqEKbVrvj91TWQuoNAZb9HAk+l6At6nQB01Jgl1d4s0pYzBsTnB10b48hTo X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:PS1PR0601MB1449; BCL:0; PCL:0; RULEID:; SRVR:PS1PR0601MB1449; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 4:57jlWYaXDHMb4jJmiGBmgwI2c1j8yQPWH/zWeJFNBn6dVRssc+yl0n1czyDtJpmspd0w4xoJGr1TQALcJkZUmT86/HVoihviY+RA5jjygBLJAVu2xVSoGHI5Aat0QD1sCEdOEOsMA/bo73XVQuBwp7O5KOnBc+FXD/Sfa59gHu+jdH3QKCNZ808A9/CW1Y8ARWWQjU+e74qGn7V8rXQ5fFoOlKG4JYF7P6NkTLW1QGQHgBWdIvDRJ+OYfeL1TdMzLd1bugBGkyvqF7ul4HL7nC6TiOipRpH/rNhWyvdmEpvloKuBfyufKqNSuHMMu8t8HE0xqyO9ZlSZcSX6df0TPG+h16V4mWGOLYKCf53l0Wwb02RgJhGPAIrRZoTzOsbbaJGeUpG5/LWzOddHye6Qqg== X-Forefront-PRVS: 000800954F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(50466002)(50986999)(33646002)(53416004)(76176999)(86362001)(54356999)(2501003)(2950100001)(46406003)(92566002)(2906002)(81156014)(81166006)(68736007)(4001350100001)(4326007)(83506001)(305945005)(36756003)(3846002)(6116002)(23726003)(19580405001)(69596002)(8676002)(586003)(77096005)(101416001)(5001770100001)(106356001)(105586002)(19580395003)(42186005)(97736004)(47776003)(7736002)(229853001)(66066001)(7846002)(189998001)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1449; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1449; 23:Hxq7VIh9lA/R/w0x/PR9r2cRdJlSfson+kCqB4q?= =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0VNDZmb1nyyCrzvboM/DzQ+Ide26wEGNOUGUYe0ZgbvNE4+N+NdjQ/XUu/PHk3zefb16iSq6DCKdd3Wx98gz4rUEZOxy3GVoxeinkYKPuTkI38wrlMgwpREeHXiCedpIofH2268UzTDkaKdLkpWsP42jBh0sax52RzgIPwOhhEQCTdoLLJAuyr+6MCBm0F4dGA6AWdzakOAW0uzN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1449; 20:IrD+xNJbIOAu2l6jWKOS0y6jt4zbedBjhRPH2UsIiOBHJ90Bm8Akj7MJMwwXOD13tjiNl+TOSte2gUvrduIagj4YCbl1ZdrOgNLEDoTXwUb4PHl5VfI/3X2Ws7cQuaEoS3LuZX1rHdAbNjfhQoJ5t/iHGJKiarNZqNITC+ecR/w= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2016 10:01:37.7481 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1449 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto rcar-thermal is supporting both thermal_zone_of_sensor_register() and thermal_zone_device_register(). But thermal_zone_of_sensor_register() doesn't enable hwmon as default. This patch enables it to keep compatibility Signed-off-by: Kuninori Morimoto --- drivers/thermal/rcar_thermal.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 71a3392..4d07644 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -31,6 +31,8 @@ #include #include +#include "thermal_hwmon.h" + #define IDLE_INTERVAL 5000 #define COMMON_STR 0x00 @@ -75,6 +77,8 @@ struct rcar_thermal_priv { #define rcar_priv_to_dev(priv) ((priv)->common->dev) #define rcar_has_irq_support(priv) ((priv)->common->base) #define rcar_id_to_shift(priv) ((priv)->id * 8) +#define rcar_of_data(dev) ((unsigned long)of_device_get_match_data(dev)) +#define rcar_use_of_thermal(dev) (rcar_of_data(dev) == USE_OF_THERMAL) #define USE_OF_THERMAL 1 static const struct of_device_id rcar_thermal_dt_ids[] = { @@ -416,6 +420,8 @@ static int rcar_thermal_remove(struct platform_device *pdev) rcar_thermal_for_each_priv(priv, common) { rcar_thermal_irq_disable(priv); thermal_zone_device_unregister(priv->zone); + if (rcar_use_of_thermal(dev)) + thermal_remove_hwmon_sysfs(priv->zone); } pm_runtime_put(dev); @@ -430,7 +436,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) struct rcar_thermal_priv *priv; struct device *dev = &pdev->dev; struct resource *res, *irq; - unsigned long of_data = (unsigned long)of_device_get_match_data(dev); int mres = 0; int i; int ret = -ENODEV; @@ -491,7 +496,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) if (ret < 0) goto error_unregister; - if (of_data == USE_OF_THERMAL) + if (rcar_use_of_thermal(dev)) priv->zone = devm_thermal_zone_of_sensor_register( dev, i, priv, &rcar_thermal_zone_of_ops); @@ -507,6 +512,17 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister; } + if (rcar_use_of_thermal(dev)) { + /* + * thermal_zone doesn't enable hwmon as default, + * but, enable it here to keep compatible + */ + priv->zone->tzp->no_hwmon = false; + ret = thermal_add_hwmon_sysfs(priv->zone); + if (ret) + goto error_unregister; + } + rcar_thermal_irq_enable(priv); list_move_tail(&priv->list, &common->head);