From patchwork Wed Oct 16 12:52:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kulkarni, Vandita" X-Patchwork-Id: 11193361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3641176 for ; Wed, 16 Oct 2019 13:22:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1EADC2067B for ; Wed, 16 Oct 2019 13:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EADC2067B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C7B46E97D; Wed, 16 Oct 2019 13:22:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6461B6E97E for ; Wed, 16 Oct 2019 13:22:04 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 06:22:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,303,1566889200"; d="scan'208";a="186148053" Received: from vandita-desktop.iind.intel.com ([10.223.74.218]) by orsmga007.jf.intel.com with ESMTP; 16 Oct 2019 06:22:01 -0700 From: Vandita Kulkarni To: intel-gfx@lists.freedesktop.org Date: Wed, 16 Oct 2019 18:22:36 +0530 Message-Id: <20191016125236.3447-2-vandita.kulkarni@intel.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a In-Reply-To: <20191016125236.3447-1-vandita.kulkarni@intel.com> References: <20191016125236.3447-1-vandita.kulkarni@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC 1/1] drm/i915/dsi: Add dsi_state in crtc_state X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, ville.syrjala@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This patch add dsi_state which provides dsi operation mode and the link mode. These are needed in order to check if they were differently configured by GOP. In present case the GOP enables dsi in periodic update mode, whereas we need to enable it in TE_GATE command mode. In which case a disable-enable sequence would be required. --- drivers/gpu/drm/i915/display/icl_dsi.c | 39 +++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 12 ++++++ 2 files changed, 51 insertions(+) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 6e398c33a524..0a9323e95866 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -1238,6 +1238,37 @@ static void gen11_dsi_get_timings(struct intel_encoder *encoder, adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vtotal; } +static bool +gen11_dsi_dual_link_enabled(struct drm_i915_private *dev_priv) +{ + u32 val1, val2; + + val1 = I915_READ(PIPECONF(TRANSCODER_DSI_0)) & + I915_READ(PIPECONF(TRANSCODER_DSI_1)); + val1 &= PIPECONF_ENABLE; + + val2 = I915_READ(TRANS_DDI_FUNC_CTL2(TRANSCODER_DSI_0)); + val2 &= PORT_SYNC_MODE_ENABLE; + + return (val1 && val2); +} + +static enum dsi_op_mode +gen11_dsi_get_op_mode(struct drm_i915_private *dev_priv, + struct intel_dsi *intel_dsi) +{ + u32 val; + enum transcoder dsi_trans; + + if (intel_dsi->ports == BIT(PORT_B)) + dsi_trans = TRANSCODER_DSI_1; + else + dsi_trans = TRANSCODER_DSI_0; + + val = I915_READ(DSI_TRANS_FUNC_CONF(dsi_trans)); + return ((val &= OP_MODE_MASK) >> OP_MODE_SHIFT); +} + static void gen11_dsi_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) { @@ -1250,6 +1281,12 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder, cnl_calc_wrpll_link(dev_priv, &pipe_config->dpll_hw_state); pipe_config->base.adjusted_mode.crtc_clock = intel_dsi->pclk; + + pipe_config->dsi_state.dual_link_mode = + gen11_dsi_dual_link_enabled(dev_priv); + pipe_config->dsi_state.op_mode = + gen11_dsi_get_op_mode(dev_priv, intel_dsi); + if (intel_dsi->dual_link) pipe_config->base.adjusted_mode.crtc_clock *= 2; @@ -1283,6 +1320,8 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder, else pipe_config->cpu_transcoder = TRANSCODER_DSI_0; + pipe_config->dsi_state.op_mode = DSI_CMD_MODE_NO_GATE; + pipe_config->dsi_state.dual_link_mode = intel_dsi->dual_link; pipe_config->clock_set = true; pipe_config->port_clock = intel_dsi_bitrate(intel_dsi) / 5; diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 40390d855815..f89917eb4b94 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -75,6 +75,13 @@ enum hdmi_force_audio { HDMI_AUDIO_ON, /* force turn on HDMI audio */ }; +enum dsi_op_mode { + DSI_CMD_MODE_NO_GATE, + DSI_CMD_MODE_TE_GATE, + DSI_CMD_MODE_PERIODIC, + DSI_VIDEO_MODE, + }; + /* "Broadcast RGB" property */ enum intel_broadcast_rgb { INTEL_BROADCAST_RGB_AUTO, @@ -861,6 +868,11 @@ struct intel_crtc_state { u32 ctrl, div; } dsi_pll; + struct { + enum dsi_op_mode op_mode; + bool dual_link_mode; + } dsi_state; + int pipe_bpp; struct intel_link_m_n dp_m_n;