Message ID | 20230530195132.2286163-4-bero@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2429791vqr; Tue, 30 May 2023 13:05:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6xZzza90u5azM/X3a4qVO7mXt7uLpIGlpXTd+nMfFXnrOJiwRpeChWVF2BM87HOS8z9IM9 X-Received: by 2002:a17:903:22c9:b0:1b0:6e18:ce49 with SMTP id y9-20020a17090322c900b001b06e18ce49mr2302536plg.23.1685477142712; Tue, 30 May 2023 13:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685477142; cv=none; d=google.com; s=arc-20160816; b=g/sw5rAMm5D0nQEk+EM3WTrAcHcu4rzOdoSLBx/cnKFUN6Kp9Se2EUY4f+uejGljti 3sMICfaJIFjM3FojSG/wcE36mzV4MVld8NXMzK2f/2bJIbeCn1wqCKXHK3CdtS81N2S8 IKC8KeHczG7D+22/fyl8dQQgkuDRXXaz1n5bqEIon/a4arVXwGpBOykjo0dKyP4ORRh9 oZj0AmX/VR358qOsDmWDPSCnZWRJJ2M9lpKyYHxP0e36bvzCkf2FscOb+JGtzD0604BE Srt91xtiPrhrKVcQ0AObR+4U5awBauES8AC+YZDSdswnYUQ7wjRUNFcjhAIiJtBeXSYu OWQA== 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=ciWtK/NV8FJwvyzOz+YO15ef5XwL4+CYCLNYB+bwuds=; b=aIR0pMG3wpya6MbpU3TBcGWXsQ/65P4sjmOK1rIqdIjTN32sS/LzbMPO3HhCynLw/q +OND9ROG7KrZFy2tgD9jrni1XAJ/gp95BSg0GVekUIg+ow5PhVvNHG1r6vVi1ZDmG/Uv S6EFKtAQn7bYC619TJ4DEGIEuVG9sbhk9c8ECnIVdjNXSD/NPqu1Vg61pi2Yqel5z5EB Jd0xMQRrrSo4RIp7P9suB3QViUShH174PmvQ41OaONFD6eWS0wc+uU1KaS+StPVtSlaK CDdhjtgTjSMU4zbGkMSEqnRXku9p9ajNktgzOKeFviObhaUQPejDhdlciwFNrLu0QYF2 UkAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=amWzlV4c; 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 y11-20020a17090322cb00b001aaf4d2eef6si260234plg.370.2023.05.30.13.05.20; Tue, 30 May 2023 13:05:42 -0700 (PDT) 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.20221208.gappssmtp.com header.s=20221208 header.b=amWzlV4c; 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 S233440AbjE3Tvt (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Tue, 30 May 2023 15:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbjE3Tvl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 30 May 2023 15:51:41 -0400 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 369A8B2 for <linux-kernel@vger.kernel.org>; Tue, 30 May 2023 12:51:40 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f6e4554453so35573245e9.3 for <linux-kernel@vger.kernel.org>; Tue, 30 May 2023 12:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1685476298; x=1688068298; 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=ciWtK/NV8FJwvyzOz+YO15ef5XwL4+CYCLNYB+bwuds=; b=amWzlV4cUJwRSvVCHD47QtIGQYkQihWeUb6kkEeS9PsJ7yT5cSpV0t69U7p7qTx+tc sJBeS6pZOMO85JE+SrxTSENln9XPDdXoipBNYonn4M6WzdEZXVmSQoaPr22g95QDxkCC +Nc34hiSj3Dms6CQbjzTYnXnUHYLO1XnRRD6QElWs4jJ2T/VI4XDW/PpYlkqDLCyCwXI E1CnOUR7p5tIl06Q3MQVwuXDeJExh9wRN6h0t332A7wm9VAf3F1yGnvkN0k4F27jO2Bp A0TJraKaUMzKkiTfOwQATi0vrM6nVPGaTP/8G/mMByKgvEIXEZDb2MwvFJEuSz89L1R2 c08g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685476298; x=1688068298; 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=ciWtK/NV8FJwvyzOz+YO15ef5XwL4+CYCLNYB+bwuds=; b=GAd9h6jL2STG3RpkUINhHteskAL7sgMRTWeOmSuJ+SRLEIID1YvikFLdQ9cjtcKlY/ SwVimuJf1GJ9lsuBPjHB0cF/PsbxITeA41fenBEF4vJxItuybo0NBy5eEblp1Lu6uegC wuo25QwGFnEGiPtwPRdZbT2jjX3f7NcWPPzH+KZZjApm13nWDjwOakc2AJMKa62Whpy5 3RrIgtk/k2Tr/pjgs10Zhl+yfFeMXOdfbcTJ/MwjuqgNr4BDfKh1MvN/L5U8QNxFpGSa 9qVkTZPPq72Pnm682/JLZ9xBo5G1W/ztRpRrRGImZKlPSNPbO89R+erDztuBjZZdT4RM pQhw== X-Gm-Message-State: AC+VfDy1k2o/jwU+ew1gxeonrnNgbP4hmaVh4vlHhPKI+MJ5tFjjWg8r q5Hei6L7+2fVtXXHNEgFPPufJg== X-Received: by 2002:a1c:7215:0:b0:3f4:239c:f19 with SMTP id n21-20020a1c7215000000b003f4239c0f19mr2605232wmc.36.1685476298560; Tue, 30 May 2023 12:51:38 -0700 (PDT) Received: from ph18.baylibre (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id n11-20020adfe34b000000b003078cd719ffsm4271545wrj.95.2023.05.30.12.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 12:51:38 -0700 (PDT) From: =?utf-8?q?Bernhard_Rosenkr=C3=A4nzer?= <bero@baylibre.com> To: daniel.lezcano@linaro.org, angelogioacchino.delregno@collabora.com, rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, rdunlap@infradead.org, ye.xingchen@zte.com.cn, p.zabel@pengutronix.de Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, wenst@chromium.org, james.lo@mediatek.com, rex-bc.chen@mediatek.com, nfraprado@collabora.com, abailon@baylibre.com, amergnat@baylibre.com, khilman@baylibre.com Subject: [PATCH v4 3/5] thermal/drivers/mediatek/lvts_thermal: Add mt8192 support Date: Tue, 30 May 2023 21:51:30 +0200 Message-ID: <20230530195132.2286163-4-bero@baylibre.com> X-Mailer: git-send-email 2.41.0.rc2 In-Reply-To: <20230530195132.2286163-1-bero@baylibre.com> References: <20230530195132.2286163-1-bero@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767350880578441740?= X-GMAIL-MSGID: =?utf-8?q?1767350880578441740?= |
Series |
Add LVTS support for mt8192
|
|
Commit Message
Bernhard Rosenkränzer
May 30, 2023, 7:51 p.m. UTC
From: Balsam CHIHI <bchihi@baylibre.com> Add LVTS Driver support for MT8192. Co-developed-by : Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> --- drivers/thermal/mediatek/lvts_thermal.c | 95 +++++++++++++++++++++++++ 1 file changed, 95 insertions(+)
Comments
Il 30/05/23 21:51, Bernhard Rosenkränzer ha scritto: > From: Balsam CHIHI <bchihi@baylibre.com> > > Add LVTS Driver support for MT8192. > > Co-developed-by : Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> > Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> > Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > --- > drivers/thermal/mediatek/lvts_thermal.c | 95 +++++++++++++++++++++++++ > 1 file changed, 95 insertions(+) > > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c > index 5ea8a9d569ea6..d5e5214784ece 100644 > --- a/drivers/thermal/mediatek/lvts_thermal.c > +++ b/drivers/thermal/mediatek/lvts_thermal.c > @@ -80,6 +80,7 @@ > #define LVTS_MSR_FILTERED_MODE 1 > > #define LVTS_HW_SHUTDOWN_MT8195 105000 > +#define LVTS_HW_SHUTDOWN_MT8192 105000 > > static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT; > static int coeff_b = LVTS_COEFF_B; > @@ -1280,6 +1281,88 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = { > } > }; > > +static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = { > + { > + .cal_offset = { 0x04, 0x08 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_BIG_CPU0 }, > + { .dt_id = MT8192_MCU_BIG_CPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x0, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + }, > + { > + .cal_offset = { 0x0c, 0x10 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_BIG_CPU2 }, > + { .dt_id = MT8192_MCU_BIG_CPU3 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x100, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + }, > + { > + .cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_LITTLE_CPU0 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU1 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU2 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU3 } > + }, > + .num_lvts_sensor = 4, > + .offset = 0x200, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + } > +}; > + > +static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] = { > + { > + .cal_offset = { 0x24, 0x28 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_VPU0 }, > + { .dt_id = MT8192_AP_VPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x0, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + }, > + { > + .cal_offset = { 0x2c, 0x30 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_GPU0 }, > + { .dt_id = MT8192_AP_GPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x100, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, I'm unable to get readings for the GPU sensors, didn't really check the others; `cat (xxxx)` gives a resource not available error, is that the same for you?! Regards, Angelo > + }, > + { > + .cal_offset = { 0x34, 0x38 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_INFRA }, > + { .dt_id = MT8192_AP_CAM }, > + }, > + .num_lvts_sensor = 2, > + .offset = 0x200, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + }, > + { > + .cal_offset = { 0x3c, 0x40, 0x44 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_MD0 }, > + { .dt_id = MT8192_AP_MD1 }, > + { .dt_id = MT8192_AP_MD2 } > + }, > + .num_lvts_sensor = 3, > + .offset = 0x300, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + } > +}; > + > static const struct lvts_data mt8195_lvts_mcu_data = { > .lvts_ctrl = mt8195_lvts_mcu_data_ctrl, > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl), > @@ -1290,9 +1373,21 @@ static const struct lvts_data mt8195_lvts_ap_data = { > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_ap_data_ctrl), > }; > > +static const struct lvts_data mt8192_lvts_mcu_data = { > + .lvts_ctrl = mt8192_lvts_mcu_data_ctrl, > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl), > +}; > + > +static const struct lvts_data mt8192_lvts_ap_data = { > + .lvts_ctrl = mt8192_lvts_ap_data_ctrl, > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_ap_data_ctrl), > +}; > + > static const struct of_device_id lvts_of_match[] = { > { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data }, > { .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data }, > + { .compatible = "mediatek,mt8192-lvts-mcu", .data = &mt8192_lvts_mcu_data }, > + { .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data }, > {}, > }; > MODULE_DEVICE_TABLE(of, lvts_of_match);
On Wed, May 31, 2023 at 3:51 AM Bernhard Rosenkränzer <bero@baylibre.com> wrote: > > From: Balsam CHIHI <bchihi@baylibre.com> > > Add LVTS Driver support for MT8192. > > Co-developed-by : Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> > Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> > Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > --- > drivers/thermal/mediatek/lvts_thermal.c | 95 +++++++++++++++++++++++++ > 1 file changed, 95 insertions(+) > > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c > index 5ea8a9d569ea6..d5e5214784ece 100644 > --- a/drivers/thermal/mediatek/lvts_thermal.c > +++ b/drivers/thermal/mediatek/lvts_thermal.c > @@ -80,6 +80,7 @@ > #define LVTS_MSR_FILTERED_MODE 1 > > #define LVTS_HW_SHUTDOWN_MT8195 105000 > +#define LVTS_HW_SHUTDOWN_MT8192 105000 > > static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT; > static int coeff_b = LVTS_COEFF_B; > @@ -1280,6 +1281,88 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = { > } > }; > > +static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = { > + { > + .cal_offset = { 0x04, 0x08 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_BIG_CPU0 }, > + { .dt_id = MT8192_MCU_BIG_CPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x0, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + }, > + { > + .cal_offset = { 0x0c, 0x10 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_BIG_CPU2 }, > + { .dt_id = MT8192_MCU_BIG_CPU3 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x100, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + }, > + { > + .cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, > + .lvts_sensor = { > + { .dt_id = MT8192_MCU_LITTLE_CPU0 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU1 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU2 }, > + { .dt_id = MT8192_MCU_LITTLE_CPU3 } > + }, > + .num_lvts_sensor = 4, > + .offset = 0x200, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + .mode = LVTS_MSR_FILTERED_MODE, > + } > +}; > + > +static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] = { > + { > + .cal_offset = { 0x24, 0x28 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_VPU0 }, > + { .dt_id = MT8192_AP_VPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x0, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + }, > + { > + .cal_offset = { 0x2c, 0x30 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_GPU0 }, > + { .dt_id = MT8192_AP_GPU1 } > + }, > + .num_lvts_sensor = 2, > + .offset = 0x100, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + }, > + { > + .cal_offset = { 0x34, 0x38 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_INFRA }, > + { .dt_id = MT8192_AP_CAM }, > + }, > + .num_lvts_sensor = 2, > + .offset = 0x200, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + }, > + { > + .cal_offset = { 0x3c, 0x40, 0x44 }, > + .lvts_sensor = { > + { .dt_id = MT8192_AP_MD0 }, > + { .dt_id = MT8192_AP_MD1 }, > + { .dt_id = MT8192_AP_MD2 } > + }, > + .num_lvts_sensor = 3, > + .offset = 0x300, > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > + } > +}; > + > static const struct lvts_data mt8195_lvts_mcu_data = { > .lvts_ctrl = mt8195_lvts_mcu_data_ctrl, > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl), > @@ -1290,9 +1373,21 @@ static const struct lvts_data mt8195_lvts_ap_data = { > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_ap_data_ctrl), > }; > > +static const struct lvts_data mt8192_lvts_mcu_data = { > + .lvts_ctrl = mt8192_lvts_mcu_data_ctrl, > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl), > +}; > + > +static const struct lvts_data mt8192_lvts_ap_data = { > + .lvts_ctrl = mt8192_lvts_ap_data_ctrl, > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_ap_data_ctrl), > +}; > + > static const struct of_device_id lvts_of_match[] = { > { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data }, > { .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data }, > + { .compatible = "mediatek,mt8192-lvts-mcu", .data = &mt8192_lvts_mcu_data }, > + { .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data }, Could you reorder everything so that they follow the order of the chip model name? That includes the entries here, and the data structures above. That would help with readability once this driver supports more chips. ChenYu > {}, > }; > MODULE_DEVICE_TABLE(of, lvts_of_match); > -- > 2.41.0.rc2 >
On Wed, May 31, 2023 at 4:07 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > Il 30/05/23 21:51, Bernhard Rosenkränzer ha scritto: > > From: Balsam CHIHI <bchihi@baylibre.com> > > > > Add LVTS Driver support for MT8192. > > > > Co-developed-by : Nícolas F. R. A. Prado <nfraprado@collabora.com> > > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > > Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> > > Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > > Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> > > Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > > --- > > drivers/thermal/mediatek/lvts_thermal.c | 95 +++++++++++++++++++++++++ > > 1 file changed, 95 insertions(+) > > > > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c > > index 5ea8a9d569ea6..d5e5214784ece 100644 > > --- a/drivers/thermal/mediatek/lvts_thermal.c > > +++ b/drivers/thermal/mediatek/lvts_thermal.c > > @@ -80,6 +80,7 @@ > > #define LVTS_MSR_FILTERED_MODE 1 > > > > #define LVTS_HW_SHUTDOWN_MT8195 105000 > > +#define LVTS_HW_SHUTDOWN_MT8192 105000 > > > > static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT; > > static int coeff_b = LVTS_COEFF_B; > > @@ -1280,6 +1281,88 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = { > > } > > }; > > > > +static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = { > > + { > > + .cal_offset = { 0x04, 0x08 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_MCU_BIG_CPU0 }, > > + { .dt_id = MT8192_MCU_BIG_CPU1 } > > + }, > > + .num_lvts_sensor = 2, > > + .offset = 0x0, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + .mode = LVTS_MSR_FILTERED_MODE, > > + }, > > + { > > + .cal_offset = { 0x0c, 0x10 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_MCU_BIG_CPU2 }, > > + { .dt_id = MT8192_MCU_BIG_CPU3 } > > + }, > > + .num_lvts_sensor = 2, > > + .offset = 0x100, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + .mode = LVTS_MSR_FILTERED_MODE, > > + }, > > + { > > + .cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_MCU_LITTLE_CPU0 }, > > + { .dt_id = MT8192_MCU_LITTLE_CPU1 }, > > + { .dt_id = MT8192_MCU_LITTLE_CPU2 }, > > + { .dt_id = MT8192_MCU_LITTLE_CPU3 } > > + }, > > + .num_lvts_sensor = 4, > > + .offset = 0x200, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + .mode = LVTS_MSR_FILTERED_MODE, > > + } > > +}; > > + > > +static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] = { > > + { > > + .cal_offset = { 0x24, 0x28 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_AP_VPU0 }, > > + { .dt_id = MT8192_AP_VPU1 } > > + }, > > + .num_lvts_sensor = 2, > > + .offset = 0x0, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + }, > > + { > > + .cal_offset = { 0x2c, 0x30 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_AP_GPU0 }, > > + { .dt_id = MT8192_AP_GPU1 } > > + }, > > + .num_lvts_sensor = 2, > > + .offset = 0x100, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > I'm unable to get readings for the GPU sensors, didn't really check > the others; `cat (xxxx)` gives a resource not available error, is that > the same for you?! That could be related to the filtered mode stuff from Nicolas? > Regards, > Angelo > > > + }, > > + { > > + .cal_offset = { 0x34, 0x38 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_AP_INFRA }, > > + { .dt_id = MT8192_AP_CAM }, > > + }, > > + .num_lvts_sensor = 2, > > + .offset = 0x200, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + }, > > + { > > + .cal_offset = { 0x3c, 0x40, 0x44 }, > > + .lvts_sensor = { > > + { .dt_id = MT8192_AP_MD0 }, > > + { .dt_id = MT8192_AP_MD1 }, > > + { .dt_id = MT8192_AP_MD2 } > > + }, > > + .num_lvts_sensor = 3, > > + .offset = 0x300, > > + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, > > + } > > +}; > > + > > static const struct lvts_data mt8195_lvts_mcu_data = { > > .lvts_ctrl = mt8195_lvts_mcu_data_ctrl, > > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl), > > @@ -1290,9 +1373,21 @@ static const struct lvts_data mt8195_lvts_ap_data = { > > .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_ap_data_ctrl), > > }; > > > > +static const struct lvts_data mt8192_lvts_mcu_data = { > > + .lvts_ctrl = mt8192_lvts_mcu_data_ctrl, > > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl), > > +}; > > + > > +static const struct lvts_data mt8192_lvts_ap_data = { > > + .lvts_ctrl = mt8192_lvts_ap_data_ctrl, > > + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_ap_data_ctrl), > > +}; > > + > > static const struct of_device_id lvts_of_match[] = { > > { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data }, > > { .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data }, > > + { .compatible = "mediatek,mt8192-lvts-mcu", .data = &mt8192_lvts_mcu_data }, > > + { .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data }, > > {}, > > }; > > MODULE_DEVICE_TABLE(of, lvts_of_match); > >
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index 5ea8a9d569ea6..d5e5214784ece 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -80,6 +80,7 @@ #define LVTS_MSR_FILTERED_MODE 1 #define LVTS_HW_SHUTDOWN_MT8195 105000 +#define LVTS_HW_SHUTDOWN_MT8192 105000 static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT; static int coeff_b = LVTS_COEFF_B; @@ -1280,6 +1281,88 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = { } }; +static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = { + { + .cal_offset = { 0x04, 0x08 }, + .lvts_sensor = { + { .dt_id = MT8192_MCU_BIG_CPU0 }, + { .dt_id = MT8192_MCU_BIG_CPU1 } + }, + .num_lvts_sensor = 2, + .offset = 0x0, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + .mode = LVTS_MSR_FILTERED_MODE, + }, + { + .cal_offset = { 0x0c, 0x10 }, + .lvts_sensor = { + { .dt_id = MT8192_MCU_BIG_CPU2 }, + { .dt_id = MT8192_MCU_BIG_CPU3 } + }, + .num_lvts_sensor = 2, + .offset = 0x100, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + .mode = LVTS_MSR_FILTERED_MODE, + }, + { + .cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, + .lvts_sensor = { + { .dt_id = MT8192_MCU_LITTLE_CPU0 }, + { .dt_id = MT8192_MCU_LITTLE_CPU1 }, + { .dt_id = MT8192_MCU_LITTLE_CPU2 }, + { .dt_id = MT8192_MCU_LITTLE_CPU3 } + }, + .num_lvts_sensor = 4, + .offset = 0x200, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + .mode = LVTS_MSR_FILTERED_MODE, + } +}; + +static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] = { + { + .cal_offset = { 0x24, 0x28 }, + .lvts_sensor = { + { .dt_id = MT8192_AP_VPU0 }, + { .dt_id = MT8192_AP_VPU1 } + }, + .num_lvts_sensor = 2, + .offset = 0x0, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + }, + { + .cal_offset = { 0x2c, 0x30 }, + .lvts_sensor = { + { .dt_id = MT8192_AP_GPU0 }, + { .dt_id = MT8192_AP_GPU1 } + }, + .num_lvts_sensor = 2, + .offset = 0x100, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + }, + { + .cal_offset = { 0x34, 0x38 }, + .lvts_sensor = { + { .dt_id = MT8192_AP_INFRA }, + { .dt_id = MT8192_AP_CAM }, + }, + .num_lvts_sensor = 2, + .offset = 0x200, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + }, + { + .cal_offset = { 0x3c, 0x40, 0x44 }, + .lvts_sensor = { + { .dt_id = MT8192_AP_MD0 }, + { .dt_id = MT8192_AP_MD1 }, + { .dt_id = MT8192_AP_MD2 } + }, + .num_lvts_sensor = 3, + .offset = 0x300, + .hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192, + } +}; + static const struct lvts_data mt8195_lvts_mcu_data = { .lvts_ctrl = mt8195_lvts_mcu_data_ctrl, .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl), @@ -1290,9 +1373,21 @@ static const struct lvts_data mt8195_lvts_ap_data = { .num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_ap_data_ctrl), }; +static const struct lvts_data mt8192_lvts_mcu_data = { + .lvts_ctrl = mt8192_lvts_mcu_data_ctrl, + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl), +}; + +static const struct lvts_data mt8192_lvts_ap_data = { + .lvts_ctrl = mt8192_lvts_ap_data_ctrl, + .num_lvts_ctrl = ARRAY_SIZE(mt8192_lvts_ap_data_ctrl), +}; + static const struct of_device_id lvts_of_match[] = { { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data }, { .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data }, + { .compatible = "mediatek,mt8192-lvts-mcu", .data = &mt8192_lvts_mcu_data }, + { .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data }, {}, }; MODULE_DEVICE_TABLE(of, lvts_of_match);