From patchwork Sat Jun 17 08:31:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9793981 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 4EB9F600F6 for ; Sat, 17 Jun 2017 08:31:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F6B9284C7 for ; Sat, 17 Jun 2017 08:31:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33BB4284FE; Sat, 17 Jun 2017 08:31:34 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 8DF6F284C7 for ; Sat, 17 Jun 2017 08:31:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 868F46E0E4; Sat, 17 Jun 2017 08:31:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 657F76E0E4 for ; Sat, 17 Jun 2017 08:31:29 +0000 (UTC) Received: by mail-pf0-x244.google.com with SMTP id w12so9769818pfk.0 for ; Sat, 17 Jun 2017 01:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=1P8gccQIzYlIAHk2KG3oD12774YhockKAEfhqXJVqms=; b=SE+v5bt2khVyKxcO4yTTu6GlEA/Ul5uemrBG0BHbt33k6BJfIVaesdkL6XK2Q7LIgv mQapniGWdVdv3MTUQY2gTXERxxWHpwP5yEZRuqjEt6XeZ/zdbaCh6dEvzxYzKeNXmF+m z7ZAkjL3UTk2/lkQjQU/lFXiENUnQb/aG/YxHaha6mysdafEV6fuWKJcIXshb9jkdzzb 1chtFLBGjieDE4DDyYfDDN9KvW61WTIz/CXy2xkm3MWm9DVpEdW15rvcfyPnlGTMir25 uBfsuLHcio5XVO2SNndKbHfPCDRdG0LD0g+mhLlFfuj9YYPExA3/y5qULFL23WutGVu2 /d9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=1P8gccQIzYlIAHk2KG3oD12774YhockKAEfhqXJVqms=; b=AcceISGwbGK8wAdhcTazZqfNAQCzJ26wMnMgpCK4BXtOwbG2p+oNZg8jK3P/Cy1pI/ iRobsiAe+Q5+O4uuZqaKO9p0Wn2g+BFxkAk4gbc2MFeWe62mvnR8j77Xr0PpjcfoZGpU YdtNXHIjsU2gC+Zb9Z3274hIcHuNfcDBWkvnpdBtgjCQOIhyP5zcAhiq2cL5IQJMY1pt 23fYLGVL8Xy8Cc/5WCWrw3bQDIKgwQGDsSpf4AqBiwXYv5WxZNZJL9biHgNWVTcd0gfQ eWIGe5YZPz2tAibpdVUesl+1QpqcW9xwWhscH5dAgiBOENwzat1Jf3+bYWETgeglD83n DX1g== X-Gm-Message-State: AKS2vOzRPJQ8TRiWEdmCPIH9vxRAcEMAhHR4IGgeXUx1mcR/2YEzlfN9 IkfQ65FAqNNvP2rh X-Received: by 10.84.238.141 with SMTP id v13mr18139791plk.162.1497688288880; Sat, 17 Jun 2017 01:31:28 -0700 (PDT) Received: from dk-thinkpad-x260.localnet ([2601:1c0:5402:5a00:29d6:4db7:4be3:b492]) by smtp.gmail.com with ESMTPSA id t82sm8849547pfe.88.2017.06.17.01.31.27 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Jun 2017 01:31:28 -0700 (PDT) From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Sat, 17 Jun 2017 01:31:16 -0700 Message-ID: <6654058.C6O5gEn43q@dk-thinkpad-x260> User-Agent: KMail/5.1.3 (Linux/4.12.0-rc4drm-tip; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1497651515.32201.6.camel@rdvivi-vienna> References: <1497644442-32040-1-git-send-email-rodrigo.vivi@intel.com> <87E1A67218970041879FDD2045F7145D06F34350@ORSMSX106.amr.corp.intel.com> <1497651515.32201.6.camel@rdvivi-vienna> MIME-Version: 1.0 Cc: "Zanoni, Paulo R" , "Pandiyan, Dhinakaran" , "Vivi, Rodrigo" Subject: Re: [Intel-gfx] [PATCH] drm/i915/cnl: Add information to missing case. 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On Friday, June 16, 2017 10:18:28 PM PDT Vivi, Rodrigo wrote: > On Fri, 2017-06-16 at 21:54 +0000, Navare, Manasi D wrote: > > > On Fri, 2017-06-16 at 21:26 +0000, Vivi, Rodrigo wrote: > > > > > On Fri, 2017-06-16 at 21:21 +0000, Pandiyan, Dhinakaran wrote: > > > > > > > On Fri, 2017-06-16 at 14:12 -0700, Manasi Navare wrote: > > > > > > > > > On Fri, Jun 16, 2017 at 08:58:25PM +0000, Pandiyan, Dhinakaran > > > > > wrote: > > > > > > > > > > > On Fri, 2017-06-16 at 13:20 -0700, Rodrigo Vivi wrote: > > > > > > > > > > > > > This missing case could be reached out on missing type or > > > > > > > missing voltage. > > > > > > > > > > > > > > > > > > Should we even reach this far with a missing DDI type? > > > > > > > > > > > > -DK > > > > > > > > > > > > > > > > > > > > > > > > > > > Yes it is possible that we get into this situation if reading of > > > > > the vccio voltage from PORT_COMP_DW3 returns a garbage value due > > > > > to some corruption > > > > > > > > > > > > MISSING_CASE already logs that. > > > > > > > > > > > > > or lets say the type is something that is not supported on this > > > > > platform. > > > > > > > > > > > > > But my question is, should we even be trying to program vswing > > > > without knowing the ddi type or for an invalid type? > > > > > > > > > we will reach the return; and avoid vswing programming. > > > And logs will give us some information of what failed during modeset. > > > > > > > > > Correct me if I am wrong, the only callers I could see are > > intel_dp_set_signal_levels() and intel_ddi_pre_enable_hdmi(). In both > > cases, the encoder type should have been set appropriately. My concern is > > that if we are seeing some other type, we should be handling that before > > calling cnl_ddi_vswing_program() > > this is why I didn't get the missing case on the type if/else ;) > > we should never reach that case, but in case there is the missing case > an extra debug message doesn't hurt... > We should not be writing to registers in the caller for invalid encoder types. And also debug log a bit sooner. How about? + /* * 1. If port type is eDP or DP, * set PORT_PCS_DW1 cmnkeeper_enable to 1b, -DK > > > > > > > But this debug message catches the condition where the type is correct but > > the type and corresponding vccio voltage Combination is wrong and the > > ddi tables are not present for that combination. I definitely think it is > > a good idea to have this Debug print here in the missing case. > > Manasi > > > > > > > > > > > > > > > > > > > > > > > > > > > > > So let's add a debug > > > > > > > > > > > > > > message to make our lives easier whenever this might happen. > > > > > > > > > > > > > > Cc: Paulo Zanoni > > > > > > > Signed-off-by: Rodrigo Vivi > > > > > > > --- > > > > > > > > > > > > > > drivers/gpu/drm/i915/intel_ddi.c | 1 + > > > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c > > > > > > > b/drivers/gpu/drm/i915/intel_ddi.c > > > > > > > index e66947a..c96c8d0 100644 > > > > > > > --- a/drivers/gpu/drm/i915/intel_ddi.c > > > > > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c > > > > > > > @@ -1802,6 +1802,7 @@ static void cnl_ddi_vswing_program(struct > > > > > > > drm_i915_private *dev_priv, > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > if (ddi_translations == NULL) { > > > > > > > > > > > > > > + DRM_DEBUG_KMS("Missing DDI translation table for type %d > > > > > > > +with voltage %d\n", type, voltage); > > > > > > > > > > > > > > MISSING_CASE(voltage); > > > > > > > return; > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > Like Paulo suggested it would be better to use a switch statement > > > > > for different vccio voltages and then have this in the default. What > > > > > do you think? > > > > > > > > we don't need to iterate on voltages... and the switch for type > > > wouldn't catch failures happening inside the functions where we > > > actually pick the table. > > > > > > > > > > > > > > > > Manasi > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Intel-gfx mailing list > > > > > > Intel-gfx@lists.freedesktop.org > > > > > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > > > > > > > > _______________________________________________ > > > > > Intel-gfx mailing list > > > > > Intel-gfx@lists.freedesktop.org > > > > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > > > > > > > > > > > > > > > _______________________________________________ > > > Intel-gfx mailing list > > > Intel-gfx@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > > > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/ intel_ddi.c index db80938..81cdffb 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1858,14 +1858,18 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level) u32 val; int ln = 0; - if ((intel_dp) && (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)) { + if (intel_dp && (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)) { width = intel_dp->lane_count; rate = intel_dp->link_rate; - } else { + } else if (type == INTEL_OUTPUT_HDMI){ width = 4; /* Rate is always < than 6GHz for HDMI */ + } else { + DRM_DEBUG_KMS("vswing sequence undefined for encoder type %d \n", type); + return; }