From patchwork Tue Jun 19 20:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10475389 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 E3F2A601D7 for ; Tue, 19 Jun 2018 20:18:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D440028306 for ; Tue, 19 Jun 2018 20:18:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C89D128389; Tue, 19 Jun 2018 20:18:39 +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, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, 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 8879C28306 for ; Tue, 19 Jun 2018 20:18:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 469DC6E5D3; Tue, 19 Jun 2018 20:18:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97F8A6E5CD; Tue, 19 Jun 2018 20:18:36 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id v13-v6so898556wrp.13; Tue, 19 Jun 2018 13:18:36 -0700 (PDT) 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:in-reply-to :references; bh=MRr/TpWBBeyC6HtzI8h9cPrVPYcrAK/b8WPSKoEuvAE=; b=uP14QhnMsFpSkH1eCYrYrVbYAI4ziidf4F1y994HcDqJHo2c49wzK79YWRAlbsVGZp doYx0DLDAm1JFRz2449jEY8WMTwmmRTvyjPLAxpIeGeQCYUinWI34+AKzSNM7GKLkZ2/ VqeHOU8pY5U0MC4pmTV9Dz8jWesc9ssMsJ/KW25TvnibwAzl++Ss2n55x8Oefbxmr1G1 Ci1tz2Pbb0EQ/sXg+Xfb4lJJj6lf6z3LTroxmS1T6bMPamxMJ136QVzUprntOlFL4Q2p RCDzzkgC65Jy87yDF5QERr0scYGFxVk/DB0/vTlNadY2lAkwt9I2RefE5Js9/S+XoBuj BP6w== X-Gm-Message-State: APt69E3nyutiv7wE76bN3rxiU7F+eYAiiZ2poBFdMzLDQkrGaThLQWP7 W4/BotZSr7gjhA4vnFM5W+Q= X-Google-Smtp-Source: ADUXVKLLfd/y5jHrCyCpbxWPGi6yFvfJhWKyhj8FfZUv7pFUGZyuAa96LYVmfcNS43m8ptMiBJWYEw== X-Received: by 2002:adf:f090:: with SMTP id n16-v6mr16291705wro.49.1529439515348; Tue, 19 Jun 2018 13:18:35 -0700 (PDT) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id m65-v6sm1104243wmd.1.2018.06.19.13.18.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 13:18:34 -0700 (PDT) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Daniel Vetter Date: Tue, 19 Jun 2018 22:18:27 +0200 Message-Id: <20180619201827.4257-5-hdegoede@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619201827.4257-1-hdegoede@redhat.com> References: <20180619201827.4257-1-hdegoede@redhat.com> Subject: [Intel-gfx] [PATCH 4/4] drm/i915/intel_dsi: Read back pclk set by GOP and use that as pclk 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: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On BYT and CHT the GOP sometimes initializes the pclk at a (slightly) different frequency then the pclk which we've calculated. This commit makes the DSI code read-back the pclk set by the GOP and if that is within a reasonable margin of the calculated pclk, uses that instead. This fixes the first modeset being a full modeset instead of a fast modeset on systems where the GOP pclk is different. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi_vbt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 4d6ffa7b3e7b..d4cc6099012c 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -517,6 +517,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) u32 mul; u16 burst_mode_ratio; enum port port; + enum pipe pipe; DRM_DEBUG_KMS("\n"); @@ -583,6 +584,19 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) } else burst_mode_ratio = 100; + /* + * On BYT / CRC the GOP sometimes picks a slightly different pclk, + * read back the GOP configured pclk and prefer it over ours. + */ + if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && + intel_dsi_get_hw_state(&intel_dsi->base, &pipe)) { + u32 gop = intel_dsi_get_pclk(&intel_dsi->base, bpp, NULL); + + DRM_DEBUG_KMS("Calculated pclk %d GOP %d\n", pclk, gop); + if (gop >= (pclk * 9 / 10) && gop <= (pclk * 11 / 10)) + pclk = gop; + } + intel_dsi->burst_mode_ratio = burst_mode_ratio; intel_dsi->pclk = pclk;