linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: jacopo mondi <jacopo@jmondi.org>
Cc: linux-kernel@vger.kernel.org,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Jyri Sarha <jsarha@ti.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints
Date: Mon, 13 Aug 2018 16:24:49 +0200	[thread overview]
Message-ID: <0baac94e-f3d2-53fd-4af9-854bb4498345@axentia.se> (raw)
In-Reply-To: <20180813135949.32vrlrevtazr5x7d@apu3b.nibble.pw>

On 2018-08-13 15:59, jacopo mondi wrote:
> Hi Peter,
> 
> On Fri, Aug 10, 2018 at 03:03:58PM +0200, Peter Rosin wrote:
>> This enables more flexible devicetrees. You can e.g. have two output
>> nodes where one is not enabled, without the ordering affecting things.
>>
>> Prior to this patch the active node had to have endpoint id zero.
>>
>> Signed-off-by: Peter Rosin <peda@axentia.se>
>> ---
>>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 32 ++++++++++++++++++------
>>  1 file changed, 25 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
>> index 8db51fb131db..16c1b2f54b42 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
>> @@ -31,14 +31,16 @@ static const struct drm_encoder_funcs atmel_hlcdc_panel_encoder_funcs = {
>>  	.destroy = drm_encoder_cleanup,
>>  };
>>  
>> -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
>> +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
>> +				       struct of_endpoint *endpoint)
>>  {
>>  	struct drm_encoder *encoder;
>>  	struct drm_panel *panel;
>>  	struct drm_bridge *bridge;
>>  	int ret;
>>  
>> -	ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint,
>> +	ret = drm_of_find_panel_or_bridge(dev->dev->of_node,
>> +					  endpoint->port, endpoint->id,
> 
> You are refusing endpoint->port != 0 in the caller, so that could be
> 0.

Yes, it could. However, I intentionally did not write 0 here, so that
the logic related to "port has to be zero" was in one place and not
scattered about. I guess it's up to Boris?

Maybe the port do not actually have to be zero at all? With the old
code, it was kind of understandable that the port number was fixed,
but for the code in my patch it does not matter at all AFAICT. There
is nothing in the binding docs (except for the example) that hints
that port has to be zero, so that's one thing in favor of just getting
rid of the port number checking altogether...

Cheers,
Peter


> Apart from that small nit:
> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> 
> Thanks
>   j
> 
>>  					  &panel, &bridge);
>>  	if (ret)
>>  		return ret;
>> @@ -77,13 +79,29 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
>>  
>>  int atmel_hlcdc_create_outputs(struct drm_device *dev)
>>  {
>> -	int endpoint, ret = 0;
>> -
>> -	for (endpoint = 0; !ret; endpoint++)
>> -		ret = atmel_hlcdc_attach_endpoint(dev, endpoint);
>> +	struct of_endpoint endpoint;
>> +	struct device_node *node = NULL;
>> +	int count = 0;
>> +	int ret = 0;
>> +
>> +	for_each_endpoint_of_node(dev->dev->of_node, node) {
>> +		of_graph_parse_endpoint(node, &endpoint);
>> +
>> +		if (endpoint.port)
>> +			continue;
>> +
>> +		ret = atmel_hlcdc_attach_endpoint(dev, &endpoint);
>> +		if (ret == -ENODEV)
>> +			continue;
>> +		if (ret) {
>> +			of_node_put(node);
>> +			break;
>> +		}
>> +		count++;
>> +	}
>>  
>>  	/* At least one device was successfully attached.*/
>> -	if (ret == -ENODEV && endpoint)
>> +	if (ret == -ENODEV && count)
>>  		return 0;
>>  
>>  	return ret;
>> -- 
>> 2.11.0
>>


  reply	other threads:[~2018-08-13 14:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 13:03 [PATCH v8 0/4] drm/atmel-hlcdc: bus-width override support Peter Rosin
2018-08-10 13:03 ` [PATCH v8 1/4] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-08-10 13:03 ` [PATCH v8 2/4] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin
2018-08-10 13:03 ` [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Peter Rosin
2018-08-13 13:59   ` jacopo mondi
2018-08-13 14:24     ` Peter Rosin [this message]
2018-08-13 20:52       ` Rob Herring
2018-08-14  6:35         ` Peter Rosin
2018-08-14 14:33           ` Rob Herring
2018-08-14 15:05             ` Peter Rosin
2018-08-24  7:47               ` Boris Brezillon
2018-08-24 16:33                 ` Rob Herring
2018-08-10 13:03 ` [PATCH v8 4/4] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin
2018-08-24  7:51 ` [PATCH v8 0/4] drm/atmel-hlcdc: bus-width override support Boris Brezillon
2018-08-24  7:59   ` Peter Rosin

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=0baac94e-f3d2-53fd-4af9-854bb4498345@axentia.se \
    --to=peda@axentia.se \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.belloni@bootlin.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jacopo@jmondi.org \
    --cc=jsarha@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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).