Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6828293rwr; Tue, 25 Apr 2023 04:34:28 -0700 (PDT) X-Google-Smtp-Source: AKy350YsH2ZJYVMzhFBXXQHqYPhW7D4kuZTLafkyxc+fDwSrkTsv8p5/FbhCq17jRPBENTdo9SSG X-Received: by 2002:a17:90b:1007:b0:244:9385:807f with SMTP id gm7-20020a17090b100700b002449385807fmr16185742pjb.44.1682422467750; Tue, 25 Apr 2023 04:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682422467; cv=none; d=google.com; s=arc-20160816; b=cVEztDyxI+XfBSGF0tdKVcSMULcviYezChve/HmR3UFiDVF2Du9nL2tTXgXjZ4ygaN uqUnYJbHN3VqfGov+3X+9Q18gCIE2ZMuiUKl/iHt4wOUj23tO5ISz7WG7Kg1n+19KqQk H1mETzdjw+6RQzXA8YMjHbgc4Q+hNZ21PwrmxoMgx/X7xANtMbET86oenkRpuwkEV/59 F1R53xoOS5WSNVw41iqz7RsOaQPK4e6zBSuvyVhaO4PQuRx73ZaVbBn4m38Z7BltOXOt x/CfQ5IB8OLRMpdkvBQyHZmBJl0zTMdM+Kg81XlgFxudOBSutP7HHVRIVO87icyt6JH6 786w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=b1nwF4kKWtunxpN6x1cZvs+8NAr3cIrq1nqIj78OXC0=; b=EsWRrUYau1gmWnvcnDytgIl0QG5YLR9NFN97VLRrrlB09IdJ6X3RThOL8E6T6Qyljz XjD4OZdtqf9AOB2BhAU7IOo4T4w4ejlzODEW/cMjHFdcWSQrE634cIMiGQRtTFzEJzuo 6E/0vJFglCjRRAg/yAskZj3py2ldhBptZn8fC1+XczPzJ9oDIUE/5LPxzzg1eX4u7cRa HAgrKZgtfd4OF/20T6wTDlh5xudesfQBsYpa1Ytu975BRR7uD/LeolwU2f4tdkeo8PQs j2ISpPk9jaaIxl7hqER2d3vAN9yktMlY798TeaccnnLfhdcVFApKUYPiQUcZLzFVZil7 LpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=yps9efPE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq11-20020a17090b380b00b002475bc0a186si17167785pjb.69.2023.04.25.04.34.16; Tue, 25 Apr 2023 04:34:27 -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=yps9efPE; 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 S233327AbjDYL3U (ORCPT + 99 others); Tue, 25 Apr 2023 07:29:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233908AbjDYL3T (ORCPT ); Tue, 25 Apr 2023 07:29:19 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D933C04 for ; Tue, 25 Apr 2023 04:29:17 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-508418b6d59so10360541a12.3 for ; Tue, 25 Apr 2023 04:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1682422155; x=1685014155; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b1nwF4kKWtunxpN6x1cZvs+8NAr3cIrq1nqIj78OXC0=; b=yps9efPE56h8YypYTfVXepsLT5PtBXWsHXI0YhVzeF2MkvHPBvi7NyD+QNASitywE1 MaSBTlfunCSskCcTj0eCHpTHUuECPyGENqvYpaH+8ZA571U60fHoN2KvRua4sVG4ymGX 4JsCsGf+3WkX5BW2Cw1lF0mIYE/Um8EEyKmHRcQt/DISj90XagxTSU5uer12QtJk1FxC FuAr0EdccL3o25jR8jpqa3o+m06ON1kvzvrGJ28N1fsYqwvrFi870nFw7ty87bu2Lhv1 I+yjAnitXDUd3hwKlPGm4KQQnyhomSmnrNzxPm2ia0qf46SB5Ly+l+2L/Jr/lVBvN+DG jjhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682422155; x=1685014155; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b1nwF4kKWtunxpN6x1cZvs+8NAr3cIrq1nqIj78OXC0=; b=gFchDS+OSFVKg5rbMYDVnko/9znBi08xd7TMWrUhJKpsKn7Kxy4tY/0ymwStyyr+pZ R23L8RieKWtjhYydTowbdCBNfLInhOVzjqHGdpKfq0kk8yv1lBx1fCfseT1EPCtbSj0a OdSDptZ8tvFzddVgtyrqT9tvzcm+fITeDNoK2j2EAoAkE4I6dj/u84ugSlmD1vPMZMs4 iC9Reut+rQPpwTyf5Hu3Tm1RfmksvAqC1XS+PUV+Jsu+LXo63dVJPXGFLeMTqPmKPomk WDUaldnxdjaaEetA5FXc0+sHflJDEvyP/AsLfJdMzSs8QJ+92VPfQOrWUXCuIUyRkpm1 yM8Q== X-Gm-Message-State: AAQBX9cO7hYDvcxP1B2SDt1pvRhnUMMLX5NiIN0+VN+KfvGWdL8Zd3s0 hdWmCOhzXSEiV9v/YvDJWhDXwc59WUqdGKMbfoucsw== X-Received: by 2002:aa7:d491:0:b0:506:a663:5c1b with SMTP id b17-20020aa7d491000000b00506a6635c1bmr12120401edr.18.1682422155536; Tue, 25 Apr 2023 04:29:15 -0700 (PDT) MIME-Version: 1.0 References: <20230307163413.143334-1-bchihi@baylibre.com> In-Reply-To: From: Balsam CHIHI Date: Tue, 25 Apr 2023 13:28:39 +0200 Message-ID: Subject: Re: [PATCH 0/4] Add LVTS support for mt8192 To: Chen-Yu Tsai Cc: =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , 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, 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, khilman@baylibre.com, james.lo@mediatek.com, rex-bc.chen@mediatek.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 25, 2023 at 12:00=E2=80=AFPM Chen-Yu Tsai = wrote: > > On Tue, Apr 25, 2023 at 6:21=E2=80=AFAM N=C3=ADcolas F. R. A. Prado > wrote: > > > > On Tue, Mar 28, 2023 at 02:20:24AM +0200, Balsam CHIHI wrote: > > > On Sat, Mar 25, 2023 at 5:33=E2=80=AFAM Chen-Yu Tsai wrote: > > > > > > > > On Wed, Mar 22, 2023 at 8:48=E2=80=AFPM Balsam CHIHI wrote: > > > > > > > > > > Hi Chen-Yu, > > > > > > > > > > I suspect the bug comes from incorrect calibration data offsets f= or AP > > > > > Domain because you confirm that MCU Domain probe runs without iss= ues. > > > > > Is it possible to test something for us to confirm this theory (i > > > > > don't have an mt8192 board on hand now), when you have the time o= f > > > > > course? > > > > > We would like to test AP Domain's calibration data offsets with a > > > > > working one, for example : > > > > > > > > > > static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] = =3D { > > > > > { > > > > > - .cal_offset =3D { 0x25, 0x28 }, > > > > > + .cal_offset =3D { 0x04, 0x04 }, > > > > > .lvts_sensor =3D { > > > > > { .dt_id =3D MT8192_AP_VPU0 }, > > > > > { .dt_id =3D MT8192_AP_VPU1 } > > > > > @@ -1336,7 +1336,7 @@ static const struct lvts_ctrl_data > > [..] > > > > > > > > > > This example is tested and works for mt8195, > > > > > (all sensors use the same calibration data offset for testing pur= poses). > > > > > > > > > > Thank you in advance for your help. > > > > > > > > The MCU ones are still tripping though. If I change all of them to = 0x04, > > > > then nothing trips. There's also a bug in the interrupt handling co= de > > > > that needs to be dealt with. > > > > > > > > AFAICT the calibration data is stored differently. If you look at C= hromeOS's > > > > downstream v5.10 driver, you'll see mt6873_efuse_to_cal_data() for = MT8192, > > > > and mt8195_efuse_to_cal_data() for MT8195. The difference sums up t= o: > > > > MT8195 has all data sequentially stored, while MT8192 has most data= stored > > > > in lower 24 bits of each 32-bit word, and the highest 8 bits are th= en used > > > > to pack data for the remaining sensors. > > > > > > > > Regards > > > > ChenYu > > > > > > Hi Chen-Yu Tsai, > > > > > > Thank you very much for helping me testing this suggestion. > > > > > > Indeed, calibration data is stored differently in the mt8192 compared= to mt8195. > > > So, the mt8192's support will be delayed for now, to allow further de= bugging. > > > > > > In the mean time, we will only continue to upstream the remaining > > > mt8195's source code, so it will get full LVTS support. > > > A new series will be submitted soon. > > > > Hi Balsam, > > > > like Chen-Yu mentioned, the calibration data is stored with 4 byte alig= nment for > > MT8192, but the data that is split between non-contiguous bytes is for = the > > thermal controllers (called Resistor-Capacitor Calibration downstream) = not the > > sensors. The controller calibration isn't currently handled in this dri= ver (and > > downstream it also isn't used, since a current value is read from the c= ontroller > > instead), so we can just ignore those. > > > > The patch below adjusts the addresseses for the sensors and gives me re= asonable > > reads, so the machine no longer reboots. Can you integrate it into your= series? > > Not sure what I got wrong, but on my machine the VPU0 and VPU1 zone inter= rupts > are still tripping excessively. The readings seem normal though. Specific= ally, > it's bits 16 and 17 that are tripping. > Hi Chen-Yu, Thank you for testing! As the readings are normal that proves that calibration data offsets are correct. would you like that I send the v2 of series to add mt8192 support? Then we could deal with the interrupts later in a separate fix, because the interrupt code in common for both SoC (mt8192 and mt8195)? Does N=C3=ADcolas also have tripping interrupts? On my side, I've got no interrupts tripping on mt8195. Any other suggestions (a question for everyone)? Best regards, Balsam > > Thanks, > > N=C3=ADcolas > > > > From 4506f03b806f3eeb89887bac2c1c86d61da97281 Mon Sep 17 00:00:00 2001 > > From: =3D?UTF-8?q?N=3DC3=3DADcolas=3D20F=3D2E=3D20R=3D2E=3D20A=3D2E=3D2= 0Prado?=3D > > > > Date: Mon, 24 Apr 2023 17:42:42 -0400 > > Subject: [PATCH] thermal/drivers/mediatek/lvts_thermal: Fix calibration > > offsets for MT8192 > > MIME-Version: 1.0 > > Content-Type: text/plain; charset=3DUTF-8 > > Content-Transfer-Encoding: 8bit > > > > Signed-off-by: N=C3=ADcolas F. R. A. Prado > > --- > > drivers/thermal/mediatek/lvts_thermal.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/= mediatek/lvts_thermal.c > > index b6956c89d557..f8afbc2ac190 100644 > > --- a/drivers/thermal/mediatek/lvts_thermal.c > > +++ b/drivers/thermal/mediatek/lvts_thermal.c > > @@ -1261,7 +1261,7 @@ static const struct lvts_ctrl_data mt8195_lvts_ap= _data_ctrl[] =3D { > > > > static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] =3D { > > { > > - .cal_offset =3D { 0x04, 0x07 }, > > + .cal_offset =3D { 0x04, 0x08 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_MCU_BIG_CPU0 }, > > { .dt_id =3D MT8192_MCU_BIG_CPU1 } > > @@ -1271,7 +1271,7 @@ static const struct lvts_ctrl_data mt8192_lvts_mc= u_data_ctrl[] =3D { > > .hw_tshut_temp =3D LVTS_HW_SHUTDOWN_MT8192, > > }, > > { > > - .cal_offset =3D { 0x0d, 0x10 }, > > + .cal_offset =3D { 0x0c, 0x10 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_MCU_BIG_CPU2 }, > > { .dt_id =3D MT8192_MCU_BIG_CPU3 } > > @@ -1281,7 +1281,7 @@ static const struct lvts_ctrl_data mt8192_lvts_mc= u_data_ctrl[] =3D { > > .hw_tshut_temp =3D LVTS_HW_SHUTDOWN_MT8192, > > }, > > { > > - .cal_offset =3D { 0x16, 0x19, 0x1c, 0x1f }, > > + .cal_offset =3D { 0x14, 0x18, 0x1c, 0x20 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_MCU_LITTLE_CPU0 }, > > { .dt_id =3D MT8192_MCU_LITTLE_CPU1 }, > > @@ -1296,7 +1296,7 @@ static const struct lvts_ctrl_data mt8192_lvts_mc= u_data_ctrl[] =3D { > > > > static const struct lvts_ctrl_data mt8192_lvts_ap_data_ctrl[] =3D { > > { > > - .cal_offset =3D { 0x25, 0x28 }, > > + .cal_offset =3D { 0x24, 0x28 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_AP_VPU0 }, > > { .dt_id =3D MT8192_AP_VPU1 } > > @@ -1306,7 +1306,7 @@ static const struct lvts_ctrl_data mt8192_lvts_ap= _data_ctrl[] =3D { > > .hw_tshut_temp =3D LVTS_HW_SHUTDOWN_MT8192, > > }, > > { > > - .cal_offset =3D { 0x2e, 0x31 }, > > + .cal_offset =3D { 0x2c, 0x30 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_AP_GPU0 }, > > { .dt_id =3D MT8192_AP_GPU1 } > > @@ -1316,7 +1316,7 @@ static const struct lvts_ctrl_data mt8192_lvts_ap= _data_ctrl[] =3D { > > .hw_tshut_temp =3D LVTS_HW_SHUTDOWN_MT8192, > > }, > > { > > - .cal_offset =3D { 0x37, 0x3a }, > > + .cal_offset =3D { 0x34, 0x38 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_AP_INFRA }, > > { .dt_id =3D MT8192_AP_CAM }, > > @@ -1326,7 +1326,7 @@ static const struct lvts_ctrl_data mt8192_lvts_ap= _data_ctrl[] =3D { > > .hw_tshut_temp =3D LVTS_HW_SHUTDOWN_MT8192, > > }, > > { > > - .cal_offset =3D { 0x40, 0x43, 0x46 }, > > + .cal_offset =3D { 0x3c, 0x40, 0x44 }, > > .lvts_sensor =3D { > > { .dt_id =3D MT8192_AP_MD0 }, > > { .dt_id =3D MT8192_AP_MD1 }, > > -- > > 2.40.0