From patchwork Wed Jun 24 16:15:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11623707 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 D8F5D90 for ; Wed, 24 Jun 2020 16:17:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B2C8620738 for ; Wed, 24 Jun 2020 16:17:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mSwR1CTW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="hAijn9tr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2C8620738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=jChJUW+HhrVlfsGftl6FsrvYCVCtNWIik19iGFYHjaQ=; b=mSwR1CTWmnL8Gxf8vu3fncNfh XQexQQ2loIVnU4W+xp3oSKb9LDuqnYPM5QToitng1UjvyPvZESwsdILLFwYgIu6yg0rBPwYspn+bc +NjsrF+CnQ/BbKLJfwkIrW053LbLFecsPEmjJY3+BRrThf6xiP2ZD+Pxty24wLdkl1R6nPiVhPNmA jMY3csaKUIUUQsvjuy5nuuGLUKyGBeroXzghRJEWYx2Je5jMBgXbMXvNvOzbr8a2gwyh+SIUp8Syx 1tL/Z4oPdqveXDL7LW3MR6ZIhSakP4TNg+upHeFXmEYfdTp0XzNSne0w+uUs43qPTvIYpSfg5Icgm HU8Zw22oA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo83x-0002rq-9K; Wed, 24 Jun 2020 16:15:49 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo83i-0002n7-RJ for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 16:15:39 +0000 Received: by mail-wm1-x342.google.com with SMTP id l17so2876096wmj.0 for ; Wed, 24 Jun 2020 09:15:34 -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 :mime-version:content-transfer-encoding; bh=i0KtkRN6SkhMzbNHsN7aB/oAr6hJXaOBssfXpSlZ3bo=; b=hAijn9trak1tV9zGu5s8r8sIHS4/1002P9VEeQEen7WNZ0Q2oDONSlMBRpnRSsJywS mMc1BAyHjGkKngMHmj6zMKf5P2fBl9WQzGEnXlEOa9kimCk5QlOrh+KUvZm4bAPz71tg nzhAAFRAixrAoK5AjDniBIXCeXLHGp2IbKePm8hzpbq4Wbmp0XFLOxHCfW4NU8JFkyya N+QHdUegs4bg4QMhOIA3t5rj+WJl2RQmbfS/Vf3A63hZkgX01VPjfdEiUzvmuVrNRxhp HgJjnk5UbB5z8PnbHvOHHqeIBYblxYRHmYr53lLtIUq2W94BBuRp5UTQ3V8rwEq5yyIE Xb9g== 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:mime-version:content-transfer-encoding; bh=i0KtkRN6SkhMzbNHsN7aB/oAr6hJXaOBssfXpSlZ3bo=; b=APPCmOP5ccTCEPpKOx9lkld6Yf74X3X6pHWIWwzSb0rB/KlO1wWKzfUvipdcW9wLyO oyHtq9feM0/soqptpK1faCH6XSNo0BCFb6V5hspU6av+35jbDMtE5iBVphkQTLNDfJp0 XRUccadF8XNaq0TWjLObKxyNhgA7fZYCCZfsj3q7MTssZ2mVWvElut7Rfc+iRDu6bJU/ VabAZiWjdxxOALkxhP5jsycpZ819I/iDmpFQ0PaWvcSKvRTrTRcyE2ZPfmoOt/5gGTmW 6tp9w8JQmJYAscQvkm6QzVifjirGbt8B71sHk/IwH/3NCmX8csHQNcbCuumHxLs/4L6s 0Bug== X-Gm-Message-State: AOAM530y+X84de1Ql8DWK/s1Z0PBPJxarsQr8x5UTxtHvAZ6PuzF439U taqwV4Qn9msXrZzBCBRRjLGrlA== X-Google-Smtp-Source: ABdhPJyQorCk33Dq8SCjQKSB7vqQBzlENSxcMcC42KDUjfhBkwAWX0rELxyJ6tIzYNbE33vELMOLlA== X-Received: by 2002:a1c:544f:: with SMTP id p15mr18416407wmi.84.1593015333772; Wed, 24 Jun 2020 09:15:33 -0700 (PDT) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:89ac:d9e8:f44c:b137]) by smtp.gmail.com with ESMTPSA id t15sm8716207wmj.14.2020.06.24.09.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 09:15:32 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org Subject: [PATCH v5 1/2] thermal: add support for the MCU controlled FAN on Khadas boards Date: Wed, 24 Jun 2020 18:15:27 +0200 Message-Id: <20200624161528.12664-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200624161528.12664-1-narmstrong@baylibre.com> References: <20200624161528.12664-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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 [2a00:1450:4864:20:0:0:0:342 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: amit.kucheria@verdurent.com, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, khilman@baylibre.com, Neil Armstrong , linux-kernel@vger.kernel.org, Amit Kucheria , linux-amlogic@lists.infradead.org, rui.zhang@intel.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The new Khadas VIM2 and VIM3 boards controls the cooling fan via the on-board microcontroller. This implements the FAN control as thermal devices and as cell of the Khadas MCU MFD driver. Signed-off-by: Neil Armstrong Reviewed-by: Amit Kucheria Acked-by: Daniel Lezcano --- Hi Daniel, Is it ok Lee applies this patch via the MFD tree since it depends on the linux/mfd/khadas-mcu.h header ? Thanks, Neil drivers/thermal/Kconfig | 11 +++ drivers/thermal/Makefile | 1 + drivers/thermal/khadas_mcu_fan.c | 162 +++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 drivers/thermal/khadas_mcu_fan.c diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 3eb2348e5242..0125561488c9 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -500,4 +500,15 @@ config SPRD_THERMAL help Support for the Spreadtrum thermal sensor driver in the Linux thermal framework. + +config KHADAS_MCU_FAN_THERMAL + tristate "Khadas MCU controller FAN cooling support" + depends on OF || COMPILE_TEST + depends on MFD_KHADAS_MCU + select MFD_CORE + select REGMAP + help + If you say yes here you get support for the FAN controlled + by the Microcontroller found on the Khadas VIM boards. + endif diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 0c8b84a09b9a..4b6aabaa7e31 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -61,3 +61,4 @@ obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o obj-$(CONFIG_SPRD_THERMAL) += sprd_thermal.o +obj-$(CONFIG_KHADAS_MCU_FAN_THERMAL) += khadas_mcu_fan.o diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c new file mode 100644 index 000000000000..9eadd2d6413e --- /dev/null +++ b/drivers/thermal/khadas_mcu_fan.c @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Khadas MCU Controlled FAN driver + * + * Copyright (C) 2020 BayLibre SAS + * Author(s): Neil Armstrong + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MAX_LEVEL 3 + +struct khadas_mcu_fan_ctx { + struct khadas_mcu *mcu; + unsigned int level; + struct thermal_cooling_device *cdev; +}; + +static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx, + unsigned int level) +{ + int ret; + + ret = regmap_write(ctx->mcu->regmap, KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, + level); + if (ret) + return ret; + + ctx->level = level; + + return 0; +} + +static int khadas_mcu_fan_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + *state = MAX_LEVEL; + + return 0; +} + +static int khadas_mcu_fan_get_cur_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + + *state = ctx->level; + + return 0; +} + +static int +khadas_mcu_fan_set_cur_state(struct thermal_cooling_device *cdev, + unsigned long state) +{ + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + + if (state > MAX_LEVEL) + return -EINVAL; + + if (state == ctx->level) + return 0; + + return khadas_mcu_fan_set_level(ctx, state); +} + +static const struct thermal_cooling_device_ops khadas_mcu_fan_cooling_ops = { + .get_max_state = khadas_mcu_fan_get_max_state, + .get_cur_state = khadas_mcu_fan_get_cur_state, + .set_cur_state = khadas_mcu_fan_set_cur_state, +}; + +static int khadas_mcu_fan_probe(struct platform_device *pdev) +{ + struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent); + struct thermal_cooling_device *cdev; + struct device *dev = &pdev->dev; + struct khadas_mcu_fan_ctx *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + ctx->mcu = mcu; + platform_set_drvdata(pdev, ctx); + + cdev = devm_thermal_of_cooling_device_register(dev->parent, + dev->parent->of_node, "khadas-mcu-fan", ctx, + &khadas_mcu_fan_cooling_ops); + if (IS_ERR(cdev)) { + ret = PTR_ERR(cdev); + dev_err(dev, "Failed to register khadas-mcu-fan as cooling device: %d\n", + ret); + return ret; + } + ctx->cdev = cdev; + thermal_cdev_update(cdev); + + return 0; +} + +static void khadas_mcu_fan_shutdown(struct platform_device *pdev) +{ + struct khadas_mcu_fan_ctx *ctx = platform_get_drvdata(pdev); + + khadas_mcu_fan_set_level(ctx, 0); +} + +#ifdef CONFIG_PM_SLEEP +static int khadas_mcu_fan_suspend(struct device *dev) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + unsigned int level_save = ctx->level; + int ret; + + ret = khadas_mcu_fan_set_level(ctx, 0); + if (ret) + return ret; + + ctx->level = level_save; + + return 0; +} + +static int khadas_mcu_fan_resume(struct device *dev) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + + return khadas_mcu_fan_set_level(ctx, ctx->level); +} +#endif + +static SIMPLE_DEV_PM_OPS(khadas_mcu_fan_pm, khadas_mcu_fan_suspend, + khadas_mcu_fan_resume); + +static const struct platform_device_id khadas_mcu_fan_id_table[] = { + { .name = "khadas-mcu-fan-ctrl", }, + {}, +}; +MODULE_DEVICE_TABLE(platform, khadas_mcu_fan_id_table); + +static struct platform_driver khadas_mcu_fan_driver = { + .probe = khadas_mcu_fan_probe, + .shutdown = khadas_mcu_fan_shutdown, + .driver = { + .name = "khadas-mcu-fan-ctrl", + .pm = &khadas_mcu_fan_pm, + }, + .id_table = khadas_mcu_fan_id_table, +}; + +module_platform_driver(khadas_mcu_fan_driver); + +MODULE_AUTHOR("Neil Armstrong "); +MODULE_DESCRIPTION("Khadas MCU FAN driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Jun 24 16:15:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11623701 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 7B0A290 for ; Wed, 24 Jun 2020 16:17:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 549DB20738 for ; Wed, 24 Jun 2020 16:17:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Jik5aUXX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="HbBo8+WP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 549DB20738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=CKzqLzis5hnev/wzk7fKsR7TSgLl/1UR5x7EXz42TTU=; b=Jik5aUXXqevelZotWaUetRIDD O0UswYrGpOOdqNqRb3CU6fqPby9j0W9ldZGy0J/GIAGpCQcHDmpgv6eFHgcTW0DIypZvv18OFU2lD jH4ONIvbT57SMxS3N9G2jP5pCIIuQa2wCtuNRjc+vGtnMphA8WeBclSUZ6nG3XtXMsJIyGuAeAa7X W+PtbLvZnZV5Md8nKPhbn29nBvqa80I2nYb1a9aqBEEds0H75IIyHz7bJVxMKRJBKt5xxoaLoLSuF gRmgU66hwidA/N4ZEArc8rgsnRl2UDb1gQg4/32Wwhs3cep6quqAUWcDWvxymdeS2nAK7SD0I22gt NnnUo/NhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo83t-0002qT-Ub; Wed, 24 Jun 2020 16:15:45 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo83l-0002ng-1q for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 16:15:38 +0000 Received: by mail-wr1-x443.google.com with SMTP id z13so2866299wrw.5 for ; Wed, 24 Jun 2020 09:15:36 -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 :mime-version:content-transfer-encoding; bh=kinXBvz5+I1FgSK2RxVnBM/4h4YycBTf3sfQytiCbSA=; b=HbBo8+WPRj3gAUYINsoDzCjuSTiw+4IVXg1BUTCPeS9//rIx0Msd7C2/3IOEqhT2au ifH40qsXdeHZFBuxYayakoHeI5GVZtrXYa4z/w6+0z4jER+c72ovBtthOxjKcI41NM67 YXA/sWFk3I3nvVOvAOmNu0p9vJXZsy+n6tDOMAWADhcErgHqJsG6kn/gtiN8Efait3Vu g7U8caQMJnfPSx32TxlICATow4MuWMRnhUBnVT4P0Qt7NW+LmYXoK2t0ILvx+H877gGQ k9atIi2siVCtlFJt9Qsxt86a9HGAidyo95/yFVpj4YC7TNm3Lvqbki1DKAzL5+qtILlf 3PgQ== 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:mime-version:content-transfer-encoding; bh=kinXBvz5+I1FgSK2RxVnBM/4h4YycBTf3sfQytiCbSA=; b=U7i6iJHdAltNBcSinos0HfqiyP/3t1BZ7ZswGEJJZg6JrpSUrBJ1vnhKAKwx0eTkOI KJE8EVVwHAhqsQLdTY3UnMazbQKgk8Yo8ujmQ9Yd8GNP3ViZtf8sAyBzbDiLH/J6mFCd 1ZrVncu3L7msJIs0ot2/YtlvksAtvUULXmbq478UYibca8cutQ1ciyM+4EiXVwvTXYm4 OpRftuTC4sNaBJQaI4Qof772/l1D3x+mlT4P0ki55VesCu6KGC+zCK8GK+2wBVBRGgze +pNOeYlVwd6XJC6SeEYjvjQCZUQVgCm2JvuZ2dJ5J4weUY8IJRlzFHR5oLmxffJWVK/r HkHQ== X-Gm-Message-State: AOAM5319F7FSBGo37AIbucxxjB6vaOwFl08DqRi6peG6dee6Xyb6qZ8R 9xuJM6kyFVa52+T9tqr7KuEK7g== X-Google-Smtp-Source: ABdhPJzU5QZYipbkQZi8xo157t2PrVSjzPMHytPFcg1TfZKTGu677lOERbPf8aPK6zEzeiz5pYn3xQ== X-Received: by 2002:a5d:4603:: with SMTP id t3mr5463690wrq.38.1593015335565; Wed, 24 Jun 2020 09:15:35 -0700 (PDT) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:89ac:d9e8:f44c:b137]) by smtp.gmail.com with ESMTPSA id t15sm8716207wmj.14.2020.06.24.09.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 09:15:34 -0700 (PDT) From: Neil Armstrong To: khilman@baylibre.com Subject: [PATCH v5 2/2] arm64: dts: meson-khadas-vim3: add Khadas MCU nodes Date: Wed, 24 Jun 2020 18:15:28 +0200 Message-Id: <20200624161528.12664-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200624161528.12664-1-narmstrong@baylibre.com> References: <20200624161528.12664-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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 [2a00:1450:4864:20:0:0:0:443 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: amit.kucheria@verdurent.com, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, Amit Kucheria , linux-amlogic@lists.infradead.org, rui.zhang@intel.com, lee.jones@linaro.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add the Khadas MCU node with active FAN thermal nodes for all the Khadas VIM3 variants. Signed-off-by: Neil Armstrong Reviewed-by: Amit Kucheria --- Hi Kevin, The bindings has been reviewed and merged by Lee, could you apply this one via the amlogic tree ? Thanks, Neil .../boot/dts/amlogic/meson-khadas-vim3.dtsi | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi index 1ef1e3672b96..27408c10a811 100644 --- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi @@ -183,6 +183,23 @@ hdmi-phandle = <&hdmi_tx>; }; +&cpu_thermal { + trips { + cpu_active: cpu-active { + temperature = <80000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */ @@ -222,6 +239,12 @@ pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; pinctrl-names = "default"; + khadas_mcu: system-controller@18 { + compatible = "khadas,mcu"; + reg = <0x18>; + #cooling-cells = <2>; + }; + gpio_expander: gpio-controller@20 { compatible = "ti,tca6408"; reg = <0x20>;