Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4052816rwb; Tue, 6 Sep 2022 01:33:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PAihBx1hDDHJ/5YB26IwSqsN48C4MEV4iW9WH8E7ZQa7gwao7VLH6WtWeVGmUutYbqw6d X-Received: by 2002:a17:902:d4ca:b0:16f:8311:54b0 with SMTP id o10-20020a170902d4ca00b0016f831154b0mr53569272plg.108.1662453187788; Tue, 06 Sep 2022 01:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662453187; cv=none; d=google.com; s=arc-20160816; b=y8WW+tZycd1W/D/MahwU9rQ8NVkjOsWsdP1tWxrxSYVTry66nQrd+xJz0lg/iEKPhA 55ScEnCCm3BBKrW78bakkMp/CsxTZhK5gHTh1QcjygmkFt4BJ2ZrxifidvXXbp8tqKPj bHy+6o979sTW7tckfEY9+o/bNgFzbNj/ZogkoE8r6LPPz2ieKFj65hYV6pR5MJLkHPTg diALt0t1xx/bJJl3vy/b8uqm9bO2XKd4Kmweb5DbZT5O3LVSqwMEfh37xxkUgKGTsWn/ yVXQAPAJ3p/7yE3ErnOj1veKeBO5O03wRIMRKFpWXtF4+GkhaHdw425dDDbAyRzxAIcV L3eA== 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=G5xMT6aDNv4kW7DoRuL08vNOs1PAIlSGM76dCe+/XnA=; b=S1bCL/mooJFbXjhIB6YGfFbrUjWTUDEO5yYk1RAqEgzlScr7twcurLeycBIyyh/dws AVc61mBgaahx9QuC0mcfSW5ZaKUSg/0HAfmRixUnMN0wo46FOBMzc2X7sJf1473rWpEI 9xmDOTh4XWwcyq4bzI9Kfm+9/q22aYH0hgJlTfkapLa3hIaTsYwmz0HE3tjIUwUcWJvm H+MjX8sVdgmzqBp6IkGWiG/5t8C5GvxkdLm4qvnVRz+6e166rTHTjheuvhEdv/9ueTSf 39S7ZNNVQz63kDYxyNzeVHTT05Veyowur89YounIhO5dB0at4PPpzDvs8Ql00hCvsvIm Zq+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IqR3y18C; 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 j4-20020a170902da8400b0016dd2643111si1202480plx.311.2022.09.06.01.32.55; Tue, 06 Sep 2022 01:33:07 -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=IqR3y18C; 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 S233467AbiIFH7B (ORCPT + 99 others); Tue, 6 Sep 2022 03:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233110AbiIFH7A (ORCPT ); Tue, 6 Sep 2022 03:59:00 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80FA7171C; Tue, 6 Sep 2022 00:58:58 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id fy31so21312539ejc.6; Tue, 06 Sep 2022 00:58:58 -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=G5xMT6aDNv4kW7DoRuL08vNOs1PAIlSGM76dCe+/XnA=; b=IqR3y18Cx1qIwYw4UCiCTVh/G1F5irxJGmeXs1tScFvtbsL6xEpJxG2G/X6Gl4lhIj +2KrmUt+oRnZv2in1enq/dW/oGz8TuVY6qP7kLHjRjLDgIUAJy0ndbbIiaJi6ZNadtxI y5EvFZkZuwL0e0v6pQC5u87gcLh52hNoFtGTG4s+x9NTpfmdykE+j8OluBNOTg5w6EEb CAj9vrObxn37Woc0hrBx34RCimwLSIK7kEqX+b1ptJmgvYmBXXMYLYD3rfzCmNogiGEn rbepDzapjt3YfkGRcTXwVovnVtdeUw/Avi2dszJ13t45IfJeQ+Am19GtI6oJjAoPrywZ o8dw== 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=G5xMT6aDNv4kW7DoRuL08vNOs1PAIlSGM76dCe+/XnA=; b=wBlqIJb8sTI0FtfooGsBYWJ4GouVIqzzpLI5z6+0IkkBNhTbX+v3FrtJZPiUiqTrdy PJCMVGDrzFtRei2bTiZei+gmtnzOoexqvL7RzEqqZalND0Pc0+pyfTR6X6ezlysbReFk +cbJlX1/kifM4ELZ4IX11yfrVnIDu+VRUuYP7JYx506L/iduxbCoAjsvwYqYJPYTKbXa 59df0HW+jnUizayl7Y6xdACrLTG6ey9+o+PcTqPYaz+/bLK3v0Xb5MsBDJX/b3hJy26H eDckBVWb0TUCJHY+mubGePFo9LFpna+O2YQrP9+xvuOG6ngKnB/N3tGfu5fgTRVV3NpZ YeBw== X-Gm-Message-State: ACgBeo0UFUMpqVuesM6K7KO3adYracuJYmLmtec5lvEpBaL9v6D1QDK+ iPKbM0fc++CczWXo+6D27qquXTVlGDBDiYbN8MM= X-Received: by 2002:a17:907:7dac:b0:739:8df9:3c16 with SMTP id oz44-20020a1709077dac00b007398df93c16mr37890355ejc.9.1662451137307; Tue, 06 Sep 2022 00:58:57 -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 09:58:45 +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 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 the 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 > control 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 is 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. 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 switc= h > > > > 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_stat > > > 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 > > >