[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ldpdd3dn.fsf@minerva.mail-host-address-is-not-set>
Date: Fri, 27 Jun 2025 09:56:20 +0200
From: Javier Martinez Canillas <javierm@...hat.com>
To: Luca Weiss <luca.weiss@...rphone.com>, Hans de Goede
<hdegoede@...hat.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Helge
Deller <deller@....de>
Cc: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, Luca Weiss
<luca.weiss@...rphone.com>
Subject: Re: [PATCH v2 5/5] fbdev/simplefb: Add support for interconnect paths
Luca Weiss <luca.weiss@...rphone.com> writes:
> Some devices might require keeping an interconnect path alive so that
> the framebuffer continues working. Add support for that by setting the
> bandwidth requirements appropriately for all provided interconnect
> paths.
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>
> Signed-off-by: Luca Weiss <luca.weiss@...rphone.com>
> ---
> drivers/video/fbdev/simplefb.c | 83 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 83 insertions(+)
>
[...]
> +static void simplefb_detach_icc(void *res)
> +{
> + struct simplefb_par *par = res;
> + int i;
> +
> + for (i = par->icc_count - 1; i >= 0; i--) {
> + if (!IS_ERR_OR_NULL(par->icc_paths[i]))
> + icc_put(par->icc_paths[i]);
> + }
> +}
> +
> +static int simplefb_attach_icc(struct simplefb_par *par,
> + struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + int ret, count, i;
> +
> + count = of_count_phandle_with_args(dev->of_node, "interconnects",
> + "#interconnect-cells");
> + if (count < 0)
> + return 0;
> +
> + /* An interconnect path consists of two elements */
> + if (count % 2) {
> + dev_err(dev, "invalid interconnects value\n");
> + return -EINVAL;
> + }
> + par->icc_count = count / 2;
> +
> + par->icc_paths = devm_kcalloc(dev, par->icc_count,
> + sizeof(*par->icc_paths),
> + GFP_KERNEL);
> + if (!par->icc_paths)
> + return -ENOMEM;
> +
> + for (i = 0; i < par->icc_count; i++) {
> + par->icc_paths[i] = of_icc_get_by_index(dev, i);
> + if (IS_ERR_OR_NULL(par->icc_paths[i])) {
> + ret = PTR_ERR(par->icc_paths[i]);
> + if (ret == -EPROBE_DEFER)
> + goto err;
> + dev_err(dev, "failed to get interconnect path %u: %d\n", i, ret);
> + continue;
> + }
> +
> + ret = icc_set_bw(par->icc_paths[i], 0, UINT_MAX);
> + if (ret) {
> + dev_err(dev, "failed to set interconnect bandwidth %u: %d\n", i, ret);
> + continue;
> + }
> + }
> +
> + return devm_add_action_or_reset(dev, simplefb_detach_icc, par);
> +
> +err:
> + while (i) {
> + --i;
> + if (!IS_ERR_OR_NULL(par->icc_paths[i]))
> + icc_put(par->icc_paths[i]);
> + }
> + return ret;
> +}
> +#else
These two functions contain the same logic that you are using in the
simpledrm driver. I wonder if could be made helpers so that the code
isn't duplicated in both drivers.
But in any case it could be a follow-up of your series I think.
Reviewed-by: Javier Martinez Canillas <javierm@...hat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
Powered by blists - more mailing lists