devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
Cc: airlied@gmail.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	steven.price@arm.com, robh+dt@kernel.org,
	alyssa.rosenzweig@collabora.com,
	krzysztof.kozlowski+dt@linaro.org, wenst@chromium.org,
	kernel@collabora.com
Subject: Re: [PATCH v1 RESEND 2/2] drm/panfrost: Add basic support for speed binning
Date: Fri, 31 Mar 2023 10:49:14 +0200	[thread overview]
Message-ID: <20230331104914.708b194e@collabora.com> (raw)
In-Reply-To: <5814d779-0635-43fe-3fe8-31c130f05b3a@collabora.com>

On Fri, 31 Mar 2023 10:11:07 +0200
AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
wrote:

> Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto:
> > Some SoCs implementing ARM Mali GPUs are subject to speed binning:
> > this means that some versions of the same SoC model may need to be
> > limited to a slower frequency compared to the other:
> > this is being addressed by reading nvmem (usually, an eFuse array)
> > containing a number that identifies the speed binning of the chip,
> > which is usually related to silicon quality.
> > 
> > To address such situation, add basic support for reading the
> > speed-bin through nvmem, as to make it possible to specify the
> > supported hardware in the OPP table for GPUs.
> > This commit also keeps compatibility with any platform that does
> > not specify (and does not even support) speed-binning.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>  
> 
> Hello maintainers,
> I've seen that this got archived in the dri-devel patchwork; because of that and
> only that, I'm sending this ping to get this patch reviewed.

Looks good to me. If you can get a DT maintainer to review the binding
(Rob?), I'd be happy to queue the series to drm-misc-next.

> 
> (perhaps we can even get it picked for v6.4?)
> 
> Regards,
> Angelo
> 
> > ---
> >   drivers/gpu/drm/panfrost/panfrost_devfreq.c | 30 +++++++++++++++++++++
> >   1 file changed, 30 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> > index fe5f12f16a63..58dfb15a8757 100644
> > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> > @@ -4,6 +4,7 @@
> >   #include <linux/clk.h>
> >   #include <linux/devfreq.h>
> >   #include <linux/devfreq_cooling.h>
> > +#include <linux/nvmem-consumer.h>
> >   #include <linux/platform_device.h>
> >   #include <linux/pm_opp.h>
> >   
> > @@ -82,6 +83,31 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = {
> >   	.get_dev_status = panfrost_devfreq_get_dev_status,
> >   };
> >   
> > +static int panfrost_read_speedbin(struct device *dev)
> > +{
> > +	u32 val;
> > +	int ret;
> > +
> > +	ret = nvmem_cell_read_variable_le_u32(dev, "speed-bin", &val);
> > +	if (ret) {
> > +		/*
> > +		 * -ENOENT means that this platform doesn't support speedbins
> > +		 * as it didn't declare any speed-bin nvmem: in this case, we
> > +		 * keep going without it; any other error means that we are
> > +		 * supposed to read the bin value, but we failed doing so.
> > +		 */
> > +		if (ret != -ENOENT) {
> > +			DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret);
> > +			return ret;
> > +		}
> > +
> > +		return 0;
> > +	}
> > +	DRM_DEV_DEBUG(dev, "Using speed-bin = 0x%x\n", val);
> > +
> > +	return devm_pm_opp_set_supported_hw(dev, &val, 1);
> > +}
> > +
> >   int panfrost_devfreq_init(struct panfrost_device *pfdev)
> >   {
> >   	int ret;
> > @@ -101,6 +127,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
> >   		return 0;
> >   	}
> >   
> > +	ret = panfrost_read_speedbin(dev);
> > +	if (ret)
> > +		return ret;
> > +
> >   	ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names);
> >   	if (ret) {
> >   		/* Continue if the optional regulator is missing */  
> 
> 


  reply	other threads:[~2023-03-31  8:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  9:08 [PATCH v1 RESEND 0/2] Panfrost: GPU Speed-binning support via OPP AngeloGioacchino Del Regno
2023-03-23  9:08 ` [PATCH v1 RESEND 1/2] dt-bindings: gpu: mali-bifrost: Document nvmem for speedbin support AngeloGioacchino Del Regno
2023-03-27  7:30   ` Krzysztof Kozlowski
2023-03-23  9:08 ` [PATCH v1 RESEND 2/2] drm/panfrost: Add basic support for speed binning AngeloGioacchino Del Regno
2023-03-31  8:11   ` AngeloGioacchino Del Regno
2023-03-31  8:49     ` Boris Brezillon [this message]
2023-03-31  8:57       ` AngeloGioacchino Del Regno
2023-03-31  9:29         ` Boris Brezillon
2023-03-31  9:46     ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230331104914.708b194e@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=airlied@gmail.com \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=steven.price@arm.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).