Message ID | 20221226094248.4506-11-roger.lu@mediatek.com |
---|---|
State | New |
Headers | show |
Series | Enahance SVS's robustness | expand |
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)
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(-)