From: Thomas Zimmermann <tzimmermann@suse.de>
To: Luca Weiss <luca.weiss@fairphone.com>,
Hans de Goede <hdegoede@redhat.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Javier Martinez Canillas <javierm@redhat.com>,
Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] drm/sysfb: simpledrm: Add support for interconnect paths
Date: Fri, 20 Jun 2025 13:01:22 +0200 [thread overview]
Message-ID: <95f59f54-0f7b-4268-8811-ccc4af565368@suse.de> (raw)
In-Reply-To: <20250620-simple-drm-fb-icc-v1-2-d92142e8f74f@fairphone.com>
Hi
Am 20.06.25 um 12:31 schrieb Luca Weiss:
> 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.
>
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
> drivers/gpu/drm/sysfb/simpledrm.c | 83 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 83 insertions(+)
>
> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
> index a1c3119330deffc9e122b83941f3697e5b87f277..9643f7c1734ab558d52779d7c45465dbe1d85762 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
> @@ -9,6 +9,7 @@
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/interconnect.h>
Alphabetical sorting please.
Apart from this nitpick, the patch looks good. For the update:
Reviewed-by: Thomas Zimmermann <tzimmermann>
Best regards
Thomas
>
> #include <drm/clients/drm_client_setup.h>
> #include <drm/drm_atomic.h>
> @@ -225,6 +226,10 @@ struct simpledrm_device {
> struct device **pwr_dom_devs;
> struct device_link **pwr_dom_links;
> #endif
> +#if defined CONFIG_OF && defined CONFIG_INTERCONNECT
> + unsigned int icc_count;
> + struct icc_path **icc_paths;
> +#endif
>
> /* modesetting */
> u32 formats[DRM_SYSFB_PLANE_NFORMATS(1)];
> @@ -547,6 +552,81 @@ static int simpledrm_device_attach_genpd(struct simpledrm_device *sdev)
> }
> #endif
>
> +#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
> +/*
> + * Generic interconnect path handling code.
> + */
> +static void simpledrm_device_detach_icc(void *res)
> +{
> + struct simpledrm_device *sdev = res;
> + int i;
> +
> + for (i = sdev->icc_count - 1; i >= 0; i--) {
> + if (!IS_ERR_OR_NULL(sdev->icc_paths[i]))
> + icc_put(sdev->icc_paths[i]);
> + }
> +}
> +
> +static int simpledrm_device_attach_icc(struct simpledrm_device *sdev)
> +{
> + struct device *dev = sdev->sysfb.dev.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) {
> + drm_err(&sdev->sysfb.dev,
> + "invalid interconnects value\n");
> + return -EINVAL;
> + }
> + sdev->icc_count = count / 2;
> +
> + sdev->icc_paths = devm_kcalloc(dev, sdev->icc_count,
> + sizeof(*sdev->icc_paths),
> + GFP_KERNEL);
> + if (!sdev->icc_paths)
> + return -ENOMEM;
> +
> + for (i = 0; i < sdev->icc_count; i++) {
> + sdev->icc_paths[i] = of_icc_get_by_index(dev, i);
> + if (IS_ERR_OR_NULL(sdev->icc_paths[i])) {
> + ret = PTR_ERR(sdev->icc_paths[i]);
> + if (ret == -EPROBE_DEFER)
> + goto err;
> + drm_err(&sdev->sysfb.dev, "failed to get interconnect path %u: %d\n",
> + i, ret);
> + continue;
> + }
> +
> + ret = icc_set_bw(sdev->icc_paths[i], 0, UINT_MAX);
> + if (ret) {
> + drm_err(&sdev->sysfb.dev, "failed to set interconnect bandwidth %u: %d\n",
> + i, ret);
> + continue;
> + }
> + }
> +
> + return devm_add_action_or_reset(dev, simpledrm_device_detach_icc, sdev);
> +
> +err:
> + while (i) {
> + --i;
> + if (!IS_ERR_OR_NULL(sdev->icc_paths[i]))
> + icc_put(sdev->icc_paths[i]);
> + }
> + return ret;
> +}
> +#else
> +static int simpledrm_device_attach_icc(struct simpledrm_device *sdev)
> +{
> + return 0;
> +}
> +#endif
> +
> /*
> * Modesetting
> */
> @@ -633,6 +713,9 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
> if (ret)
> return ERR_PTR(ret);
> ret = simpledrm_device_attach_genpd(sdev);
> + if (ret)
> + return ERR_PTR(ret);
> + ret = simpledrm_device_attach_icc(sdev);
> if (ret)
> return ERR_PTR(ret);
>
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2025-06-20 11:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 10:31 [PATCH 0/3] Add interconnent support for simpledrm/simplefb Luca Weiss
2025-06-20 10:31 ` [PATCH 1/3] dt-bindings: display: simple-framebuffer: Add interconnects property Luca Weiss
2025-06-20 11:03 ` Thomas Zimmermann
2025-06-20 10:31 ` [PATCH 2/3] drm/sysfb: simpledrm: Add support for interconnect paths Luca Weiss
2025-06-20 11:01 ` Thomas Zimmermann [this message]
2025-06-20 10:31 ` [PATCH 3/3] fbdev/simplefb: " Luca Weiss
2025-06-20 11:02 ` Thomas Zimmermann
2025-06-20 11:07 ` Luca Weiss
2025-06-20 11:28 ` Thomas Zimmermann
2025-06-20 12:07 ` Luca Weiss
2025-06-20 12:36 ` Thomas Zimmermann
2025-06-20 13:09 ` Luca Weiss
2025-06-22 2:21 ` kernel test robot
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=95f59f54-0f7b-4268-8811-ccc4af565368@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=conor+dt@kernel.org \
--cc=deller@gmx.de \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=javierm@redhat.com \
--cc=krzk+dt@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
/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