Message ID | 20221226094248.4506-11-roger.lu@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp828132wrt; Mon, 26 Dec 2022 01:44:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtaGMMJov13c76Qk6bnQOq/wQkITXVuAnxaxWavdBlAFRCsv5wjVry1S17xA7mXBNnq9S9z X-Received: by 2002:a17:903:40d2:b0:191:19ed:d6b3 with SMTP id t18-20020a17090340d200b0019119edd6b3mr21001678pld.3.1672047851030; Mon, 26 Dec 2022 01:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672047851; cv=none; d=google.com; s=arc-20160816; b=BGucen2XDtnmai+FB+pqucJ4ObILSLYYmg2BlChye9cExiT7XQPYBdqmAxPQ2fi2hz DcaGp7jLnbbDgsK1MpRn/fEq4yu6zapwYRmwimOnI/JzrrUKjD1maVTOJhJ5QCE9ee6l e7lXKF5b/qOY7O56882VkrQ3Q1mA6kOCNSoIGfmjoQhGseVsHP8vLtmrrEW63FH1I3RW 2U/LQKSEkLi+MODmsr5Wtk/7LJVxstfgkRCVH8aFPOzGYZ4NOC3/2784Es8ZKszktwZR ilpocoure+X5snaQDybNZlIgJUXZ/g9gmL78jZu+nMmMo3gq6kPWqT3t2bkSbw5tDC/M 4Ybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=szL/Z8KRv/eOK5zfngE4zwdXUJOXKEwhTUO7lZ879G0=; b=Q0VyaMFdOBTwi1T2pmKuXDz/4lTbEWUpL8yAh5MEtQrc9fKENQbem0NOP+yXImAxkH KF+3OO5ac9NPJvNP1URW+8Vox//TJW6DHtBUhvumtfr+wP5B4xsTW06Bs8w69jg6+SDw 3Pkq+GqBs3T6tCRtCfzPgApMz2/WPZEbPaVu4IIIdMj60dTnr2n3sXDtyYFAtofuT7sj f7g4dQh639FEwBlnFH2x/oNS4F3JMR9nF8tAc9FI1kEt1qIKE4hEn2V8r/iYRuIQPBdZ NGJTjEzXvqvVsW/3os3oZlJZsfs+kQftopF60ziil1e93/63ggDVvS3g1X3lh/7O6NQM JAxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Hi6S7gQn; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a170902e80c00b00189d12c1226si11138439plg.144.2022.12.26.01.43.59; Mon, 26 Dec 2022 01:44:11 -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=@mediatek.com header.s=dk header.b=Hi6S7gQn; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbiLZJnf (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Mon, 26 Dec 2022 04:43:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbiLZJnC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 26 Dec 2022 04:43:02 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A6622BC3; Mon, 26 Dec 2022 01:43:01 -0800 (PST) X-UUID: 938bdd09844c4aaba9175a5fe55a8187-20221226 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=szL/Z8KRv/eOK5zfngE4zwdXUJOXKEwhTUO7lZ879G0=; b=Hi6S7gQnsLYF0juTiDf7Pp6UKpJMd+knfukuzCJTDp2Iy6wz+7kkz/gjFLnWYei05pRuY1HA1nJXjAAnp4gXcMkFpwYRLsEHdHg0xH/9/7qx4Yz6mk4epoXSAo8BUGZ5TzkyADwRonwJAXaIVFEytLFzVnPQnzyGh+XLWEeWTsY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:32145459-b641-436b-904b-5f81f04af570,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:a8b7f8f3-ff42-4fb0-b929-626456a83c14,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 938bdd09844c4aaba9175a5fe55a8187-20221226 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from <roger.lu@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1641875201; Mon, 26 Dec 2022 17:42:52 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 26 Dec 2022 17:42:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 26 Dec 2022 17:42:50 +0800 From: Roger Lu <roger.lu@mediatek.com> To: Matthias Brugger <matthias.bgg@gmail.com>, Enric Balletbo Serra <eballetbo@gmail.com>, Kevin Hilman <khilman@kernel.org>, Nicolas Boichat <drinkcat@google.com> CC: Fan Chen <fan.chen@mediatek.com>, Roger Lu <roger.lu@mediatek.com>, Jia-wei Chang <jia-wei.chang@mediatek.com>, <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>, <Project_Global_Chrome_Upstream_Group@mediatek.com> Subject: [PATCH v1 10/13] soc: mediatek: mtk-svs: restore default voltages when svs init02 fail Date: Mon, 26 Dec 2022 17:42:45 +0800 Message-ID: <20221226094248.4506-11-roger.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20221226094248.4506-1-roger.lu@mediatek.com> References: <20221226094248.4506-1-roger.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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: <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?1753269247704752300?= X-GMAIL-MSGID: =?utf-8?q?1753269247704752300?= |
Series |
Enahance SVS's robustness
|
|
Commit Message
Roger Lu
Dec. 26, 2022, 9:42 a.m. UTC
If svs init02 fail, it means we cannot rely on svs bank voltages anymore.
We need to disable svs function and restore DVFS opp voltages back to the
default voltages for making sure we have enough DVFS voltages.
Signed-off-by: Roger Lu <roger.lu@mediatek.com>
---
drivers/soc/mediatek/mtk-svs.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
Comments
Il 26/12/22 10:42, Roger Lu ha scritto: > If svs init02 fail, it means we cannot rely on svs bank voltages anymore. > We need to disable svs function and restore DVFS opp voltages back to the > default voltages for making sure we have enough DVFS voltages. > > Signed-off-by: Roger Lu <roger.lu@mediatek.com> This needs a Fixes tag... and it also needs to apply to older kernels, as MT8183 does use SVS in previous versions. Perhaps you can send a different patch, without the cleanups, only for the backport? Otherwise you'll have to duplicate svs_bank_disable_and_restore_default_volts() again before cleaning up... I'll leave the choice to you. Regards, Angelo
Hi AngeloGioacchino, Sorry for the late reply and thanks for the advices always. On Tue, 2023-01-03 at 13:49 +0100, AngeloGioacchino Del Regno wrote: > Il 26/12/22 10:42, Roger Lu ha scritto: > > If svs init02 fail, it means we cannot rely on svs bank voltages anymore. > > We need to disable svs function and restore DVFS opp voltages back to the > > default voltages for making sure we have enough DVFS voltages. > > > > Signed-off-by: Roger Lu <roger.lu@mediatek.com> > > This needs a Fixes tag... and it also needs to apply to older kernels, as > MT8183 does use SVS in previous versions. No problem. I'll add a Fixes tag. > > Perhaps you can send a different patch, without the cleanups, only for the > backport? > Otherwise you'll have to duplicate > svs_bank_disable_and_restore_default_volts() > again before cleaning up... > > I'll leave the choice to you. I'll reorder the patch to put cleanup patches first and fix patches next in the patchset. Thanks for the advice again. > > Regards, > Angelo
diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index c4b36c908eda..3a2be5ced8e6 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -1467,6 +1467,7 @@ static int svs_init02(struct svs_platform *svsp) { struct svs_bank *svsb; unsigned long flags, time_left; + int ret; u32 idx; for (idx = 0; idx < svsp->bank_max; idx++) { @@ -1485,7 +1486,8 @@ static int svs_init02(struct svs_platform *svsp) msecs_to_jiffies(5000)); if (!time_left) { dev_err(svsb->dev, "init02 completion timeout\n"); - return -EBUSY; + ret = -EBUSY; + goto out_of_init02; } } @@ -1503,12 +1505,21 @@ static int svs_init02(struct svs_platform *svsp) if (svsb->type == SVSB_HIGH || svsb->type == SVSB_LOW) { if (svs_sync_bank_volts_from_opp(svsb)) { dev_err(svsb->dev, "sync volt fail\n"); - return -EPERM; + ret = -EPERM; + goto out_of_init02; } } } return 0; + +out_of_init02: + for (idx = 0; idx < svsp->bank_max; idx++) { + svsb = &svsp->banks[idx]; + svs_bank_disable_and_restore_default_volts(svsp, svsb); + } + + return ret; } static void svs_mon_mode(struct svs_platform *svsp)