From patchwork Thu Nov 26 00:04:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 7703801 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6DA719FCA2 for ; Thu, 26 Nov 2015 00:04:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FF75208C7 for ; Thu, 26 Nov 2015 00:04:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C9771208CA for ; Thu, 26 Nov 2015 00:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8DDD6E39C; Wed, 25 Nov 2015 16:04:23 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 3470A6E119; Wed, 25 Nov 2015 16:04:12 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 25 Nov 2015 16:04:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,344,1444719600"; d="scan'208";a="859509048" Received: from rdvivi-dublin.jf.intel.com ([10.7.196.164]) by orsmga002.jf.intel.com with ESMTP; 25 Nov 2015 16:04:12 -0800 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Subject: [PATCH 8/9] drm/i915: Move dummy aux read from read_wake to aux_transfer. Date: Wed, 25 Nov 2015 16:04:04 -0800 Message-Id: <1448496245-1495-9-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1448496245-1495-1-git-send-email-rodrigo.vivi@intel.com> References: <1448496245-1495-1-git-send-email-rodrigo.vivi@intel.com> MIME-Version: 1.0 Cc: Jani Nikula , dri-devel@lists.freedesktop.org, Rodrigo Vivi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 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 The goal is to kill the intel_dp_dpcd_read_wake for all, however Jani noticed we cannot ignore the case introduced by: 'commit f6a1906 ("drm/i915: Do a dummy DPCD read before the actual read")' So, instead for removing this for now let's apply that dummy read to all DP_AUX_NATIVE_READ cases. Pratically no functional changes with this change, but ideally we want to remove this code for here. Unfortunately I don't have the monitor/hardware that made us to include this extra call so for now let's move this here and add a FIXME tag so this case can be properly fixed/verified later. An alternative plan is to remove completely this piece of code and when we start getting the corner cases again we investigate it properly to see if instead of this extra read we can simply handle properly or return a -EBUSY or -EAGAIN so drm can retry instead. Cc: Ville Syrjälä Cc: Jani Nikula Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a02bfa1..0febf8d 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -937,7 +937,7 @@ static ssize_t intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) { struct intel_dp *intel_dp = container_of(aux, struct intel_dp, aux); - uint8_t txbuf[20], rxbuf[20]; + uint8_t txbuf[20], rxbuf[20], dumbuf[20]; size_t txsize, rxsize; int ret; @@ -974,6 +974,18 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) break; case DP_AUX_NATIVE_READ: + /* + * FIXME: Sometime we just get the same incorrect byte repeated + * over the entire buffer. Doing just one throw away read + * initially seems to "solve" it. + */ + dumbuf[0] = (DP_AUX_NATIVE_READ << 4) | + ((DP_DPCD_REV >> 16) & 0xf); + dumbuf[1] = (DP_DPCD_REV >> 8) & 0xff; + dumbuf[2] = DP_DPCD_REV & 0xff; + dumbuf[3] = 0; + intel_dp_aux_ch(intel_dp, dumbuf, HEADER_SIZE, rxbuf, 2); + case DP_AUX_I2C_READ: txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE; rxsize = msg->size + 1; @@ -3171,13 +3183,6 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset, ssize_t ret; int i; - /* - * Sometime we just get the same incorrect byte repeated - * over the entire buffer. Doing just one throw away read - * initially seems to "solve" it. - */ - drm_dp_dpcd_read(aux, DP_DPCD_REV, buffer, 1); - for (i = 0; i < 3; i++) { ret = drm_dp_dpcd_read(aux, offset, buffer, size); if (ret == size)