All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: Thierry Reding <thierry.reding@gmail.com>,
	David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	linux-sunxi@googlegroups.com,
	Mark Van den Borre <mark@fosdem.org>,
	Gerry Demaret <gerry@fosdem.org>, Luc Verhaegen <libv@skynet.be>,
	Paul Kocialkowski <contact@paulk.fr>
Subject: [PATCH v3 2/8] drm/sun4i: tcon: Get the connector from the encoder in RGB setup
Date: Wed,  7 Nov 2018 19:18:37 +0100	[thread overview]
Message-ID: <20181107181843.27628-3-contact@paulk.fr> (raw)
In-Reply-To: <20181107181843.27628-1-contact@paulk.fr>

Features such as dithering and pixel data edge configuration currently
rely on the panel registered with the TCON driver. However, bridges are
also supported in addition to panels for RGB setup.

Instead of retrieving the connector from the panel, get it from the
encoder with the dedicated helper.

Even in the case of bridges, the connector is registered with the
encoder from our driver and is accessible when iterating connectors.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 5e1f762fc3db..262ffb6b0f82 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -481,6 +481,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -492,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -557,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
-
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);
 
 	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
 			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Mark Van den Borre <mark-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org>,
	Gerry Demaret <gerry-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org>,
	Luc Verhaegen <libv-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>,
	Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
Subject: [PATCH v3 2/8] drm/sun4i: tcon: Get the connector from the encoder in RGB setup
Date: Wed,  7 Nov 2018 19:18:37 +0100	[thread overview]
Message-ID: <20181107181843.27628-3-contact@paulk.fr> (raw)
In-Reply-To: <20181107181843.27628-1-contact-W9ppeneeCTY@public.gmane.org>

Features such as dithering and pixel data edge configuration currently
rely on the panel registered with the TCON driver. However, bridges are
also supported in addition to panels for RGB setup.

Instead of retrieving the connector from the panel, get it from the
encoder with the dedicated helper.

Even in the case of bridges, the connector is registered with the
encoder from our driver and is accessible when iterating connectors.

Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 5e1f762fc3db..262ffb6b0f82 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -481,6 +481,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -492,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -557,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
-
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);
 
 	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
 			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: contact@paulk.fr (Paul Kocialkowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/8] drm/sun4i: tcon: Get the connector from the encoder in RGB setup
Date: Wed,  7 Nov 2018 19:18:37 +0100	[thread overview]
Message-ID: <20181107181843.27628-3-contact@paulk.fr> (raw)
In-Reply-To: <20181107181843.27628-1-contact@paulk.fr>

Features such as dithering and pixel data edge configuration currently
rely on the panel registered with the TCON driver. However, bridges are
also supported in addition to panels for RGB setup.

Instead of retrieving the connector from the panel, get it from the
encoder with the dedicated helper.

Even in the case of bridges, the connector is registered with the
encoder from our driver and is accessible when iterating connectors.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 5e1f762fc3db..262ffb6b0f82 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -481,6 +481,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -492,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -557,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
-
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);
 
 	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
 			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
-- 
2.19.1

  parent reply	other threads:[~2018-11-07 18:19 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 18:18 [PATCH v3 0/8] BL035-RGB-002 3.5" LCD sunxi DRM support Paul Kocialkowski
2018-11-07 18:18 ` Paul Kocialkowski
2018-11-07 18:18 ` Paul Kocialkowski
2018-11-07 18:18 ` [PATCH v3 1/8] drm/sun4i: tcon: Pass encoder to RGB setup function Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18 ` Paul Kocialkowski [this message]
2018-11-07 18:18   ` [PATCH v3 2/8] drm/sun4i: tcon: Get the connector from the encoder in RGB setup Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18 ` [PATCH v3 3/8] drm/sun4i: tcon: Support an active-low DE signal with RGB interface Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18 ` [PATCH v3 4/8] dt-bindings: Add vendor prefix for LeMaker Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
     [not found]   ` <20181107181843.27628-5-contact-W9ppeneeCTY@public.gmane.org>
2018-11-12 23:37     ` Rob Herring
2018-11-12 23:37       ` Rob Herring
2019-01-28 16:00   ` Thierry Reding
2019-01-28 16:00     ` Thierry Reding
2019-01-28 16:00     ` Thierry Reding
2018-11-07 18:18 ` [PATCH v3 5/8] dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
     [not found]   ` <20181107181843.27628-6-contact-W9ppeneeCTY@public.gmane.org>
2018-11-12 23:37     ` Rob Herring
2018-11-12 23:37       ` Rob Herring
2019-01-28 16:00   ` Thierry Reding
2019-01-28 16:00     ` Thierry Reding
2019-01-28 16:00     ` Thierry Reding
2018-11-07 18:18 ` [PATCH v3 6/8] drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2019-01-28 16:01   ` Thierry Reding
2019-01-28 16:01     ` Thierry Reding
2019-01-28 16:01     ` Thierry Reding
2018-11-07 18:18 ` [PATCH NOT FOR MERGE v3 7/8] ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18 ` [PATCH NOT FOR MERGE v3 8/8] ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-07 18:18   ` Paul Kocialkowski
2018-11-09  8:46 ` [PATCH v3 0/8] BL035-RGB-002 3.5" LCD sunxi DRM support Maxime Ripard
2018-11-09  8:46   ` Maxime Ripard
2018-11-09  8:46   ` Maxime Ripard

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=20181107181843.27628-3-contact@paulk.fr \
    --to=contact@paulk.fr \
    --cc=airlied@linux.ie \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gerry@fosdem.org \
    --cc=libv@skynet.be \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=mark@fosdem.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=wens@csie.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.