All of lore.kernel.org
 help / color / mirror / Atom feed
From: Madhav Chauhan <madhav.chauhan@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com, paulo.r.zanoni@intel.com, rodrigo.vivi@intel.com
Subject: [PATCH 20/20] drm/i915/icl: Configure DSI transcoders
Date: Fri, 15 Jun 2018 15:51:24 +0530	[thread overview]
Message-ID: <1529058084-31777-21-git-send-email-madhav.chauhan@intel.com> (raw)
In-Reply-To: <1529058084-31777-1-git-send-email-madhav.chauhan@intel.com>

This patch programs DSI operation mode, pixel format,
BGR info, link calibration etc for the DSI transcoder.
This patch also extract BGR info of the DSI panel from
VBT and save it inside struct intel_dsi which used for
configuring DSI transcoder.

Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.h     |  3 ++
 drivers/gpu/drm/i915/intel_dsi_new.c | 87 +++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dsi_vbt.c |  1 +
 3 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 16964c2..fdde724 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -81,6 +81,9 @@ struct intel_dsi {
 	u16 dcs_backlight_ports;
 	u16 dcs_cabc_ports;
 
+	/* RGB or BGR */
+	unsigned int bgr_enabled;
+
 	u8 pixel_overlap;
 	u32 port_bits;
 	u32 bw_timer;
diff --git a/drivers/gpu/drm/i915/intel_dsi_new.c b/drivers/gpu/drm/i915/intel_dsi_new.c
index dd2f186..21fd1b7 100644
--- a/drivers/gpu/drm/i915/intel_dsi_new.c
+++ b/drivers/gpu/drm/i915/intel_dsi_new.c
@@ -28,8 +28,7 @@
 
 #include "intel_dsi.h"
 
-static enum transcoder __attribute__((unused)) dsi_port_to_transcoder(
-								enum port port)
+static enum transcoder dsi_port_to_transcoder(enum port port)
 {
 	if (port == PORT_A)
 		return TRANSCODER_DSI_0;
@@ -338,6 +337,87 @@ static void gen11_dsi_setup_dphy_timings(struct intel_encoder *encoder)
 	}
 }
 
+static void gen11_dsi_configure_transcoder(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	u32 tmp;
+	enum port port;
+	enum transcoder dsi_trans;
+
+	for_each_dsi_port(port, intel_dsi->ports) {
+		dsi_trans = dsi_port_to_transcoder(port);
+		tmp = I915_READ(DSI_TRANS_FUNC_CONF(dsi_trans));
+
+		if (intel_dsi->eotp_pkt == 0)
+			tmp |= EOTP_DISABLED;
+		else
+			tmp &= ~EOTP_DISABLED;
+
+		/* enable link calibration if freq > 1.5Gbps */
+		if (intel_dsi->bitrate_khz >= (1500 * 1000)) {
+			tmp &= ~LINK_CALIBRATION_MASK;
+			tmp |= LINK_CALIBRATION(
+					CALIBRATION_ENABLED_INITIAL_ONLY);
+		}
+
+		/* configure continuous clock */
+		tmp &= ~CONTINUOUS_CLK_MASK;
+		if (intel_dsi->clock_stop)
+			tmp |= CONTINUOUS_CLK(CLK_ENTER_LP_AFTER_DATA);
+		else
+			tmp |= CONTINUOUS_CLK(CLK_HS_CONTINUOUS);
+
+		/* configure buffer threshold limit to minimum */
+		tmp &= ~PIX_BUF_THRESHOLD_MASK;
+		tmp |= PIX_BUF_THRESHOLD(PIX_BUF_THRESHOLD_1_4);
+
+		/* set virtual channel to '0' */
+		tmp &= ~PIX_VIRT_CHAN_MASK;
+		tmp |= PIX_VIRT_CHAN(0x0);
+
+		/* program BGR transmission */
+		if (intel_dsi->bgr_enabled)
+			tmp |= BGR_TRANSMISSION;
+
+		/* select pixel format */
+		tmp &= ~PIX_FMT_MASK;
+
+		switch (intel_dsi->pixel_format) {
+		case MIPI_DSI_FMT_RGB888:
+			tmp |= PIX_FMT(PIX_FMT_RGB888);
+			break;
+		case MIPI_DSI_FMT_RGB666:
+			tmp |= PIX_FMT(PIX_FMT_RGB666_LOOSE);
+			break;
+		case MIPI_DSI_FMT_RGB666_PACKED:
+			tmp |= PIX_FMT(PIX_FMT_RGB666_PACKED);
+			break;
+		case MIPI_DSI_FMT_RGB565:
+			tmp |= PIX_FMT(PIX_FMT_RGB565);
+			break;
+		default:
+			DRM_ERROR("DSI pixel format unsupported\n");
+		}
+
+		/* program DSI operation mode */
+		if (intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE) {
+			tmp &= ~OP_MODE_MASK;
+			if (intel_dsi->video_mode_format ==
+					VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE) {
+				tmp |= OP_MODE(VIDEO_MODE_SYNC_PULSE);
+			} else if (intel_dsi->video_mode_format ==
+					VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS) {
+				tmp |= OP_MODE(VIDEO_MODE_SYNC_EVENT);
+			} else {
+				DRM_ERROR("DSI Video Mode unsupported\n");
+			}
+		}
+
+		I915_WRITE(DSI_TRANS_FUNC_CONF(dsi_trans), tmp);
+	}
+}
+
 static void gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder)
 {
 	/* step 4a: power up all lanes of the DDI used by DSI */
@@ -354,6 +434,9 @@ static void gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder)
 
 	/* step 4e: setup D-PHY timings */
 	gen11_dsi_setup_dphy_timings(encoder);
