linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liviu Dudau <Liviu.Dudau@arm.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, Daniel Vetter <daniel@ffwll.ch>,
	David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] drm/arcpgu: Get rid of "encoder-slave" property
Date: Fri, 3 Mar 2017 16:28:37 +0000	[thread overview]
Message-ID: <20170303162837.GO917@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <1488554364-25579-1-git-send-email-abrodkin@synopsys.com>

On Fri, Mar 03, 2017 at 06:19:24PM +0300, Alexey Brodkin wrote:
> We used to use "encoder-slave" property in PGU's
> Device Tree node to refer to the encoder, but since there's
> a way to find it with some code smarts we get rid of
> obviously extra complication in PGU node.
> 
> Again inspired by ARM's HDLCD code.

Again, Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>  :)

> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <Liviu.Dudau@arm.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Rob Herring <robh+dt@kernel.org>
> ---
>  arch/arc/boot/dts/axs10x_mb.dtsi |  1 -
>  drivers/gpu/drm/arc/arcpgu_drv.c | 23 +++++++++++++++++------
>  2 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
> index 41cfb29b62c1..2fe030186b9d 100644
> --- a/arch/arc/boot/dts/axs10x_mb.dtsi
> +++ b/arch/arc/boot/dts/axs10x_mb.dtsi
> @@ -287,7 +287,6 @@
>  		pgu@17000 {
>  			compatible = "snps,arcpgu";
>  			reg = <0x17000 0x400>;
> -			encoder-slave = <&adv7511>;
>  			clocks = <&pguclk>;
>  			clock-names = "pxlclk";
>  			memory-region = <&frame_buffer>;
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 5c82f52fba80..b1b2286bda95 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -19,6 +19,7 @@
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <linux/of_graph.h>
>  #include <linux/of_reserved_mem.h>
>  
>  #include "arcpgu.h"
> @@ -83,7 +84,7 @@ static int arcpgu_load(struct drm_device *drm)
>  {
>  	struct platform_device *pdev = to_platform_device(drm->dev);
>  	struct arcpgu_drm_private *arcpgu;
> -	struct device_node *encoder_node;
> +	struct device_node *encoder, *port;
>  	struct resource *res;
>  	int ret;
>  
> @@ -118,14 +119,24 @@ static int arcpgu_load(struct drm_device *drm)
>  	if (arc_pgu_setup_crtc(drm) < 0)
>  		return -ENODEV;
>  
> -	/* find the encoder node and initialize it */
> -	encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0);
> -	if (encoder_node) {
> -		ret = arcpgu_drm_hdmi_init(drm, encoder_node);
> -		of_node_put(encoder_node);
> +	/* There is only one output port inside each device, find it */
> +	port = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
> +
> +	if (port) {
> +		if (of_device_is_available(port))
> +			encoder = of_graph_get_remote_port_parent(port);
> +		of_node_put(port);
> +	}

You must've been looking at some old version. Current version in -next uses
of_graph_get_remote_node() to replace all those lines you have added (see Rob
Herring's series to introduce of_graph_get_remote_node() function)

Best regards,
Liviu


> +
> +	if (encoder && of_device_is_available(encoder)) {
> +		dev_info(drm->dev, "Found encoder node %s, proceeding with it\n",
> +			 encoder->name);
> +		ret = arcpgu_drm_hdmi_init(drm, encoder);
> +		of_node_put(encoder);
>  		if (ret < 0)
>  			return ret;
>  	} else {
> +		dev_info(drm->dev, "No encoder node, assume simulation\n");
>  		ret = arcpgu_drm_sim_init(drm, NULL);
>  		if (ret < 0)
>  			return ret;
> -- 
> 2.7.4
> 

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

  reply	other threads:[~2017-03-03 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 15:19 [PATCH] drm/arcpgu: Get rid of "encoder-slave" property Alexey Brodkin
2017-03-03 16:28 ` Liviu Dudau [this message]
2017-03-03 17:48   ` Alexey Brodkin
2017-03-03 18:21     ` Liviu.Dudau
2017-03-29 13:34       ` Alexey Brodkin
2017-03-29 13:48         ` 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=20170303162837.GO917@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=robh+dt@kernel.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).