From patchwork Tue Jun 19 20:18:24 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: 10475387 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 A22246029B for ; Tue, 19 Jun 2018 20:18:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 921FE28306 for ; Tue, 19 Jun 2018 20:18:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8676228389; Tue, 19 Jun 2018 20:18:38 +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 3D8E828306 for ; Tue, 19 Jun 2018 20:18:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44EC36E5CD; Tue, 19 Jun 2018 20:18:37 +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 6D89E6E279; Tue, 19 Jun 2018 20:18:34 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id a12-v6so944301wro.1; Tue, 19 Jun 2018 13:18:34 -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=4h42j7rOYrSVm9ZirIYWYxrf8OAlnRUSWisYgUZ2DfI=; b=gFv+irIYda2wdM5gll6dnzULAmLgG7ENAQFBUP/KqEH2Au4OXl/Pz21NbhHUxTkZJO TO2r7cCrUSWOKnxiCt2PSiFfRhmivFYpWwEAwnJkzHeuGWNhsa6gl9V/WFWy4jL9/Aag DD9Dn6EqDTHwKa1+ORjROefwTE9TfQ5BPD3mGMmpyHWRPctrv6CiiVSdgxlrNjLIhFgF Ep8VpbybRAT9cBCPT2/8IYD3meqUJLFKlbUoilTfitPPlGqwZfGS9qEjuKrZLkog0a9k W7dBFre2jsjTFF2gODsKrMORcdhdAolVoCjvleHoUkv8Nl4ZTYV5QCvBit+IdKA9P6hl wOmQ== X-Gm-Message-State: APt69E1NX3o1ZGfWNDbCGkQU6XMtH07mryGGQUd9s4Zn/efX2x4QqRZg vFRaZsy6fVdalmZEyxnWk0g= X-Google-Smtp-Source: ADUXVKKWNGeIlfpG2Evl5CBY8hd54045BBDa7IJqXWkI8cdlBon5HSculnhcP8vLn4FpdJyUbJ8Wrg== X-Received: by 2002:adf:98cf:: with SMTP id w73-v6mr16100649wrb.209.1529439513191; Tue, 19 Jun 2018 13:18:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 13:18:32 -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:24 +0200 Message-Id: <20180619201827.4257-2-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 1/4] drm/i915/intel_dsi: Allow calling intel_dsi_get_pclk with a NULL config 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 Allow calling intel_dsi_get_pclk without passing in an intel_crtc_state. This is a preparation patch for reading back the GOP configured DSI clk during probe. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi_pll.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dsi_pll.c b/drivers/gpu/drm/i915/intel_dsi_pll.c index 2ff2ee7f3b78..71ce6e3157d4 100644 --- a/drivers/gpu/drm/i915/intel_dsi_pll.c +++ b/drivers/gpu/drm/i915/intel_dsi_pll.c @@ -279,8 +279,10 @@ static u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp, pll_div = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_DIVIDER); mutex_unlock(&dev_priv->sb_lock); - config->dsi_pll.ctrl = pll_ctl & ~DSI_PLL_LOCK; - config->dsi_pll.div = pll_div; + if (config) { + config->dsi_pll.ctrl = pll_ctl & ~DSI_PLL_LOCK; + config->dsi_pll.div = pll_div; + } /* mask out other bits and extract the P1 divisor */ pll_ctl &= DSI_PLL_P1_POST_DIV_MASK; @@ -330,6 +332,7 @@ static u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp, static u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp, struct intel_crtc_state *config) { + u32 ctrl; u32 pclk; u32 dsi_clk; u32 dsi_ratio; @@ -342,9 +345,12 @@ static u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp, return 0; } - config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL); + ctrl = I915_READ(BXT_DSI_PLL_CTL); + + if (config) + config->dsi_pll.ctrl = ctrl; - dsi_ratio = config->dsi_pll.ctrl & BXT_DSI_PLL_RATIO_MASK; + dsi_ratio = ctrl & BXT_DSI_PLL_RATIO_MASK; dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;