dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property
@ 2022-04-07 18:56 Marek Vasut
  2022-04-07 18:56 ` [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing Marek Vasut
  2022-04-08 20:52 ` [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Rob Herring
  0 siblings, 2 replies; 5+ messages in thread
From: Marek Vasut @ 2022-04-07 18:56 UTC (permalink / raw)
  To: dri-devel
  Cc: Marek Vasut, devicetree, Laurent Pinchart, robert.foss,
	Rob Herring, Maxime Ripard, Thomas Zimmermann, Sam Ravnborg,
	Jagan Teki

It is necessary to specify the number of connected/used DSI data lanes when
using the DSI input port of this bridge. Document the 'data-lanes' property
of the DSI input port.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: devicetree@vger.kernel.org
To: dri-devel@lists.freedesktop.org
---
NOTE: This is consistent with all the other DSI panel and bridge bindings which
      document 'data-lanes' property, all of which already use OF graph and have
      the 'data-lanes' property in the port@N subnode, see:
      $ git grep -l data-lanes Documentation/devicetree/bindings/display/
---
 .../display/bridge/chipone,icn6211.yaml        | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
index 7257fd0ae4da8..4f0b7c71313c3 100644
--- a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
@@ -41,10 +41,26 @@ properties:
 
     properties:
       port@0:
-        $ref: /schemas/graph.yaml#/properties/port
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
         description:
           Video port for MIPI DSI input
 
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              data-lanes:
+                description: array of physical DSI data lane indexes.
+                minItems: 1
+                items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+
       port@1:
         $ref: /schemas/graph.yaml#/properties/port
         description:
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing
  2022-04-07 18:56 [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Marek Vasut
@ 2022-04-07 18:56 ` Marek Vasut
  2022-04-19 17:20   ` Robert Foss
  2022-04-08 20:52 ` [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Rob Herring
  1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2022-04-07 18:56 UTC (permalink / raw)
  To: dri-devel
  Cc: Marek Vasut, Laurent Pinchart, robert.foss, Maxime Ripard,
	Thomas Zimmermann, Sam Ravnborg, Jagan Teki

The driver currently hard-codes DSI lane count to two, however the chip
is capable of operating in 1..4 DSI lanes mode. Parse 'data-lanes' DT
property and program the result into DSI_CTRL register.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
To: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
index 6ce0633d4c089..e2b599a44275c 100644
--- a/drivers/gpu/drm/bridge/chipone-icn6211.c
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -395,6 +395,11 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
 	/* dsi specific sequence */
 	chipone_writeb(icn, SYNC_EVENT_DLY, 0x80);
 	chipone_writeb(icn, HFP_MIN, hfp & 0xff);
+
+	/* DSI data lane count */
+	chipone_writeb(icn, DSI_CTRL,
+		    DSI_CTRL_UNKNOWN | DSI_CTRL_DSI_LANES(icn->dsi->lanes - 1));
+
 	chipone_writeb(icn, MIPI_PD_CK_LANE, 0xa0);
 	chipone_writeb(icn, PLL_CTRL(12), 0xff);
 	chipone_writeb(icn, MIPI_PN_SWAP, 0x00);
@@ -480,9 +485,23 @@ static void chipone_mode_set(struct drm_bridge *bridge,
 static int chipone_dsi_attach(struct chipone *icn)
 {
 	struct mipi_dsi_device *dsi = icn->dsi;
-	int ret;
+	struct device *dev = icn->dev;
+	struct device_node *endpoint;
+	int dsi_lanes, ret;
+
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
+	dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
+	of_node_put(endpoint);
+
+	/*
+	 * If the 'data-lanes' property does not exist in DT or is invalid,
+	 * default to previously hard-coded behavior, which was 4 data lanes.
+	 */
+	if (dsi_lanes >= 1 && dsi_lanes <= 4)
+		icn->dsi->lanes = dsi_lanes;
+	else
+		icn->dsi->lanes = 4;
 
-	dsi->lanes = 4;
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
 			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property
  2022-04-07 18:56 [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Marek Vasut
  2022-04-07 18:56 ` [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing Marek Vasut
@ 2022-04-08 20:52 ` Rob Herring
  2022-04-08 20:54   ` Marek Vasut
  1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2022-04-08 20:52 UTC (permalink / raw)
  To: Marek Vasut
  Cc: devicetree, Laurent Pinchart, robert.foss, dri-devel,
	Rob Herring, Maxime Ripard, Thomas Zimmermann, Sam Ravnborg,
	Jagan Teki

On Thu, 07 Apr 2022 20:56:16 +0200, Marek Vasut wrote:
> It is necessary to specify the number of connected/used DSI data lanes when
> using the DSI input port of this bridge. Document the 'data-lanes' property
> of the DSI input port.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: devicetree@vger.kernel.org
> To: dri-devel@lists.freedesktop.org
> ---
> NOTE: This is consistent with all the other DSI panel and bridge bindings which
>       document 'data-lanes' property, all of which already use OF graph and have
>       the 'data-lanes' property in the port@N subnode, see:
>       $ git grep -l data-lanes Documentation/devicetree/bindings/display/
> ---
>  .../display/bridge/chipone,icn6211.yaml        | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 


Please add Acked-by/Reviewed-by tags when posting new versions. However,
there's no need to repost patches *only* to add the tags. The upstream
maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property
  2022-04-08 20:52 ` [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Rob Herring
@ 2022-04-08 20:54   ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2022-04-08 20:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, Laurent Pinchart, robert.foss, dri-devel,
	Rob Herring, Maxime Ripard, Thomas Zimmermann, Sam Ravnborg,
	Jagan Teki

On 4/8/22 22:52, Rob Herring wrote:
> On Thu, 07 Apr 2022 20:56:16 +0200, Marek Vasut wrote:
>> It is necessary to specify the number of connected/used DSI data lanes when
>> using the DSI input port of this bridge. Document the 'data-lanes' property
>> of the DSI input port.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Jagan Teki <jagan@amarulasolutions.com>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Maxime Ripard <maxime@cerno.tech>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Robert Foss <robert.foss@linaro.org>
>> Cc: Sam Ravnborg <sam@ravnborg.org>
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: devicetree@vger.kernel.org
>> To: dri-devel@lists.freedesktop.org
>> ---
>> NOTE: This is consistent with all the other DSI panel and bridge bindings which
>>        document 'data-lanes' property, all of which already use OF graph and have
>>        the 'data-lanes' property in the port@N subnode, see:
>>        $ git grep -l data-lanes Documentation/devicetree/bindings/display/
>> ---
>>   .../display/bridge/chipone,icn6211.yaml        | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
> 
> 
> Please add Acked-by/Reviewed-by tags when posting new versions. However,
> there's no need to repost patches *only* to add the tags. The upstream
> maintainer will do that for acks received on the version they apply.
> 
> If a tag was not added on purpose, please state why and what changed.

I suspect Maxime wants to have one more look at this and the 2/2 patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing
  2022-04-07 18:56 ` [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing Marek Vasut
@ 2022-04-19 17:20   ` Robert Foss
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Foss @ 2022-04-19 17:20 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Laurent Pinchart, dri-devel, Maxime Ripard, Thomas Zimmermann,
	Sam Ravnborg, Jagan Teki

On Thu, 7 Apr 2022 at 20:56, Marek Vasut <marex@denx.de> wrote:
>
> The driver currently hard-codes DSI lane count to two, however the chip
> is capable of operating in 1..4 DSI lanes mode. Parse 'data-lanes' DT
> property and program the result into DSI_CTRL register.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> To: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/bridge/chipone-icn6211.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
> index 6ce0633d4c089..e2b599a44275c 100644
> --- a/drivers/gpu/drm/bridge/chipone-icn6211.c
> +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
> @@ -395,6 +395,11 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
>         /* dsi specific sequence */
>         chipone_writeb(icn, SYNC_EVENT_DLY, 0x80);
>         chipone_writeb(icn, HFP_MIN, hfp & 0xff);
> +
> +       /* DSI data lane count */
> +       chipone_writeb(icn, DSI_CTRL,
> +                   DSI_CTRL_UNKNOWN | DSI_CTRL_DSI_LANES(icn->dsi->lanes - 1));
> +
>         chipone_writeb(icn, MIPI_PD_CK_LANE, 0xa0);
>         chipone_writeb(icn, PLL_CTRL(12), 0xff);
>         chipone_writeb(icn, MIPI_PN_SWAP, 0x00);
> @@ -480,9 +485,23 @@ static void chipone_mode_set(struct drm_bridge *bridge,
>  static int chipone_dsi_attach(struct chipone *icn)
>  {
>         struct mipi_dsi_device *dsi = icn->dsi;
> -       int ret;
> +       struct device *dev = icn->dev;
> +       struct device_node *endpoint;
> +       int dsi_lanes, ret;
> +
> +       endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
> +       dsi_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> +       of_node_put(endpoint);
> +
> +       /*
> +        * If the 'data-lanes' property does not exist in DT or is invalid,
> +        * default to previously hard-coded behavior, which was 4 data lanes.
> +        */
> +       if (dsi_lanes >= 1 && dsi_lanes <= 4)
> +               icn->dsi->lanes = dsi_lanes;
> +       else
> +               icn->dsi->lanes = 4;
>
> -       dsi->lanes = 4;
>         dsi->format = MIPI_DSI_FMT_RGB888;
>         dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
>                           MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;

Reviewed-by: Robert Foss <robert.foss@linaro.org>

Fixed checkpatch --strict format warning & applied to drm-misc-next.

Rob.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-19 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 18:56 [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Marek Vasut
2022-04-07 18:56 ` [PATCH 2/2] drm: bridge: icn6211: Add DSI lane count DT property parsing Marek Vasut
2022-04-19 17:20   ` Robert Foss
2022-04-08 20:52 ` [PATCH 1/2] dt-bindings: display: bridge: icn6211: Document DSI data-lanes property Rob Herring
2022-04-08 20:54   ` 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).