From patchwork Wed Oct 30 16:38:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11219841 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6060D1747 for ; Wed, 30 Oct 2019 16:39:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E4A421924 for ; Wed, 30 Oct 2019 16:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572453573; bh=uPpsLnIwswK4MvCgYfMrudAcG0whDitorkLSfI+nb3Q=; h=From:To:Cc:Subject:Date:List-ID:From; b=Z9DY0FIPzDNJrFgMv0V+LamHF4VrHHWSYzXOAsjHmVpiMwsrdHvJmaVTVAIwsL8D2 CWzXS+Jx0eSvHC+J+rW/gZK/BF93jp6NxUl9V/4AuvnBrfHIiwEmc2GX0WezPF/crX hBXmzhyMnXZIKQAKLwpLgYfc8JUOJi4/AncMdwzQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726552AbfJ3Qjc (ORCPT ); Wed, 30 Oct 2019 12:39:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:46594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbfJ3Qjc (ORCPT ); Wed, 30 Oct 2019 12:39:32 -0400 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 78A97218AC; Wed, 30 Oct 2019 16:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572453571; bh=uPpsLnIwswK4MvCgYfMrudAcG0whDitorkLSfI+nb3Q=; h=From:To:Cc:Subject:Date:From; b=xdkOfd1yvSJdwDk7TNjX9HOowIi2HLFtg17p6P0NFVvETxTk1VqoKCMxbdUwfIY0G DZEaIhwLkmobqT0No607KZqrpOI73RtwYdp6hgKBYTEm/tdOwc6pELf22IPS+wmtY1 dpYphs9pdwMIH6/RoQNz9Eu0TDrTa7y2xV7Z/TMQ= Received: by wens.tw (Postfix, from userid 1000) id 66E5F5FB7D; Thu, 31 Oct 2019 00:39:28 +0800 (CST) From: Chen-Yu Tsai To: Markus Mayer , Florian Fainelli , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria Cc: Chen-Yu Tsai , bcm-kernel-feedback-list@broadcom.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: brcmstb: enable hwmon Date: Thu, 31 Oct 2019 00:38:07 +0800 Message-Id: <20191030163807.17817-1-wens@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Chen-Yu Tsai By defaul of-based thermal driver do not have hwmon entries registered. Do this explicitly so users can use standard hwmon interfaces and tools to read the temperature. This is based on similar changes for bcm2835_thermal in commit d56c19d07e0b ("thermal: bcm2835: enable hwmon explicitly"). Signed-off-by: Chen-Yu Tsai Tested-by: Florian Fainelli --- This patch was only compile tested. A similar patch [1] was submitted to the downstream kernel, which I did build and actually run on a Raspberry Pi 4. This one for mainline is much simpler, as it does not need to deal with the error path or device removal, due to the use of devres. [1] https://github.com/raspberrypi/linux/pull/3307 --- drivers/thermal/broadcom/brcmstb_thermal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 5825ac581f56..8353aaa4d624 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -21,6 +21,8 @@ #include #include +#include "../thermal_hwmon.h" + #define AVS_TMON_STATUS 0x00 #define AVS_TMON_STATUS_valid_msk BIT(11) #define AVS_TMON_STATUS_data_msk GENMASK(10, 1) @@ -343,6 +345,12 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) return ret; } + /* hwmon not enabled by default. Enable it here. */ + thermal->tzp->no_hwmon = false; + ret = thermal_add_hwmon_sysfs(thermal); + if (ret) + return ret; + dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); return 0;