From patchwork Tue May 31 09:25:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 9143989 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 641DB60777 for ; Tue, 31 May 2016 09:16:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5712B2793B for ; Tue, 31 May 2016 09:16:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BF9428185; Tue, 31 May 2016 09:16:43 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF0502793B for ; Tue, 31 May 2016 09:16:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 650576E341; Tue, 31 May 2016 09:16:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id D5DCA6E24F for ; Tue, 31 May 2016 09:16:30 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 31 May 2016 02:16:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,395,1459839600"; d="scan'208";a="711474908" Received: from shashanks-desktop.iind.intel.com ([10.223.26.24]) by FMSMGA003.fm.intel.com with ESMTP; 31 May 2016 02:16:28 -0700 From: Shashank Sharma To: intel-gfx@lists.freedesktop.org, ville.syrjala@linux.intel.com, paulo.r.zanoni@intel.com Date: Tue, 31 May 2016 14:55:46 +0530 Message-Id: <1464686746-5099-6-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464686746-5099-1-git-send-email-shashank.sharma@intel.com> References: <1464686746-5099-1-git-send-email-shashank.sharma@intel.com> Cc: daniel.vetter@intel.com Subject: [Intel-gfx] [PATCH 5/5] drm/i915: Enable lspcon initialization X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds initialization code for lspcon. What we are doing here is: - Check if lspcon is configured in VBT for this port - If lspcon is configured, configure it as DP port - Register additional HDMI functions to support LS mode functionalities. Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/intel_ddi.c | 36 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 4 ++++ drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 811c829..2107c0d 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -2314,8 +2314,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port) struct drm_i915_private *dev_priv = dev->dev_private; struct intel_digital_port *intel_dig_port; struct intel_encoder *intel_encoder; + struct intel_connector *intel_connector = NULL; struct drm_encoder *encoder; - bool init_hdmi, init_dp; + bool init_hdmi, init_dp, init_lspcon = false; int max_lanes; if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) { @@ -2347,6 +2348,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port) init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi || dev_priv->vbt.ddi_port_info[port].supports_hdmi); init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp; + + if (intel_bios_is_lspcon_present(dev_priv, port)) { + /* + * Lspcon device needs to be driven with DP connector + * with special detection sequence. So make sure DP + * is initialized before lspcon. + */ + init_dp = true; + init_lspcon = true; + init_hdmi = false; + DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port)); + } + if (!init_dp && !init_hdmi) { DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n", port_name(port)); @@ -2399,7 +2413,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->cloneable = 0; if (init_dp) { - if (!intel_ddi_init_dp_connector(intel_dig_port)) + intel_connector = intel_ddi_init_dp_connector(intel_dig_port); + if (!intel_connector) goto err; intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; @@ -2420,6 +2435,23 @@ void intel_ddi_init(struct drm_device *dev, enum port port) goto err; } + if (init_lspcon) { + if (lspcon_init(intel_dig_port)) { + if (intel_hdmi_init_minimum(intel_dig_port, + intel_connector)) { + DRM_ERROR("HDMI init for LSPCON failed\n"); + goto err; + } + } else { + /* + * LSPCON init faied, but DP init was success, so lets try to + * drive as DP++ port. + */ + DRM_ERROR("LSPCON init failed on port %c\n", + port_name(port)); + } + } + return; err: diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index fa77886..402e656 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1454,6 +1454,10 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); enum drm_connector_status intel_hdmi_detect(struct drm_connector *connector, bool force); +int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port, + struct intel_connector *intel_connector); + + /* intel_lvds.c */ void intel_lvds_init(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 79184e2..54b0b46 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1931,6 +1931,23 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, } } +int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port, + struct intel_connector *intel_connector) +{ + struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; + + if (WARN(intel_dig_port->max_lanes < 4, + "Not enough lanes (%d) for HDMI on port %c\n", + intel_dig_port->max_lanes, port_name(intel_dig_port->port))) + return -EINVAL; + + intel_hdmi->write_infoframe = hsw_write_infoframe; + intel_hdmi->set_infoframes = hsw_set_infoframes; + intel_hdmi->infoframe_enabled = hsw_infoframe_enabled; + intel_hdmi->attached_connector = intel_connector; + return 0; +} + void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg, enum port port) {