Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2092430pxf; Sat, 20 Mar 2021 04:21:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz/v5chBXWMozCcm+undOxOUcQ/5o9NtOgDykNw24XXEegbroVqyb3a5hF4r9I6WyE9hd0 X-Received: by 2002:a17:906:f1d6:: with SMTP id gx22mr9294468ejb.59.1616239283952; Sat, 20 Mar 2021 04:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616239283; cv=none; d=google.com; s=arc-20160816; b=hQP46MKppMdJs9Y3yquxFqiN6w5AA7mEmqzRGQFsMUklyxo/2ogqRHdRTxTT5iNO2I ZThVK337vWIjTjMVlSYZ+kgswgHKLZGTx5bZ+HShvyUoWSConhYpiFZ9WjfBkCdDFQqQ wbisgzpIuREWlS7/Zulgg/C69t9IoRCyYOAOoY94T/Fkho2bzzyV254Zo/VL1AqPx+IK s5Idt9cQChiC+ZXu1JFAhl0o2fFjcjzBEEKzn1Eha1MfjITLbb+Oxyt2laFq5X6oAbms 6y36gSOWiHE4x3S57BUBlC2GHshlgW0MDZ7BEy1MV6funvbYtm9vy0cbMlQoEQToOVux Xulw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5rx54XOq4cGnoyPqTNXPmFBrLR2RTFNWgo85VwjcYYA=; b=SCFd1tdV49z+o7GAv5udlsETaXDR0nKDbwoVayoKnRpCRdhaBJdQhfzuYGGNQZHtkw B6j7xc3EWwaKqVMi4WcvGibQ0fGCc5eEqljpR37Qy8f2AcNz85gYW3aap3o2KtZ/I77t 3akkJSPTOp4GXWxLxkuc76JPNMNoKvymPYwgF+lAILI2bNSVVI9dtEf//jpZ0JszJN+Z xAhj9xzDmBKQCdV/HLwhWcp/nioSPCuZq8RT36HQ7smg1Dj3bVMp0fEuA1Z5Krxm1rFm XgZIcX9xsHzb0e2SopjYFhGCSm/jxNWJ+A30KIIxBUixV324p9FfIFp7QicT4ksuQV26 TI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="fSq/cy9z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq26si6477498ejc.213.2021.03.20.04.21.01; Sat, 20 Mar 2021 04:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="fSq/cy9z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbhCTLT4 (ORCPT + 99 others); Sat, 20 Mar 2021 07:19:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbhCTLTc (ORCPT ); Sat, 20 Mar 2021 07:19:32 -0400 Received: from mxwww.masterlogin.de (mxwww.masterlogin.de [IPv6:2a03:2900:1:1::a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37BBC0613EE for ; Sat, 20 Mar 2021 03:30:04 -0700 (PDT) Received: from mxout2.routing.net (unknown [192.168.10.82]) by backup.mxwww.masterlogin.de (Postfix) with ESMTPS id 9ECD02C513; Sat, 20 Mar 2021 08:12:19 +0000 (UTC) Received: from mxbox4.masterlogin.de (unknown [192.168.10.79]) by mxout2.routing.net (Postfix) with ESMTP id 1F3185FC87; Sat, 20 Mar 2021 08:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1616227633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5rx54XOq4cGnoyPqTNXPmFBrLR2RTFNWgo85VwjcYYA=; b=fSq/cy9z1JhQI222WTEyqmkz+WPc4kVwaDBiNLRXQhn97ey2tRbg5VxNT6FiHw8Hzwef5G btKEzXN762UAgMAxR3GTxyrk1n8QNU3xReOn/lzlSsZIXC+BmEQzvgdiaTzIW0QyKNLCIi DHzgCyNJK0KLFXi9MZ7Ss+R6esX6JrA= Received: from localhost.localdomain (fttx-pool-217.61.145.178.bambit.de [217.61.145.178]) by mxbox4.masterlogin.de (Postfix) with ESMTPSA id 2BB0F80269; Sat, 20 Mar 2021 08:07:12 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Zhang Rui , Daniel Lezcano , Amit Kucheria , Matthias Brugger , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: mediatek: add sensors-support Date: Sat, 20 Mar 2021 09:06:46 +0100 Message-Id: <20210320080646.49615-1-linux@fw-web.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mail-ID: d03ccc71-1dc6-4253-aa41-7875f90d3cb0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Wunderlich add HWMON-support to mediateks thermanl driver to allow lm-sensors userspace tools read soc temperature Signed-off-by: Frank Wunderlich --- drivers/thermal/mtk_thermal.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 149c6d7fd5a0..e22d77d57458 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_hwmon.h" + /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 #define AUXADC_CON1_CLR_V 0x00c @@ -983,6 +985,13 @@ static void mtk_thermal_release_periodic_ts(struct mtk_thermal *mt, writel((tmp & (~0x10e)), mt->thermal_base + TEMP_MSRCTL1); } +static void mtk_thermal_hwmon_action(void *data) +{ + struct thermal_zone_device *zone = data; + + thermal_remove_hwmon_sysfs(zone); +} + static int mtk_thermal_probe(struct platform_device *pdev) { int ret, i, ctrl_id; @@ -1087,6 +1096,19 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } +#ifdef CONFIG_THERMAL_HWMON + tzdev->tzp->no_hwmon = false; + ret = thermal_add_hwmon_sysfs(tzdev); + if (ret) + dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); + + ret = devm_add_action(&pdev->dev, mtk_thermal_hwmon_action, tzdev); + if (ret) { + dev_err(&pdev->dev, "error in devm_add_action"); + mtk_thermal_hwmon_action(tzdev); + } +#endif + return 0; err_disable_clk_peri_therm: -- 2.25.1