Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1090589ybx; Wed, 30 Oct 2019 09:42:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGytKLk9CCtpv0xcCZ7KolTH5aBJGknTZ+Dyo32ke/7kyVv2iOdghjEPZDHIFq6HlSRU9u X-Received: by 2002:a17:906:edd7:: with SMTP id sb23mr490682ejb.168.1572453750713; Wed, 30 Oct 2019 09:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572453750; cv=none; d=google.com; s=arc-20160816; b=Gc6OYodaLXNswt3jhfa3nJcDDHZA3VF8sDbLsPLm9IJpL82vYAzMgzoJUle7ec6AlE rmuJXNAuFGXrlrCJwjaQvYxcpJKtOYQxdqPUMkPFBnU+8POKaB65VRMTsIBGFEfgO1ZP 0AAV4pzNzVdKmTm+pXgKBckHcjUM4KI+TPblJG77d9KI30NS+Ix1nDXzI4xe+rf98bh/ bHP+FwKNSJgtmnZkIUGL0QTPEt74boDxMhBSngVP7HdsfCykBKsVcid2/jFeK2KYLM6Z fo60jhQ8tAq3HK9Bc8jWwdAb4UhjR4tEnhGRRWPAMS70IfjSou3gL7w6K8fMV6cvwSJ8 0MVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QOT6318YDSBqEUQsAk8OZFhxCSRLp0QPh+SpV+rUW1M=; b=Zypa8A0n43yphO7j1DaNbQGHcfF6jic/qTRq1r2iQdrS6ayhvdSRKcNhap6iHXlAl0 KqHYEQe2vr3J7CtJTqyXRy/42VDf3Iq3vr7YNS05xnUsieyICMsgYoLtlUYLEwZAgrC4 N7TsD6wfMT53HHBLKVW+hv56c8ryfpvHXfGh0gUCh7mL8Ei8LpRY8xrAJ8iYGmEyeCJ4 AsLpVaftUU00MQwH4vSfW5wbb07fWMrx8jB1yiVETT3dhxbmGQVg7gFAUTR6Sbv+dJSY Hj7S1DMfGzueGlthgJwA1+IKyCZjJB0dgYamDl5lj8CE/hjlpzE1cQMUKSbaxuEvb5Ux lCVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xdkOfd1y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si2271859edx.257.2019.10.30.09.42.03; Wed, 30 Oct 2019 09:42:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xdkOfd1y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726940AbfJ3Qjd (ORCPT + 99 others); Wed, 30 Oct 2019 12:39:33 -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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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; -- 2.20.1