From patchwork Thu Jul 5 13:02:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chauhan, Madhav" X-Patchwork-Id: 10509069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5904A600F5 for ; Thu, 5 Jul 2018 13:12:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4752128BF5 for ; Thu, 5 Jul 2018 13:12:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5DC28E87; Thu, 5 Jul 2018 13:12:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D142228BF5 for ; Thu, 5 Jul 2018 13:12:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EAC76ED65; Thu, 5 Jul 2018 13:12:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEFF66ED65 for ; Thu, 5 Jul 2018 13:12:31 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2018 06:12:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,312,1526367600"; d="scan'208";a="70293197" Received: from madhav-desktop.iind.intel.com ([10.223.25.13]) by orsmga001.jf.intel.com with ESMTP; 05 Jul 2018 06:12:29 -0700 From: Madhav Chauhan To: intel-gfx@lists.freedesktop.org Date: Thu, 5 Jul 2018 18:32:07 +0530 Message-Id: <1530795727-28644-21-git-send-email-madhav.chauhan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530795727-28644-1-git-send-email-madhav.chauhan@intel.com> References: <1530795727-28644-1-git-send-email-madhav.chauhan@intel.com> Subject: [Intel-gfx] [PATCH v3 20/20] drm/i915/icl: Configure DSI transcoders 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, paulo.r.zanoni@intel.com, rodrigo.vivi@intel.com MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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. v2: Rebase Signed-off-by: Madhav Chauhan --- drivers/gpu/drm/i915/gen11_dsi.c | 87 +++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dsi.h | 3 ++ drivers/gpu/drm/i915/intel_dsi_vbt.c | 1 + 3 files changed, 89 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gen11_dsi.c b/drivers/gpu/drm/i915/gen11_dsi.c index 97b9b1e..9b4743e 100644 --- a/drivers/gpu/drm/i915/gen11_dsi.c +++ b/drivers/gpu/drm/i915/gen11_dsi.c @@ -27,8 +27,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; @@ -334,6 +333,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 */ @@ -350,6 +430,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)) 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_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;