* [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select
@ 2021-06-02 20:37 Marek Vasut
2021-06-02 20:37 ` [PATCH V2 2/2] drm/bridge: lvds-codec: Add support for " Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Marek Vasut @ 2021-06-02 20:37 UTC (permalink / raw)
To: dri-devel
Cc: Marek Vasut, devicetree, ch, Rob Herring, Laurent Pinchart, Sam Ravnborg
Decoder input LVDS format is a property of the decoder chip or even
its strapping. Add DT property data-mapping the same way lvds-panel
does, to define the LVDS data mapping.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: devicetree@vger.kernel.org
To: dri-devel@lists.freedesktop.org
---
V2: - Use allOf
- Move the data-mapping to endpoint
---
.../bindings/display/bridge/lvds-codec.yaml | 53 ++++++++++++++-----
1 file changed, 41 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
index cacafa61e3f52..c493d007785ca 100644
--- a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
@@ -68,6 +68,18 @@ properties:
For LVDS encoders, port 1 is the LVDS output
For LVDS decoders, port 1 is the parallel output
+ properties:
+ endpoint:
+ properties:
+ data-mapping:
+ enum:
+ - jeida-18
+ - jeida-24
+ - vesa-24
+ description: |
+ The color signals mapping order. See details in
+ Documentation/devicetree/bindings/display/panel/lvds.yaml
+
required:
- port@0
- port@1
@@ -79,21 +91,38 @@ properties:
power-supply: true
-if:
- not:
- properties:
- compatible:
- contains:
- const: lvds-encoder
-then:
- properties:
- ports:
+allOf:
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: lvds-encoder
+ then:
+ properties:
+ ports:
+ properties:
+ port@0:
+ properties:
+ endpoint:
+ properties:
+ pclk-sample: false
+
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: lvds-decoder
+ then:
properties:
- port@0:
+ ports:
properties:
- endpoint:
+ port@1:
properties:
- pclk-sample: false
+ endpoint:
+ properties:
+ data-mapping: false
required:
- compatible
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V2 2/2] drm/bridge: lvds-codec: Add support for LVDS data mapping select
2021-06-02 20:37 [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select Marek Vasut
@ 2021-06-02 20:37 ` Marek Vasut
2021-06-10 18:11 ` [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document " Rob Herring
2021-06-14 18:09 ` Laurent Pinchart
2 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2021-06-02 20:37 UTC (permalink / raw)
To: dri-devel; +Cc: Marek Vasut, Sam Ravnborg, ch, Laurent Pinchart
Decoder input LVDS format is a property of the decoder chip or even
its strapping. Handle data-mapping the same way lvds-panel does. In
case data-mapping is not present, do nothing, since there are still
legacy bindings which do not specify this property.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org
---
V2: - Move the data-mapping to endpoint
---
drivers/gpu/drm/bridge/lvds-codec.c | 58 +++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
index 80ce6783d10a8..0719744e1cddb 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -23,6 +23,7 @@ struct lvds_codec {
struct regulator *vcc;
struct gpio_desc *powerdown_gpio;
u32 connector_type;
+ unsigned int bus_format;
};
static inline struct lvds_codec *to_lvds_codec(struct drm_bridge *bridge)
@@ -69,10 +70,33 @@ static void lvds_codec_disable(struct drm_bridge *bridge)
"Failed to disable regulator \"vcc\": %d\n", ret);
}
+static bool lvds_codec_mode_fixup(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adj)
+{
+ struct lvds_codec *lvds_codec = to_lvds_codec(bridge);
+ struct drm_encoder *encoder = bridge->encoder;
+ struct drm_device *ddev = encoder->dev;
+ struct drm_connector *connector;
+
+ /* If 'data-mapping' was not specified, do nothing. */
+ if (!lvds_codec->bus_format)
+ return true;
+
+ /* Patch in the LVDS format */
+ list_for_each_entry(connector, &ddev->mode_config.connector_list, head) {
+ drm_display_info_set_bus_formats(&connector->display_info,
+ &lvds_codec->bus_format, 1);
+ }
+
+ return true;
+}
+
static const struct drm_bridge_funcs funcs = {
.attach = lvds_codec_attach,
.enable = lvds_codec_enable,
.disable = lvds_codec_disable,
+ .mode_fixup = lvds_codec_mode_fixup,
};
static int lvds_codec_probe(struct platform_device *pdev)
@@ -82,7 +106,9 @@ static int lvds_codec_probe(struct platform_device *pdev)
struct device_node *bus_node;
struct drm_panel *panel;
struct lvds_codec *lvds_codec;
+ const char *mapping;
u32 val;
+ int ret;
lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL);
if (!lvds_codec)
@@ -143,6 +169,38 @@ static int lvds_codec_probe(struct platform_device *pdev)
of_node_put(bus_node);
}
+ /*
+ * Decoder input LVDS format is a property of the decoder chip or even
+ * its strapping. Handle data-mapping the same way lvds-panel does. In
+ * case data-mapping is not present, do nothing, since there are still
+ * legacy bindings which do not specify this property.
+ */
+ if (lvds_codec->connector_type != DRM_MODE_CONNECTOR_LVDS) {
+ bus_node = of_graph_get_endpoint_by_regs(dev->of_node, 1, 0);
+ if (!bus_node) {
+ dev_dbg(dev, "bus DT node not found\n");
+ return -ENXIO;
+ }
+
+ ret = of_property_read_string(bus_node, "data-mapping",
+ &mapping);
+ of_node_put(bus_node);
+ if (ret < 0) {
+ dev_err(dev, "missing 'data-mapping' DT property\n");
+ } else {
+ if (!strcmp(mapping, "jeida-18")) {
+ lvds_codec->bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
+ } else if (!strcmp(mapping, "jeida-24")) {
+ lvds_codec->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+ } else if (!strcmp(mapping, "vesa-24")) {
+ lvds_codec->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+ } else {
+ dev_err(dev, "invalid 'data-mapping' DT property\n");
+ return -EINVAL;
+ }
+ }
+ }
+
/*
* 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
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select
2021-06-02 20:37 [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select Marek Vasut
2021-06-02 20:37 ` [PATCH V2 2/2] drm/bridge: lvds-codec: Add support for " Marek Vasut
@ 2021-06-10 18:11 ` Rob Herring
2021-06-14 18:09 ` Laurent Pinchart
2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-06-10 18:11 UTC (permalink / raw)
To: Marek Vasut
Cc: devicetree, ch, dri-devel, Rob Herring, Laurent Pinchart, Sam Ravnborg
On Wed, 02 Jun 2021 22:37:30 +0200, Marek Vasut wrote:
> Decoder input LVDS format is a property of the decoder chip or even
> its strapping. Add DT property data-mapping the same way lvds-panel
> does, to define the LVDS data mapping.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: devicetree@vger.kernel.org
> To: dri-devel@lists.freedesktop.org
> ---
> V2: - Use allOf
> - Move the data-mapping to endpoint
> ---
> .../bindings/display/bridge/lvds-codec.yaml | 53 ++++++++++++++-----
> 1 file changed, 41 insertions(+), 12 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select
2021-06-02 20:37 [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select Marek Vasut
2021-06-02 20:37 ` [PATCH V2 2/2] drm/bridge: lvds-codec: Add support for " Marek Vasut
2021-06-10 18:11 ` [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document " Rob Herring
@ 2021-06-14 18:09 ` Laurent Pinchart
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2021-06-14 18:09 UTC (permalink / raw)
To: Marek Vasut; +Cc: devicetree, Rob Herring, Sam Ravnborg, ch, dri-devel
Hi Marek,
Thank you for the patch.
On Wed, Jun 02, 2021 at 10:37:30PM +0200, Marek Vasut wrote:
> Decoder input LVDS format is a property of the decoder chip or even
> its strapping. Add DT property data-mapping the same way lvds-panel
> does, to define the LVDS data mapping.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: devicetree@vger.kernel.org
> To: dri-devel@lists.freedesktop.org
> ---
> V2: - Use allOf
> - Move the data-mapping to endpoint
> ---
> .../bindings/display/bridge/lvds-codec.yaml | 53 ++++++++++++++-----
> 1 file changed, 41 insertions(+), 12 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
> index cacafa61e3f52..c493d007785ca 100644
> --- a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
> @@ -68,6 +68,18 @@ properties:
> For LVDS encoders, port 1 is the LVDS output
> For LVDS decoders, port 1 is the parallel output
>
> + properties:
> + endpoint:
> + properties:
> + data-mapping:
> + enum:
> + - jeida-18
> + - jeida-24
> + - vesa-24
> + description: |
> + The color signals mapping order. See details in
> + Documentation/devicetree/bindings/display/panel/lvds.yaml
> +
> required:
> - port@0
> - port@1
> @@ -79,21 +91,38 @@ properties:
>
> power-supply: true
>
> -if:
> - not:
> - properties:
> - compatible:
> - contains:
> - const: lvds-encoder
> -then:
> - properties:
> - ports:
> +allOf:
> + - if:
> + not:
> + properties:
> + compatible:
> + contains:
> + const: lvds-encoder
> + then:
> + properties:
> + ports:
> + properties:
> + port@0:
> + properties:
> + endpoint:
> + properties:
> + pclk-sample: false
> +
> + - if:
> + not:
> + properties:
> + compatible:
> + contains:
> + const: lvds-decoder
Is this correct ? The condition says that if it's an encoder (not a
decoder), then the data-mapping property on port 1 (the output port,
thus and LVDS port) is not allowed. I think this should be for decoders,
not encoders. You can thus combine the two conditions:
allOf:
- if:
not:
properties:
compatible:
contains:
const: lvds-encoder
then:
properties:
ports:
properties:
port@0:
properties:
endpoint:
properties:
pclk-sample: false
port@1:
properties:
endpoint:
properties:
data-mapping: false
You could also drop the allOf, or keep it to avoid whitespace churn when
a new condition will need to be added.
> + then:
> properties:
> - port@0:
> + ports:
> properties:
> - endpoint:
> + port@1:
> properties:
> - pclk-sample: false
> + endpoint:
> + properties:
> + data-mapping: false
>
> required:
> - compatible
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select
@ 2021-07-26 20:16 Marek Vasut
0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2021-07-26 20:16 UTC (permalink / raw)
To: dri-devel
Cc: Marek Vasut, devicetree, Rob Herring, Sam Ravnborg, Laurent Pinchart
Decoder input LVDS format is a property of the decoder chip or even
its strapping. Add DT property data-mapping the same way lvds-panel
does, to define the LVDS data mapping.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: devicetree@vger.kernel.org
To: dri-devel@lists.freedesktop.org
---
V2: Rebase on latest next
---
.../bindings/display/bridge/lvds-codec.yaml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
index 304a1367faaa7..33e0c08933b72 100644
--- a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
@@ -64,6 +64,15 @@ properties:
- port@0
- port@1
+ data-mapping:
+ enum:
+ - jeida-18
+ - jeida-24
+ - vesa-24
+ description: |
+ The color signals mapping order. See details in
+ Documentation/devicetree/bindings/display/panel/lvds.yaml
+
powerdown-gpios:
description:
The GPIO used to control the power down line of this device.
@@ -71,6 +80,16 @@ properties:
power-supply: true
+if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: lvds-decoder
+then:
+ properties:
+ data-mapping: false
+
required:
- compatible
- ports
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-26 20:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 20:37 [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document LVDS data mapping select Marek Vasut
2021-06-02 20:37 ` [PATCH V2 2/2] drm/bridge: lvds-codec: Add support for " Marek Vasut
2021-06-10 18:11 ` [PATCH V2 1/2] dt-bindings: display: bridge: lvds-codec: Document " Rob Herring
2021-06-14 18:09 ` Laurent Pinchart
2021-07-26 20:16 Marek Vasut
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).