From: jacopo@jmondi.org (jacopo mondi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] drm: bridge: lvds-encoder: allow specifying the input bus format
Date: Tue, 27 Mar 2018 12:27:41 +0200 [thread overview]
Message-ID: <20180327102741.GN27746@w540> (raw)
In-Reply-To: <20180326212447.7380-5-peda@axentia.se>
Hi Peter, Laurent,
thanks for the patches,
On Mon, Mar 26, 2018 at 11:24:46PM +0200, Peter Rosin wrote:
> If the bridge changes the bus format, allow this to be described in
> the bridge, instead of providing false information about the bus
> format of the connector or panel.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> .../bindings/display/bridge/lvds-transmitter.txt | 6 ++++++
> drivers/gpu/drm/bridge/lvds-encoder.c | 25 ++++++++++++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> index 50220190c203..8d40a2069252 100644
> --- a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> @@ -30,6 +30,12 @@ Required properties:
> device-specific version corresponding to the device first
> followed by the generic version.
>
> +Optional properties:
> +
> +- interface-pix-fmt:
> + List of valid input bus formats of the encoder. Recognized bus formats
> + are listed in ../bus-format.txt
> +
This comments applies here and to [3/5] as well.
Are we sure we want the supported bridge input format defined in DT
bindings?
Again, I may be biased, but as I see this, each bridge driver should
list its supported formats with MEDIA_BUS_FMT_ fourcc codes and return
the currently 'active' one when requested by the preceding bridge.
I understand for this driver, being compatible with both a generic lvds
encoder and a specific chip, the supported input formats are
different, but I would have used the 'of_device_id.data' field for
this and leave this out from DT bindings.
This makes the translation routine here implemented not required if
I'm not wrong...
Thanks
j
> Required nodes:
>
> This device has two video ports. Their connections are modeled using the OF
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 75b0d3f6e4de..b78619b5560a 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -9,6 +9,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_bridge.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_panel.h>
>
> #include <linux/of_graph.h>
> @@ -16,6 +17,8 @@
> struct lvds_encoder {
> struct drm_bridge bridge;
> struct drm_bridge *panel_bridge;
> + int num_bus_formats;
> + u32 *bus_formats;
> };
>
> static int lvds_encoder_attach(struct drm_bridge *bridge)
> @@ -28,8 +31,22 @@ static int lvds_encoder_attach(struct drm_bridge *bridge)
> bridge);
> }
>
> +static int lvds_encoder_input_formats(struct drm_bridge *bridge,
> + const u32 **bus_formats)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> + struct lvds_encoder,
> + bridge);
> +
> + if (lvds_encoder->num_bus_formats)
> + *bus_formats = lvds_encoder->bus_formats;
> +
> + return lvds_encoder->num_bus_formats;
> +}
> +
> static struct drm_bridge_funcs funcs = {
> .attach = lvds_encoder_attach,
> + .input_formats = lvds_encoder_input_formats,
> };
>
> static int lvds_encoder_probe(struct platform_device *pdev)
> @@ -39,6 +56,7 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> struct device_node *panel_node;
> struct drm_panel *panel;
> struct lvds_encoder *lvds_encoder;
> + int ret;
>
> lvds_encoder = devm_kzalloc(&pdev->dev, sizeof(*lvds_encoder),
> GFP_KERNEL);
> @@ -79,6 +97,12 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> if (IS_ERR(lvds_encoder->panel_bridge))
> return PTR_ERR(lvds_encoder->panel_bridge);
>
> + ret = drm_of_bus_formats(pdev->dev.of_node, "interface-pix-fmt",
> + &lvds_encoder->bus_formats);
> + if (ret < 0)
> + return ret;
> + lvds_encoder->num_bus_formats = ret;
> +
> /* The panel_bridge bridge is attached to the panel's of_node,
> * but we need a bridge attached to our of_node for our user
> * to look up.
> @@ -96,6 +120,7 @@ static int lvds_encoder_remove(struct platform_device *pdev)
> {
> struct lvds_encoder *lvds_encoder = platform_get_drvdata(pdev);
>
> + kfree(lvds_encoder->bus_formats);
> drm_bridge_remove(&lvds_encoder->bridge);
>
> return 0;
> --
> 2.11.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180327/d1047c42/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: jacopo mondi <jacopo@jmondi.org>
To: Peter Rosin <peda@axentia.se>
Cc: Mark Rutland <mark.rutland@arm.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, David Airlie <airlied@linux.ie>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Daniel Vetter <daniel.vetter@intel.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/5] drm: bridge: lvds-encoder: allow specifying the input bus format
Date: Tue, 27 Mar 2018 12:27:41 +0200 [thread overview]
Message-ID: <20180327102741.GN27746@w540> (raw)
In-Reply-To: <20180326212447.7380-5-peda@axentia.se>
[-- Attachment #1.1: Type: text/plain, Size: 4339 bytes --]
Hi Peter, Laurent,
thanks for the patches,
On Mon, Mar 26, 2018 at 11:24:46PM +0200, Peter Rosin wrote:
> If the bridge changes the bus format, allow this to be described in
> the bridge, instead of providing false information about the bus
> format of the connector or panel.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> .../bindings/display/bridge/lvds-transmitter.txt | 6 ++++++
> drivers/gpu/drm/bridge/lvds-encoder.c | 25 ++++++++++++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> index 50220190c203..8d40a2069252 100644
> --- a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> @@ -30,6 +30,12 @@ Required properties:
> device-specific version corresponding to the device first
> followed by the generic version.
>
> +Optional properties:
> +
> +- interface-pix-fmt:
> + List of valid input bus formats of the encoder. Recognized bus formats
> + are listed in ../bus-format.txt
> +
This comments applies here and to [3/5] as well.
Are we sure we want the supported bridge input format defined in DT
bindings?
Again, I may be biased, but as I see this, each bridge driver should
list its supported formats with MEDIA_BUS_FMT_ fourcc codes and return
the currently 'active' one when requested by the preceding bridge.
I understand for this driver, being compatible with both a generic lvds
encoder and a specific chip, the supported input formats are
different, but I would have used the 'of_device_id.data' field for
this and leave this out from DT bindings.
This makes the translation routine here implemented not required if
I'm not wrong...
Thanks
j
> Required nodes:
>
> This device has two video ports. Their connections are modeled using the OF
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 75b0d3f6e4de..b78619b5560a 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -9,6 +9,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_bridge.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_panel.h>
>
> #include <linux/of_graph.h>
> @@ -16,6 +17,8 @@
> struct lvds_encoder {
> struct drm_bridge bridge;
> struct drm_bridge *panel_bridge;
> + int num_bus_formats;
> + u32 *bus_formats;
> };
>
> static int lvds_encoder_attach(struct drm_bridge *bridge)
> @@ -28,8 +31,22 @@ static int lvds_encoder_attach(struct drm_bridge *bridge)
> bridge);
> }
>
> +static int lvds_encoder_input_formats(struct drm_bridge *bridge,
> + const u32 **bus_formats)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> + struct lvds_encoder,
> + bridge);
> +
> + if (lvds_encoder->num_bus_formats)
> + *bus_formats = lvds_encoder->bus_formats;
> +
> + return lvds_encoder->num_bus_formats;
> +}
> +
> static struct drm_bridge_funcs funcs = {
> .attach = lvds_encoder_attach,
> + .input_formats = lvds_encoder_input_formats,
> };
>
> static int lvds_encoder_probe(struct platform_device *pdev)
> @@ -39,6 +56,7 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> struct device_node *panel_node;
> struct drm_panel *panel;
> struct lvds_encoder *lvds_encoder;
> + int ret;
>
> lvds_encoder = devm_kzalloc(&pdev->dev, sizeof(*lvds_encoder),
> GFP_KERNEL);
> @@ -79,6 +97,12 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> if (IS_ERR(lvds_encoder->panel_bridge))
> return PTR_ERR(lvds_encoder->panel_bridge);
>
> + ret = drm_of_bus_formats(pdev->dev.of_node, "interface-pix-fmt",
> + &lvds_encoder->bus_formats);
> + if (ret < 0)
> + return ret;
> + lvds_encoder->num_bus_formats = ret;
> +
> /* The panel_bridge bridge is attached to the panel's of_node,
> * but we need a bridge attached to our of_node for our user
> * to look up.
> @@ -96,6 +120,7 @@ static int lvds_encoder_remove(struct platform_device *pdev)
> {
> struct lvds_encoder *lvds_encoder = platform_get_drvdata(pdev);
>
> + kfree(lvds_encoder->bus_formats);
> drm_bridge_remove(&lvds_encoder->bridge);
>
> return 0;
> --
> 2.11.0
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: jacopo mondi <jacopo@jmondi.org>
To: Peter Rosin <peda@axentia.se>
Cc: linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Archit Taneja <architt@codeaurora.org>,
Andrzej Hajda <a.hajda@samsung.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Daniel Vetter <daniel.vetter@intel.com>,
Gustavo Padovan <gustavo@padovan.org>,
Sean Paul <seanpaul@chromium.org>,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/5] drm: bridge: lvds-encoder: allow specifying the input bus format
Date: Tue, 27 Mar 2018 12:27:41 +0200 [thread overview]
Message-ID: <20180327102741.GN27746@w540> (raw)
In-Reply-To: <20180326212447.7380-5-peda@axentia.se>
[-- Attachment #1: Type: text/plain, Size: 4339 bytes --]
Hi Peter, Laurent,
thanks for the patches,
On Mon, Mar 26, 2018 at 11:24:46PM +0200, Peter Rosin wrote:
> If the bridge changes the bus format, allow this to be described in
> the bridge, instead of providing false information about the bus
> format of the connector or panel.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> .../bindings/display/bridge/lvds-transmitter.txt | 6 ++++++
> drivers/gpu/drm/bridge/lvds-encoder.c | 25 ++++++++++++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> index 50220190c203..8d40a2069252 100644
> --- a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
> @@ -30,6 +30,12 @@ Required properties:
> device-specific version corresponding to the device first
> followed by the generic version.
>
> +Optional properties:
> +
> +- interface-pix-fmt:
> + List of valid input bus formats of the encoder. Recognized bus formats
> + are listed in ../bus-format.txt
> +
This comments applies here and to [3/5] as well.
Are we sure we want the supported bridge input format defined in DT
bindings?
Again, I may be biased, but as I see this, each bridge driver should
list its supported formats with MEDIA_BUS_FMT_ fourcc codes and return
the currently 'active' one when requested by the preceding bridge.
I understand for this driver, being compatible with both a generic lvds
encoder and a specific chip, the supported input formats are
different, but I would have used the 'of_device_id.data' field for
this and leave this out from DT bindings.
This makes the translation routine here implemented not required if
I'm not wrong...
Thanks
j
> Required nodes:
>
> This device has two video ports. Their connections are modeled using the OF
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 75b0d3f6e4de..b78619b5560a 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -9,6 +9,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_bridge.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_panel.h>
>
> #include <linux/of_graph.h>
> @@ -16,6 +17,8 @@
> struct lvds_encoder {
> struct drm_bridge bridge;
> struct drm_bridge *panel_bridge;
> + int num_bus_formats;
> + u32 *bus_formats;
> };
>
> static int lvds_encoder_attach(struct drm_bridge *bridge)
> @@ -28,8 +31,22 @@ static int lvds_encoder_attach(struct drm_bridge *bridge)
> bridge);
> }
>
> +static int lvds_encoder_input_formats(struct drm_bridge *bridge,
> + const u32 **bus_formats)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> + struct lvds_encoder,
> + bridge);
> +
> + if (lvds_encoder->num_bus_formats)
> + *bus_formats = lvds_encoder->bus_formats;
> +
> + return lvds_encoder->num_bus_formats;
> +}
> +
> static struct drm_bridge_funcs funcs = {
> .attach = lvds_encoder_attach,
> + .input_formats = lvds_encoder_input_formats,
> };
>
> static int lvds_encoder_probe(struct platform_device *pdev)
> @@ -39,6 +56,7 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> struct device_node *panel_node;
> struct drm_panel *panel;
> struct lvds_encoder *lvds_encoder;
> + int ret;
>
> lvds_encoder = devm_kzalloc(&pdev->dev, sizeof(*lvds_encoder),
> GFP_KERNEL);
> @@ -79,6 +97,12 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> if (IS_ERR(lvds_encoder->panel_bridge))
> return PTR_ERR(lvds_encoder->panel_bridge);
>
> + ret = drm_of_bus_formats(pdev->dev.of_node, "interface-pix-fmt",
> + &lvds_encoder->bus_formats);
> + if (ret < 0)
> + return ret;
> + lvds_encoder->num_bus_formats = ret;
> +
> /* The panel_bridge bridge is attached to the panel's of_node,
> * but we need a bridge attached to our of_node for our user
> * to look up.
> @@ -96,6 +120,7 @@ static int lvds_encoder_remove(struct platform_device *pdev)
> {
> struct lvds_encoder *lvds_encoder = platform_get_drvdata(pdev);
>
> + kfree(lvds_encoder->bus_formats);
> drm_bridge_remove(&lvds_encoder->bridge);
>
> return 0;
> --
> 2.11.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-03-27 10:27 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 21:24 [PATCH v2 0/5] allow override of bus format in bridges Peter Rosin
2018-03-26 21:24 ` Peter Rosin
2018-03-26 21:24 ` [PATCH v2 1/5] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Peter Rosin
2018-03-26 21:24 ` [PATCH v2 1/5] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-04-03 22:19 ` [PATCH v2 1/5] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Laurent Pinchart
2018-04-03 22:19 ` [PATCH v2 1/5] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Laurent Pinchart
2018-04-03 22:19 ` [PATCH v2 1/5] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Laurent Pinchart
2018-03-26 21:24 ` [PATCH v2 2/5] drm: bridge: add API to query the expected input formats of bridges Peter Rosin
2018-03-26 21:24 ` Peter Rosin
2018-03-27 9:47 ` jacopo mondi
2018-03-27 9:47 ` jacopo mondi
2018-03-27 12:12 ` Peter Rosin
2018-03-27 12:12 ` Peter Rosin
2018-03-27 13:02 ` jacopo mondi
2018-03-27 13:02 ` jacopo mondi
2018-04-04 13:07 ` Laurent Pinchart
2018-04-04 13:07 ` Laurent Pinchart
2018-04-04 13:07 ` Laurent Pinchart
2018-04-04 14:40 ` Peter Rosin
2018-04-04 14:40 ` Peter Rosin
2018-03-27 13:04 ` Peter Rosin
2018-03-27 13:04 ` Peter Rosin
2018-03-26 21:24 ` [PATCH v2 3/5] drm: of: add display bus-format parser Peter Rosin
2018-03-26 21:24 ` Peter Rosin
2018-03-26 21:24 ` [PATCH v2 4/5] drm: bridge: lvds-encoder: allow specifying the input bus format Peter Rosin
2018-03-26 21:24 ` Peter Rosin
2018-03-27 10:27 ` jacopo mondi [this message]
2018-03-27 10:27 ` jacopo mondi
2018-03-27 10:27 ` jacopo mondi
2018-03-27 12:56 ` Peter Rosin
2018-03-27 12:56 ` Peter Rosin
2018-04-09 18:37 ` Rob Herring
2018-04-09 18:37 ` Rob Herring
2018-04-09 18:37 ` Rob Herring
2018-03-26 21:24 ` [PATCH v2 5/5] drm/atmel-hlcdc: take bridges into account when selecting output format Peter Rosin
2018-03-26 21:24 ` Peter Rosin
2018-03-28 7:08 ` [PATCH v2 0/5] allow override of bus format in bridges Daniel Vetter
2018-03-28 7:08 ` Daniel Vetter
2018-03-28 7:08 ` Daniel Vetter
2018-04-03 22:28 ` Laurent Pinchart
2018-04-03 22:28 ` Laurent Pinchart
2018-04-03 22:28 ` Laurent Pinchart
2018-04-03 22:31 ` Laurent Pinchart
2018-04-03 22:31 ` Laurent Pinchart
2018-04-03 22:31 ` Laurent Pinchart
2018-04-04 6:34 ` Daniel Vetter
2018-04-04 6:34 ` Daniel Vetter
2018-04-04 6:34 ` Daniel Vetter
2018-04-04 9:07 ` Laurent Pinchart
2018-04-04 9:07 ` Laurent Pinchart
2018-04-04 9:07 ` Laurent Pinchart
2018-04-04 12:35 ` Peter Rosin
2018-04-04 12:35 ` Peter Rosin
2018-04-09 7:04 ` Peter Rosin
2018-04-09 7:04 ` Peter Rosin
2018-04-09 12:51 ` Laurent Pinchart
2018-04-09 12:51 ` Laurent Pinchart
2018-04-09 12:51 ` Laurent Pinchart
2018-04-09 13:29 ` Peter Rosin
2018-04-09 13:29 ` 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=20180327102741.GN27746@w540 \
--to=jacopo@jmondi.org \
--cc=linux-arm-kernel@lists.infradead.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 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.