Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1606723rwl; Mon, 26 Dec 2022 01:52:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvbTwuu9yIWoDRwpgZBFIXquqEa0qPgnQDz1ml9rdgbNiy7pbOvJ1TICNJJpfkcLPM/7CS5 X-Received: by 2002:a05:6a20:438e:b0:a5:7700:2a1a with SMTP id i14-20020a056a20438e00b000a577002a1amr25903368pzl.1.1672048359524; Mon, 26 Dec 2022 01:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672048359; cv=none; d=google.com; s=arc-20160816; b=uGNOdJ8AYVpwWX+UkE+JaRPpschCniPxmGbLzhl/w59drXq+kQfxGu7cvfE6yAhxHy lmxNGlEve3pp77fY/eA2O6ziiIIe7K2yea+KWL1OCklXqJAfuK5icyCavSJkxBjBYw9z bIl4Iz0cWgZ8Yg1VJsT9lbfuh9g+IE4fU8hMlK6kg5DNqhed/upziaPT9gQshNBimYx8 PAtE5DHBQVcGXYXY2senT0avugBkkbH+cI71mFrHPuXN1ItG9j8JPo6EC+3wboIiN6Yk R5mj/MCjqSQ5CHUJVE4JzY0PyI5+B/Ksso9C4fpgkCBvQtpYTrDKddjIQmktBHDF9qZh a7ZA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c34-20020a631c22000000b004780cf90998si11322571pgc.494.2022.12.26.01.52.30; Mon, 26 Dec 2022 01:52:39 -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 + 67 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 ); 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 ) (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 To: Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Nicolas Boichat CC: Fan Chen , Roger Lu , Jia-wei Chang , , , , , , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/soc/mediatek/mtk-svs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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) -- 2.18.0