Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp402528rwn; Thu, 8 Sep 2022 03:30:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR46CMJuCDQyv9DiEHlKSc7pFm2m1bT9jYu8s0KMpchWTX/jdWRxw5cU8wqNA/nPzykfP1IX X-Received: by 2002:a17:907:1ded:b0:76f:af8f:942e with SMTP id og45-20020a1709071ded00b0076faf8f942emr5470115ejc.120.1662633047284; Thu, 08 Sep 2022 03:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662633047; cv=none; d=google.com; s=arc-20160816; b=jmX84GNmEr/Af8+PfNiJyPJklbu+IrR05+T2Rcswm7ShRpjmSfWqUKBQbKGAjpxfy/ WKIFqTbu8JwEobYf6QR9E30cVdoWeI1EsglfFhP+LIvElfIYDuvQ9sHKprbaYy4Y9+Th +Uj3woLO696YCYw2QPr/ddYF6bmOEPjXniKNjyc1nmBF2fup4qS3ZsorhvEM2Z9KVuqi hJOpqGbi4s3j7A+gxbcUQ26T9+5eTGk/OOI1GanvrhOAB+iptyHtj+znYs3eXpP32emI hcg5jv8boe6ezQgDCzaIVCTUFghaeIuIbdtbzYcwu3jBBMwBaoee+r3HaCmtT4ZL/WTb JL0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=CQAKNgTnVfeb82BICyWNOyKRpGOviN8QMZO1olmqqZo=; b=YfLgJIAJReXPf5/T/8/CramYj0t3FK1oX5kuodmt1m0L5D7kZKO9jBtIDlJFd4qMWt SdUMFla9Qq8ceBil8eOaF9lc2k+Pwk+Uz/hdmTh/xs1oSc9Q4uAZqDgjb3zyQWScuBLy vCz0vpgVPhe1ZJrjuMkFHqv7jTTB62IKakJgARzT0Wdq5OLra1wKpeSA1uNZp1skrziR Zs3X3Dr00bkj4sfiJfuqT/bhxH7Y1lDJjM9c4JczKYljJ34Te8OlRV1kbo4krDFqyJDE LoKVqOn03WYKdbkA2JXXXX5pl8wAAOWStnIPvcTmUM/DlnncLpJ4vdKj7uGZvGSyvcCd /RHw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gk7-20020a17090790c700b00730a23e9326si1478421ejb.614.2022.09.08.03.30.21; Thu, 08 Sep 2022 03:30:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230441AbiIHKDf (ORCPT + 99 others); Thu, 8 Sep 2022 06:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbiIHKDc (ORCPT ); Thu, 8 Sep 2022 06:03:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7407CBAD83; Thu, 8 Sep 2022 03:03:30 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58C9114BF; Thu, 8 Sep 2022 03:03:36 -0700 (PDT) Received: from [10.1.39.19] (e122027.cambridge.arm.com [10.1.39.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 936833F73D; Thu, 8 Sep 2022 03:03:23 -0700 (PDT) Message-ID: <65948185-b017-3da5-fdce-e28887b01ff4@arm.com> Date: Thu, 8 Sep 2022 11:03:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v4 4/5] drm/panfrost: devfreq: set opp to the recommended one to configure regulator Content-Language: en-GB To: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , David Airlie , Daniel Vetter Cc: 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 , Qiang Yu References: <20220906153034.153321-1-peron.clem@gmail.com> <20220906153034.153321-5-peron.clem@gmail.com> From: Steven Price In-Reply-To: <20220906153034.153321-5-peron.clem@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,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 On 06/09/2022 16:30, Clément Péron wrote: > Enabling panfrost GPU OPP with dynamic regulator will make OPP > responsible to enable and configure it. > > Unfortunatly OPP configure and enable the regulator when an OPP NIT: Unfortunately > is asked to be set, which is not the case during > panfrost_devfreq_init(). > > This leave the regulator unconfigured and if no GPU load is > triggered, no OPP is asked to be set which make the regulator framework > switching it off during regulator_late_cleanup() without > noticing and therefore make the board hang as any access to GPU > memory space make bus locks up. > > Call dev_pm_opp_set_opp() with the recommend OPP in > panfrost_devfreq_init() to enable the regulator, this will properly > configure and enable the regulator and will avoid any switch off > by regulator_late_cleanup(). > > Suggested-by: Viresh Kumar > Signed-off-by: Clément Péron Reviewed-by: Steven Price Note this same sequence is used in the Lima driver, so it would be good to submit the fix there too as it presumably is affected by the same issue. I've CC'd Qiang for visibility. I'll push this patch to drm-misc-fixes (with the typo above fixed), the device tree patches can go through a different tree. Steve > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 5110cd9b2425..fe5f12f16a63 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -131,6 +131,17 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > return PTR_ERR(opp); > > panfrost_devfreq_profile.initial_freq = cur_freq; > + > + /* > + * Set the recommend OPP this will enable and configure the regulator > + * if any and will avoid a switch off by regulator_late_cleanup() > + */ > + ret = dev_pm_opp_set_opp(dev, opp); > + if (ret) { > + DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n"); > + return ret; > + } > + > dev_pm_opp_put(opp); > > /*