From patchwork Thu Dec 14 10:30:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 10111771 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 B4132603FA for ; Thu, 14 Dec 2017 10:30:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C11F212DB for ; Thu, 14 Dec 2017 10:30:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90CB128A06; Thu, 14 Dec 2017 10:30:29 +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,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 38B342936A for ; Thu, 14 Dec 2017 10:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbdLNKa1 (ORCPT ); Thu, 14 Dec 2017 05:30:27 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:57176 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbdLNKaZ (ORCPT ); Thu, 14 Dec 2017 05:30:25 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id B4D6320993; Thu, 14 Dec 2017 11:30:23 +0100 (CET) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4C4B8207A7; Thu, 14 Dec 2017 11:30:23 +0100 (CET) From: Miquel Raynal To: Zhang Rui , Eduardo Valentin , Rob Herring , Mark Rutland , Jason Cooper , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Catalin Marinas , Will Deacon Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Antoine Tenart , Nadav Haklai , Miquel Raynal , Baruch Siach , David Sniatkiwicz Subject: [PATCH v3 10/11] thermal: armada: Give useful names to the thermal zone Date: Thu, 14 Dec 2017 11:30:10 +0100 Message-Id: <20171214103011.24713-11-miquel.raynal@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171214103011.24713-1-miquel.raynal@free-electrons.com> References: <20171214103011.24713-1-miquel.raynal@free-electrons.com> 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 After registration to the thermal core, sysfs will make one entry per instance of the driver in /sys/class/thermal_zoneX and /sys/class/hwmon/hwmonX, X being the index of the instance, all of them having the type/name "armada_thermal". Until now there was only one thermal zone per SoC but SoCs like Armada A7K and Armada A8K have respectively two and three thermal zones (one per AP and one per CP) and this number is subject to grow in the future. Because there is no easy way to name them effectively, use the new DT property "marvell,thermal-zone-name" if it is available. Signed-off-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 1c4122f7377c..b31d03dde44b 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -357,6 +357,8 @@ MODULE_DEVICE_TABLE(of, armada_thermal_id_table); static int armada_thermal_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; + const char *zone_name = "armada_thermal"; void __iomem *control = NULL; struct thermal_zone_device *thermal; const struct of_device_id *match; @@ -398,8 +400,14 @@ static int armada_thermal_probe(struct platform_device *pdev) priv->data = (struct armada_thermal_data *)match->data; priv->data->init_sensor(pdev, priv); - thermal = thermal_zone_device_register("armada_thermal", 0, 0, - priv, &ops, NULL, 0, 0); + /* + * Some platforms use several instances of this driver without any way + * to identify them. Use a new property to gave the thermal zone name a + * valid meaning (used by hwmon too). + */ + of_property_read_string(np, "marvell,thermal-zone-name", &zone_name); + thermal = thermal_zone_device_register(zone_name, 0, 0, priv, &ops, + NULL, 0, 0); if (IS_ERR(thermal)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n");