From patchwork Thu Jan 12 15:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3950477wrt; Thu, 12 Jan 2023 07:40:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXuEw5uvFX5ckdH2yvPqGFxSYHqaAy/HudZCYOjjV9mZQCo+Ur+EAsUGQ/S7EAqbfUWul/ER X-Received: by 2002:a17:906:6881:b0:84d:4d6c:a462 with SMTP id n1-20020a170906688100b0084d4d6ca462mr11737563ejr.25.1673538031916; Thu, 12 Jan 2023 07:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538031; cv=none; d=google.com; s=arc-20160816; b=F6XX4Tb+Y2Ldd2spVM1b/+7qcXq9MrTGOD6LYlztAIB8B0iufm+M97GZEZgYS5B1Gk e4fdJIHlet4ccp57rYZup/A9/abbCN6SKNcExWPL6M7JtiNOE/L7trC7oKsjboEAOXNF 84Oog5uG3pkJagytFA9IZ+MNQo6xDKvNQjYITYzMPpPB9lkFt7LMrEubSrc8VpgKll/r SNCuQdKV0RLOV1Edsi3CN8inrq8K4EBnB6fRyVI//QQ3MFWWeXpup3VcBcZn0Xsuxp8F yhqA4zOCFgI+fXfY8twLxl4jWu9dn+8NHddOTlrBsEjHPoAZ3MTHn4vPl3GnkGlHbRCM vm4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6VSnhqLrpT6kDXZFeOhmvYh0g128g6QipzNoayDzA2s=; b=zwqkUT+dveFQmGHIG3NrLbpuWBwq7ZFXmACVruE2EYKlLWbk4Fou3myURJ2dI68THM P2jExie6/RcLJ25TiPlJxh365Exgart/xv2nsfMPM2wbhQ/t53RrW8Fx8DbkpStTU0nZ IqzNYPK6b0m6xbdEN8JMW1utDBs2XpVzEUUIuYhSf42sjP3as/wzNlSvQFQjnvwaYoYZ 87lRLoRTBrcWeki5xAnD/nheUl3II5HXiwGVpFpuJkbOkKq5ICbvz82M5wLhhAd+RjYJ GpPoluAkoEYdd4MVRPZkvYv5/bbFxKpl54u2adU2zh/uugzTfNSSKrvj9YX92u7a+XLB X+uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=6M9RLTA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw4-20020a170906478400b007c14afc0ecdsi18251723ejc.479.2023.01.12.07.39.44; Thu, 12 Jan 2023 07:40:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=6M9RLTA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240501AbjALPjU (ORCPT + 99 others); Thu, 12 Jan 2023 10:39:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240560AbjALPin (ORCPT ); Thu, 12 Jan 2023 10:38:43 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 329ED48CDF for ; Thu, 12 Jan 2023 07:29:55 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id h16so18442729wrz.12 for ; Thu, 12 Jan 2023 07:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6VSnhqLrpT6kDXZFeOhmvYh0g128g6QipzNoayDzA2s=; b=6M9RLTA5Z33oePTWgAfJnIQq8S7p/3hEE+PdOcvkwXq22q+OfT3/YVb7tx3hEhuBjf mDlcfxv3F0qqU0IWUty+rXELBSKB5EcFfqkPdWRyDHetmA5pFUg0RCLO9GDcw4SNecw4 yw7NcFGG0hG149TqHPat3QuzKPbIei5z7gNdVPNI6d+47K7vka6ZnE+MMCAjhN5wrqfE TKpEWj0AHGaqChjvXWbZ4d2AS3DpvgzRHdwepCJwYyPS4b3wuG+wwKuW/YCPeAbQOKIM Xtk1BvnTjDLjg/jD77Lx0necyYZH9PZgHdO/P4Mk4G6hrOFR+QOa2upVwNIwMjw+JNWQ LwYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6VSnhqLrpT6kDXZFeOhmvYh0g128g6QipzNoayDzA2s=; b=42760dXHYVaODXvs5qFmyi3RpoA+TIKhTSOrrd9mmsgrpdCwWACXxl56TDH4Nlo3+U SEqicLJG64CKDAq3Ud51gy4eXWCW8cZnzP2P8YbwZRqRU+8Xwh0dEfy+3d1X15h7BFHC KyvEUbzbBEOTpjewS5db+lJyocRylxhLrYTPMvpqZwnC2ceVc9mlSqdAfDjEBwWCX1Uv k3T/XL1171xux+t7MP8JnrPZy4f4K5pgH1nrcQ70+I+VEXSYBTciijLoLRWOrNer/2aI c1UZU6EZ0ouKyiXLMvT91afRdRN80bW8SrPwaoDcl20VQeIsQBvbiH9uKOP0HpfvxLfR Qpag== X-Gm-Message-State: AFqh2kr30cE9TeyOlr2p1T74PFKftTjJqFHEgtUZd0QrQINlHQ/4dosj gM9cZ5qyMbgXJw7pPrcDs5pONw== X-Received: by 2002:adf:e6ce:0:b0:293:1089:d6a with SMTP id y14-20020adfe6ce000000b0029310890d6amr29501933wrm.39.1673537393977; Thu, 12 Jan 2023 07:29:53 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:53 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 1/6] thermal/drivers/mediatek: Relocate driver to mediatek folder Date: Thu, 12 Jan 2023 16:28:50 +0100 Message-Id: <20230112152855.216072-2-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831815170220003?= X-GMAIL-MSGID: =?utf-8?q?1754831815170220003?= From: Balsam CHIHI Add MediaTek proprietary folder to upstream more thermal zone and cooler drivers, relocate the original thermal controller driver to it, and rename it as "auxadc_thermal.c" to show its purpose more clearly. Signed-off-by: Balsam CHIHI --- drivers/thermal/Kconfig | 14 ++++--------- drivers/thermal/Makefile | 2 +- drivers/thermal/mediatek/Kconfig | 21 +++++++++++++++++++ drivers/thermal/mediatek/Makefile | 1 + .../auxadc_thermal.c} | 2 +- 5 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 drivers/thermal/mediatek/Kconfig create mode 100644 drivers/thermal/mediatek/Makefile rename drivers/thermal/{mtk_thermal.c => mediatek/auxadc_thermal.c} (99%) diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index e052dae614eb..d35f63daca3b 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -412,16 +412,10 @@ config DA9062_THERMAL zone. Compatible with the DA9062 and DA9061 PMICs. -config MTK_THERMAL - tristate "Temperature sensor driver for mediatek SoCs" - depends on ARCH_MEDIATEK || COMPILE_TEST - depends on HAS_IOMEM - depends on NVMEM || NVMEM=n - depends on RESET_CONTROLLER - default y - help - Enable this option if you want to have support for thermal management - controller present in Mediatek SoCs +menu "Mediatek thermal drivers" +depends on ARCH_MEDIATEK || COMPILE_TEST +source "drivers/thermal/mediatek/Kconfig" +endmenu config AMLOGIC_THERMAL tristate "Amlogic Thermal Support" diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 2506c6c8ca83..766ce38ff4f3 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -55,7 +55,7 @@ obj-y += st/ obj-y += qcom/ obj-y += tegra/ obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o +obj-y += mediatek/ obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig new file mode 100644 index 000000000000..7558a847d4e9 --- /dev/null +++ b/drivers/thermal/mediatek/Kconfig @@ -0,0 +1,21 @@ +config MTK_THERMAL + tristate "MediaTek thermal drivers" + depends on THERMAL_OF + help + This is the option for MediaTek thermal software solutions. + Please enable corresponding options to get temperature + information from thermal sensors or turn on throttle + mechaisms for thermal mitigation. + +if MTK_THERMAL + +config MTK_SOC_THERMAL + tristate "AUXADC temperature sensor driver for MediaTek SoCs" + depends on HAS_IOMEM + help + Enable this option if you want to get SoC temperature + information for MediaTek platforms. + This driver configures thermal controllers to collect + temperature via AUXADC interface. + +endif diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile new file mode 100644 index 000000000000..53e86e30b26f --- /dev/null +++ b/drivers/thermal/mediatek/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_MTK_SOC_THERMAL) += auxadc_thermal.o diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c similarity index 99% rename from drivers/thermal/mtk_thermal.c rename to drivers/thermal/mediatek/auxadc_thermal.c index 8440692e3890..b4ef57fa9183 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -23,7 +23,7 @@ #include #include -#include "thermal_hwmon.h" +#include "../thermal_hwmon.h" /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 From patchwork Thu Jan 12 15:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3950611wrt; Thu, 12 Jan 2023 07:40:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWoBEnuzAxXnFWk3eselgC/xQTRHRlkTVm7b4PfzwCKXp0onUc7+3OhE2g3rcX93Mww/kB X-Received: by 2002:a17:907:62a9:b0:85d:dd20:60a2 with SMTP id nd41-20020a17090762a900b0085ddd2060a2mr10422272ejc.7.1673538045469; Thu, 12 Jan 2023 07:40:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538045; cv=none; d=google.com; s=arc-20160816; b=kU6Ktlo/xgepOWhgMhpj+e5HcdtmRETqcIYFCI0G2mKeURUfc6K8MPPrr0W/uVgBaV 6k8mAF8U3VLJ8oGIXDjeULhi2khW98t8fUiR46Mym4BZ6X9fIJ5uBSLnYC2BNGAlX6RP YJQgbU+Z/0xu7t8N+HN3E9LzpWh9OZ8jB7zHeMNWG9SbVjIcwQTmxw4rtRVBlnrpv8wD beTLCqxMm4PW/LMGV+bV9NbVcGV1IOOtke/PQCZzU3B5NHkJQ/V4ck4wwYQ3tpEDSSdy vzIV2ov+BOJCUyUEaGOXxCNTPwyTKIyB9U6tfLI1xWCqBPoZnGdRgl0voZvPTrHuI+4G p50w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5QQJhQTvWiPr9ySZtlJAJmZ7yaiH8RE0d51kxRCXOJE=; b=GceQlP9bE1msGEMdYfA2gxdkE1X6rK406dNPy9omOhIeXpA6bv5jHshvvAiC/N0Dcm 3MbUphosoJ1OrjIZuV6jcZMBBoxHjJ0DdI5byziQKiUbaiWGp8CNedAFTvvdrmmm8hq7 +KPE4o19BqlXdv6DONABweAux53TGLdWEE+ViO5CsPTTIzvAkCxfnlxtqm7OjPsRiQOS Yq5AAfl3F5Xk3/aXmPxODsUjAil2tV163nzsyvzJAybw+Z3XrljU3ehZM2wgO941x+6k WWmIPcOeySdrtWhNm6XaTdgLXS0uutUg2vmwxePPjGiVqm4DaUc4MDbpzYUc9aoj68Oq +fzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=UxompglS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a170906795200b0078266dc4b8csi21575502ejo.719.2023.01.12.07.40.21; Thu, 12 Jan 2023 07:40:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=UxompglS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240517AbjALPja (ORCPT + 99 others); Thu, 12 Jan 2023 10:39:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240576AbjALPis (ORCPT ); Thu, 12 Jan 2023 10:38:48 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9DD7F71 for ; Thu, 12 Jan 2023 07:29:56 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id m3so13475706wmq.0 for ; Thu, 12 Jan 2023 07:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5QQJhQTvWiPr9ySZtlJAJmZ7yaiH8RE0d51kxRCXOJE=; b=UxompglSyH+QvEIlm5ZP/6IP6s/tpCs6DgkoLYD0u9PacNQMNULMI+i/ZjWqE9HoDT sEyWwjMAAiB3lH96geHYqYModKKu43ori8b1/0uYFBAgFezIl61+KZbc1G5LiFL3ZUMl nztSxAnV3FqIYMEpYSoARP+5AOD4/2sQFO6cL21Yl26L/cmLX4Kz3G8F1KvZqBcTjr+B qeU+Xif0CjVQPbDEtewQaq0sQEHz+yOvT2g8GNRSoyT1GuTxOvI6sBPyHSWZZr4MMUL8 JHEl9SE969bygf+zMzgNAjNAf85aD2C0mP6bO0hB3q6Qa/9Mcz7a4UX6Jf8/DTxItW9j fnxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5QQJhQTvWiPr9ySZtlJAJmZ7yaiH8RE0d51kxRCXOJE=; b=RCVhVyyk2YBE/JJ2hRkifkbd2/c/wzEJruVO4Q3h2RVajzf8skQeJQu8ByDWg/u/tE XsAgZzgdJnGl8WI5UB5q+ApIJ14y+cov/l4cdh0kd6N1yu2dgZUAZ6tHNDHamEG+S534 qpNWmEg/0TCTjBj6YNp2xKiT3yyagwKSTuL6urGRoiRmI4eFnO3j2iYH4JvU45kwDHN4 6HsgD2gcNv/cTZ1YUeb9n5djlMiiAdkgMGtCgomnwNjMP4tz03ZD2Ti7nsu4/GV+SSAj IccFknRN6i9jau59UWlO9Dq1m+6Z3vgsRJZFFIt5ZzLsTF3POjLozTpVQqeqxmNmPifk JISg== X-Gm-Message-State: AFqh2krZbm1cYTMzsu+nnK4bT0D7088Uz9ophbJqOgTZs0mEZyEphSBw g63/VlNePO31vOda0X5xqtJvdvF+lSuetaFC X-Received: by 2002:a05:600c:3509:b0:3c6:e60f:3f6f with SMTP id h9-20020a05600c350900b003c6e60f3f6fmr54885253wmq.38.1673537394730; Thu, 12 Jan 2023 07:29:54 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:54 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 2/6] dt-bindings/thermal/mediatek: Add dt-binding document for LVTS thermal controllers Date: Thu, 12 Jan 2023 16:28:51 +0100 Message-Id: <20230112152855.216072-3-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831829827333753?= X-GMAIL-MSGID: =?utf-8?q?1754831829827333753?= From: Balsam CHIHI Add dt-binding document for mt8192 and mt8195 LVTS thermal controllers. Signed-off-by: Balsam CHIHI --- .../thermal/mediatek,lvts-thermal.yaml | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml diff --git a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml new file mode 100644 index 000000000000..43b8777fc1b2 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml @@ -0,0 +1,140 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/mediatek,lvts-thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek SoC Low Voltage Thermal Sensor (LVTS) + +maintainers: + - Balsam CHIHI + +description: | + LVTS is a thermal management architecture composed of three subsystems, + a Sensing device - Thermal Sensing Micro Circuit Unit (TSMCU), + a Converter - Low Voltage Thermal Sensor converter (LVTS), and + a Digital controller (LVTS_CTRL). + +properties: + compatible: + enum: + - mediatek,mt8192-lvts-mcu + - mediatek,mt8192-lvts-ap + - mediatek,mt8195-lvts-mcu + - mediatek,mt8195-lvts-ap + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + resets: + maxItems: 1 + description: LVTS reset for clearing temporary data on AP/MCU. + + nvmem-cells: + minItems: 1 + items: + - description: Calibration eFuse data 1 for LVTS + - description: Calibration eFuse data 2 for LVTS + + nvmem-cell-names: + minItems: 1 + items: + - const: lvts-calib-data-1 + - const: lvts-calib-data-2 + + "#thermal-sensor-cells": + const: 1 + +allOf: + - $ref: thermal-sensor.yaml# + + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8192-lvts-mcu + - mediatek,mt8192-lvts-ap + then: + properties: + nvmem-cells: + maxItems: 1 + + nvmem-cell-names: + maxItems: 1 + + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8195-lvts-mcu + - mediatek,mt8195-lvts-ap + then: + properties: + nvmem-cells: + maxItems: 2 + + nvmem-cell-names: + maxItems: 2 + +required: + - compatible + - reg + - interrupts + - clocks + - resets + - nvmem-cells + - nvmem-cell-names + - "#thermal-sensor-cells" + +additionalProperties: false + +examples: + - | + #include + #include + #include + #include + + soc { + #address-cells = <2>; + #size-cells = <2>; + + lvts_mcu: thermal-sensor@11278000 { + compatible = "mediatek,mt8195-lvts-mcu"; + reg = <0 0x11278000 0 0x1000>; + interrupts = ; + clocks = <&infracfg_ao CLK_INFRA_AO_THERM>; + resets = <&infracfg_ao MT8195_INFRA_RST4_THERM_CTRL_MCU_SWRST>; + nvmem-cells = <&lvts_efuse_data1 &lvts_efuse_data2>; + nvmem-cell-names = "lvts-calib-data-1", "lvts-calib-data-2"; + #thermal-sensor-cells = <1>; + }; + }; + + thermal_zones: thermal-zones { + cpu0-thermal { + polling-delay = <1000>; + polling-delay-passive = <250>; + thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU0>; + trips { + cpu0_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu0_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; From patchwork Thu Jan 12 15:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3950680wrt; Thu, 12 Jan 2023 07:40:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJ5fhhx03E4ZQPL72ZwHPMTaf8fwjB9EiJDrHdF31g/CKIAw0sUwEzY1iXxLUmBRtOhj1V X-Received: by 2002:a17:906:9f07:b0:7c1:6f0a:a2cf with SMTP id fy7-20020a1709069f0700b007c16f0aa2cfmr68942406ejc.32.1673538051863; Thu, 12 Jan 2023 07:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538051; cv=none; d=google.com; s=arc-20160816; b=uM8q3BdBNXzZ112QsbFBov+/6JXyUMC1D6OuPo2Nq7wnv+EaRcDrlNvcHBHc03sZ1w WDS1TA74m2fsZXiJb9KX8iXbUvFNzgS0LyVKPeFIEJ++NC98v62TrJb+cFRthC5978A9 x0bXC01EelOfglZlFFneADrbqhmSpGzjS2AHrDry07Kp6cFkxbuaEFiYKkhDr5r/GTOZ 8hy8XAb45NjIQVSB7V6Ip0t+VTbXdv3xYzW4GNxqjDWimPm+U/ZJlgffq9eOgNBXKlgA oXkJqEG4uWkqXHYfMTklkfiMKU0qXCz/g+P8LwvxihUDU+QVkYJDRiU0rE5N9mnLoLoP W6Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Uqegivo06ni2uw8aCUgMRe2pmSyBI28Ht6YBxVVOckk=; b=TYh6/sY50RFjMXtxAxFRPwLxj42p/YeAK3jErMlKpBiahwdcaGQyC8CSIlBhtzeWG0 rdfSUNY3Kk9fOKwBOnF7+8OjU7EByXHWUWbMK6uQ3gVlslzafEsZTczNBbtvo+vrcqZV 0Yk7ACDrIN3Dd5/e66/mc0NCVRzMgUv6w6ZSLo+fGiEaqGngoGQm23HwlhmZwuNGwWaK nTQPkbU32gqyr6LunDxRsyF7eGziFOrh0iW2Kk59qmtZtq3QndilZ6IyS4U0v9iiQUnG UfScesl3v7Dox2//XpbrdJLq0tKdhixD3zQnHH89TgzwsoWRc66s4Fq63iC/BgsgP9Jv 4vcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=IRAFQCNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd41-20020a17090796a900b007c0fb283f11si20311704ejc.130.2023.01.12.07.40.05; Thu, 12 Jan 2023 07:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=IRAFQCNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240451AbjALPjX (ORCPT + 99 others); Thu, 12 Jan 2023 10:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240566AbjALPir (ORCPT ); Thu, 12 Jan 2023 10:38:47 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED2648CEA for ; Thu, 12 Jan 2023 07:29:57 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id az7so18455585wrb.5 for ; Thu, 12 Jan 2023 07:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uqegivo06ni2uw8aCUgMRe2pmSyBI28Ht6YBxVVOckk=; b=IRAFQCNtHY/UvGlzxoyB13GflYu7GWMy5iKQE0dPIHmEFVdLre8sY5yc5AyuxnmXML EvxiThKaM9NnLePX289opg8ijNnokMNMrnVfDLeedkehG163Lzq1lHb7WszuRZbS6l1P Qz8emFJJ/Uvr2hm108nUV1PpZuGJkH4sn7GhTuK7Az2l4qAFPv8yaIKpGjPRVQQxMIy1 Nli5ttNg+ck+zZ+h2J+iETYhjtzKRiKm7KhYJGIJ96yWiZHnEXfWOLo6hFRJ0wcB5YLa 8Os7EmawAlRpNivq9fvwO15HlmrdjZaLuTnseGgJmmHZ16ZcVJzTmIastJaMXWfMO7XZ jk7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uqegivo06ni2uw8aCUgMRe2pmSyBI28Ht6YBxVVOckk=; b=2rQ3Aqc5FBTQa/YT31W6tIv4NDQNEtYZ24pQ1t67hN1GOFs09D0VxaNn9aT4gUARku zqL8Emn8tXAQgZIWYpzzt2GhyIR97jjxY8LuG/TWn5rYRHgIXcuJZOQawhyTVLZrHD8M VqKOKNekE07Mm17cbElIO8DxQfSKHVcU5HnDD5gqzod4+vnBa6y8hPFqWe8MZ+Ij+H8E 3Iow6yYcH134311C9mDrXufMOeOX/OleCRG3gbZHy80SxleTAhk/gGCuRV8SlQ1h8hqm ORvDCcfsrox73OaeOsyiKkEqr4m8708p5pxhp+Dsc5kg+CGmg/KUgkBGarinmPVJv+VT 777Q== X-Gm-Message-State: AFqh2koRfGir3OWYJOMbK0WAWjU2AgIYt0o68UEVGmrlXpopZzzfdftW wQadqN0ngY+r3mjd2EDTCkiEMQ== X-Received: by 2002:adf:e987:0:b0:2bb:e891:1829 with SMTP id h7-20020adfe987000000b002bbe8911829mr11869254wrm.4.1673537395581; Thu, 12 Jan 2023 07:29:55 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:55 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 3/6] arm64/dts/mt8195: Add efuse node to mt8195 Date: Thu, 12 Jan 2023 16:28:52 +0100 Message-Id: <20230112152855.216072-4-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831836065723887?= X-GMAIL-MSGID: =?utf-8?q?1754831836065723887?= From: Balsam CHIHI Add efuse node. This will be required by the thermal driver to get the calibration data. Signed-off-by: Balsam CHIHI Reviewed-by: Matthias Brugger Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 5d31536f4c48..09df105f4606 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -1380,6 +1380,12 @@ pciephy_glb_intr: pciephy-glb-intr@193 { dp_calibration: dp-data@1ac { reg = <0x1ac 0x10>; }; + lvts_efuse_data1: lvts1-calib@1bc { + reg = <0x1bc 0x14>; + }; + lvts_efuse_data2: lvts2-calib@1d0 { + reg = <0x1d0 0x38>; + }; }; u3phy2: t-phy@11c40000 { From patchwork Thu Jan 12 15:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3951240wrt; Thu, 12 Jan 2023 07:42:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXt5R7MGNLnL7NtZnG1hdMZ5sO+435bDtQRF/4sL+9H2FLp1lckPQCgIuXkRRdA5PxqWAa+8 X-Received: by 2002:a17:906:c0c2:b0:836:3d22:5d73 with SMTP id bn2-20020a170906c0c200b008363d225d73mr64959019ejb.39.1673538128923; Thu, 12 Jan 2023 07:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538128; cv=none; d=google.com; s=arc-20160816; b=e5AfMWtckAN7HpVkQPbtP+VBrdQ9JUdQn4ckE5bq5PuRt4rL+4+zm/X+FYFU+fYwQc j6aErx7LHrD4XGMNg7IUXVBnyh4227f6gMyWJej3OM8PgF2TxylItHx238Fza2t0BEHk mLRdvNWrbpB5KQUR5tipR2nxgpVjWgO++gQC1aX5348zHQuOkgJZ2fRgHxti39+OQu8b KKvAonh+/icL7WwNHICZo5KrZfjO7WcOeGv1pTvyHY2bmU0K/pDWzln+lDGohJqWGmXZ xP4shFPTI3kso43vrwEURB2zguecvzc2VBsItZyXIEpGA1YEYoz1JyuSXa52Z4bbYD2n yacA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OAAnrpHxi5e9Zk0ezA98CU0+UFbH/mq4H+Bswht0RG8=; b=dftYd+VBZjUu28ThEWKFBYlYCb3dxgpddWm/ylKJ8I74j8OmRWScZkPOE9QkS0ppvU perx0ph/FQhzxkDdDqOkFubbSPNlHWEODhOq62u0S2+6uyaA4QsUs0u/t8CNITN93PV4 TLibjP+1+oeIM97RY3ZHMq79LyXQzjVW9IcriNpE4yInY9iFCJT9NHitP0+tmbjS5n5p JyLvhBiIzS+OsWWVAQXUs0dDJ9JyWT1/Vno4iYcIK4ps7xbrqjcr0nNODQIr/V8tJivY MVO1kxtkPIKASvLhcehHcZllFUmHkNhdoWugmdTP4xH59SGIbyYYpjf/ngH0fF/3dA+e hcFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=yS1n0Egy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go9-20020a1709070d8900b0078239e3f846si7150936ejc.1.2023.01.12.07.41.43; Thu, 12 Jan 2023 07:42:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=yS1n0Egy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231615AbjALPkV (ORCPT + 99 others); Thu, 12 Jan 2023 10:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240513AbjALPj1 (ORCPT ); Thu, 12 Jan 2023 10:39:27 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B64DA4A950 for ; Thu, 12 Jan 2023 07:29:58 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id m3so13475811wmq.0 for ; Thu, 12 Jan 2023 07:29:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OAAnrpHxi5e9Zk0ezA98CU0+UFbH/mq4H+Bswht0RG8=; b=yS1n0EgyiIqFNdW1TouV8J1GnzMiG3M0JjZe2ILgOfYGm45K54VSpgqgq2qlFh0kTV RWzJedK012kmPYMN8DqHa8kDc4dmbww5m/ms7XlXhZZUjxaoFwzuNquOu1raGL/Hor/t 6WxfLZsC20cY+DgcMhql0b+WXLShGL3qISDby4v7Fj6v9uaMr7Q1LPFopOkigNcTxl7Y ebS2xAPFXyAX+X4dKB6XdO6x3pqF/7oT5ehFLRp3c0AdoLs9etxFG33wAQ3+LadmEn2i zXpfmFGIv7fREL/LAoiZhH8jRd7mw+hJo9e7pGVNVVCqAmpvJXqAKpF2SUFFHmflcJDW A1Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OAAnrpHxi5e9Zk0ezA98CU0+UFbH/mq4H+Bswht0RG8=; b=zu13XLnteTfXACFvajZBkXtbRDgm1Ulf7mB+VvIhDWm1MUQV3Tmcwn2f1VtdcUdkO2 ViIQQXPwQWFdskgPeI3R/H4l11QjkKBhPA9W5Yt8OitbTXxfgqqw4UR7F5//KLJDpBqi uGruEsM3iKJvLGoV1zKKBzoc+h+rDEctD04ljqdZ7FO+dfwAQtkXYgi+RVatdpzCoD4k /iRTDpoWQ/n1EIYZKCPssLK946mEKnex/erfPHTCP4Rujj07i9pRsxkaDxbOFOUIuqIH jWm11PsoR7sM5yyY2w5PY3r6zOXqH9YknRY7WN4vqzpu9rWMna7YIAkUeUvFdvMTLVSJ EdfQ== X-Gm-Message-State: AFqh2kqiPBl/ZP9XinSSRiaVwyot5cz0vVBZHAF/A+DJu/roP/fU+ASA icgqg5yT+KmAbALxXhtfSmVOJw== X-Received: by 2002:a1c:6a0d:0:b0:3d9:edd6:bcbe with SMTP id f13-20020a1c6a0d000000b003d9edd6bcbemr12546964wmc.38.1673537396727; Thu, 12 Jan 2023 07:29:56 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:56 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 4/6] thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver Date: Thu, 12 Jan 2023 16:28:53 +0100 Message-Id: <20230112152855.216072-5-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831917221910021?= X-GMAIL-MSGID: =?utf-8?q?1754831917221910021?= From: Balsam CHIHI The Low Voltage Thermal Sensor (LVTS) is a multiple sensors, multi controllers contained in a thermal domain. A thermal domains can be the MCU or the AP. Each thermal domains contain up to seven controllers, each thermal controller handle up to four thermal sensors. The LVTS has two Finite State Machines (FSM), one to handle the functionin temperatures range like hot or cold temperature and another one to handle monitoring trip point. The FSM notifies via interrupts when a trip point is crossed. The interrupt is managed at the thermal controller level, so when an interrupt occurs, the driver has to find out which sensor triggered such an interrupt. The sampling of the thermal can be filtered or immediate. For the former, the LVTS measures several points and applies a low pass filter. Signed-off-by: Balsam CHIHI --- drivers/thermal/mediatek/Kconfig | 15 + drivers/thermal/mediatek/Makefile | 1 + drivers/thermal/mediatek/lvts_thermal.c | 1244 +++++++++++++++++++ include/dt-bindings/thermal/mediatek-lvts.h | 19 + 4 files changed, 1279 insertions(+) create mode 100644 drivers/thermal/mediatek/lvts_thermal.c create mode 100644 include/dt-bindings/thermal/mediatek-lvts.h diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig index 7558a847d4e9..99597d7b9890 100644 --- a/drivers/thermal/mediatek/Kconfig +++ b/drivers/thermal/mediatek/Kconfig @@ -18,4 +18,19 @@ config MTK_SOC_THERMAL This driver configures thermal controllers to collect temperature via AUXADC interface. +config MTK_LVTS_THERMAL + tristate "LVTS Thermal Driver for MediaTek SoCs" + depends on HAS_IOMEM + help + Enable this option if you want to get SoC temperature + information for supported MediaTek platforms. + This driver configures LVTS (Low Voltage Thermal Sensor) + thermal controllers to collect temperatures via ASIF + (Analog Serial Interface). + +config MTK_LVTS_THERMAL_DEBUGFS + bool "LVTS thermal debugfs" + depends on MTK_LVTS_THERMAL && DEBUG_FS + help + Enable this option to debug the internals of the device driver. endif diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile index 53e86e30b26f..1c6daa1e644b 100644 --- a/drivers/thermal/mediatek/Makefile +++ b/drivers/thermal/mediatek/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_MTK_SOC_THERMAL) += auxadc_thermal.o +obj-$(CONFIG_MTK_LVTS_THERMAL) += lvts_thermal.o diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c new file mode 100644 index 000000000000..a8fe64beb3c4 --- /dev/null +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -0,0 +1,1244 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Balsam CHIHI + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LVTS_MONCTL0(__base) (__base + 0x0000) +#define LVTS_MONCTL1(__base) (__base + 0x0004) +#define LVTS_MONCTL2(__base) (__base + 0x0008) +#define LVTS_MONINT(__base) (__base + 0x000C) +#define LVTS_MONINTSTS(__base) (__base + 0x0010) +#define LVTS_MONIDET0(__base) (__base + 0x0014) +#define LVTS_MONIDET1(__base) (__base + 0x0018) +#define LVTS_MONIDET2(__base) (__base + 0x001C) +#define LVTS_MONIDET3(__base) (__base + 0x0020) +#define LVTS_H2NTHRE(__base) (__base + 0x0024) +#define LVTS_HTHRE(__base) (__base + 0x0028) +#define LVTS_OFFSETH(__base) (__base + 0x0030) +#define LVTS_OFFSETL(__base) (__base + 0x0034) +#define LVTS_MSRCTL0(__base) (__base + 0x0038) +#define LVTS_MSRCTL1(__base) (__base + 0x003C) +#define LVTS_TSSEL(__base) (__base + 0x0040) +#define LVTS_CALSCALE(__base) (__base + 0x0048) +#define LVTS_ID(__base) (__base + 0x004C) +#define LVTS_CONFIG(__base) (__base + 0x0050) +#define LVTS_EDATA00(__base) (__base + 0x0054) +#define LVTS_EDATA01(__base) (__base + 0x0058) +#define LVTS_EDATA02(__base) (__base + 0x005C) +#define LVTS_EDATA03(__base) (__base + 0x0060) +#define LVTS_MSR0(__base) (__base + 0x0090) +#define LVTS_MSR1(__base) (__base + 0x0094) +#define LVTS_MSR2(__base) (__base + 0x0098) +#define LVTS_MSR3(__base) (__base + 0x009C) +#define LVTS_IMMD0(__base) (__base + 0x00A0) +#define LVTS_IMMD1(__base) (__base + 0x00A4) +#define LVTS_IMMD2(__base) (__base + 0x00A8) +#define LVTS_IMMD3(__base) (__base + 0x00AC) +#define LVTS_PROTCTL(__base) (__base + 0x00C0) +#define LVTS_PROTTA(__base) (__base + 0x00C4) +#define LVTS_PROTTB(__base) (__base + 0x00C8) +#define LVTS_PROTTC(__base) (__base + 0x00CC) +#define LVTS_CLKEN(__base) (__base + 0x00E4) + +#define LVTS_SENSOR_MAX 4 +#define LVTS_GOLDEN_TEMP_MAX 62 +#define LVTS_GOLDEN_TEMP_DEFAULT 50 +#define LVTS_COEFF_A -250460 +#define LVTS_COEFF_B 250460 + +#define LVTS_MSR_IMMEDIATE_MODE 0 +#define LVTS_MSR_FILTERED_MODE 1 + +#define LVTS_HW_SHUTDOWN_MT8195 105000 + +static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT; +static int coeff_b = LVTS_COEFF_B; + +struct lvts_sensor_data { + int dt_id; +}; + +struct lvts_ctrl_data { + struct lvts_sensor_data lvts_sensor[LVTS_SENSOR_MAX]; + int cal_offset[LVTS_SENSOR_MAX]; + int hw_tshut_temp; + int num_lvts_sensor; + int offset; + int mode; +}; + +struct lvts_data { + struct lvts_ctrl_data *lvts_ctrl; + int num_lvts_ctrl; +}; + +struct lvts_sensor { + struct thermal_zone_device *tz; + void __iomem *msr; + void __iomem *base; + int id; + int dt_id; +}; + +struct lvts_ctrl { + struct lvts_sensor sensors[LVTS_SENSOR_MAX]; + u32 calibration[LVTS_SENSOR_MAX]; + u32 hw_tshut_raw_temp; + int num_lvts_sensor; + int mode; + void __iomem *base; +}; + +struct lvts_domain { + struct lvts_ctrl *lvts_ctrl; + struct reset_control *reset; + struct clk *clk; + int num_lvts_ctrl; + void __iomem *base; + size_t calib_len; + u8 *calib; +}; + +#ifdef CONFIG_MTK_LVTS_THERMAL_DEBUGFS + +static struct dentry *root; + +#define LVTS_DEBUG_FS_REGS(__reg) \ +{ \ + .name = __stringify(__reg), \ + .offset = __reg(0), \ +} + +static const struct debugfs_reg32 lvts_regs[] = { + LVTS_DEBUG_FS_REGS(LVTS_MONCTL0), + LVTS_DEBUG_FS_REGS(LVTS_MONCTL1), + LVTS_DEBUG_FS_REGS(LVTS_MONCTL2), + LVTS_DEBUG_FS_REGS(LVTS_MONINT), + LVTS_DEBUG_FS_REGS(LVTS_MONINTSTS), + LVTS_DEBUG_FS_REGS(LVTS_MONIDET0), + LVTS_DEBUG_FS_REGS(LVTS_MONIDET1), + LVTS_DEBUG_FS_REGS(LVTS_MONIDET2), + LVTS_DEBUG_FS_REGS(LVTS_MONIDET3), + LVTS_DEBUG_FS_REGS(LVTS_H2NTHRE), + LVTS_DEBUG_FS_REGS(LVTS_HTHRE), + LVTS_DEBUG_FS_REGS(LVTS_OFFSETH), + LVTS_DEBUG_FS_REGS(LVTS_OFFSETL), + LVTS_DEBUG_FS_REGS(LVTS_MSRCTL0), + LVTS_DEBUG_FS_REGS(LVTS_MSRCTL1), + LVTS_DEBUG_FS_REGS(LVTS_TSSEL), + LVTS_DEBUG_FS_REGS(LVTS_CALSCALE), + LVTS_DEBUG_FS_REGS(LVTS_ID), + LVTS_DEBUG_FS_REGS(LVTS_CONFIG), + LVTS_DEBUG_FS_REGS(LVTS_EDATA00), + LVTS_DEBUG_FS_REGS(LVTS_EDATA01), + LVTS_DEBUG_FS_REGS(LVTS_EDATA02), + LVTS_DEBUG_FS_REGS(LVTS_EDATA03), + LVTS_DEBUG_FS_REGS(LVTS_MSR0), + LVTS_DEBUG_FS_REGS(LVTS_MSR1), + LVTS_DEBUG_FS_REGS(LVTS_MSR2), + LVTS_DEBUG_FS_REGS(LVTS_MSR3), + LVTS_DEBUG_FS_REGS(LVTS_IMMD0), + LVTS_DEBUG_FS_REGS(LVTS_IMMD1), + LVTS_DEBUG_FS_REGS(LVTS_IMMD2), + LVTS_DEBUG_FS_REGS(LVTS_IMMD3), + LVTS_DEBUG_FS_REGS(LVTS_PROTCTL), + LVTS_DEBUG_FS_REGS(LVTS_PROTTA), + LVTS_DEBUG_FS_REGS(LVTS_PROTTB), + LVTS_DEBUG_FS_REGS(LVTS_PROTTC), + LVTS_DEBUG_FS_REGS(LVTS_CLKEN), +}; + +static int lvts_debugfs_init(struct device *dev, + struct lvts_domain *lvts_td) +{ + struct debugfs_regset32 *regset; + struct lvts_ctrl *lvts_ctrl; + struct dentry *dentry; + struct dentry *dom_dentry; + char name[64]; + int i; + + if (!root) + root = debugfs_create_dir("lvts", NULL); + + dom_dentry = debugfs_create_dir(dev_name(dev), root); + if (!dom_dentry) + return 0; + + for (i = 0; i < lvts_td->num_lvts_ctrl; i++) { + + lvts_ctrl = &lvts_td->lvts_ctrl[i]; + + sprintf(name, "controller%d", i); + dentry = debugfs_create_dir(name, dom_dentry); + if (!dentry) + continue; + + regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); + if (!regset) + continue; + + regset->base = lvts_ctrl->base; + regset->regs = lvts_regs; + regset->nregs = ARRAY_SIZE(lvts_regs); + + debugfs_create_regset32("registers", 0400, dentry, regset); + } + + return 0; +} + +static void lvts_debugfs_exit(void) +{ + debugfs_remove_recursive(root); +} + +#else + +static inline int lvts_debugfs_init(struct device *dev, + struct lvts_domain *lvts_td) +{ + return 0; +} + +static void lvts_debugfs_exit(void) { } + +#endif + +static int lvts_raw_to_temp(u32 raw_temp) +{ + int temperature; + + temperature = ((s64)(raw_temp & 0xFFFF) * LVTS_COEFF_A) >> 14; + temperature += coeff_b; + + return temperature; +} + +static u32 lvts_temp_to_raw(int temperature) +{ + u32 raw_temp = ((s64)(coeff_b - temperature)) << 14; + + raw_temp = div_s64(raw_temp, -LVTS_COEFF_A); + + return raw_temp; +} + +static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) +{ + struct lvts_sensor *lvts_sensor = tz->devdata; + void __iomem *msr = lvts_sensor->msr; + u32 value; + + /* + * Measurement registers: + * + * LVTS_MSR[0-3] / LVTS_IMMD[0-3] + * + * Bits: + * + * 32-17: Unused + * 16 : Valid temperature + * 15-0 : Raw temperature + */ + value = readl(msr); + + /* + * As the thermal zone temperature will read before the + * hardware sensor is fully initialized, we have to check the + * validity of the temperature returned when reading the + * measurement register. The thermal controller will set the + * valid bit temperature only when it is totally initialized. + * + * Otherwise, we may end up with garbage values out of the + * functionning temperature and directly jump to a system + * shutdown. + */ + if (!(value & BIT(16))) + return -EAGAIN; + + *temp = lvts_raw_to_temp(value & 0xFFFF); + + return 0; +} + +static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) +{ + struct lvts_sensor *lvts_sensor = tz->devdata; + void __iomem *base = lvts_sensor->base; + u32 raw_low = lvts_temp_to_raw(low); + u32 raw_high = lvts_temp_to_raw(high); + + /* + * Hot to normal temperature threshold + * + * LVTS_H2NTHRE + * + * Bits: + * + * 14-0 : Raw temperature for threshold + */ + if (low != -INT_MAX) { + dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low); + writel(raw_low, LVTS_H2NTHRE(base)); + } + + /* + * Hot temperature threshold + * + * LVTS_HTHRE + * + * Bits: + * + * 14-0 : Raw temperature for threshold + */ + dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high); + writel(raw_high, LVTS_HTHRE(base)); + + return 0; +} + +static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl) +{ + irqreturn_t iret = IRQ_NONE; + u32 value, masks[] = { 0x0009001F, 0X000881F0, 0x00247C00, 0x1FC00000 }; + int i; + + /* + * Interrupt monitoring status + * + * LVTS_MONINTST + * + * Bits: + * + * 31 : Interrupt for stage 3 + * 30 : Interrupt for stage 2 + * 29 : Interrupt for state 1 + * 28 : Interrupt using filter on sensor 3 + * + * 27 : Interrupt using immediate on sensor 3 + * 26 : Interrupt normal to hot on sensor 3 + * 25 : Interrupt high offset on sensor 3 + * 24 : Interrupt low offset on sensor 3 + * + * 23 : Interrupt hot threshold on sensor 3 + * 22 : Interrupt cold threshold on sensor 3 + * 21 : Interrupt using filter on sensor 2 + * 20 : Interrupt using filter on sensor 1 + * + * 19 : Interrupt using filter on sensor 0 + * 18 : Interrupt using immediate on sensor 2 + * 17 : Interrupt using immediate on sensor 1 + * 16 : Interrupt using immediate on sensor 0 + * + * 15 : Interrupt device access timeout interrupt + * 14 : Interrupt normal to hot on sensor 2 + * 13 : Interrupt high offset interrupt on sensor 2 + * 12 : Interrupt low offset interrupt on sensor 2 + * + * 11 : Interrupt hot threshold on sensor 2 + * 10 : Interrupt cold threshold on sensor 2 + * 9 : Interrupt normal to hot on sensor 1 + * 8 : Interrupt high offset interrupt on sensor 1 + * + * 7 : Interrupt low offset interrupt on sensor 1 + * 6 : Interrupt hot threshold on sensor 1 + * 5 : Interrupt cold threshold on sensor 1 + * 4 : Interrupt normal to hot on sensor 0 + * + * 3 : Interrupt high offset interrupt on sensor 0 + * 2 : Interrupt low offset interrupt on sensor 0 + * 1 : Interrupt hot threshold on sensor 0 + * 0 : Interrupt cold threshold on sensor 0 + * + * We are interested in the sensor(s) responsible of the + * interrupt event. We update the thermal framework with the + * thermal zone associated with the sensor. The framework will + * take care of the rest whatever the kind of interrupt, we + * are only interested in which sensor raised the interrupt. + * + * sensor 3 interrupt: 0001 1111 1100 0000 0000 0000 0000 0000 + * => 0x1FC00000 + * sensor 2 interrupt: 0000 0000 0010 0100 0111 1100 0000 0000 + * => 0x00247C00 + * sensor 1 interrupt: 0000 0000 0001 0001 0000 0011 1110 0000 + * => 0X000881F0 + * sensor 0 interrupt: 0000 0000 0000 1001 0000 0000 0001 1111 + * => 0x0009001F + */ + value = readl(LVTS_MONINTSTS(lvts_ctrl->base)); + + /* + * Let's figure out which sensors raised the interrupt + * + * NOTE: the masks array must be ordered with the index + * corresponding to the sensor id eg. index=0, mask for + * sensor0. + */ + for (i = 0; i < ARRAY_SIZE(masks); i++) { + + if (!(value & masks[i])) + continue; + + thermal_zone_device_update(lvts_ctrl->sensors[i].tz, + THERMAL_TRIP_VIOLATED); + iret |= IRQ_HANDLED; + } + + /* + * Write back to clear the interrupt status (W1C) + */ + writel(value, LVTS_MONINTSTS(lvts_ctrl->base)); + + return iret; +} + +/* + * Temperature interrupt handler. Even if the driver supports more + * interrupt modes, we use the interrupt when the temperature crosses + * the hot threshold the way up and the way down (modulo the + * hysteresis). + * + * Each thermal domain has a couple of interrupts, one for hardware + * reset and another one for all the thermal events happening on the + * different sensors. + * + * The interrupt is configured for thermal events when crossing the + * hot temperature limit. At each interrupt, we check in every + * controller if there is an interrupt pending. + */ +static irqreturn_t lvts_irq_handler(int irq, void *data) +{ + struct lvts_domain *lvts_td = data; + irqreturn_t iret = IRQ_NONE; + int i; + + for (i = 0; i < lvts_td->num_lvts_ctrl; i++) + iret |= lvts_ctrl_irq_handler(lvts_td->lvts_ctrl); + + return iret; +} + +static struct thermal_zone_device_ops lvts_ops = { + .get_temp = lvts_get_temp, + .set_trips = lvts_set_trips, +}; + +static int __init lvts_sensor_init(struct device *dev, + struct lvts_ctrl *lvts_ctrl, + struct lvts_ctrl_data *lvts_ctrl_data) +{ + struct lvts_sensor *lvts_sensor = lvts_ctrl->sensors; + void __iomem *msr_regs[] = { + LVTS_MSR0(lvts_ctrl->base), + LVTS_MSR1(lvts_ctrl->base), + LVTS_MSR2(lvts_ctrl->base), + LVTS_MSR3(lvts_ctrl->base) + }; + + void __iomem *imm_regs[] = { + LVTS_IMMD0(lvts_ctrl->base), + LVTS_IMMD1(lvts_ctrl->base), + LVTS_IMMD2(lvts_ctrl->base), + LVTS_IMMD3(lvts_ctrl->base) + }; + + int i; + + for (i = 0; i < lvts_ctrl_data->num_lvts_sensor; i++) { + + int dt_id = lvts_ctrl_data->lvts_sensor[i].dt_id; + + /* + * At this point, we don't know which id matches which + * sensor. Let's set arbitrally the id from the index. + */ + lvts_sensor[i].id = i; + + /* + * The thermal zone registration will set the trip + * point interrupt in the thermal controller + * register. But this one will be reset in the + * initialization after. So we need to post pone the + * thermal zone creation after the controller is + * setup. For this reason, we store the device tree + * node id from the data in the sensor structure + */ + lvts_sensor[i].dt_id = dt_id; + + /* + * We assign the base address of the thermal + * controller as a back pointer. So it will be + * accessible from the different thermal framework ops + * as we pass the lvts_sensor pointer as thermal zone + * private data. + */ + lvts_sensor[i].base = lvts_ctrl->base; + + /* + * Each sensor has its own register address to read from. + */ + lvts_sensor[i].msr = lvts_ctrl_data->mode == LVTS_MSR_IMMEDIATE_MODE ? + imm_regs[i] : msr_regs[i]; + }; + + lvts_ctrl->num_lvts_sensor = lvts_ctrl_data->num_lvts_sensor; + + return 0; +} + +/* + * The efuse blob values follows the sensor enumeration per thermal + * controller. The decoding of the stream is as follow: + * + * <--?-> <----big0 ???---> <-sensor0-> <-0-> + * ------------------------------------------ + * index in the stream: : | 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 | + * ------------------------------------------ + * + * <--sensor1--><-0-> <----big1 ???---> <-sen + * ------------------------------------------ + * | 0x7 | 0x8 | 0x9 | 0xA | 0xB | OxC | OxD | + * ------------------------------------------ + * + * sor0-> <-0-> <-sensor1-> <-0-> .......... + * ------------------------------------------ + * | 0x7 | 0x8 | 0x9 | 0xA | 0xB | OxC | OxD | + * ------------------------------------------ + * + * And so on ... + * + * The data description gives the offset of the calibration data in + * this bytes stream for each sensor. + * + * Each thermal controller can handle up to 4 sensors max, we don't + * care if there are less as the array of calibration is sized to 4 + * anyway. The unused sensor slot will be zeroed. + */ +static int __init lvts_calibration_init(struct device *dev, + struct lvts_ctrl *lvts_ctrl, + struct lvts_ctrl_data *lvts_ctrl_data, + u8 *efuse_calibration) +{ + int i; + + for (i = 0; i < lvts_ctrl_data->num_lvts_sensor; i++) + memcpy(&lvts_ctrl->calibration[i], + efuse_calibration + lvts_ctrl_data->cal_offset[i], 2); + + return 0; +} + +/* + * The efuse bytes stream can be split into different chunk of + * nvmems. This function reads and concatenate those into a single + * buffer so it can be read sequentially when initializing the + * calibration data. + */ +static int lvts_calibration_read(struct device *dev, struct lvts_domain *lvts_td, + struct lvts_data *lvts_data) +{ + struct device_node *np = dev_of_node(dev); + struct nvmem_cell *cell; + struct property *prop; + const char *cell_name; + + of_property_for_each_string(np, "nvmem-cell-names", prop, cell_name) { + size_t len; + u8 *efuse; + + cell = of_nvmem_cell_get(np, cell_name); + if (IS_ERR(cell)) { + dev_dbg(dev, "Failed to get cell '%s'\n", cell_name); + return PTR_ERR(cell); + } + + efuse = nvmem_cell_read(cell, &len); + + nvmem_cell_put(cell); + + if (IS_ERR(efuse)) { + dev_dbg(dev, "Failed to read cell '%s'\n", cell_name); + return PTR_ERR(efuse); + } + + lvts_td->calib = devm_krealloc(dev, lvts_td->calib, + lvts_td->calib_len + len, GFP_KERNEL); + if (!lvts_td->calib) + return -ENOMEM; + + memcpy(lvts_td->calib + lvts_td->calib_len, efuse, len); + + lvts_td->calib_len += len; + + kfree(efuse); + } + + return 0; +} + +static int __init lvts_golden_temp_init(struct device *dev, u32 *value) +{ + u32 gt; + + gt = (*value) >> 24; + + if (gt && gt < LVTS_GOLDEN_TEMP_MAX) + golden_temp = gt; + + coeff_b = golden_temp * 500 + LVTS_COEFF_B; + + return 0; +} + +static int __init lvts_ctrl_init(struct device *dev, + struct lvts_domain *lvts_td, + struct lvts_data *lvts_data) +{ + size_t size = sizeof(*lvts_td->lvts_ctrl) * lvts_data->num_lvts_ctrl; + struct lvts_ctrl *lvts_ctrl; + int i, ret; + + /* + * Create the calibration bytes stream from efuse data + */ + ret = lvts_calibration_read(dev, lvts_td, lvts_data); + if (ret) + return ret; + + /* + * The golden temp information is contained in the first chunk + * of efuse data. + */ + ret = lvts_golden_temp_init(dev, (u32 *)lvts_td->calib); + if (ret) + return ret; + + lvts_ctrl = devm_kzalloc(dev, size, GFP_KERNEL); + if (!lvts_ctrl) + return -ENOMEM; + + for (i = 0; i < lvts_data->num_lvts_ctrl; i++) { + + lvts_ctrl[i].base = lvts_td->base + lvts_data->lvts_ctrl[i].offset; + + ret = lvts_sensor_init(dev, &lvts_ctrl[i], + &lvts_data->lvts_ctrl[i]); + if (ret) + return ret; + + ret = lvts_calibration_init(dev, &lvts_ctrl[i], + &lvts_data->lvts_ctrl[i], + lvts_td->calib); + if (ret) + return ret; + + /* + * The mode the ctrl will use to read the temperature + * (filtered or immediate) + */ + lvts_ctrl[i].mode = lvts_data->lvts_ctrl[i].mode; + + /* + * The temperature to raw temperature must be done + * after initializing the calibration. + */ + lvts_ctrl[i].hw_tshut_raw_temp = + lvts_temp_to_raw(lvts_data->lvts_ctrl[i].hw_tshut_temp); + } + + /* + * We no longer need the efuse bytes stream, let's free it + */ + devm_kfree(dev, lvts_td->calib); + + lvts_td->lvts_ctrl = lvts_ctrl; + lvts_td->num_lvts_ctrl = lvts_data->num_lvts_ctrl; + + return 0; +} + +/* + * At this point the configuration register is the only place in the + * driver where we write multiple values. Per hardware constraint, + * each write in the configuration register must be separated by a + * delay of 2 us. + */ +static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, u32 *cmds, int nr_cmds) +{ + int i; + + /* + * Configuration register + */ + for (i = 0; i < nr_cmds; i++) { + writel(cmds[i], LVTS_CONFIG(lvts_ctrl->base)); + usleep_range(2, 4); + } +} + +static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl) +{ + u32 value; + + /* + * LVTS_PROTCTL : Thermal Protection Sensor Selection + * + * Bits: + * + * 19-18 : Sensor to base the protection on + * 17-16 : Strategy: + * 00 : Average of 4 sensors + * 01 : Max of 4 sensors + * 10 : Selected sensor with bits 19-18 + * 11 : Reserved + */ + value = BIT(16); + writel(value, LVTS_PROTCTL(lvts_ctrl->base)); + + /* + * LVTS_PROTTA : Stage 1 temperature threshold + * LVTS_PROTTB : Stage 2 temperature threshold + * LVTS_PROTTC : Stage 3 temperature threshold + * + * Bits: + * + * 14-0: Raw temperature threshold + * + * writel(0x0, LVTS_PROTTA(lvts_ctrl->base)); + * writel(0x0, LVTS_PROTTB(lvts_ctrl->base)); + */ + writel(lvts_ctrl->hw_tshut_raw_temp, LVTS_PROTTC(lvts_ctrl->base)); + + /* + * LVTS_MONINT : Interrupt configuration register + * + * The LVTS_MONINT register layout is the same as the LVTS_MONINTSTS + * register, except we set the bits to enable the interrupt. + */ + value = 0x9FBF7BDE; + writel(value, LVTS_MONINT(lvts_ctrl->base)); + + return 0; +} + +static int lvts_domain_reset(struct device *dev, struct reset_control *reset) +{ + int ret; + + ret = reset_control_assert(reset); + if (ret) + return ret; + + return reset_control_deassert(reset); +} + +/* + * Enable or disable the clocks of a specified thermal controller + */ +static int lvts_ctrl_set_enable(struct lvts_ctrl *lvts_ctrl, int enable) +{ + /* + * LVTS_CLKEN : Internal LVTS clock + * + * Bits: + * + * 0 : enable / disable clock + */ + writel(enable, LVTS_CLKEN(lvts_ctrl->base)); + + return 0; +} + +static inline int lvts_ctrl_enable(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + return lvts_ctrl_set_enable(lvts_ctrl, 1); +} + +static inline int lvts_ctrl_disable(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + return lvts_ctrl_set_enable(lvts_ctrl, 0); +} + +static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + u32 id, cmds[] = { 0xC103FFFF, 0xC502FF55 }; + + lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds)); + + /* + * LVTS_ID : Get ID and status of the thermal controller + * + * Bits: + * + * 0-5 : thermal controller id + * 7 : thermal controller connection is valid + */ + id = readl(LVTS_ID(lvts_ctrl->base)); + if (!(id & BIT(7))) + return -EIO; + + return 0; +} + +static int lvts_ctrl_initialize(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + /* + * Write device mask: 0xC1030000 + */ + u32 cmds[] = { + 0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1, + 0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300, + 0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC, + 0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1 + }; + + lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds)); + + return 0; +} + +static int lvts_ctrl_calibrate(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + int i; + void __iomem *lvts_edata[] = { + LVTS_EDATA00(lvts_ctrl->base), + LVTS_EDATA01(lvts_ctrl->base), + LVTS_EDATA02(lvts_ctrl->base), + LVTS_EDATA03(lvts_ctrl->base) + }; + + /* + * LVTS_EDATA0X : Efuse calibration reference value for sensor X + * + * Bits: + * + * 20-0 : Efuse value for normalization data + */ + for (i = 0; i < LVTS_SENSOR_MAX; i++) + writel(lvts_ctrl->calibration[i], lvts_edata[i]); + + return 0; +} + +static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + u32 period_unit = (118 * 1000) / (256 * 38); + u32 grp_interval = 1; + u32 flt_interval = 1; + u32 sensor_interval = 1; + u32 hw_filter = 0x2; + u32 value; + + /* + * LVTS_TSSEL : Sensing point index numbering + * + * Bits: + * + * 31-24: ADC Sense 3 + * 23-16: ADC Sense 2 + * 15-8 : ADC Sense 1 + * 7-0 : ADC Sense 0 + */ + value = 0x13121110; + writel(value, LVTS_TSSEL(lvts_ctrl->base)); + + /* + * LVTS_CALSCALE : ADC voltage round + */ + value = 0x300; + writel(value, LVTS_CALSCALE(lvts_ctrl->base)); + + /* + * LVTS_MSRCTL0 : Sensor filtering strategy + * + * Filters: + * + * 000 : One sample + * 001 : Avg 2 samples + * 010 : 4 samples, drop min and max, avg 2 samples + * 011 : 6 samples, drop min and max, avg 4 samples + * 100 : 10 samples, drop min and max, avg 8 samples + * 101 : 18 samples, drop min and max, avg 16 samples + * + * Bits: + * + * 0-2 : Sensor0 filter + * 3-5 : Sensor1 filter + * 6-8 : Sensor2 filter + * 9-11 : Sensor3 filter + */ + value = hw_filter << 9 | hw_filter << 6 | hw_filter << 3 | hw_filter; + writel(value, LVTS_MSRCTL0(lvts_ctrl->base)); + + /* + * LVTS_MSRCTL1 : Measurement control + * + * Bits: + * + * 9: Ignore MSRCTL0 config and do immediate measurement on sensor3 + * 6: Ignore MSRCTL0 config and do immediate measurement on sensor2 + * 5: Ignore MSRCTL0 config and do immediate measurement on sensor1 + * 4: Ignore MSRCTL0 config and do immediate measurement on sensor0 + * + * That configuration will ignore the filtering and the delays + * introduced below in MONCTL1 and MONCTL2 + */ + if (lvts_ctrl->mode == LVTS_MSR_IMMEDIATE_MODE) { + value = BIT(9) | BIT(6) | BIT(5) | BIT(4); + writel(value, LVTS_MSRCTL1(lvts_ctrl->base)); + } + + /* + * LVTS_MONCTL1 : Period unit and group interval configuration + * + * The clock source of LVTS thermal controller is 26MHz. + * + * The period unit is a time base for all the interval delays + * specified in the registers. By default we use 12. The time + * conversion is done by multiplying by 256 and 1/26.10^6 + * + * An interval delay multiplied by the period unit gives the + * duration in seconds. + * + * - Filter interval delay is a delay between two samples of + * the same sensor. + * + * - Sensor interval delay is a delay between two samples of + * different sensors. + * + * - Group interval delay is a delay between different rounds. + * + * For example: + * If Period unit = C, filter delay = 1, sensor delay = 2, group delay = 1, + * and two sensors, TS1 and TS2, are in a LVTS thermal controller + * and then + * Period unit time = C * 1/26M * 256 = 12 * 38.46ns * 256 = 118.149us + * Filter interval delay = 1 * Period unit = 118.149us + * Sensor interval delay = 2 * Period unit = 236.298us + * Group interval delay = 1 * Period unit = 118.149us + * + * TS1 TS1 ... TS1 TS2 TS2 ... TS2 TS1... + * <--> Filter interval delay + * <--> Sensor interval delay + * <--> Group interval delay + * Bits: + * 29 - 20 : Group interval + * 16 - 13 : Send a single interrupt when crossing the hot threshold (1) + * or an interrupt everytime the hot threshold is crossed (0) + * 9 - 0 : Period unit + * + */ + value = grp_interval << 20 | period_unit; + writel(value, LVTS_MONCTL1(lvts_ctrl->base)); + + /* + * LVTS_MONCTL2 : Filtering and sensor interval + * + * Bits: + * + * 25-16 : Interval unit in PERIOD_UNIT between sample on + * the same sensor, filter interval + * 9-0 : Interval unit in PERIOD_UNIT between each sensor + * + */ + value = flt_interval << 16 | sensor_interval; + writel(value, LVTS_MONCTL2(lvts_ctrl->base)); + + return lvts_irq_init(lvts_ctrl); +} + +static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl) +{ + struct lvts_sensor *lvts_sensors = lvts_ctrl->sensors; + struct thermal_zone_device *tz; + u32 sensor_map = 0; + int i; + + for (i = 0; i < lvts_ctrl->num_lvts_sensor; i++) { + + int dt_id = lvts_sensors[i].dt_id; + + tz = devm_thermal_of_zone_register(dev, dt_id, &lvts_sensors[i], + &lvts_ops); + if (IS_ERR(tz)) { + /* + * This thermal zone is not described in the + * device tree. It is not an error from the + * thermal OF code POV, we just continue. + */ + if (PTR_ERR(tz) == -ENODEV) + continue; + + return PTR_ERR(tz); + } + + /* + * The thermal zone pointer will be needed in the + * interrupt handler, we store it in the sensor + * structure. The thermal domain structure will be + * passed to the interrupt handler private data as the + * interrupt is shared for all the controller + * belonging to the thermal domain. + */ + lvts_sensors[i].tz = tz; + + /* + * This sensor was correctly associated with a thermal + * zone, let's set the corresponding bit in the sensor + * map, so we can enable the temperature monitoring in + * the hardware thermal controller. + */ + sensor_map |= BIT(i); + } + + /* + * Bits: + * 9: Single point access flow + * 0-3: Enable sensing point 0-3 + * + * The initialization of the thermal zones give us + * which sensor point to enable. If any thermal zone + * was not described in the device tree, it won't be + * enabled here in the sensor map. + */ + writel(sensor_map | BIT(9), LVTS_MONCTL0(lvts_ctrl->base)); + + return 0; +} + +static int lvts_domain_init(struct device *dev, struct lvts_domain *lvts_td, + struct lvts_data *lvts_data) +{ + struct lvts_ctrl *lvts_ctrl; + int i, ret; + + ret = lvts_ctrl_init(dev, lvts_td, lvts_data); + if (ret) + return ret; + + ret = lvts_domain_reset(dev, lvts_td->reset); + if (ret) { + dev_dbg(dev, "Failed to reset domain"); + return ret; + } + + for (i = 0; i < lvts_td->num_lvts_ctrl; i++) { + + lvts_ctrl = &lvts_td->lvts_ctrl[i]; + + /* + * Initialization steps: + * + * - Enable the clock + * - Connect to the LVTS + * - Initialize the LVTS + * - Prepare the calibration data + * - Select monitored sensors + * [ Configure sampling ] + * [ Configure the interrupt ] + * - Start measurement + */ + ret = lvts_ctrl_enable(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to enable LVTS clock"); + return ret; + } + + ret = lvts_ctrl_connect(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to connect to LVTS controller"); + return ret; + } + + ret = lvts_ctrl_initialize(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to initialize controller"); + return ret; + } + + ret = lvts_ctrl_calibrate(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to calibrate controller"); + return ret; + } + + ret = lvts_ctrl_configure(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to configure controller"); + return ret; + } + + ret = lvts_ctrl_start(dev, lvts_ctrl); + if (ret) { + dev_dbg(dev, "Failed to start controller"); + return ret; + } + } + + return lvts_debugfs_init(dev, lvts_td); +} + +static int lvts_probe(struct platform_device *pdev) +{ + struct lvts_data *lvts_data; + struct lvts_domain *lvts_td; + struct device *dev = &pdev->dev; + struct resource *res; + int irq, ret; + + lvts_td = devm_kzalloc(dev, sizeof(*lvts_td), GFP_KERNEL); + if (!lvts_td) + return -ENOMEM; + + lvts_data = (struct lvts_data *)of_device_get_match_data(dev); + if (!lvts_data) { + dev_dbg(dev, "No platforme data"); + return -ENODATA; + }; + + lvts_td->clk = devm_clk_get_enabled(dev, NULL); + if (IS_ERR(lvts_td->clk)) { + dev_dbg(dev, "Failed to retrieve clock\n"); + return PTR_ERR(lvts_td->clk); + } + + res = platform_get_mem_or_io(pdev, 0); + if (!res) { + dev_dbg(dev, "No IO resource\n"); + return -ENXIO; + } + + lvts_td->base = devm_ioremap_resource(dev, res); + if (IS_ERR(lvts_td->base)) { + dev_dbg(dev, "Failed to map io resource\n"); + return PTR_ERR(lvts_td->base); + } + + lvts_td->reset = devm_reset_control_get_by_index(dev, 0); + if (IS_ERR(lvts_td->reset)) { + dev_dbg(dev, "Failed to get reset control\n"); + return PTR_ERR(lvts_td->reset); + } + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_dbg(dev, "No irq resource\n"); + return irq; + } + + ret = lvts_domain_init(dev, lvts_td, lvts_data); + if (ret) { + dev_dbg(dev, "Failed to initialize the lvts domain\n"); + return ret; + } + + /* + * At this point the LVTS is initialized and enabled. We can + * safely enable the interrupt. + */ + ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler, + IRQF_ONESHOT, dev_name(dev), lvts_td); + if (ret) { + dev_dbg(dev, "Failed to request interrupt\n"); + return ret; + } + + platform_set_drvdata(pdev, lvts_td); + + return 0; +} + +static int lvts_remove(struct platform_device *pdev) +{ + struct lvts_domain *lvts_td; + struct device *dev = &pdev->dev; + int i; + + lvts_td = platform_get_drvdata(pdev); + + for (i = 0; i < lvts_td->num_lvts_ctrl; i++) + lvts_ctrl_disable(dev, &lvts_td->lvts_ctrl[i]); + + lvts_debugfs_exit(); + + return 0; +} + +static struct lvts_ctrl_data mt819x_lvts_data_ctrl[] = { + { + .cal_offset = { 0x4, 0x7 }, + .lvts_sensor = { + { .dt_id = MT819x_MCU_BIG_CPU0 }, + { .dt_id = MT819x_MCU_BIG_CPU1 } + }, + .num_lvts_sensor = 2, + .offset = 0x0, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195, + }, + + { + .cal_offset = { 0xd, 0x10 }, + .lvts_sensor = { + { .dt_id = MT819x_MCU_BIG_CPU2 }, + { .dt_id = MT819x_MCU_BIG_CPU3 } + }, + .num_lvts_sensor = 2, + .offset = 0x100, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195, + }, + + { + .cal_offset = { 0x16, 0x19, 0x1c, 0x1f }, + .lvts_sensor = { + { .dt_id = MT819x_MCU_LITTLE_CPU0 }, + { .dt_id = MT819x_MCU_LITTLE_CPU1 }, + { .dt_id = MT819x_MCU_LITTLE_CPU2 }, + { .dt_id = MT819x_MCU_LITTLE_CPU3 } + }, + .num_lvts_sensor = 4, + .offset = 0x200, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195, + } +}; + +static struct lvts_data mt819x_lvts_mcu_data = { + .lvts_ctrl = mt819x_lvts_data_ctrl, + .num_lvts_ctrl = ARRAY_SIZE(mt819x_lvts_data_ctrl), +}; + +static const struct of_device_id lvts_of_match[] = { + { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt819x_lvts_mcu_data }, + {}, +}; +MODULE_DEVICE_TABLE(of, lvts_of_match); + +static struct platform_driver lvts_driver = { + .probe = lvts_probe, + .remove = lvts_remove, + .driver = { + .name = "mtk-lvts-thermal", + .of_match_table = lvts_of_match, + }, +}; +module_platform_driver(lvts_driver); + +MODULE_AUTHOR("Balsam CHIHI "); +MODULE_DESCRIPTION("MediaTek LVTS Thermal Driver"); +MODULE_LICENSE("GPL"); diff --git a/include/dt-bindings/thermal/mediatek-lvts.h b/include/dt-bindings/thermal/mediatek-lvts.h new file mode 100644 index 000000000000..80d060400236 --- /dev/null +++ b/include/dt-bindings/thermal/mediatek-lvts.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Balsam CHIHI + */ + +#ifndef __MEDIATEK_LVTS_DT_H +#define __MEDIATEK_LVTS_DT_H + +#define MT819x_MCU_BIG_CPU0 0 +#define MT819x_MCU_BIG_CPU1 1 +#define MT819x_MCU_BIG_CPU2 2 +#define MT819x_MCU_BIG_CPU3 3 +#define MT819x_MCU_LITTLE_CPU0 4 +#define MT819x_MCU_LITTLE_CPU1 5 +#define MT819x_MCU_LITTLE_CPU2 6 +#define MT819x_MCU_LITTLE_CPU3 7 + +#endif /* __MEDIATEK_LVTS_DT_H */ From patchwork Thu Jan 12 15:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3951781wrt; Thu, 12 Jan 2023 07:43:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMEXMFP5tZp6Ho7LV9neFqIw9U664oHv75SIw6PChWFPXazxSDrrjkfBW29Wey4x6gV2Ty X-Received: by 2002:a05:6402:249a:b0:499:cc32:6a52 with SMTP id q26-20020a056402249a00b00499cc326a52mr10032502eda.16.1673538196086; Thu, 12 Jan 2023 07:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538196; cv=none; d=google.com; s=arc-20160816; b=FIRwjA67hUAnHkUWB1BH1biWvxEQOJEPt+ZLv9xH4KLfXTZmWBQvMD1ksx+6QDoDJY ZU91xdtVF/5JtJht+1DucoyznaqeIEy2eSqDNA9b39JBTQSt6zjB1VURFOWG06UaXAhL NgWAwUXgsr94ruwObrHVhvJ+sPzfKOWdSOQvV1KE6kLL+iD3ZSsnlPxYEW5bYuGMxMDS k+zXVG886laLFAz1TzDufS9ZXtVkfEkDihINZtYhaIGOMoBQWAL8bVoJRclwY3jP1rL7 bClbHmjjpSNna8UBS7Q4AsnlmfV15ufn8x3JloW4GtnuSf1Xqvi2S+KSkCIWbyBEME52 52HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qYKO/+Ese+Gsdpx7Yai4eCJP1kFLpdiryIGZcYJl+sg=; b=u4r0PRutfmp7B+CdiNfolVkT2MI3jDJ1veClUgC8g2TBtu1KeH17lpMWhXTdNt6Pvw dfVUanBDlLbQ+jerrDTZl+/FbjoeWOo3Wu0RZKhhBq+WjlAWvQQWHqNuHDHcsR/Fzfek 6fk0cB2MMuRPM9Y2F52CsP/D/J2FpkU4dTSG2l1P4Fc7rpmzrM6ko0TwnKWJk4raB6sx StmNQTZ7HviTn0EI6DnFdyzkfZ18sIrS+fcj8de1klH1HgLeu6w8TbpS0h9o2kmpoLHz mJ40UjoqAGR2ABuzhrqB4hL/2iG8WG6DZtD4iflx1LlvaWcH3n5iI5Xr9hpbtDpQLrXn l8qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=ayc3wAVb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a056402279000b004619867344csi21237090ede.0.2023.01.12.07.42.52; Thu, 12 Jan 2023 07:43:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=ayc3wAVb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239836AbjALPkE (ORCPT + 99 others); Thu, 12 Jan 2023 10:40:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234690AbjALPi7 (ORCPT ); Thu, 12 Jan 2023 10:38:59 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7DBE50E6C for ; Thu, 12 Jan 2023 07:29:58 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so15367272wms.2 for ; Thu, 12 Jan 2023 07:29:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qYKO/+Ese+Gsdpx7Yai4eCJP1kFLpdiryIGZcYJl+sg=; b=ayc3wAVbLb3WAPdUsT644YQOfU6shQ9nk1FmldmoTfiTwnmdCb03coIKk4xsPeAr0f lNpBnxuO1FIeTdlgGLnHKsnFR8hf/qQ0bqVOcjmSrvkdONOajQAFsrz0hMdU4pYB+HKP g62yKYWqzZRoZA8xqtpl0UAAwX+p6Wa5O16OLXFlNcdcn5L2p+d7+iveMSmvcFaJTbP1 o3gZhOlRJtIw8JCznuJu2eRrX2d3rzAwjb5n91v+T5140fD5s6Uvy5Oh6H/wweL/PPmO XWEeXlNpLUv53l/ydSwf7te9tR47lWMRjXnAcOS912bdHY56n3Gcou8SO9RCjFLlJlhP 1lzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qYKO/+Ese+Gsdpx7Yai4eCJP1kFLpdiryIGZcYJl+sg=; b=4KVpCi02//Bwnot1QrI9xKZGty9YO1pWyF6w5oK1O83CNOH85TEvR9/8gQ+dBl35w0 gAwV1m5XAMRbsQZfZ0rGvqt4Sc9GX7q2M51frCCkBK1K5vEgLhtP9/F3tkw22nzsEt1D vOyctVVL1e3mybUeuRzWawjofiop/37aswSQqXwJ10r7OMYmDI68CfCJS2SRAslY5k68 G5yK9yRkj/zB5fSk42XnG7ccgOETd1GXIonPieHzj0xB4JjyFy0p9OMTpy7x8NeW3VkY wBLCxXs3A8AizqLqTjD4wBpRNAPdYPrNqRq7FlbDRMiMk+C5R+8e+6TA9+C/epker0/v SriA== X-Gm-Message-State: AFqh2krSuhAvswjHlqqLbkzZUmYuZfezeFT32IGp1nclP8lFd8/ylTb5 EhIlD7sbjO/jIcmXyZqjEHrjA6wtwwwk3Oao X-Received: by 2002:a05:600c:5119:b0:3da:79f:8953 with SMTP id o25-20020a05600c511900b003da079f8953mr5389346wms.41.1673537397457; Thu, 12 Jan 2023 07:29:57 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:57 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 5/6] arm64/dts/mt8195: Add thermal zones and thermal nodes Date: Thu, 12 Jan 2023 16:28:54 +0100 Message-Id: <20230112152855.216072-6-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831987868582856?= X-GMAIL-MSGID: =?utf-8?q?1754831987868582856?= From: Balsam CHIHI Add thermal zones and thermal nodes for the mt8195. Signed-off-by: Balsam CHIHI --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 129 +++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 09df105f4606..683e5057d68d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -14,6 +14,7 @@ #include #include #include +#include / { compatible = "mediatek,mt8195"; @@ -954,6 +955,17 @@ spi0: spi@1100a000 { status = "disabled"; }; + lvts_ap: thermal-sensor@1100b000 { + compatible = "mediatek,mt8195-lvts-ap"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = ; + clocks = <&infracfg_ao CLK_INFRA_AO_THERM>; + resets = <&infracfg_ao MT8195_INFRA_RST0_THERM_CTRL_SWRST>; + nvmem-cells = <&lvts_efuse_data1 &lvts_efuse_data2>; + nvmem-cell-names = "lvts-calib-data-1", "lvts-calib-data-2"; + #thermal-sensor-cells = <1>; + }; + spi1: spi@11010000 { compatible = "mediatek,mt8195-spi", "mediatek,mt6765-spi"; @@ -1114,6 +1126,17 @@ mmc2: mmc@11250000 { status = "disabled"; }; + lvts_mcu: thermal-sensor@11278000 { + compatible = "mediatek,mt8195-lvts-mcu"; + reg = <0 0x11278000 0 0x1000>; + interrupts = ; + clocks = <&infracfg_ao CLK_INFRA_AO_THERM>; + resets = <&infracfg_ao MT8195_INFRA_RST4_THERM_CTRL_MCU_SWRST>; + nvmem-cells = <&lvts_efuse_data1 &lvts_efuse_data2>; + nvmem-cell-names = "lvts-calib-data-1", "lvts-calib-data-2"; + #thermal-sensor-cells = <1>; + }; + xhci1: usb@11290000 { compatible = "mediatek,mt8195-xhci", "mediatek,mtk-xhci"; @@ -2387,4 +2410,110 @@ dp_tx: dp-tx@1c600000 { status = "disabled"; }; }; + + thermal_zones: thermal-zones { + cpu0-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU0>; + trips { + cpu0_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu1-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU1>; + trips { + cpu1_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu2-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU2>; + trips { + cpu2_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu3-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU3>; + trips { + cpu3_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu4-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU0>; + trips { + cpu4_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu5-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU1>; + trips { + cpu5_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu6-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU2>; + trips { + cpu6_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu7-thermal { + polling-delay = <0>; + polling-delay-passive = <0>; + thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU3>; + trips { + cpu7_crit: trip-crit { + temperature = <100000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; }; From patchwork Thu Jan 12 15:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balsam CHIHI X-Patchwork-Id: 42509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3950713wrt; Thu, 12 Jan 2023 07:40:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJhjZXsQnJPcak7rcDlDOrKioYaClP7qkolDB0ipgAo6OEc6jM07MeEyKnu+4X3OjtaiBl X-Received: by 2002:aa7:c597:0:b0:499:b53f:1c56 with SMTP id g23-20020aa7c597000000b00499b53f1c56mr12690843edq.38.1673538056264; Thu, 12 Jan 2023 07:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673538056; cv=none; d=google.com; s=arc-20160816; b=O0/GldoNnkojXJc1yGUN3bnb/g76eNiblvXoBugTGLpkaLw2F50RcEax+shWtxtiiW Fq+/F5lqKzuTb3vpttrfU9fpjg5W+zkGZoOYwrtbmIQ318oRFyax7ChxkL9jMFOLBEUQ wA01UtBYUSmL6g9hg9z3AwhCu6WooNFf/TJS8Ehe4bpKrFZUp8/oQdQhjteWWUpMMqUK pUEkporpIuZr3dSwDNEifnL1i9HkMnXUhJxORWAjLf9H1Yy5fxFMhUalfmB4GnvLCjnm f58DC+tqSf+7PmetvbZ/VROiZkeBnK5iyL3H9Fk3FNbtSXJXXE5bYzx9eJrcS/YmHl5i rnHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zX/CQGZwby8Bq/JpQAndBnSTYre5Hfcs3oFccuKqTKw=; b=XoJeb0RreUcVbL/1N9g4kxs/59not7uv5Ksq93ppBHmjk0n6NwFSvi1kWJQK2ka6ox WgMzBPCpipvJbgnX2YgAM3xnsy3Jlaidz3nIpI6NS7qdDPVA2hSCqC4hfa2BW9abWzCP kN3yeddr23WTfjAE5EGaqqDoUUBcuI+nxjElUl3qIn2UhpCqAiL2YMnNA+wTX3A0AFJ6 XTqv36AY6driqXsws4Krv3zIonaUdHhU7H2+xSC9DeS/vwiGiSVTeVtekbMo0TapaFzc 5OWUJHjmxuXg9SoOTfYvrNB674lV24FbEIeYCI4DLudgvJssEcTqumohSZGYXQUgds6L or+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=yNc6PMpx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a50d551000000b004782d6db359si17056117edj.146.2023.01.12.07.40.32; Thu, 12 Jan 2023 07:40:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=yNc6PMpx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240543AbjALPjm (ORCPT + 99 others); Thu, 12 Jan 2023 10:39:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240589AbjALPiv (ORCPT ); Thu, 12 Jan 2023 10:38:51 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7ED850F43 for ; Thu, 12 Jan 2023 07:29:59 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso15366125wms.5 for ; Thu, 12 Jan 2023 07:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zX/CQGZwby8Bq/JpQAndBnSTYre5Hfcs3oFccuKqTKw=; b=yNc6PMpxrO8M2h1fKar31wGacq668VpYXsRSM0w0MQyM69WYMb1SanLv5TG5w9Al4/ y4pzIKNXR24UVbxUPoKmpQY+6wCOwlb3+6qkKiU17hzAB2+CI21Ob7TySeoFu267GlLl rm2p0l7mRtUrYMhh089rnQko0ilyDhkafEz8cUloWEpHwYdCDZ7W6MlB2MrZPcijwarA rZiOLRpUm9ZHtk8NF8BQdQg5OPxXqykjfSI7VkDLURHhD9p0MEk9CyAJKLwOHH9/a/tU lmoTIXgt9C5tKiSe6rODgy7bT/9C5A1fAEkIMyrsEH89zmg3r2hzpwZbF3+3nnwquJ2/ X4AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zX/CQGZwby8Bq/JpQAndBnSTYre5Hfcs3oFccuKqTKw=; b=4+cpYg8ys0GkYItAEMHVQaK1n3pjVTrzcMqxR+mu4KxC09KCYlpPRiJEft9I9PgRb2 7oHmZ7++HRDwdrmIiPiQptaOy3I3Jp5G370ryryxvCeL/vok6SBs7SYzR/i7/ifHCd2G 89H5+Y+bLg7+gJccc+tqh/PQQSeVq15/gHQ/ZXQfyIDCheYtLjv9p19CJ9gmIr32LQ0C uilBO2ycVU9gtqkhFqYryd8JCjIGtzXgLWJKbcDpT1Ns+kF+6iHU1T38QsYR4myq9o7L zjsy2GV6vy6Tbcv8PknYqfD/lOyySvwBKObo8Nun9J/Y/V3uyIRBzp6cPKYrUuvv9eFO KS9A== X-Gm-Message-State: AFqh2kq/SU2dEYlmN9ystEpRAnBWHsxy4SeNywd48sqYip/8o5BQEcAu r38LC8maJFFoBJ12xmC3vDBm4g== X-Received: by 2002:a05:600c:3d90:b0:3d9:f798:dcba with SMTP id bi16-20020a05600c3d9000b003d9f798dcbamr8881980wmb.38.1673537398182; Thu, 12 Jan 2023 07:29:58 -0800 (PST) Received: from t480-bl003.civfrance.com (58.188.158.77.rev.sfr.net. [77.158.188.58]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm26395909wmh.46.2023.01.12.07.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:29:57 -0800 (PST) From: bchihi@baylibre.com To: daniel.lezcano@linaro.org, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com Subject: [PATCH v10 6/6] arm64/dts/mt8195: Add temperature mitigation threshold Date: Thu, 12 Jan 2023 16:28:55 +0100 Message-Id: <20230112152855.216072-7-bchihi@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112152855.216072-1-bchihi@baylibre.com> References: <20230112152855.216072-1-bchihi@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754831841002599820?= X-GMAIL-MSGID: =?utf-8?q?1754831841002599820?= From: Balsam CHIHI The mt8195 board has several hotspots around the CPUs. Specify the targeted temperature threshold when to apply the mitigation and define the associated cooling devices. Signed-off-by: Balsam CHIHI --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 153 ++++++++++++++++++++--- 1 file changed, 137 insertions(+), 16 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 683e5057d68d..0d6642603095 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -14,6 +14,7 @@ #include #include #include +#include #include / { @@ -2413,107 +2414,227 @@ dp_tx: dp-tx@1c600000 { thermal_zones: thermal-zones { cpu0-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU0>; trips { + cpu0_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu0_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu0_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu1-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU1>; trips { + cpu1_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu1_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu1_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu2-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU2>; trips { + cpu2_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu2_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu2_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu3-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_LITTLE_CPU3>; trips { + cpu3_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu3_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu3_alert>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu4-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU0>; trips { + cpu4_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu4_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu4_alert>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu5-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU1>; trips { + cpu5_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu5_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu5_alert>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu6-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU2>; trips { + cpu6_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu6_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu6_alert>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; cpu7-thermal { - polling-delay = <0>; - polling-delay-passive = <0>; + polling-delay = <1000>; + polling-delay-passive = <250>; thermal-sensors = <&lvts_mcu MT819x_MCU_BIG_CPU3>; trips { + cpu7_alert: trip-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; cpu7_crit: trip-crit { temperature = <100000>; hysteresis = <2000>; type = "critical"; }; }; + + cooling-maps { + map0 { + trip = <&cpu7_alert>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; }; };