From patchwork Sat Jan 11 16:15:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11328915 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 780B66C1 for ; Sat, 11 Jan 2020 16:16:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5613320661 for ; Sat, 11 Jan 2020 16:16:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B4b27yvo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5613320661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=i2se.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hoJDAs/wP6ll62xK5w5ydnRbKIXjaKYQv5ynkZSJqcc=; b=B4b27yvoscW0D+NA6Hr/jpgwMU ViBRYv5BAfp7CehuF1aYZ7iqVUuAcpq8FXl11+d5xktkY+62xuHQRBTUd3Yah9WhIctI382JIDuwa Y/yu21x33wQ/Qb/K1GvBKTNs8puO3pbGILjhw/LuI0HDhtPEE6lkJwzG+cho3Ld+rs5DccuPxXX1/ bd5ChYFg4KHp315zA09TuSnsyesIg+MVRbYNUu537IcmTLLz/Oo/jSAhHR0PszPUTXJpz594hMq5p rpmLzPhmOLpLOavD/w9Nz0s6X1aPDixXYlZRllICNDvKO7USNsEWZEdwz/LIl4uvWQKeJhcZlgNyM Nje6A/bQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJQx-0002yd-Jy; Sat, 11 Jan 2020 16:16:19 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJQn-0002ql-Or for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2020 16:16:11 +0000 Received: from localhost.localdomain ([37.4.249.154]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MMWcT-1j9DUG0YRr-00JcDG; Sat, 11 Jan 2020 17:15:51 +0100 From: Stefan Wahren To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , Nicolas Saenz Julienne , Florian Fainelli , Catalin Marinas , Will Deacon Subject: [PATCH V4 1/4] dt-bindings: Add Broadcom AVS RO thermal Date: Sat, 11 Jan 2020 17:15:39 +0100 Message-Id: <1578759342-4550-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> References: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:c1+Mg9NKoWCLsN8E1wZaMxrh5a2EHZsNfpj80gj1+uD4c7oIiwg B3VvaHwXDziW/0JZNSoLmcZX8rLv0yBvdngyCtKwW1gYSC5Tb2b7wF6GswrAYW9I+WHKu/o LTaFSb+hdE937/T5VA55+bpUm7bMwoXxhCnwMuCcO7Kvivv9lh/LFNaaELpESpgXuR7c5Od yOjaNwupb1GP1TMr/Lp0g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:bDV4gChWJ6A=:zVDMyHIm0wg/sFXJsxBFfg vngWYXC+y1Ggagzjk+77JYoa5b8mlaU7s3yQysh/DUcYDchjc2QE+oKBV2X/cMebilELriIOu GhmEp0SQpix3GArGJMKuMqF1IxCI15L9gjDGX/RNoJVqFqxqgGOs647EWR1TAcGe12Xl/UFzF yQQ3cDZ/IbLfKTKf3FUm27gVfsJFK+as6TGliiefFdHgdRg2HE4hklN4EPR3EFivwP8bpboNc 3ZvgkRDm7duKqdiWFQSZ1zB6e0WeTBhbrJ9UZaT6D7af6Bu/U6072B+qAUgA+2w0h1zJUppqH Hr8vvVFWdZo3nyqjZ+qiB6EJ8QkkeU9rCxBlxU7ZjF9IInhJBOamwjbNAudlesivbMfVy0jzz a+JlGtygizahGncvqBM+hLVuYgPeMvUBieneXCq24uAVJEFch9oUeUn3bEulqZ0Sj/2gRFe63 wqRPYahB1wAEch+A/wKcVMj7y37TTMtvm0A84VT9UnkEE56//NhE5gL7BUmA7m2MfABMb4aVg vKkjETfAuqYxj0A2yh6+v5cOyztnjBG/zt8+/eryT11h91mPcDtd5ltWmSuhVeqomXNIjaDIJ JxoEgCFbd/fAHqE/tczrz0Of38IQjktzXm96FpwwLa8u8hKjLBcf6oYjOJv5sNgbDoZBHu7YR 1Gvjse1+vdz6hef6XU/FO/D3xqp+taSVj9IUZIOsV1lGBaeVUcI1zVA1quOEhVza36sLDPamj xGoaGYGp0FYhbEdG3ZlTLzHLtZM8N0nE5YZ0cunW8Yv5NPSCTwZ0oBp6hnT6Y1eeBAyM+K+7W apIiRHo9Vaa68SxMS4JXRGizA4wnUmXXPxX0Jbo4/0YDzMSDHc+JBLFeDxKTbgmlLlAY5+4en QmlpyU4MCCmOIQr/pmA6q3/sIYrU2c0p6DC4rPrwA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_081610_100762_DEFA5C65 X-CRM114-Status: GOOD ( 13.85 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since the BCM2711 doesn't have a AVS TMON block, the thermal information must be retrieved from the AVS ring oscillator block. This block is part of the AVS monitor which contains a bunch of raw sensors. Signed-off-by: Stefan Wahren Reviewed-by: Rob Herring Reviewed-by: Nicolas Saenz Julienne --- .../bindings/thermal/brcm,avs-ro-thermal.yaml | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml new file mode 100644 index 0000000..98e7b57 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/brcm,avs-ro-thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom AVS ring oscillator thermal + +maintainers: + - Stefan Wahren + +description: |+ + The thermal node should be the child of a syscon node with the + required property: + + - compatible: Should be one of the following: + "brcm,bcm2711-avs-monitor", "syscon", "simple-mfd" + + Refer to the the bindings described in + Documentation/devicetree/bindings/mfd/syscon.txt + +properties: + compatible: + const: brcm,bcm2711-thermal + + reg: + maxItems: 1 + +required: + - compatible + - reg + +examples: + - | + avs-monitor@7d5d2000 { + compatible = "brcm,bcm2711-avs-monitor", + "syscon", "simple-mfd"; + reg = <0x7d5d2000 0xf00>; + + thermal: thermal { + compatible = "brcm,bcm2711-thermal"; + #thermal-sensor-cells = <0>; + }; + }; +... From patchwork Sat Jan 11 16:15:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11328919 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 D221B1398 for ; Sat, 11 Jan 2020 16:16:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFFE420661 for ; Sat, 11 Jan 2020 16:16:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R0ME6G0T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFFE420661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=i2se.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=yrPEobDXSLXpAr8YSPiFzl3yQWKsUDKVgx7cTId8eUc=; b=R0ME6G0ThDu6kfFcWvqXm+6tCH LvfqK4JyzQJxnEJJ2okS2gV9MPbC8mRZjG965Mmbstu/ujGvcnWP/RX2ymmE1Pi86LSEfuglEfcSF Nmpr//oZstI28rzPmljGBSB93sdmvMyKXpfRpWOm9eKrai5ealo95auVbihILqV+WXZtE0A+HxfZx omL5Z2jJrNDIRLtAlA9v21BeBpvHSYnYwxXLzeeAciIF6gHyoS1FtKt1tmtZ818ElkfXBizwYPMQX gWEsD3hBjNz8HPj6W60/TW19hCMpUDYgPYNao/AxzyzTmQSGKkYaqSCt//QMXSFFdRXIqX4be4fmv P0sYbQMg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJRH-0003HP-C5; Sat, 11 Jan 2020 16:16:39 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJQn-0002qn-VB for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2020 16:16:13 +0000 Received: from localhost.localdomain ([37.4.249.154]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N2VGj-1joql63Bip-013ze2; Sat, 11 Jan 2020 17:15:51 +0100 From: Stefan Wahren To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , Nicolas Saenz Julienne , Florian Fainelli , Catalin Marinas , Will Deacon Subject: [PATCH V4 2/4] thermal: Add BCM2711 thermal driver Date: Sat, 11 Jan 2020 17:15:40 +0100 Message-Id: <1578759342-4550-3-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> References: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:jpF70Cx2jUyAw6JIvYmMLcAnFVDLZaCts+nTxiBrfb4+0NVpStD bD85rov7s3eKlRtF9OCsAN8N5X3nelMp777k//ChHAsvbr0um0P1eenRhsKIcgi54EDv1e4 Yaej82NAf2Q8NWZhsrJyI/y3lRJi0GKAWmr8TAZjZ6EM0XoSWryu9wUogTheqEl5rWtYrU6 8FHknqHHCKqXgJFPc+wlA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:6yyhpYWfYjg=:hDWk++0d+zTF3NotoYlqgq dG1kqCik+ZYKFdfG1J+91LHuJhIvdsLxxSgJAAx6RbWf2sAiLBClM1kFG6It9JDlGhOsgAprt IVqH3P5G+DoHKrl0klrpG99Bb9M0hCQ633IEzToWodC4rzWNR0GlL6YrWucrLxAc+cEI7c8ft PqJZKxnVY0OiGqsdm+OwB9ffRINi4YFvDrtdyxv7dgNmiYc42TMr0TMRrsUasbTkISu3aQ22r qeDJYBfzm104DvYM6PP+NvSn5+6YfCgddo7V/OlQafkutHPyYWAuDfULVVds5njv6c8dS2gjm FaC/icnWnM8HBDMLsCTptyQelF9DSH4SjYwPm1TvbtMhMqqMj91CtsYqlI30dCacRWtDI3bSP 97bejCjJ4gt3GE2qEVfMXKme9RrhDWkYe9FyPK+gdUSdKkWXgRsuYmkfq83ts0T02KBswQhHB ceoIZlaA1YYvsrc4Hc8SkUq5MJt2Uyc1hL0FOaKEsbExkr5GVF3XiSfWVIkky30E204OZxV2A L+ROBXxw+NeeA8L97GSLzlCXRLn0Cth+f9R+3AZJu7NtpDXsMa64wHPOL8xG5ZrH3f/6CulbN /X/IO09piUzG7lRtBXozPsGqKxYdWPCxC7EuWZubUYsUXhskbJeL68d1xISpwUqFCm6N1TmR4 H17hhOGx40U2JTDZG5xRWq06SFXECzBw4yNR579WkkfMagtoT1q3sEUEumVhzT+B178qlqjvC HzXXxXG79AFfjWXyVWYnaYC9Z9XdKQKlrAawejVGNwQI3X3ZHtTcYcf4vABglID+NF4qgsL6P Zo2ymwSegKqbHeK5Xf4K2CIpj0tDG9cbIiKbQh1jOzuUpxMW34LH5zSGDXrMfN2tvfAvlORaO 88yVTTYPEmWnTTBBOSdpFhlO5+IfaddBSqysmbmGk= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_081610_298312_5B244188 X-CRM114-Status: GOOD ( 20.22 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This adds the thermal sensor driver for the Broadcom BCM2711 SoC, which is placed on the Raspberry Pi 4. The driver only provides SoC temperature reading so far. Signed-off-by: Stefan Wahren Reviewed-by: Florian Fainelli Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne --- drivers/thermal/broadcom/Kconfig | 7 ++ drivers/thermal/broadcom/Makefile | 1 + drivers/thermal/broadcom/bcm2711_thermal.c | 129 +++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c diff --git a/drivers/thermal/broadcom/Kconfig b/drivers/thermal/broadcom/Kconfig index cf43e15..061f1db 100644 --- a/drivers/thermal/broadcom/Kconfig +++ b/drivers/thermal/broadcom/Kconfig @@ -1,4 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-only +config BCM2711_THERMAL + tristate "Broadcom AVS RO thermal sensor driver" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on THERMAL_OF && MFD_SYSCON + help + Support for thermal sensors on Broadcom BCM2711 SoCs. + config BCM2835_THERMAL tristate "Thermal sensors on bcm2835 SoC" depends on ARCH_BCM2835 || COMPILE_TEST diff --git a/drivers/thermal/broadcom/Makefile b/drivers/thermal/broadcom/Makefile index 490ab1f..c917b24 100644 --- a/drivers/thermal/broadcom/Makefile +++ b/drivers/thermal/broadcom/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_BCM2711_THERMAL) += bcm2711_thermal.o obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o obj-$(CONFIG_BRCMSTB_THERMAL) += brcmstb_thermal.o obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c new file mode 100644 index 0000000..b1d3c4d --- /dev/null +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Broadcom AVS RO thermal sensor driver + * + * based on brcmstb_thermal + * + * Copyright (C) 2020 Stefan Wahren + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../thermal_hwmon.h" + +#define AVS_RO_TEMP_STATUS 0x200 + #define AVS_RO_TEMP_STATUS_valid_msk (BIT(16) | BIT(10)) + #define AVS_RO_TEMP_STATUS_data_msk GENMASK(9, 0) + +struct bcm2711_thermal_priv { + struct regmap *regmap; + struct device *dev; + struct thermal_zone_device *thermal; +}; + +static int bcm2711_get_temp(void *data, int *temp) +{ + struct bcm2711_thermal_priv *priv = data; + int slope = thermal_zone_get_slope(priv->thermal); + int offset = thermal_zone_get_offset(priv->thermal); + u32 val; + int ret; + long t; + + ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val); + if (ret) + return ret; + + if (!(val & AVS_RO_TEMP_STATUS_valid_msk)) { + dev_err(priv->dev, "reading not valid\n"); + return -EIO; + } + + val &= AVS_RO_TEMP_STATUS_data_msk; + + /* Convert a HW code to a temperature reading (millidegree celsius) */ + t = slope * val + offset; + if (t < 0) + *temp = 0; + else + *temp = t; + + return 0; +} + +static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops = { + .get_temp = bcm2711_get_temp, +}; + +static const struct of_device_id bcm2711_thermal_id_table[] = { + { .compatible = "brcm,bcm2711-thermal" }, + {}, +}; +MODULE_DEVICE_TABLE(of, bcm2711_thermal_id_table); + +static int bcm2711_thermal_probe(struct platform_device *pdev) +{ + struct thermal_zone_device *thermal; + struct bcm2711_thermal_priv *priv; + struct device *dev = &pdev->dev; + struct device_node *parent; + struct regmap *regmap; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + /* get regmap from syscon node */ + parent = of_get_parent(dev->of_node); /* parent should be syscon node */ + regmap = syscon_node_to_regmap(parent); + of_node_put(parent); + if (IS_ERR(regmap)) { + ret = PTR_ERR(regmap); + dev_err(dev, "failed to get regmap: %d\n", ret); + return ret; + } + priv->regmap = regmap; + priv->dev = dev; + + thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv, + &bcm2711_thermal_of_ops); + if (IS_ERR(thermal)) { + ret = PTR_ERR(thermal); + dev_err(dev, "could not register sensor: %d\n", ret); + return ret; + } + + priv->thermal = thermal; + + thermal->tzp->no_hwmon = false; + ret = thermal_add_hwmon_sysfs(thermal); + if (ret) + return ret; + + return 0; +} + +static struct platform_driver bcm2711_thermal_driver = { + .probe = bcm2711_thermal_probe, + .driver = { + .name = "bcm2711_thermal", + .of_match_table = bcm2711_thermal_id_table, + }, +}; +module_platform_driver(bcm2711_thermal_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Stefan Wahren"); +MODULE_DESCRIPTION("Broadcom AVS RO thermal sensor driver"); From patchwork Sat Jan 11 16:15:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11328921 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 50C481398 for ; Sat, 11 Jan 2020 16:16:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E8A020661 for ; Sat, 11 Jan 2020 16:16:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WfCL3mDi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E8A020661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=i2se.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=00p+1DvyPD63ywTmoaUieIG/Ucvr2esb9KG//dEUXhk=; b=WfCL3mDiwBJU1tUZ9JuhU7I+0r +AtTYMIrHJVFyort0CmFgDiYSO8yl/mJtmaQlYLX/aNeQ6g9jomEW9Hyql+tomile7XIFiPRbDxZ3 +oTWPt2tKkiR4tAyGBFNGd8c5ZmJNO6xdryX8aQEQhfmd9Dnl4ex/h9fVtbq+xZ1iR5FXXJQROhFf ZL0Fop8GSsJCHUAVkVStTRBbsscRLO25G41VHTTkc0+2UCFe0/uMYI/tlCnrXwINNBJX/UUhRqKoa HEFN0lzEoTf2WK4DXET/C4JP6xcVOH5QolkW91wpDNTThUY53K+ixakhuWxU9RPUAWd+hFJFQO/AB ej5YS2hA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJRW-0003Ux-JG; Sat, 11 Jan 2020 16:16:54 +0000 Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJQp-0002qp-BX for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2020 16:16:13 +0000 Received: from localhost.localdomain ([37.4.249.154]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MAxLT-1iwc0f1XRZ-00BKky; Sat, 11 Jan 2020 17:15:52 +0100 From: Stefan Wahren To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , Nicolas Saenz Julienne , Florian Fainelli , Catalin Marinas , Will Deacon Subject: [PATCH V4 3/4] ARM: dts: bcm2711: Enable thermal Date: Sat, 11 Jan 2020 17:15:41 +0100 Message-Id: <1578759342-4550-4-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> References: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:0IUicZLxdYp4qHZTyX6kmYwbihuuzvekhpMT2zBM5MdAzJFI8Zb TnyIvYP83Sd6Q1mNIZClhRa8DgoepMjtak3u/3UC2PvTJmhvKg3bOobmKjRNuX3Ct6zVOib 4MZj57j1ValZPtjVGT6916Kct6VP+7X7KmoUzAzbBAtxzozfuE54d7Dp7jg/s3tZkWDDzhr O0pRr8746i+6ag5larC/g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PG4FVKCkg8o=:p72Bcm07B31S0vAEPP3C86 pvVcGFbOsQmqlyiyCFi8u4/QcSZ12aNgOePNixWnVmNS43xMhc6AwZ1tbkcopV1d3TyZY7nJp stfc0RO3zPWkGXHejh4Beg+PVoiZKNuzUEm/L711hKjGyWBsrNZUnOqjQPdY0UMPH7SekX6OB XJGsBDbvF6CGZ3f2NpSis5xmV4Bb4lfJBLPIuFSUzZxHDXQRkeT2Oh9SGROvogfojcq3RjPCd CmCafC+JsEF6hfeMOqtDGVJoUx1yaX4zox5SAnANVNB5V+dxFHV+5FzNsQ76BzJr8nH0qJ9yQ JCZ/iwnsuGB+10NS85x58oDGDTawCy7LEEYiDW1Kh/Nrf8FALg9bRE54llfWv6pExV39numVO KgSO+LUoisGO0ehBkjWNCPDoZ2eyihsH2iyYSZqDzQltuQPYJgMdwJBY85Gw4iyREktWPjnm8 f99GqOiVjleHPOWigwV9XnYoDON4Xc7OV8p55Kzox2Y4zmXArBeummyn3o1k9ghss9u1NA+T/ oK5izKsf1SGZK5gxh1ewEiu2AIskARqqo6L43Tf8a3m/t7hMb2sPRE9ZSKHKbU170d1iO225W CtxngFJtKhV1X+uebG1W25w6q9cIxrKb8dBLZFkKeiUpxfoi5dUSm7TLrZlaeyhy2C/N5h57I 8Cl1C/XcB3HITsiSYfkHeMXJHcC0lKCzJea9xxBsmC2l9h6U530wsY5ddBplZ95bIfxDB3l7r egNDPMvZZOr+buA8iBcNRTZuCRjxQJnbfjZWC0fupJB3veiDZxeCnkOfQC5QNygRNWoEpx/Mr QJl4Y06GbntfFN1lz08k0RAwEIKAplo4dtuJv1WAQOrCows68pjYWMILRXJFoTvx0dGkpevui AtsY/W8p5s9TFG6LUTe1gdFLiM54Ojwm0PeJYwHxU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_081611_709898_FAE108FD X-CRM114-Status: GOOD ( 12.36 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.72.192.73 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This enables thermal for the BCM2711 (used on Raspberry Pi 4) by adding the AVS monitor and a subnode for the thermal part. Signed-off-by: Stefan Wahren Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne --- arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi index 961bed8..96f341d 100644 --- a/arch/arm/boot/dts/bcm2711.dtsi +++ b/arch/arm/boot/dts/bcm2711.dtsi @@ -66,6 +66,17 @@ IRQ_TYPE_LEVEL_HIGH)>; }; + avs_monitor: avs-monitor@7d5d2000 { + compatible = "brcm,bcm2711-avs-monitor", + "syscon", "simple-mfd"; + reg = <0x7d5d2000 0xf00>; + + thermal: thermal { + compatible = "brcm,bcm2711-thermal"; + #thermal-sensor-cells = <0>; + }; + }; + dma: dma@7e007000 { compatible = "brcm,bcm2835-dma"; reg = <0x7e007000 0xb00>; @@ -363,6 +374,7 @@ &cpu_thermal { coefficients = <(-487) 410040>; + thermal-sensors = <&thermal>; }; &dsi0 { From patchwork Sat Jan 11 16:15:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11328923 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 2E51E6C1 for ; Sat, 11 Jan 2020 16:17:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C53C20661 for ; Sat, 11 Jan 2020 16:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RCFFQXvj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C53C20661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=i2se.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=y8yFrKqN9mI0o4tN9YnVC4jEakp+Uli2+mSL+/FGU2Y=; b=RCFFQXvjmicSByLIbXdtrJl1GY ubgGxqRE9VflYxGoo9DObT7e7Q+SoqIUL6t++5vcx7oeA1X4FzbcLf48x56Q739MDl5+OnYIzDjWB TleUjOEpRaoUW976We6sVMksyT96d3MbZSHLm4hGt+E0Jd3LMFviV/JiKBaJEIqGI6xFMkDWYm2fk Sx/mJrsKG+T0h5ol9OrKfGPabzpJ4tFdS+58An1LaUjPecziHxO8NaoNmnYXJDTSK//Wb7CiBNKPM 9Jc80tPTKMN5SD1Vik2DVzE/XAhPQgDMO+4ZAAp5N+VVwf/tTwIEhnpLhHc8FvAiMAGZngIpcLC+Y 786iyu2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJRo-0003nF-0o; Sat, 11 Jan 2020 16:17:12 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqJR4-00035F-CD for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2020 16:16:28 +0000 Received: from localhost.localdomain ([37.4.249.154]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MlO5j-1jWldt45e9-00lm2O; Sat, 11 Jan 2020 17:15:53 +0100 From: Stefan Wahren To: Zhang Rui , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , Nicolas Saenz Julienne , Florian Fainelli , Catalin Marinas , Will Deacon Subject: [PATCH V4 4/4] ARM: configs: Build BCM2711 thermal as module Date: Sat, 11 Jan 2020 17:15:42 +0100 Message-Id: <1578759342-4550-5-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> References: <1578759342-4550-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:PGzIYruZHR30DesD7wJ+elb2eQS3441bmcXLTgoww362SkbKOqv y7l5+cOKxknUI5qQREvnPRQFO9rGVdK/fg6udRYDUhnh6l2HVbHpbVal0TisaemPqmZhYd9 hkKTRdm5rttJmKhtKWCgonPaRep1878OxdPg5aJhFQBzNBEZOTx4v633r3p2gAoMpP60lJt +K5AO/aaMSTS4iYcMYffQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zIMcgdIknNE=:G0dKVNn1GloLF3qitLLuSB zg3m/E+0b0lWgdxg8628Ty/PZDjhlxYm4PEja1NDFOtC4y6ia8Dwt4EX4CBaw9utcqdeZIxtz 8r5UHDDQdVuyacIOpBbGnHjCOuvxstimNhT94ji1iQEM3bpOyb8lOKKbRizkHGB6KX5aAWvPi GdW78ry9/fDuUeOsoyvKxKuAvwwL6pEiMqaOtPnhMeqwORtId7bJGkPZuFMyyh6QxeWVRRM14 i6729LkdbfxD3x+Mbwg3bkWi5gkgCd/Zl5sO6gdeLhrRjXvT0b0MEx9GCv5uxfkHdBp7//QB+ zrzCLslqKP5+dGPvdxgnsgLMZ5mn93NcYehcjUKx3Vt1mzVUlAeRK3Ym2Pw3YE/jH4r3+aIke l5Jo2NbRLZHa7cvO7YGTfdtfr/jWp99vwx3v8vLEQAEi8vy/L2LeVlfhRjB2eRbPHOJFMLQg3 ocpxR74nwNS9gVY8ioJ3RiWrlbCaHKeIk2xqCIAtxByxP7brYblBsjdUa2DARzR9D7otEvHUE rxtWTtJfX1TdzaUCBbCoy/frTSqG5b6XUp+LE3vVBP5rDWvA+8jd+aQy38ANIyE+mJNZLNQ3A ZctZLrhuuGGNyWzqkc5U1rqQEydTcp0iBq1qp/2KI7ObuYUWhqYHCy3pvh9daKNB8+o/YdJwj IOFg4CZx0LqlaUQiBI7vJ59a+XdFCar6TIzH4dD2Y3X/Xo02ahJH+uEG14zE6vXKL1nhhukqs z7JvsEmSfX6M1vawD2IgfkzDyHef70gWjgiZ8wNVT16aAde6qpzU+T54P0OCKYFO5RbPK+iLS vFA//jHVaVxwTiem8wL/ER7q1/KP+Gj8FM/mxndW8WXkFkQ6+cfiJGRY8KAlpeJuYHL+FENuF dm82scAuUFUTGlMWM6M/ZJBbDeu0P0viprN25wAQI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_081626_727280_21694742 X-CRM114-Status: GOOD ( 12.28 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.72.192.74 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This builds the BCM2711 thermal driver as module for the Raspberry Pi 4. Signed-off-by: Stefan Wahren Reviewed-by: Florian Fainelli Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne --- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 3f1b96d..f5d19cc 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -496,6 +496,7 @@ CONFIG_IMX_THERMAL=y CONFIG_ROCKCHIP_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_ARMADA_THERMAL=y +CONFIG_BCM2711_THERMAL=m CONFIG_BCM2835_THERMAL=m CONFIG_BRCMSTB_THERMAL=m CONFIG_ST_THERMAL_MEMMAP=y diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 6a83ba2..b2f6673 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -442,6 +442,7 @@ CONFIG_ROCKCHIP_THERMAL=m CONFIG_RCAR_THERMAL=y CONFIG_RCAR_GEN3_THERMAL=y CONFIG_ARMADA_THERMAL=y +CONFIG_BCM2711_THERMAL=m CONFIG_BCM2835_THERMAL=m CONFIG_BRCMSTB_THERMAL=m CONFIG_EXYNOS_THERMAL=y