From: Peter Rosin <peda@axentia.se> To: linux-kernel@vger.kernel.org Cc: Peter Rosin <peda@axentia.se>, 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: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Date: Fri, 10 Aug 2018 15:03:58 +0200 [thread overview] Message-ID: <20180810130359.9882-4-peda@axentia.se> (raw) In-Reply-To: <20180810130359.9882-1-peda@axentia.se> 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, &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
WARNING: multiple messages have this Message-ID (diff)
From: peda@axentia.se (Peter Rosin) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Date: Fri, 10 Aug 2018 15:03:58 +0200 [thread overview] Message-ID: <20180810130359.9882-4-peda@axentia.se> (raw) In-Reply-To: <20180810130359.9882-1-peda@axentia.se> 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, &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
next prev parent reply other threads:[~2018-08-10 13:04 UTC|newest] Thread overview: 37+ 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 ` 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 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 ` Peter Rosin 2018-08-10 13:03 ` Peter Rosin [this message] 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 13:59 ` jacopo mondi 2018-08-13 14:24 ` Peter Rosin 2018-08-13 14:24 ` Peter Rosin 2018-08-13 20:52 ` Rob Herring 2018-08-13 20:52 ` Rob Herring 2018-08-13 20:52 ` Rob Herring 2018-08-14 6:35 ` Peter Rosin 2018-08-14 6:35 ` Peter Rosin 2018-08-14 6:35 ` Peter Rosin 2018-08-14 14:33 ` Rob Herring 2018-08-14 14:33 ` Rob Herring 2018-08-14 14:33 ` Rob Herring 2018-08-14 15:05 ` Peter Rosin 2018-08-14 15:05 ` Peter Rosin 2018-08-14 15:05 ` Peter Rosin 2018-08-24 7:47 ` Boris Brezillon 2018-08-24 7:47 ` Boris Brezillon 2018-08-24 7:47 ` Boris Brezillon 2018-08-24 16:33 ` Rob Herring 2018-08-24 16:33 ` Rob Herring 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-10 13:03 ` Peter Rosin 2018-08-24 7:51 ` [PATCH v8 0/4] drm/atmel-hlcdc: bus-width override support Boris Brezillon 2018-08-24 7:51 ` Boris Brezillon 2018-08-24 7:51 ` Boris Brezillon 2018-08-24 7:59 ` Peter Rosin 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=20180810130359.9882-4-peda@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=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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.