From patchwork Wed Jun 22 00:38:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9191581 X-Patchwork-Delegate: geert@linux-m68k.org 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 79AEF6075E for ; Wed, 22 Jun 2016 00:38:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62BBF2838C for ; Wed, 22 Jun 2016 00:38:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EC8628358; Wed, 22 Jun 2016 00:38:44 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham 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 5074028358 for ; Wed, 22 Jun 2016 00:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751506AbcFVAim (ORCPT ); Tue, 21 Jun 2016 20:38:42 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:26505 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750905AbcFVAik (ORCPT ); Tue, 21 Jun 2016 20:38:40 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 22 Jun 2016 09:38:38 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 10093431F6; Wed, 22 Jun 2016 09:38:38 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id F1EDB1806F; Wed, 22 Jun 2016 09:38:37 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id ED2231800A; Wed, 22 Jun 2016 09:38:37 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id KBG31426; Wed, 22 Jun 2016 09:38:37 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="213486820" Received: from mail-pu1apc01lp0019.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.19]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 22 Jun 2016 09:38:37 +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=zdYCMN7rPmDLDGE7t0IqIdPogYH4pI2wQdW2tqiRkoY=; b=RxXBl/lwvHQPwa/b2BfL2eW46SB7g27cE242V9VaylZfXW91KXxBVvQ6C8uof04FOKsXCfwfsizArKdcvMmYoRaRdTTtsyfaoLvxal9TRIDyBG2l5iEvoQEmC55ZBN1d4yn/lzTXW4zhnyXdUA0Cgi0Ft9AqPJ2z7e/qpEgXybg= 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 PS1PR06MB1706.apcprd06.prod.outlook.com (10.167.53.16) with Microsoft SMTP Server (TLS) id 15.1.523.12; Wed, 22 Jun 2016 00:38:35 +0000 Message-ID: <87lh1ykqs4.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Zhang Rui CC: "edubezval@gmail.com" , "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" , MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Wed, 22 Jun 2016 00:38:35 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0043.jpnprd01.prod.outlook.com (10.164.162.25) To PS1PR06MB1706.apcprd06.prod.outlook.com (10.167.53.16) X-MS-Office365-Filtering-Correlation-Id: 89d2b448-3163-4675-9947-08d39a358bdd X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 2:G0JVW419WfKNF+zvQk5JP4OLmfPTnxQrMQqh0TQUcuT4hOaNuO8QxPqwK+zeEuWP9PKh9ics1Ymj0eB8N9PmKqP/TWS73bFvfJPJXUbsNpQk/nlgBvW6MH6XnWRhGrvOd05LBqmRvhOWtqQTsxqMIcIdXX9VEhrgSsrAK4mP8VS8XM12AYgGkXIerGPYb/QX; 3:vKPbsI3/P9GIA4F90vIdIr3a0bcyITzplwjRVovzXN7osOGwymD3rNVOSCzGEPe5nwNmPsC3iA3fV880oWBzc3NugFeUYdg7HRlUA6P2Z8S/vRfZQOPwGU4DRSJczcJK X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1706; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 25:G2aEU9I3X1ZGvntLnKKZowenv6sv8IIbBFXb2db2HuZrSo3og2QUPqGyJlOA+33/tglDFw0ZvuErz/4t6gxZnIesgPs3bgIGxykR4zfz0JvAyRXb1T1+wOvDljYsauZU4moNB8k32XVCKGqjslK9e/arrsAstmAq4F85RkZS36G/NJT1D/zvXNgv47GHk93uH+kkzaoSuVy1W2Mp1sGb/YYvvR2/c/e7oDJHJVGJm5uYM2/MWZHR70g3wKl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DHgzFZ46tuiTQfV1+W8afX29rfrd/o5QInwcOMeEEOm1MycINs2ikZ+fl++NrfpmEPD/hcRMopIZ8b0h1mIPoaLB7+GmQ2bx81r/CGOrnxsUY8TQiosLH3MKhmSGQl/K65Y/VSPVn6pyyR1OgJVdIoYV9tSCv9j2FydoZjh3A5tgKvRA3DOuveLd8G1tMbtYK7Sv3XhOivj7WE1q9wsQ9oz+MTVWKUHPJ7YO7ytYOqXDS4V9MKi6Ee8vS0SmwAZ+3hNtBT5yZ+/53WVwu+zuOjmFjnxnihE03PmOX0z77L2S9dy3jPl+EdmLcZirloF2Sk3+i1O/8G2zZrT1CTN1F0xRGv0qYjCGMEO9G2kwL3braTJrCg== 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:PS1PR06MB1706; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1706; X-Forefront-PRVS: 0981815F2F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(19580405001)(69596002)(19580395003)(23726003)(189998001)(110136002)(97736004)(4001350100001)(46406003)(68736007)(33646002)(50466002)(47776003)(7736002)(7846002)(86362001)(92566002)(101416001)(586003)(105586002)(50986999)(53416004)(36756003)(8676002)(66066001)(42186005)(229853001)(2906002)(81156014)(3846002)(6116002)(54356999)(81166006)(106356001)(77096005)(4326007)(83506001)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1706; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR06MB1706; 23:diTbYfwKjn7GMdAukzynox/PV8K3i7glPFCnBJ2vv?= =?us-ascii?Q?UnbEaTOrG/lzyZNx2feqnFhSkHC32EoP//HoPIza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PC9cbgggs6DmYUa/iLS14MN99QEazcbl8nf/EE7uk6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 20:ycSJkuuj5l8PmXQpuzYfPQ7Vp/BRnb6Cl214V4u2gE7qcv+LbvnJv6UCC6z+elm5O2MvzIn1ZmbPYDVPnUaxgSpcnNm/1d8iuhBSyapuKjT+zO0Os8XG0PSY8Jupn0F/3x7IHnRnIPjvvGFX1nb1yOUMFbjRA8ELRvur+uaj3es= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2016 00:38:35.3016 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1706 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@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 --- >> Zhang I want to have Tested-by from Hiep or Phuc 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);