devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luca Weiss" <luca.weiss@fairphone.com>
To: "Javier Martinez Canillas" <javierm@redhat.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"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>,
	"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 v2 3/5] drm/sysfb: simpledrm: Add support for interconnect paths
Date: Fri, 11 Jul 2025 09:43:46 +0200	[thread overview]
Message-ID: <DB9237QHOXRU.JRJB8SPUX8RO@fairphone.com> (raw)
In-Reply-To: <87qzz5d3le.fsf@minerva.mail-host-address-is-not-set>

Hi Javier,

On Fri Jun 27, 2025 at 9:51 AM CEST, Javier Martinez Canillas wrote:
> Luca Weiss <luca.weiss@fairphone.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@suse.de>
>> 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 349219330314e3421a6bb26ad5cf39a679a5cb7a..47d213e20cab1dd1e19528674a95edea00f4bb30 100644
>> --- a/drivers/gpu/drm/sysfb/simpledrm.c
>> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
>> @@ -2,6 +2,7 @@
>>  
>>  #include <linux/aperture.h>
>>  #include <linux/clk.h>
>> +#include <linux/interconnect.h>
>>  #include <linux/minmax.h>
>>  #include <linux/of_address.h>
>>  #include <linux/of_clk.h>
>> @@ -225,6 +226,10 @@ struct simpledrm_device {
>>  	struct device **pwr_dom_devs;
>>  	struct device_link **pwr_dom_links;
>>  #endif
>
> Can you add a /* interconnects */ comment here? Similarly how there is one
> for clocks, regulators, power domains, etc.

Sure!

>
>> +#if defined CONFIG_OF && defined CONFIG_INTERCONNECT
>> +	unsigned int icc_count;
>> +	struct icc_path **icc_paths;
>> +#endif
>>  
>
> ...
>
>> +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);
>
> You could use dev_err_probe() instead that already handles the -EPROBE_DEFER
> case and also will get this message in the /sys/kernel/debug/devices_deferred
> debugfs entry, as the reason why the probe deferral happened.

Not quite sure how to implement dev_err_probe, but I think this should
be quite okay?

		if (IS_ERR_OR_NULL(sdev->icc_paths[i])) {
			ret = dev_err_probe(dev, PTR_ERR(sdev->icc_paths[i]),
				      "failed to get interconnect path %u\n", i);
			if (ret == -EPROBE_DEFER)
				goto err;
			continue;
		}

That would still keep the current behavior for defer vs permanent error
while printing when necessary and having it for devices_deferred for the
defer case.

Not sure what the difference between drm_err and dev_err are, but I
trust you on that.

Let me know.

Regards
Luca

>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>


  reply	other threads:[~2025-07-11  7:43 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23  6:44 [PATCH v2 0/5] Add interconnent support for simpledrm/simplefb Luca Weiss
2025-06-23  6:44 ` [PATCH v2 1/5] dt-bindings: display: simple-framebuffer: Add interconnects property Luca Weiss
2025-06-27  7:40   ` Javier Martinez Canillas
2025-06-27  8:08   ` Krzysztof Kozlowski
2025-06-27  9:48     ` Luca Weiss
2025-06-27 10:06       ` Javier Martinez Canillas
2025-06-28 11:49       ` Krzysztof Kozlowski
2025-06-29 12:07         ` Hans de Goede
2025-06-30  8:24           ` Krzysztof Kozlowski
2025-06-30  8:38             ` Maxime Ripard
2025-06-30  9:36               ` Krzysztof Kozlowski
2025-06-30 10:10                 ` Hans de Goede
2025-06-30 10:45                 ` Maxime Ripard
2025-06-30  8:40             ` Hans de Goede
2025-07-02 20:43               ` Krzysztof Kozlowski
2025-07-03  6:47                 ` Thomas Zimmermann
2025-07-03  8:34                   ` Hans de Goede
2025-07-03  8:41                     ` Thomas Zimmermann
2025-07-03  9:41                     ` Maxime Ripard
2025-07-03  9:45                       ` Krzysztof Kozlowski
2025-07-06 11:24                 ` Dmitry Baryshkov
2025-07-11  7:49                   ` Luca Weiss
2025-07-11  7:56                     ` Krzysztof Kozlowski
2025-06-30  6:26         ` Thomas Zimmermann
2025-06-27 11:34     ` Thomas Zimmermann
2025-06-28 11:50       ` Krzysztof Kozlowski
2025-06-30  6:34         ` Thomas Zimmermann
2025-06-30  7:26           ` Hans de Goede
2025-06-30  7:46             ` Thomas Zimmermann
2025-06-23  6:44 ` [PATCH v2 2/5] drm/sysfb: simpledrm: Sort headers correctly Luca Weiss
2025-06-27  7:41   ` Javier Martinez Canillas
2025-06-27  7:41   ` Thomas Zimmermann
2025-06-23  6:44 ` [PATCH v2 3/5] drm/sysfb: simpledrm: Add support for interconnect paths Luca Weiss
2025-06-27  7:51   ` Javier Martinez Canillas
2025-07-11  7:43     ` Luca Weiss [this message]
2025-07-11  9:21       ` Javier Martinez Canillas
2025-08-27  8:42         ` Luca Weiss
2025-07-06 11:14   ` Dmitry Baryshkov
2025-07-09 11:59     ` Luca Weiss
2025-06-23  6:44 ` [PATCH v2 4/5] fbdev/simplefb: Sort headers correctly Luca Weiss
2025-06-27  7:43   ` Thomas Zimmermann
2025-06-27  7:52   ` Javier Martinez Canillas
2025-06-23  6:44 ` [PATCH v2 5/5] fbdev/simplefb: Add support for interconnect paths Luca Weiss
2025-06-27  7:56   ` Javier Martinez Canillas
2025-06-27  9:51     ` Luca Weiss
2025-06-27 10:02       ` Javier Martinez Canillas
2025-06-27 11:36     ` Thomas Zimmermann
2025-06-27 11:43       ` Javier Martinez Canillas
2025-06-23  8:17 ` [PATCH v2 0/5] Add interconnent support for simpledrm/simplefb Hans de Goede

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=DB9237QHOXRU.JRJB8SPUX8RO@fairphone.com \
    --to=luca.weiss@fairphone.com \
    --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=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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).