Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686560

[PATCH 10/18] drm/sun4i: tcon: Move out the tcon0 common setup

From Maxime Ripard <maxime.ripard@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH 10/18] drm/sun4i: tcon: Move out the tcon0 common setup
Date 2017-07-13 16:20 +0200
Message-ID <u2N8f-6Ff-21@gated-at.bofh.it> (permalink)
References <u2N8d-6Ff-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Some channel0 setup has to be done, no matter what the output interface is
(RGB, CPU, LVDS). Move that code into a common function in order to avoid
duplication.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index a3bbf9994cfa..f051862d635e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -125,15 +125,26 @@ static int sun4i_tcon_get_clk_delay(struct drm_display_mode *mode,
 	return delay;
 }
 
-static void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
-				 struct drm_display_mode *mode)
+static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
+					struct drm_display_mode *mode)
+{
+	/* Configure the dot clock */
+	clk_set_rate_protect(tcon->dclk, mode->crtc_clock * 1000);
+
+	/* Set the resolution */
+	regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
+		     SUN4I_TCON0_BASIC0_X(mode->crtc_hdisplay) |
+		     SUN4I_TCON0_BASIC0_Y(mode->crtc_vdisplay));
+}
+
+static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
+				     struct drm_display_mode *mode)
 {
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
 
-	/* Configure the dot clock */
-	clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -141,11 +152,6 @@ static void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
 			   SUN4I_TCON0_CTL_CLK_DELAY_MASK,
 			   SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
 
-	/* Set the resolution */
-	regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
-		     SUN4I_TCON0_BASIC0_X(mode->crtc_hdisplay) |
-		     SUN4I_TCON0_BASIC0_Y(mode->crtc_vdisplay));
-
 	/*
 	 * This is called a backporch in the register documentation,
 	 * but it really is the back porch + hsync
@@ -295,7 +301,7 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, struct drm_encoder *encoder,
 {
 	switch (encoder->encoder_type) {
 	case DRM_MODE_ENCODER_NONE:
-		sun4i_tcon0_mode_set(tcon, mode);
+		sun4i_tcon0_mode_set_rgb(tcon, mode);
 		break;
 	case DRM_MODE_ENCODER_TVDAC:
 		/*
-- 
git-series 0.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/18] drm/sun4i: Allwinner MIPI-DSI support Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
  [PATCH 06/18] drm/sun4i: tcon: Don't rely on encoders to enable the TCON Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 06/18] drm/sun4i: tcon: Don't rely on encoders to enable  the TCON Chen-Yu Tsai <wens@csie.org> - 2017-07-14 05:50 +0200
  [PATCH 04/18] drm/sun4i: Remove useless atomic_check Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 04/18] drm/sun4i: Remove useless atomic_check Chen-Yu Tsai <wens@csie.org> - 2017-07-14 05:20 +0200
      Re: [PATCH 04/18] drm/sun4i: Remove useless atomic_check Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-17 10:50 +0200
  [PATCH 15/18] drm/panel: Add Huarui LHR050H41 panel driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 15/18] drm/panel: Add Huarui LHR050H41 panel driver Andrzej Hajda <a.hajda@samsung.com> - 2017-07-14 11:30 +0200
  [PATCH 08/18] drm/sun4i: tcon: Add TRI finish interrupt for vblank Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 08/18] drm/sun4i: tcon: Add TRI finish interrupt for vblank Chen-Yu Tsai <wens@csie.org> - 2017-07-14 06:00 +0200
  [PATCH 07/18] drm/sun4i: tcon: Don't rely on encoders to set the TCON mode Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 07/18] drm/sun4i: tcon: Don't rely on encoders to set the  TCON mode Chen-Yu Tsai <wens@csie.org> - 2017-07-14 06:00 +0200
  [PATCH 10/18] drm/sun4i: tcon: Move out the tcon0 common setup Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 10/18] drm/sun4i: tcon: Move out the tcon0 common setup kbuild test robot <lkp@intel.com> - 2017-07-14 12:00 +0200
    Re: [PATCH 10/18] drm/sun4i: tcon: Move out the tcon0 common setup Chen-Yu Tsai <wens@csie.org> - 2017-07-18 05:50 +0200
  [PATCH 16/18] arm: dts: sun8i: a33: Add the DSI-related nodes Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
  [PATCH 09/18] drm/sun4i: tcon: Adjust dotclock dividers range Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 09/18] drm/sun4i: tcon: Adjust dotclock dividers range Chen-Yu Tsai <wens@csie.org> - 2017-07-14 06:20 +0200
  [PATCH 17/18] arm: dts: sun8i: Add BananaPI M2-Magic DTS Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 17/18] arm: dts: sun8i: Add BananaPI M2-Magic DTS Chen-Yu Tsai <wens@csie.org> - 2017-07-14 06:50 +0200
      Re: [PATCH 17/18] arm: dts: sun8i: Add BananaPI M2-Magic DTS Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-17 11:10 +0200
  [PATCH 13/18] dt-bindings: vendor: Add Huarui Lighting Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 13/18] dt-bindings: vendor: Add Huarui Lighting Chen-Yu Tsai <wens@csie.org> - 2017-07-14 10:00 +0200
  [PATCH 01/18] regmap: mmio: Add function to attach a clock Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 01/18] regmap: mmio: Add function to attach a clock Mark Brown <broonie@kernel.org> - 2017-07-13 18:10 +0200
      Re: [PATCH 01/18] regmap: mmio: Add function to attach a clock Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-17 11:10 +0200
  [PATCH 02/18] drm/sun4i: Add if statement instead of depends on Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 02/18] drm/sun4i: Add if statement instead of depends on Chen-Yu Tsai <wens@csie.org> - 2017-07-14 05:10 +0200
      Re: [PATCH 02/18] drm/sun4i: Add if statement instead of depends on Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-17 10:50 +0200
  [PATCH 18/18] [DO NOT MERGE] arm: dts: sun8i: bpi-m2m: Add DSI display Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
  [PATCH 03/18] drm/sun4i: Realign Makefile padding and reorder it Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:20 +0200
    Re: [PATCH 03/18] drm/sun4i: Realign Makefile padding and reorder it Chen-Yu Tsai <wens@csie.org> - 2017-07-14 05:20 +0200

csiph-web