+
+	/* Step (4h, 4i, 4j, 4k): Configure transcoder */
+	gen11_dsi_configure_transcoder(encoder);
 }
 
 static void __attribute__((unused)) gen11_dsi_pre_enable(
diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index a3d71fb..57a44a2 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -542,6 +542,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
 	intel_dsi->video_frmt_cfg_bits =
 		mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
+	intel_dsi->bgr_enabled = mipi_config->rgb_flip;
 
 	pclk = mode->clock;
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-06-15 10:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 10:21 [PATCH 00/20] ICELAKE DSI DRIVER Madhav Chauhan
2018-06-15 10:21 ` [PATCH 01/20] drm/i915/icl: Define register for DSI PLL Madhav Chauhan
2018-06-29 11:43   ` Jani Nikula
2018-06-29 13:31     ` Chauhan, Madhav
2018-06-29 14:18       ` Jani Nikula
2018-06-15 10:21 ` [PATCH 02/20] drm/i915/icl: Program DSI Escape clock Divider Madhav Chauhan
2018-06-15 17:30   ` Paulo Zanoni
2018-06-15 18:00     ` Chauhan, Madhav
2018-06-15 18:11       ` Paulo Zanoni
2018-06-20  8:14         ` Chauhan, Madhav
2018-06-15 10:21 ` [PATCH 03/20] drm/i915/icl: Define DSI mode ctl register Madhav Chauhan
2018-06-29 11:51   ` Jani Nikula
2018-06-29 13:59     ` Chauhan, Madhav
2018-06-29 14:18       ` Jani Nikula
2018-06-15 10:21 ` [PATCH 04/20] drm/i915/icl: Enable DSI IO power Madhav Chauhan
2018-07-02  9:56   ` Jani Nikula
2018-07-02 10:03     ` Chauhan, Madhav
2018-07-02 10:22       ` Jani Nikula
2018-07-02 10:26         ` Chauhan, Madhav
2018-06-15 10:21 ` [PATCH 05/20] drm/i915/icl: Define PORT_CL_DW_10 register Madhav Chauhan
2018-06-29 13:53   ` Jani Nikula
2018-07-02  8:22     ` Chauhan, Madhav
2018-07-02 10:12       ` Jani Nikula
2018-07-02 10:17         ` Chauhan, Madhav
2018-06-15 10:21 ` [PATCH 06/20] drm/i915/icl: Power down unused DSI lanes Madhav Chauhan
2018-06-29 13:57   ` Jani Nikula
2018-07-02 12:42   ` Jani Nikula
2018-07-02 12:43     ` Chauhan, Madhav
2018-06-15 10:21 ` [PATCH 07/20] drm/i915/icl: Define AUX lane registers for Port A/B Madhav Chauhan
2018-06-15 10:21 ` [PATCH 08/20] drm/i915/icl: Configure lane sequencing of combo phy transmitter Madhav Chauhan
2018-06-15 10:21 ` [PATCH 09/20] drm/i915/icl: DSI vswing programming sequence Madhav Chauhan
2018-06-15 10:21 ` [PATCH 10/20] drm/i915/icl: Enable DDI Buffer Madhav Chauhan
2018-06-15 10:21 ` [PATCH 11/20] drm/i915/icl: Define T_INIT_MASTER registers Madhav Chauhan
2018-06-15 10:21 ` [PATCH 12/20] drm/i915/icl: Program " Madhav Chauhan
2018-06-15 10:21 ` [PATCH 13/20] drm/i915/icl: Define data/clock lanes dphy timing registers Madhav Chauhan
2018-06-15 10:21 ` [PATCH 14/20] drm/i915/icl: Program DSI clock and data lane timing params Madhav Chauhan
2018-06-15 10:21 ` [PATCH 15/20] drm/i915/icl: Define TA_TIMING_PARAM registers Madhav Chauhan
2018-06-15 10:21 ` [PATCH 16/20] drm/i915/icl: Program " Madhav Chauhan
2018-06-15 10:21 ` [PATCH 17/20] drm/i915/icl: Get DSI transcoder for a given port Madhav Chauhan
2018-06-15 10:21 ` [PATCH 18/20] drm/i915/icl: Add macros for MMIO of DSI transcoder registers Madhav Chauhan
2018-06-15 10:21 ` [PATCH 19/20] drm/i915/icl: Define TRANS_DSI_FUNC_CONF register Madhav Chauhan
2018-06-15 10:21 ` Madhav Chauhan [this message]
2018-06-15 11:06 ` ✗ Fi.CI.CHECKPATCH: warning for ICELAKE DSI DRIVER Patchwork
2018-06-15 11:12 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-06-15 11:21 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-15 18:14 ` ✓ Fi.CI.IGT: " Patchwork
2018-06-27  6:32 ` [PATCH 00/20] " Chauhan, Madhav

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=1529058084-31777-21-git-send-email-madhav.chauhan@intel.com \
    --to=madhav.chauhan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /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.