Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dongjin Kim <tobetter@gmail.com>
To: Guillaume La Roque <glaroque@baylibre.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] thermal: amlogic_thermal: Add hwmon support
Date: Thu, 26 Nov 2020 01:24:05 +0900	[thread overview]
Message-ID: <20201125162405.GA1263100@paju> (raw)

Expose Amlogic thermal as HWMON devices.

	$ sensors
	cpu_thermal-virtual-0
	Adapter: Virtual device
	temp1:        +32.2 C  (crit = +110.0 C)

	ddr_thermal-virtual-0
	Adapter: Virtual device
	temp1:        +33.4 C  (crit = +110.0 C)

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
---
 drivers/thermal/amlogic_thermal.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index ccb1fe18e993..2fce96c32586 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -29,6 +29,7 @@
 #include <linux/thermal.h>
 
 #include "thermal_core.h"
+#include "thermal_hwmon.h"
 
 #define TSENSOR_CFG_REG1			0x4
 	#define TSENSOR_CFG_REG1_RSET_VBG	BIT(12)
@@ -291,6 +292,9 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	if (devm_thermal_add_hwmon_sysfs(pdata->tzd))
+		dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
+
 	ret = amlogic_thermal_enable(pdata);
 
 	return ret;
-- 
2.25.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

             reply	other threads:[~2020-11-25 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 16:24 Dongjin Kim [this message]
2020-11-25 22:12 ` [PATCH] thermal: amlogic_thermal: Add hwmon support Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201125162405.GA1263100@paju \
    --to=tobetter@gmail.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=glaroque@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox