From patchwork Fri Aug 16 00:30:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Ausmus X-Patchwork-Id: 2845336 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03EBD9F2F5 for ; Fri, 16 Aug 2013 00:48:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24A29202B1 for ; Fri, 16 Aug 2013 00:48:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 36060200F0 for ; Fri, 16 Aug 2013 00:48:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B89EE852B for ; Thu, 15 Aug 2013 17:48:39 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 44900E64E6 for ; Thu, 15 Aug 2013 17:32:07 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 15 Aug 2013 17:29:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,889,1367996400"; d="scan'208";a="387901436" Received: from jausmus-gentoo-dev5.jf.intel.com ([10.7.198.60]) by orsmga002.jf.intel.com with ESMTP; 15 Aug 2013 17:31:55 -0700 From: james.ausmus@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 15 Aug 2013 17:30:32 -0700 Message-Id: <1376613069-15790-8-git-send-email-james.ausmus@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> References: <1376613069-15790-1-git-send-email-james.ausmus@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] Wake up DP sinks for DPCD read-based detection. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stuart Abercrombie When in DPMS sleep state the Apple mini DP->VGA adapter doesn't respond. This led to no external display on boot. v2: Avoid DPCD check and keep AUX awake for EDID read. BUG=chrome-os-partner:17063 TEST=Straight DP and various adapters on mini-DP and DP platforms. Change-Id: I90bea73006ae9c99464b0b5bc57f3803918313a8 Reviewed-on: https://gerrit.chromium.org/gerrit/42583 Reviewed-by: Stéphane Marchesin Commit-Queue: Stuart Abercrombie Tested-by: Stuart Abercrombie [marcheu: fixups for 3.8] Signed-off-by: Stéphane Marchesin --- drivers/gpu/drm/i915/intel_dp.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c271c05..f886ae9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1290,14 +1290,10 @@ static void ironlake_edp_pll_off(struct intel_dp *intel_dp) } /* If the sink supports it, try to set the power state appropriately */ -void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode) +static void intel_dp_do_sink_dpms(struct intel_dp *intel_dp, int mode) { int ret, i; - /* Should have a valid DPCD by this point */ - if (intel_dp->dpcd[DP_DPCD_REV] < 0x11) - return; - if (mode != DRM_MODE_DPMS_ON) { ret = intel_dp_aux_native_write_1(intel_dp, DP_SET_POWER, DP_SET_POWER_D3); @@ -1319,6 +1315,16 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode) } } +/* If we have a valid DPCD, set the power state. */ +void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode) +{ + /* Should have a valid DPCD by this point */ + if (intel_dp->dpcd[DP_DPCD_REV] < 0x11) + return; + + intel_dp_do_sink_dpms(intel_dp, mode); +} + static bool intel_dp_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe) { @@ -2330,6 +2336,12 @@ intel_dp_detect(struct drm_connector *connector, bool force) intel_dp->has_audio = false; + /* Ensure the sink is awake for DPCD/EDID reads. */ + if (connector->dpms != DRM_MODE_DPMS_ON) { + /* Bypass DPCD check, since we obtain it during detection. */ + intel_dp_do_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); + } + if (HAS_PCH_SPLIT(dev)) status = ironlake_dp_detect(intel_dp); else @@ -2339,8 +2351,11 @@ intel_dp_detect(struct drm_connector *connector, bool force) 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); - if (status != connector_status_connected) + if (status != connector_status_connected) { + if (connector->dpms != DRM_MODE_DPMS_ON) + intel_dp_do_sink_dpms(intel_dp, connector->dpms); return status; + } intel_dp_probe_oui(intel_dp); @@ -2356,6 +2371,11 @@ intel_dp_detect(struct drm_connector *connector, bool force) if (intel_encoder->type != INTEL_OUTPUT_EDP) intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT; + + /* Restore the sink state */ + if (connector->dpms != DRM_MODE_DPMS_ON) + intel_dp_do_sink_dpms(intel_dp, connector->dpms); + return connector_status_connected; }