mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Faiz Abbas <faiz.abbas@arm.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch
Subject: Re: [PATCH 1/3] drm/arm/komeda: Fix komeda probe failing if there are no links in the secondary pipeline
Date: Wed, 6 Mar 2024 13:43:56 +0000	[thread overview]
Message-ID: <ZehzHJonrS7dLSHn@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <20240219100915.192475-2-faiz.abbas@arm.com>

Hi Faiz,

On Mon, Feb 19, 2024 at 03:39:13PM +0530, Faiz Abbas wrote:
> Since commit f7936d6beda9 ("drm/arm/komeda: Remove component framework and
> add a simple encoder"), the devm_drm_of_get_bridge() call happens
> regardless of whether any remote nodes are available on the pipeline. Fix
> this by moving the bridge attach to its own function and calling it
> conditional on there being an output link.
> 
> Fixes: f7936d6beda9 ("drm/arm/komeda: Remove component framework and add a simple encoder")

I don't know what tree you're using, but the commit that you're quoting here is
actually 4cfe5cc02e3f. I will fix it when I merge the patch.

Best regards,
Liviu

> Signed-off-by: Faiz Abbas <faiz.abbas@arm.com>
> ---
>  .../gpu/drm/arm/display/komeda/komeda_crtc.c  | 43 ++++++++++++++-----
>  1 file changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> index 2c661f28410e..b645c5998230 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> @@ -5,6 +5,7 @@
>   *
>   */
>  #include <linux/clk.h>
> +#include <linux/of.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/spinlock.h>
>  
> @@ -610,12 +611,34 @@ get_crtc_primary(struct komeda_kms_dev *kms, struct komeda_crtc *crtc)
>  	return NULL;
>  }
>  
> +static int komeda_attach_bridge(struct device *dev,
> +				struct komeda_pipeline *pipe,
> +				struct drm_encoder *encoder)
> +{
> +	struct drm_bridge *bridge;
> +	int err;
> +
> +	bridge = devm_drm_of_get_bridge(dev, pipe->of_node,
> +					KOMEDA_OF_PORT_OUTPUT, 0);
> +	if (IS_ERR(bridge))
> +		return dev_err_probe(dev, PTR_ERR(bridge), "remote bridge not found for pipe: %s\n",
> +				     of_node_full_name(pipe->of_node));
> +
> +	err = drm_bridge_attach(encoder, bridge, NULL, 0);
> +	if (err)
> +		dev_err(dev, "bridge_attach() failed for pipe: %s\n",
> +			of_node_full_name(pipe->of_node));
> +
> +	return err;
> +}
> +
>  static int komeda_crtc_add(struct komeda_kms_dev *kms,
>  			   struct komeda_crtc *kcrtc)
>  {
>  	struct drm_crtc *crtc = &kcrtc->base;
>  	struct drm_device *base = &kms->base;
> -	struct drm_bridge *bridge;
> +	struct komeda_pipeline *pipe = kcrtc->master;
> +	struct drm_encoder *encoder = &kcrtc->encoder;
>  	int err;
>  
>  	err = drm_crtc_init_with_planes(base, crtc,
> @@ -626,27 +649,25 @@ static int komeda_crtc_add(struct komeda_kms_dev *kms,
>  
>  	drm_crtc_helper_add(crtc, &komeda_crtc_helper_funcs);
>  
> -	crtc->port = kcrtc->master->of_output_port;
> +	crtc->port = pipe->of_output_port;
>  
>  	/* Construct an encoder for each pipeline and attach it to the remote
>  	 * bridge
>  	 */
>  	kcrtc->encoder.possible_crtcs = drm_crtc_mask(crtc);
> -	err = drm_simple_encoder_init(base, &kcrtc->encoder,
> -				      DRM_MODE_ENCODER_TMDS);
> +	err = drm_simple_encoder_init(base, encoder, DRM_MODE_ENCODER_TMDS);
>  	if (err)
>  		return err;
>  
> -	bridge = devm_drm_of_get_bridge(base->dev, kcrtc->master->of_node,
> -					KOMEDA_OF_PORT_OUTPUT, 0);
> -	if (IS_ERR(bridge))
> -		return PTR_ERR(bridge);
> -
> -	err = drm_bridge_attach(&kcrtc->encoder, bridge, NULL, 0);
> +	if (pipe->of_output_links[0]) {
> +		err = komeda_attach_bridge(base->dev, pipe, encoder);
> +		if (err)
> +			return err;
> +	}
>  
>  	drm_crtc_enable_color_mgmt(crtc, 0, true, KOMEDA_COLOR_LUT_SIZE);
>  
> -	return err;
> +	return 0;
>  }
>  
>  int komeda_kms_add_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev)
> -- 
> 2.25.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

  reply	other threads:[~2024-03-06 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 10:09 [PATCH 0/3] Fixes for the komeda driver Faiz Abbas
2024-02-19 10:09 ` [PATCH 1/3] drm/arm/komeda: Fix komeda probe failing if there are no links in the secondary pipeline Faiz Abbas
2024-03-06 13:43   ` Liviu Dudau [this message]
2024-03-11  8:32     ` Faiz Abbas
2024-02-19 10:09 ` [PATCH 2/3] drm/arm/komeda: Move pipeline prints to after the entire pipeline has been enabled Faiz Abbas
2024-02-19 10:09 ` [PATCH 3/3] drm/arm/komeda: update DMA mask to 40 bits Faiz Abbas
2024-02-27 10:52 ` [PATCH 0/3] Fixes for the komeda driver Liviu Dudau

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=ZehzHJonrS7dLSHn@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faiz.abbas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --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

all inboxes | Powered by JetHome®