Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4095832rwb; Tue, 6 Sep 2022 02:24:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR5C2+3DCi38kMhEuoLtcGgjWeR0XyYtEgbfBHm9UcGEUF500sDWQpGUa20YJgLaXwlpDRMb X-Received: by 2002:a17:907:d0c:b0:741:6115:a69 with SMTP id gn12-20020a1709070d0c00b0074161150a69mr30525877ejc.325.1662456267873; Tue, 06 Sep 2022 02:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662456267; cv=none; d=google.com; s=arc-20160816; b=VdKvCkFkIgqt6vRvcJJErrniTaZw88OWd80OntEducyX2Ruva2rf4w3n70bML88PHo USDXSGWud7Uga02tiTCHjOXKOPVjdL2NKIJJHPqMI37qn9ZaCH5krY0r1AY14nVXpPE3 ouRRv21HPL3F0XcizcsDG/yak0RkoFq1I7Qe/DKTBg7hehZZC7rsFOzgEWW2tT5u1V0A WcUoG4r++2XRAOckTETdbvyopiY1cVSeg5UzV88fqu/Bk4lFXh2urQSL71jYqeIrOQi9 vBcov1cKdPLXx0j/ajnMT8GKx6jwob5yFyqxH8/XsAtovWLtE/QG0eUi02wGzgMWjcKz 3BoA== 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=ixcTJEmX6ojSJFpffdmxDEeT09//71awlYUYMTCkQ2k=; b=B46t8C0LxUkm+KmUHinD7eA0DDMfkdJ3oPvdstirsmBHsHd97TKM6pbanVeR/Fkx/6 CJyAJECYoA2/kGNSvqaYxMhmkG9HOCX7QlOIHu/ezZAYrBhJh4GfrR5s+XLUoKqqIoih +sqvchLlWpGvfFjugjKuOhcDkjXsYRZQnLlhhymIIU4SMncdxdnb8zlI9XF3Ba4M5doJ jXv6aZ8o8gsH1XkIQU8Hth1Pw0Ic0vOBJrZt7TyIwYkE1irPNv2tEk1fPlW03y5W18sn pfcG/16KOCaIDnMZ4bUabVhZIzRcQpwKDt57I9PYJ+MnfhqIfmGo0u01OXtBH0TICGWn pwWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZEw2t8eu; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr17-20020a170907721100b0072ef52514f6si10330081ejc.629.2022.09.06.02.24.03; Tue, 06 Sep 2022 02:24: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=@gmail.com header.s=20210112 header.b=ZEw2t8eu; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238508AbiIFIJg (ORCPT + 99 others); Tue, 6 Sep 2022 04:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238774AbiIFIIc (ORCPT ); Tue, 6 Sep 2022 04:08:32 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D5BB6D555; Tue, 6 Sep 2022 01:08:31 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id gb36so21329023ejc.10; Tue, 06 Sep 2022 01:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=ixcTJEmX6ojSJFpffdmxDEeT09//71awlYUYMTCkQ2k=; b=ZEw2t8eu/IGDJPWWS2O9AIx5J+sVDehAoSc0jwGGUi62VfOxEv0EBn/OlitZ+YCeRf PR7LKeKeVrdvAjyp8thX5wqf3UHxdpDl/5T0XW+lG1qku5rK3Hmmkzjsm47nUXSsg7+J 8Q8z8iDRqSYxh3qlGRknUNhrP+SLOPhXZYUqTDAd5ceCxMn3My+V9VqLUS81gaE+cIXs 9GfSR3XtxUG6oomZZeXFRlN68cuesq9Zl6Ovhe3SK7WEcHMxmTFlxs4Xjq5ADtAWyUOX oVY5p05K7+V5XUbz+R/MJUb0BWZLhdSpttHWjB9fbbrIPyoqqov5dyuatCRJqfNPHBKQ mU6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=ixcTJEmX6ojSJFpffdmxDEeT09//71awlYUYMTCkQ2k=; b=q1Oc9B2rNSeUbfBTuh7vdkbKep0iTlYrepaAyezIjs4vdgfUdfaGvkSvheVeDUqi5X nwmsPaAQqFi1J/PLPERVCnNBPUeJ6j8njYXT0OQ3NMzLugCRSqXFRB+VjU9xFy7NAPWN xd6rYioE+HBGu7sE+2Kre+XXWTlTGyjdDSSm+fItLt616VUjhSFwJ2YxNPuEUmorVrfn vE1PA89x4qoXeIQ/eXEcOt7PJV8qtID3sXtUFomulnrnj2Y6mXxLtcINz68NTQJoHpK4 Vfr88WXA5PUbSt5GA1MC8SASBNGsxN8Da7qk03gJsAc1cNzuCGHwoO/VYJxZoaOOZw7b LwSg== X-Gm-Message-State: ACgBeo2yIU+pMEox/bVAowz1l+nZuJJIPfxvSaOnXDm3xfChmX1bb5PS mjuLHqTI8+Oz/eGadwfx0iob1FpHTLQQv2WUCCYrrDBsSAs= X-Received: by 2002:a17:906:8450:b0:741:5b1b:5c7f with SMTP id e16-20020a170906845000b007415b1b5c7fmr30767205ejy.766.1662451709902; Tue, 06 Sep 2022 01:08:29 -0700 (PDT) MIME-Version: 1.0 References: <20220905171601.79284-1-peron.clem@gmail.com> <20220905171601.79284-5-peron.clem@gmail.com> In-Reply-To: From: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= Date: Tue, 6 Sep 2022 10:08:18 +0200 Message-ID: Subject: Re: [PATCH v3 4/5] drm/panfrost: devfreq: set opp to the recommended one to configure and enable regulator To: Biju Das Cc: Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Catalin Marinas , Will Deacon , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , David Airlie , Daniel Vetter , Bjorn Andersson , Shawn Guo , Geert Uytterhoeven , Arnd Bergmann , Marcel Ziswiler , Vinod Koul , Dmitry Baryshkov , Rob Herring , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-sunxi@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Viresh Kumar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 Hi, On Tue, 6 Sept 2022 at 10:06, Biju Das wrote: > > Hi Clement, > > > Subject: Re: [PATCH v3 4/5] drm/panfrost: devfreq: set opp to the > > recommended one to configure and enable regulator > > > > Hi Biju, > > > > On Tue, 6 Sept 2022 at 08:42, Biju Das > > wrote: > > > > > > Hi Clement, > > > > > > > > > > > Hi, > > > > > > > > On Mon, 5 Sept 2022 at 20:17, Biju Das > > > > wrote: > > > > > > > > > > Hi, > > > > > > > > > > Thanks for the patch. > > > > > > > > > > > Subject: [PATCH v3 4/5] drm/panfrost: devfreq: set opp to the > > > > > > recommended one to configure and enable regulator > > > > > > > > > > > > devm_pm_opp_set_regulators() doesn't enable regulator, which > > > > > > make regulator framework switching it off during > > regulator_late_cleanup(). > > > > > > > > > > In that case, why not regulator_get()for Dynamic regulator(non > > > > > fixed regulator)?? > > > > > > > > Sorry I don't understand, what do you mean? > > > > > > Normally we need to turn on regulator and clock only when needed. > > > I am not sure with your new code, will make it always on and drains > > > the power unnecessarily and does it set lower opp or higher opp at th= e > > > start?? > > > > The code doesn't make it always on, it makes it how it should be at the > > recommended OPP which is the "start point". > > > > If the recommended OPP says to switch off the regulator then it will. > > > > > > > > Compared to the fixed regulator, you have voltage regulator to contro= l > > > that is the difference between my environment and Your environment. > > > > > > I am not sure any other SoC is using voltage regulator?? > > > If yes, thenthere should be some bug or some difference in HW which i= s > > > giving different behaviour?? > > > > > > If you are the first one using voltage regulator with mali gpu, Then > > > Your implementation may be correct, as you have proper HW to check. > > > > The issue is that my regulator is not marked as "always-on", if no OPP = is > > called before regulator_late_cleanup() then nobody sets the > > regulator_enable() and the regulator is switched off, which makes my > > board hang. > > Cool, From your testing looks like no one tested this feature with > mali GPU on mainline?? Or no one without always-on. Clement > > Cheers, > Biju > > > > > > Like Viresh recommends I will send an update with more details in the > > commit log. > > > > Regards, > > Clement > > > > > > > > > > > > > > > > > > > > > > > > > > > > Call dev_pm_opp_set_opp() with the recommend OPP in > > > > > > panfrost_devfreq_init() to enable the regulator and avoid any > > > > > > switch off by regulator_late_cleanup(). > > > > > > > > > > > > Suggested-by: Viresh Kumar > > > > > > Signed-off-by: Cl=C3=A9ment P=C3=A9ron > > > > > > --- > > > > > > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++++++++ > > > > > > 1 file changed, 8 insertions(+) > > > > > > > > > > > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > > > > > b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > > > > > index 5110cd9b2425..67b242407156 100644 > > > > > > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > > > > > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > > > > > @@ -131,6 +131,14 @@ int panfrost_devfreq_init(struct > > > > > > panfrost_device > > > > > > *pfdev) > > > > > > return PTR_ERR(opp); > > > > > > > > > > > > panfrost_devfreq_profile.initial_freq =3D cur_freq; > > > > > > + > > > > > > + /* Setup and enable regulator */ > > > > > > + ret =3D dev_pm_opp_set_opp(dev, opp); > > > > > > + if (ret) { > > > > > > + DRM_DEV_ERROR(dev, "Couldn't set recommended > > OPP\n"); > > > > > > + return ret; > > > > > > + } > > > > > > > > > > > > > > > FYI, > > > > > On RZ/G2L mali gpu, we have fixed regulator and I was able to do > > > > > GPU OPP transition without any issues previously. > > > > > > > > rzg2l-smarc-som.dtsi uses regulator reg_1p1v; which is marked as > > > > regulator-always-on; that's why > > > > regulator_late_cleanup() doesn't switch it off. > > > > > > Yes that is correct. It is fixed regulator and always on. > > > We control only frequency. > > > > > > Cheers, > > > Biju > > > > > > > > > > > > > > > > > root@smarc-rzg2l:~# cat /sys/class/devfreq/11840000.gpu/trans_sta= t > > > > > From : To > > > > > : 50000000 62500000 100000000 125000000 200000000 > > > > 250000000 400000000 500000000 time(ms) > > > > > * 50000000: 0 0 0 0 0 > > > > 0 0 1 144 > > > > > 62500000: 0 0 0 0 0 > > > > 0 0 0 0 > > > > > 100000000: 0 0 0 0 0 > > > > 0 0 9 524 > > > > > 125000000: 0 0 9 0 0 > > > > 0 0 3 2544 > > > > > 200000000: 0 0 0 11 0 > > > > 0 0 46 3304 > > > > > 250000000: 1 0 0 0 33 > > > > 0 0 0 7496 > > > > > 400000000: 0 0 0 0 16 > > > > 19 0 0 2024 > > > > > 500000000: 1 0 0 1 8 > > > > 15 35 0 4032 > > > > > Total transition : 208 > > > > > > > > > > Cheers, > > > > > Biju > > > > >