From patchwork Wed Jul 31 12:14:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20F26112C for ; Wed, 31 Jul 2019 12:14:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C02B288CB for ; Wed, 31 Jul 2019 12:14:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F177D288F8; Wed, 31 Jul 2019 12:14:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6376288CB for ; Wed, 31 Jul 2019 12:14:56 +0000 (UTC) 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=OIxpJ7Sf3U3rYC6Wn7NECihU8YJJzH5wS5dmWMgo7+0=; b=b3Sd1DLIAibjuzRZpcOwxm+mop +533LVMZi6cwhl+2kOiv7OZEtxYiO8412G3M1SjK4oAHYwMehgLfv19/dlk4fXK7ZM0rzn0vvNPMH TgfleBRQO1QL4Z6NYd13TjCjsLtCA3IphkVrlyuPdw6BZFDV1iQSotxPqxlkNdRQ7udw8EVlJJHA/ KOyQL/AdEoZjC5HMxY9t46vZD1vHSRUNsdnqkNtz4GmbQk4T0vqsPS5ZdeZjtD82Da6F1WmFxBpwV Fn+8lyPc8kxYhMX7c2zcmNW8GDWn7bTrRakugfrsME4KheRHbs5bHb20rQ6PuNi1Gr74WpYkkRUw2 BHYe7OyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnVQ-0006FA-2D; Wed, 31 Jul 2019 12:14:56 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUl-0005OT-SA for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:19 +0000 Received: by mail-wr1-x444.google.com with SMTP id n4so69502027wrs.3 for ; Wed, 31 Jul 2019 05:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZCxLPCe1ACQErDUW8aWQ5KGtk3yR1/KdxyjnNrl959M=; b=hEtFsx3E+vxVxKVnkVJrIPQhq8u5k6R7R82zb8hMdxf9abXPdtLUh28KELgdxJxC7H fRk2y7UTqODUNIsjHz/e6c/DCcMZFDmYmRqcQer0vInc6NtYSx+JKe507QqSSmy+27sA si1yo3vz6FWgANa91bC16sQzkIS5vyEUgDzCdvaqR4tzTBvn61aSjX6IhW0cw61qZQPE NbnbApP+KE2tqktTZaEEwZ6VIEEC7DjdrKqhLyYtc/cUEbL48PcGFI70udjecD5SUYgU 1DavhttVuzkByIzpTjIXy8Ot5Ginl8C4aNnpTVOXHvtAjoj3meueKbzIOTXOZxjIfDvF 9LwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZCxLPCe1ACQErDUW8aWQ5KGtk3yR1/KdxyjnNrl959M=; b=ng4YCHTfNu0AXxcrIPL1ZdkTN9ad/8mn5V7Jbn55UTneAuYsyNkt9MvT0SlVwdC6es 2gbgUddIzjEHhNyp681yNCdhxAR+oHSxiYlZvS20+Dr5EQ7C0ZugaQr6WtSE8XHHkcTL wM58ZaKhNNSiQZIvwI4ifCOEyRXhfk1Y4r7d/4GuOxXZZAHk2T4i8VvNhxgKVl6P+Gu+ qhFoNI+Id1j3VOMfRo2sqPNPIQA+2+pWOyNSi7xJn36Aa21K4keKueCY73erRILttbAA 87+DgVjO5gGrzsT2QB5GJA10JRxJBC6BGbsBOqSWbUxUNDeL+cHhOGCl8dKIdFaIRACy MrPg== X-Gm-Message-State: APjAAAWdXgToQmI82k/0cXV0w+WbAZeBVFglCgQcMZEx2FHiOEZYPnbQ bR6rL7GZ/i32V6e3WLGA7DLp3w== X-Google-Smtp-Source: APXvYqyR0a3A3NknrNBLDCX+TNBWHtgAMABkJnJgH0JnXRb3PYf4C6vmioWW1jWll9xmx8tLdvDNwg== X-Received: by 2002:adf:e50c:: with SMTP id j12mr51394689wrm.117.1564575254371; Wed, 31 Jul 2019 05:14:14 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:13 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 1/6] dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal Date: Wed, 31 Jul 2019 14:14:04 +0200 Message-Id: <20190731121409.17285-2-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051415_915121_EE8A2758 X-CRM114-Status: GOOD ( 10.02 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Adding the devicetree binding documentation for the Amlogic temperature sensor found in the Amlogic Meson G12 SoCs. the G12A and G12B SoCs are supported. Signed-off-by: Guillaume La Roque --- .../bindings/thermal/amlogic,thermal.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml diff --git a/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file mode 100644 index 000000000000..1e2fe84da13d --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Thermal Driver + +maintainers: + - Guillaume La Roque + +description: Amlogic Thermal driver + +properties: + compatible: + oneOf: + - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - enum: + - amlogic,g12-thermal + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + +required: + - compatible + - reg + - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>; + interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; +... \ No newline at end of file From patchwork Wed Jul 31 12:14:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF17113A0 for ; Wed, 31 Jul 2019 12:15:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A86C6288E5 for ; Wed, 31 Jul 2019 12:15:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BDC9288FC; Wed, 31 Jul 2019 12:15:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E58BD288E5 for ; Wed, 31 Jul 2019 12:15:10 +0000 (UTC) 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=Wzry9rSVWBmfD9oHK7T6Q6AoOY2vwa90pRbPFqczt3g=; b=Ry3fQlE3qfVZ6fFImAldAAV/KN uZuK43noKlsJd+xCLFnhuJ78EcOLYR7x7dra7wl+sTs3SoJb/Y3JYJNI4ZymXCb3jHp7rc8EEOa4f SBoocWXXjBxk8TcVDDVCjo4VMOFsmV6Sfy1/graL3WWcjoBq+nulOyUdG6W5AkJWonNn23dCDKMIR I9jc6j3QPGhjoSQZyGNvztS9vAv8AaqwkuRxTEDnwa2LgqtDmjVM9EtX6dom65iJ9LgkgxW3bJyIT KeochvjbZ5sUgwXhxlmet8aj6xvwLbgbzzsntvekp5cAuFkkYSzeb6Tc/yUBNYRmob4+ZsJO5wLD+ c36i08Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnVd-0006vO-RX; Wed, 31 Jul 2019 12:15:10 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUn-0005PW-5E for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:22 +0000 Received: by mail-wm1-x342.google.com with SMTP id v15so60596736wml.0 for ; Wed, 31 Jul 2019 05:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2GI3WROr9PL26mrpDFVBlnpN8oY0cW4cXyUuX6sB6nw=; b=xL9zu1narbapY5n1BST9kQofAhW6fysxknqJW3CPJMFUqHrvtzTn3J5tHdOvdWbEio xhYqPGYY543Da/xxFfDHQPcW3KtHBlR5Eg0xPiLY7g5k9bAiuSDXrRJX8QmY6a94/QTW 26anVxSCk4vIwtPfImAp0ugIWkTTg+OkJMNzPcAhZ7oLNY+8OLoEPoYQ3r0+skwKw8be Q4yNbYMitUP9m0fwAJIoSpRK5gpgikwgtYn7smAZxilO/hltI+vgeBMRvf2FbMqzzUZ9 gFo9kMKfRGslFMk5+6TR1dlKyha/ojcvFrXcRJxpTYq1DChnl25EuoVuPtPfMlHCg+gd uXbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2GI3WROr9PL26mrpDFVBlnpN8oY0cW4cXyUuX6sB6nw=; b=cxMtqmci8enMPijrw3C5qIBopCUBJPxnuWMLaMfd8E9BW6oxVDGA7GYAHC1u3eqUip /KTKYxWNVvsf6+eI/+pV9IL2CpUsS4T7MH3zoQtkAuzJQOH5oERXlaRdI2Xg8wk4B0DH B0NxrnH0RBsnBaoNmf6wZ9A4U+PT6etK9XTutWc8SRuOmyiJgE43eQSvmaaJVFpmeOMY 8pSNiWPAD8F0g80i4SzKfaeKkzQUAemCUhu1d0uajE0EfcUis+PTR0Zh8wqJ2y0EEFWA r8mjfUr1xMi4f5qfzyoKX4Qvn9ArVp/4bQZnGo29gH4cfd9Jm1O67rSIeZqGHpKhxZn6 rD/g== X-Gm-Message-State: APjAAAUIY6gDUR0DEFlaEtaU3b08niq6dTtCZ0QCJ+TnrBvPlW7h7hoI aRgLGmFu9JAWqBIF6heoGgv3EQ== X-Google-Smtp-Source: APXvYqxgHTYrDDcBXZ5CHzL04lHb6W+8B/+GIKHNhQOWL7jnCk3gpn+BVpyUE9zHfCp6xRhz3AymXQ== X-Received: by 2002:a1c:e710:: with SMTP id e16mr113970351wmh.38.1564575255337; Wed, 31 Jul 2019 05:14:15 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:14 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs Date: Wed, 31 Jul 2019 14:14:05 +0200 Message-Id: <20190731121409.17285-3-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051417_199467_D1EAD792 X-CRM114-Status: GOOD ( 20.17 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Guillaume La Roque --- drivers/thermal/Kconfig | 12 +- drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 335 ++++++++++++++++++++++++++++++ 3 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 drivers/thermal/amlogic_thermal.c diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 9966364a6deb..2332ef1bfafc 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -1,4 +1,3 @@ -# SPDX-License-Identifier: GPL-2.0-only # # Generic thermal sysfs drivers configuration # @@ -348,6 +347,17 @@ config MTK_THERMAL Enable this option if you want to have support for thermal management controller present in Mediatek SoCs +config AMLOGIC_THERMAL + tristate "Amlogic Thermal Support" + default ARCH_MESON + depends on OF && ARCH_MESON + help + If you say yes here you get support for Amlogic Thermal + for G12 SoC Family. + + This driver can also be built as a module. If so, the module will + be called amlogic_thermal. + menu "Intel thermal drivers" depends on X86 || X86_INTEL_QUARK || COMPILE_TEST source "drivers/thermal/intel/Kconfig" diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 74a37c7f847a..baeb70bf0568 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -54,3 +54,4 @@ obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o +obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c new file mode 100644 index 000000000000..6b6d62326725 --- /dev/null +++ b/drivers/thermal/amlogic_thermal.c @@ -0,0 +1,335 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Amlogic Meson Thermal Sensor Driver + * + * Copyright (C) 2017 Huan Biao + * Copyright (C) 2019 Guillaume La Roque + * + * Register value to celsius temperature formulas: + * Read_Val m * U + * U = ---------, Uptat = --------- + * 2^16 1 + n * U + * + * Temperature = A * ( Uptat + u_efuse / 2^16 )- B + * + * A B m n : calibration parameters + * u_efuse : fused calibration value, it's a signed 16 bits value + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "thermal_core.h" + +#define TSENSOR_CFG_REG1 0x4 + #define TSENSOR_CFG_REG1_RSET_VBG BIT(12) + #define TSENSOR_CFG_REG1_RSET_ADC BIT(11) + #define TSENSOR_CFG_REG1_VCM_EN BIT(10) + #define TSENSOR_CFG_REG1_VBG_EN BIT(9) + #define TSENSOR_CFG_REG1_OUT_CTL BIT(6) + #define TSENSOR_CFG_REG1_FILTER_EN BIT(5) + #define TSENSOR_CFG_REG1_DEM_EN BIT(3) + #define TSENSOR_CFG_REG1_CH_SEL GENMASK(1, 0) + #define TSENSOR_CFG_REG1_ENABLE \ + (TSENSOR_CFG_REG1_FILTER_EN | \ + TSENSOR_CFG_REG1_VCM_EN | \ + TSENSOR_CFG_REG1_VBG_EN | \ + TSENSOR_CFG_REG1_DEM_EN | \ + TSENSOR_CFG_REG1_CH_SEL) + +#define TSENSOR_STAT0 0x40 + +#define TSENSOR_STAT9 0x64 + +#define TSENSOR_READ_TEMP_MASK GENMASK(15, 0) +#define TSENSOR_TEMP_MASK GENMASK(11, 0) + +#define TSENSOR_TRIM_SIGN_MASK BIT(15) +#define TSENSOR_TRIM_TEMP_MASK GENMASK(14, 0) +#define TSENSOR_TRIM_VERSION_MASK GENMASK(31, 24) + +#define TSENSOR_TRIM_VERSION(_version) \ + FIELD_GET(TSENSOR_TRIM_VERSION_MASK, _version) + +#define TSENSOR_TRIM_CALIB_VALID_MASK (GENMASK(3, 2) | BIT(7)) + +#define TSENSOR_CALIB_OFFSET 1 +#define TSENSOR_CALIB_SHIFT 4 + +/** + * struct amlogic_thermal_soc_data + * @A, B, m, n: calibration parameters + * This structure is required for configuration of amlogic thermal driver. + */ +struct amlogic_thermal_soc_data { + int A; + int B; + int m; + int n; +}; + +/** + * struct amlogic_thermal_data + * @u_efuse_off: register offset to read fused calibration value + * @soc: calibration parameters structure pointer + * @regmap_config: regmap config for the device + * This structure is required for configuration of amlogic thermal driver. + */ +struct amlogic_thermal_data { + int id; + int u_efuse_off; + const struct amlogic_thermal_soc_data *soc; + const struct regmap_config *regmap_config; +}; + +struct amlogic_thermal { + struct platform_device *pdev; + const struct amlogic_thermal_data *data; + struct regmap *regmap; + struct regmap *sec_ao_map; + struct clk *clk; + struct thermal_zone_device *tzd; + u32 trim_info; + void __iomem *base; +}; + +/* + * Calculate a temperature value from a temperature code. + * The unit of the temperature is degree Celsius. + */ +static int code_to_temp(struct amlogic_thermal *pdata, int temp_code) +{ + const struct amlogic_thermal_soc_data *param = pdata->data->soc; + int temp; + s64 factor, Uptat, uefuse; + + uefuse = pdata->trim_info & TSENSOR_TRIM_SIGN_MASK ? + ~(pdata->trim_info & TSENSOR_TRIM_TEMP_MASK) + 1 : + (pdata->trim_info & TSENSOR_TRIM_TEMP_MASK); + + factor = param->n * temp_code; + factor = div_s64(factor, 100); + + Uptat = temp_code * param->m; + Uptat = div_s64(Uptat, 100); + Uptat = Uptat * BIT(16); + Uptat = div_s64(Uptat, BIT(16) + factor); + + temp = (Uptat + uefuse) * param->A; + temp = div_s64(temp, BIT(16)); + temp = (temp - param->B) * 100; + + return temp; +} + +static int amlogic_thermal_initialize(struct amlogic_thermal *pdata) +{ + int ret = 0; + int ver; + + regmap_read(pdata->sec_ao_map, pdata->data->u_efuse_off, + &pdata->trim_info); + + ver = TSENSOR_TRIM_VERSION(pdata->trim_info); + + if ((ver & TSENSOR_TRIM_CALIB_VALID_MASK) == 0) { + ret = -EINVAL; + dev_err(&pdata->pdev->dev, + "tsensor thermal calibration not supported: 0x%x!\n", + ver); + } + + return ret; +} + +static int amlogic_thermal_enable(struct amlogic_thermal *data) +{ + clk_prepare_enable(data->clk); + regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, TSENSOR_CFG_REG1_ENABLE); + + return 0; +} + +static int amlogic_thermal_disable(struct amlogic_thermal *data) +{ + regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, 0); + clk_disable(data->clk); + + return 0; +} + +static int amlogic_thermal_get_temp(void *data, int *temp) +{ + unsigned int tvalue; + struct amlogic_thermal *pdata = data; + + if (!data) + return -EINVAL; + + regmap_read(pdata->regmap, TSENSOR_STAT0, &tvalue); + *temp = code_to_temp(pdata, + tvalue & TSENSOR_READ_TEMP_MASK); + + return 0; +} + +static const struct thermal_zone_of_device_ops amlogic_thermal_ops = { + .get_temp = amlogic_thermal_get_temp, +}; + +static const struct regmap_config amlogic_thermal_regmap_config_g12 = { + .reg_bits = 8, + .val_bits = 32, + .reg_stride = 4, + .max_register = TSENSOR_STAT9, +}; + +static const struct amlogic_thermal_soc_data amlogic_thermal_g12 = { + .A = 9411, + .B = 3159, + .m = 424, + .n = 324, +}; + +static const struct amlogic_thermal_data amlogic_thermal_g12_cpu_param = { + .id = 0, + .u_efuse_off = 0x128, + .soc = &amlogic_thermal_g12, + .regmap_config = &amlogic_thermal_regmap_config_g12, +}; + +static const struct amlogic_thermal_data amlogic_thermal_g12_ddr_param = { + .id = 1, + .u_efuse_off = 0xF0, + .soc = &amlogic_thermal_g12, + .regmap_config = &amlogic_thermal_regmap_config_g12, +}; + +static const struct of_device_id of_amlogic_thermal_match[] = { + { + .compatible = "amlogic,g12-ddr-thermal", + .data = &amlogic_thermal_g12_ddr_param, + }, + { + .compatible = "amlogic,g12-cpu-thermal", + .data = &amlogic_thermal_g12_cpu_param, + }, + { /* end */ } +}; +MODULE_DEVICE_TABLE(of, of_amlogic_thermal_match); + +static int amlogic_thermal_probe(struct platform_device *pdev) +{ + struct amlogic_thermal *pdata; + struct device *dev = &pdev->dev; + struct resource *res; + int ret; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdata->data = of_device_get_match_data(dev); + pdata->pdev = pdev; + platform_set_drvdata(pdev, pdata); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pdata->base = devm_ioremap_resource(dev, res); + if (IS_ERR(pdata->base)) { + dev_err(dev, "failed to get io address\n"); + return PTR_ERR(pdata->base); + } + + pdata->regmap = devm_regmap_init_mmio(dev, pdata->base, + pdata->data->regmap_config); + if (IS_ERR(pdata->regmap)) + return PTR_ERR(pdata->regmap); + + pdata->clk = devm_clk_get(dev, NULL); + if (IS_ERR(pdata->clk)) { + if (PTR_ERR(pdata->clk) != -EPROBE_DEFER) + dev_err(dev, "failed to get clock\n"); + return PTR_ERR(pdata->clk); + } + + pdata->sec_ao_map = syscon_regmap_lookup_by_phandle + (pdev->dev.of_node, "amlogic,ao-secure"); + if (IS_ERR(pdata->sec_ao_map)) { + dev_err(dev, "syscon regmap lookup failed.\n"); + return PTR_ERR(pdata->sec_ao_map); + } + + pdata->tzd = devm_thermal_zone_of_sensor_register + (&pdev->dev, + pdata->data->id, + pdata, + &amlogic_thermal_ops); + if (IS_ERR(pdata->tzd)) { + ret = PTR_ERR(pdata->tzd); + dev_err(dev, "Failed to register tsensor: %d\n", ret); + return PTR_ERR(pdata->tzd); + } + + ret = amlogic_thermal_initialize(pdata); + if (ret) + return ret; + + ret = amlogic_thermal_enable(pdata); + if (ret) + clk_unprepare(pdata->clk); + + return ret; +} + +static int amlogic_thermal_remove(struct platform_device *pdev) +{ + struct amlogic_thermal *data = platform_get_drvdata(pdev); + + return amlogic_thermal_disable(data); +} + +#ifdef CONFIG_PM_SLEEP +static int amlogic_thermal_suspend(struct device *dev) +{ + struct amlogic_thermal *data = dev_get_drvdata(dev); + + return amlogic_thermal_disable(data); +} + +static int amlogic_thermal_resume(struct device *dev) +{ + struct amlogic_thermal *data = dev_get_drvdata(dev); + + return amlogic_thermal_enable(data); +} +#endif + +static SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops, + amlogic_thermal_suspend, amlogic_thermal_resume); + +static struct platform_driver amlogic_thermal_driver = { + .driver = { + .name = "amlogic_thermal", + .pm = &amlogic_thermal_pm_ops, + .of_match_table = of_amlogic_thermal_match, + }, + .probe = amlogic_thermal_probe, + .remove = amlogic_thermal_remove, +}; + +module_platform_driver(amlogic_thermal_driver); + +MODULE_AUTHOR("Guillaume La Roque "); +MODULE_DESCRIPTION("Amlogic thermal driver"); +MODULE_LICENSE("GPL v2"); From patchwork Wed Jul 31 12:14:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA9BE13A0 for ; Wed, 31 Jul 2019 12:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5CCE288CB for ; Wed, 31 Jul 2019 12:15:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E5B288F8; Wed, 31 Jul 2019 12:15:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F83D288CB for ; Wed, 31 Jul 2019 12:15:21 +0000 (UTC) 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=Bhaumxh9wFMyzB4qUpgALForc+W/7t/Qjmp3xfyK3u8=; b=hcTW0TDJqJALASSE1HzwRk/tmG oSWqZ/bqqfrB6Yn1tnUeKErJXYo+rvCuEIvLLSxZYXv5PmbzBbmKc2eFUujjlEKGSzZHvaWEoAI16 VV2+tA6/+ga2hovR66MlaSJQ9Mkwg7UVkKzlGKUSzmsiloM6t1yXQuKIuax7ypc1hdNQkrzCLQtS7 rLRYh8ie3kIbVlFrxXrFOhGLgwjZYStjivHSIgC3SYF86U6BPCVG7HGkuF4MWCH51cQuu03/FkrrE vRWyxWUlwaqvgsRToQ8BEB04CutUcn/yXihd5Aldm5bFIw2K47YoFAMYq2jMWhdEEAmgzhVRtClYz d/KG+7Fg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnVo-0007nk-SY; Wed, 31 Jul 2019 12:15:20 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUn-0005Pc-9p for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:21 +0000 Received: by mail-wr1-x443.google.com with SMTP id z1so69395703wru.13 for ; Wed, 31 Jul 2019 05:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3CCOCjh2x1iQPGlZN3jIo89XnZKXDURAKwx788VT6WA=; b=konqN/tSWn5MnRNaHXWCAuACoPQk79+SeUDGVfuNUSYGAy6R13WPzZcwC/9viSy9ZC uiBR0TN5rc3akffhBkgRd7o78J2XiETILJxUH1Ctr4biflUhUKSphigwbyX08uSaQAKN SpV+/OeKHwEm119YhMP4Wrlmn6ueB2rRj0/JZ04ZBuuu7X92DNKTlFqO/o4/Y2F8MKJ/ u5u1P/QG/2a8RNDnEBPFP9wLkR+hhRpLdM2IRvrQ1JhifwRh7xz4wt+ByVgkKH+VwDFL O6SdN9yX46kRY0aZ3UCVxKwh1pe+TDeIVmJ2/qQfDPfT35db9g4qTrHr4OKmx+4Owqn7 wi8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3CCOCjh2x1iQPGlZN3jIo89XnZKXDURAKwx788VT6WA=; b=hLiW5a83Fpdqeqb87r8svoix71V35a5IVbF+/wqR3nreMCaYSda2eze1y+R0bWZDls /pzQ81p/i3PskDRSmex031gfuEwfZ6j4Z105uRbauW0nK/SO9BCBt2CoaDbR0NWpFFRd pbDa6k4X4vUwddEbZjlNffouj0gCssxlnxEa+WgIz7ooynUxqd2NyMiskdX4xXD1KD3Z Gz3v/A6nvBR5gV1CIlo6W8QNtiwK3Rcn7TVoxRxgmZRAlETAfkBP2AN1fqF0b8Oc9RFe kuiNSWSneky6GKaBw7Z0aLdYUZUiyAXez9YGH72ke2QhyII9Hj8c3wtUTR1XFM3EI1Hk aJ2Q== X-Gm-Message-State: APjAAAXKqpEp4I89+gR5vVXXDvx75jIn2aDHrg+3Z4tSyVMPoWHECTJj +aoRkZMxzb3WktB6YhVprSCBnw== X-Google-Smtp-Source: APXvYqwrOzBQ/vplwh9sXRThCJ+igArUJU9XiT1VUFIdwNGAU5J1RHqwjHxq4gdna2QH4jynKhdhPw== X-Received: by 2002:adf:f812:: with SMTP id s18mr5128298wrp.32.1564575256188; Wed, 31 Jul 2019 05:14:16 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:15 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 3/6] arm64: dts: amlogic: g12: add temperature sensor Date: Wed, 31 Jul 2019 14:14:06 +0200 Message-Id: <20190731121409.17285-4-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051417_342510_445DF0C9 X-CRM114-Status: UNSURE ( 7.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add cpu and ddr temperature sensors for G12 Socs Signed-off-by: Guillaume La Roque --- .../boot/dts/amlogic/meson-g12-common.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi index 06e186ca41e3..e10aba5c9270 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -1353,6 +1353,28 @@ }; }; + cpu_temp: temperature-sensor@34800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34800 0x0 0x50>; + interrupts = ; + clocks = <&clkc CLKID_TS>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; + + ddr_temp: temperature-sensor@34c00 { + compatible = "amlogic,g12-ddr-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34c00 0x0 0x50>; + interrupts = ; + clocks = <&clkc CLKID_TS>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; + usb2_phy0: phy@36000 { compatible = "amlogic,g12a-usb2-phy"; reg = <0x0 0x36000 0x0 0x2000>; From patchwork Wed Jul 31 12:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4370112C for ; Wed, 31 Jul 2019 12:14:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFE98288CB for ; Wed, 31 Jul 2019 12:14:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3E06288F8; Wed, 31 Jul 2019 12:14:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7DEAA288CB for ; Wed, 31 Jul 2019 12:14:59 +0000 (UTC) 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=gZ2olXJbxdYSfHzT8Zf32d6BVETxfnfTLP6hvN4Dz1I=; b=f2qefnunB11VRzTgbRZ+08m6x3 RW4iox8SlUS3leHZZRQSZplIN4pzXMSX9JmGpT0ReH2G9NHj65tor1+Dv8/kzRKONi39ugAhF/aaS LBg0lAZVoQffqJZt+LaFZZSYLHZIpWSKyYHrz2EJUlY4sbIL4VdCMB1c65/oj/kq+lErgpXEBGsN+ 4eNVerw7Rb13vOji6pEUc/omun9k7UcVDYehWhzdRXH7Z/v0XauN5wktH0zd+mw46/b8motcrm1rR h7Nlcwdq5h3jM+Z7CaS3dCDE1dE0pa2MdnsXCMY7eHm//cZ0HIb2vwwO9sum/W8MLSXd5iVZ8Tzj1 aeSry74A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnVT-0006Im-2b; Wed, 31 Jul 2019 12:14:59 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUo-0005QK-9e for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:21 +0000 Received: by mail-wm1-x342.google.com with SMTP id v19so59629901wmj.5 for ; Wed, 31 Jul 2019 05:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4dhyanCajCoQ1NdrxY9RmPZmRRskdkUd8pA1FbO4zdo=; b=fYS3TgnwrniuqSiM6EH8XBX5NO0WHBVCvOQ0paEeMa5/j1L16S3eMBI475LTjoV8ui XZMH/qiesdnDqiwtIhyM1C2/aKEjieF90KHqB6+woi/R04pCoUA/DS7g8FxIvxCnVtge CGwXU2VF0b6n9CWoTmUCdsFiMDjRLlu5sziIWWZIkiHdyN0Y/Wsf0v2npxS2fT0fS+lM erUXS9kjSafOR4vz6DeIvqCDioiICAfx5E4DG2s8qQ9IObARQnUnjfv1c+5qN9fxljuk dnOaSG3+0/aKtms73knvFjaJth/VFSJ1fRgV96ir5bKG0YYN6P1Pt94Qm3nVEVGmD6W2 8e7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4dhyanCajCoQ1NdrxY9RmPZmRRskdkUd8pA1FbO4zdo=; b=da3JToyRIByGMa3/QEdRmOtKTf7c5pwWNQ43bioHj7p6RulokmjLJp/A5rvZidmNoH Mon1evsNejyRtZBvKTqVO3n9Raoj0/KviyeDF+Kl6odbsDIdaLLPHqeYCQdLZgum7fjW esrw0L3/aNaabOs3i8COnj0HZECaIYuIc37O8ULgVj+sbfjbqA7SGiZIsiYlc/eLTYuB UcC/c/WTlXrPeVL7e/7p6r/Zvawg+lUcMGPbhbLGFxzJjxqUXEOEkoZGOEToOWliJhE6 6m9jLEuvJZGPowPjbw0GvcXN9lWlDNr3ZkYi42brOXjPKYNTJ0KPjBwamwX1uMNQqzJW gvwg== X-Gm-Message-State: APjAAAVdJkBUYmWMSCicB7S+5/xco5XaAYslbtABLkrL/0oX0VVBlISI w2kYdvcN/cGsl1n+c707hraPkA== X-Google-Smtp-Source: APXvYqxRDiGgBTKX4OvpK3DPoOUb/3Cu6lXEUEkKcn4C86RVnIxo9nRbAkWga96jF5qAdQmTIoHbSA== X-Received: by 2002:a7b:c251:: with SMTP id b17mr37174245wmj.143.1564575257149; Wed, 31 Jul 2019 05:14:17 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:16 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 4/6] arm64: dts: meson: sei510: Add minimal thermal zone Date: Wed, 31 Jul 2019 14:14:07 +0200 Message-Id: <20190731121409.17285-5-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051418_334606_335D6351 X-CRM114-Status: UNSURE ( 7.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add minimal thermal zone for DDR and CPU sensor Signed-off-by: Guillaume La Roque --- arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts index c7a87368850b..79ae514e238d 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts @@ -33,6 +33,19 @@ ethernet0 = ðmac; }; + thermal-zones { + soc_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp 0>; + }; + ddr_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp 1>; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>; From patchwork Wed Jul 31 12:14:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA44313A0 for ; Wed, 31 Jul 2019 12:15:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6C1F2885F for ; Wed, 31 Jul 2019 12:15:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA9ED288E5; Wed, 31 Jul 2019 12:15:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71AA22885F for ; Wed, 31 Jul 2019 12:15:44 +0000 (UTC) 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=ywEUMUOBvd45KWBKM5+mIYfJZKlGhzEcXXHBEGLdO/Q=; b=uYErbID4rSu6ivjt95V4DDyRia q+FPtPtmHE6d1Kz5tQy1GEKZmf/hfWryMB1iZfl2QUTD14E7aossLHCEzhbN+eRqC0Ipy71buKfzU FC11ZTUkxlBhH0Tn40bHTkzKF5J5Zeoa+XuQ12xJ7liaJJmlPUqEafQYwh9oxjoPbUUe84a/9MVZb 8RtjI99EthrWmO7zWaoWXTQm0WWl0mltB+96W4Q+M4YNNwiiSYbN1O6qE3c1G5Gy7eiTq+u4i+0U+ x/S/rKqixNiIt4P+rajm8kIgww7VYp10yJqdPu5KOdP0XZC9vlNX5iUCr8Im1Q+v6+sZnIb1d9Ysn nQFKeFGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnWB-0008L3-Nw; Wed, 31 Jul 2019 12:15:43 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUp-0005RD-CW for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:23 +0000 Received: by mail-wr1-x441.google.com with SMTP id c2so66204808wrm.8 for ; Wed, 31 Jul 2019 05:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BOF17YQQWl12xZ1QhY8MZFUcVRdvZruqxl9AoPVourc=; b=KOwU/VDLfH4d9hcV47fA2w/uqwOYT2FS68Y+GEZgeAIxQeMzox1GTF+0nrmfbwgok6 lFKgs6HQrZ5vHJV79TS3uRpfM7LBBpF/8oOwgSPwJoZn4uSGVeyYfnWNtxTN0cCnSKnA fwLcqzDLNkSmAbYJFRKWbisb1VHFrT9BBYe1njiRWWCpIVjSFXkGFjmG8l7ix6YGmBuO jmb5mztHtAF8AeFgsBIRAXSHH7dLXHH2WTPiyN1yejHwdxPZrwqe+2OU49FlyeZkQ6rT E+OVoUnb/VSTVGanCM84e147CCmhwhG/RaHrkLmA2+q2AMN+jbaHINtHsTQGrCX8cYtO lB1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BOF17YQQWl12xZ1QhY8MZFUcVRdvZruqxl9AoPVourc=; b=JACxFISCV+6mlQFrBhVhH9C9vYp9Cs0zg2DXHiBJxmjbkLoZ+Bi1nmjF5IXZLaI86B dgUT72NRjbrbJYCnyrplabIe4SI5bd/mhmZSuZQlqxfUUaP8O0opZWr3fsLSTypCM9eY +Rlzv5OijIOPpNMMcE49baNUmqcjmKCY6apg/zY2V8pVLduvadV4EJ5Bxe6G4B+A767T pdRO85Kw9c1I8jZEzGHXN+Iq1IQMyk9DPE5JGnQ0fyEVg5+4RMIxsvq0HYkkXIQhUIYi udd1mn9RB+8+GUXjnw71pO+GsjsMyOcMunu+AmZJkK1vmTciFv0jwjhCKkQH3e1ZJBa7 0Kzw== X-Gm-Message-State: APjAAAVJ264ldy9bAky0J6YgrSL0oVhu3jr69UDRFkejt83Y5DcfnPaQ flsTz7V6FOh6qUCjFZm+RfIcdQ== X-Google-Smtp-Source: APXvYqw5Af6krHH2u8yfiDYnUo0PUK03ieMfQQIWsJDDVp5cTQO8+Z6dt5o79L+VaM5ofBQMkgnbuQ== X-Received: by 2002:adf:c803:: with SMTP id d3mr61363995wrh.130.1564575258197; Wed, 31 Jul 2019 05:14:18 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:17 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 5/6] arm64: dts: amlogic: odroid-n2: add minimal thermal zone Date: Wed, 31 Jul 2019 14:14:08 +0200 Message-Id: <20190731121409.17285-6-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051419_463773_07E9E6D6 X-CRM114-Status: UNSURE ( 7.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add minimal thermal zone for DDR and CPU sensor Signed-off-by: Guillaume La Roque --- .../arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts index 81780ffcc7f0..4bd8d6d0c972 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts @@ -20,6 +20,19 @@ ethernet0 = ðmac; }; + thermal-zones { + soc_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp 0>; + }; + ddr_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp 1>; + }; + }; + chosen { stdout-path = "serial0:115200n8"; }; From patchwork Wed Jul 31 12:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LA ROQUE X-Patchwork-Id: 11067633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 313EA14E5 for ; Wed, 31 Jul 2019 12:15:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD452885F for ; Wed, 31 Jul 2019 12:15:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10F88288E5; Wed, 31 Jul 2019 12:15:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B57602885F for ; Wed, 31 Jul 2019 12:15:46 +0000 (UTC) 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=0q+ep8D7Tmkt13YJ5zd6e7cuW5CYAQzPBCqY85tabsc=; b=cQrx0NX0XBM3xv4g5WeTEYMy3e Oa159TaMElARtqWBOUKndiIQ4RuEOabgwboHxx9I7vGRQWKyjuhAXJhKtiLaIqMUmHqnyzzcGNd6V vO2jeKv3vafWcwc0b8Fpw2+XZh+h560UiIzjeY4It55jk7YRqIYMAYT+n6MGP7PRKAQXgDeji89zJ MTYBQRc0+Xd4JdyBh5xB634MYiEc6f0KQzmAWTTqQMr9LrVlGqh8mkkMX31pZsa8SLBxqzCBXlQw1 71EbXhtqzVjT8MicMmOelGxuq8VBxxVBqAd6hBvDIIf2pjOOmnYGwP+MTmYPtiDQCN/UZ5zow7Fm6 7o4G3yHw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsnWE-0008O2-4C; Wed, 31 Jul 2019 12:15:46 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsnUq-0005Ro-8T for linux-amlogic@lists.infradead.org; Wed, 31 Jul 2019 12:14:23 +0000 Received: by mail-wm1-x344.google.com with SMTP id g67so55499014wme.1 for ; Wed, 31 Jul 2019 05:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/dy6tDwrDZyQwCbBNtI3rvHog6QhVWeb1hPHlqbhReg=; b=kzR+HTfyhqOF5B0psynwHitDS5M5lgyvesQmRWyJVlV9jqMOaUnE+AVFRXp1M4H1Yu xn4FMMwB3LiyZTWnm4rZ0nOG2r4OZqBi18gRFUqxrC9weYcDY1E0FavjRHhW5pTtUjuu gxUa5C1VfZtk9MXIbl82EBNGyUinA5CXVo/4O4u9V33NHCjscxUt0eSYo2B6krLA3bk1 vKc85SttiGAvhvj2dTxKNq2vUcVJzUvA8dKoZlBzDKrMIJZL7WArbqHaQSRLTi/lwxCi m7RAxchFhPRZBW/pEkGuLftOLhfeEP3DBP283XWvwLO7iAb1GllGbdMntPm9eOZWUx1o hrUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/dy6tDwrDZyQwCbBNtI3rvHog6QhVWeb1hPHlqbhReg=; b=AtwFW6cyIy/JNIOMy0KbXeLnHhSE/Ey0p7gGwoJeNd70QOPQLbQwi4iTjQoAbHMqr6 EObgZ9Vs0M9yIUirVI37YB5RuxX0x4DrnGA4AYJZcY/DPjzWUFl0z8iF1zO6Wrqk/pdj SSquaPgr7Ri2swDvjhaij2BvyeFA0/MpKYn8/kbVr2y3ghe2ENAIvTCAbgSFlepjZeL7 cmNzXN564M+uH6N7/Ldk2cnxBeXlDTyrzgQaU6OY9FAoqY31qClwkNoBUSbDaEsYTPoU UWpg2LqejCIACRzkgRM2kwPThzC5kKbL5N5/QmHp7wAd03D4DlvsUJizcSZUV/1KmiH+ eDHQ== X-Gm-Message-State: APjAAAU5YNkXWY1Mwelu2TQH08WkQSMTfwDNmmT+bjGZX9UzL/L6DNTR dc85uSOtI4mmUj2ClKdkE32hDw== X-Google-Smtp-Source: APXvYqwiXLefKrRh2int86J1ClmPTnKB6ds2eofOnlZxzgE2XsT6NJ7qlB851jUxzNz+12Fsd6Bh7w== X-Received: by 2002:a1c:3587:: with SMTP id c129mr114572270wma.90.1564575259044; Wed, 31 Jul 2019 05:14:19 -0700 (PDT) Received: from glaroque-ThinkPad-T480.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a64sm3613713wmf.1.2019.07.31.05.14.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 05:14:18 -0700 (PDT) From: Guillaume La Roque To: daniel.lezcano@linaro.org, khilman@baylibre.com Subject: [PATCH 6/6] MAINTAINERS: add entry for Amlogic Thermal driver Date: Wed, 31 Jul 2019 14:14:09 +0200 Message-Id: <20190731121409.17285-7-glaroque@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731121409.17285-1-glaroque@baylibre.com> References: <20190731121409.17285-1-glaroque@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190731_051420_350888_F4813EF2 X-CRM114-Status: UNSURE ( 7.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add myself as maintainer for Amlogic Thermal driver. Signed-off-by: Guillaume La Roque Reviewed-by: Neil Armstrong --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index fb2b12f75c37..299f27d11058 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15910,6 +15910,15 @@ F: Documentation/driver-api/thermal/cpu-cooling-api.rst F: drivers/thermal/cpu_cooling.c F: include/linux/cpu_cooling.h +THERMAL DRIVER FOR AMLOGIC SOCS +M: Guillaume La Roque +L: linux-pm@vger.kernel.org +L: linux-amlogic@lists.infradead.org +W: http://linux-meson.com/ +S: Supported +F: drivers/thermal/amlogic_thermal.c +F: Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml + THINKPAD ACPI EXTRAS DRIVER M: Henrique de Moraes Holschuh L: ibm-acpi-devel@lists.sourceforge.net