Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp68029pxb; Mon, 13 Sep 2021 13:08:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6WPHqvT85htRS8W9sl6Kp+nYGEEt7LYeeSMDx/ITvqhSc/cSb3tbDMAXyQiJ/tr8DrgQH X-Received: by 2002:aa7:d78e:: with SMTP id s14mr2492008edq.171.1631563729318; Mon, 13 Sep 2021 13:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563729; cv=none; d=google.com; s=arc-20160816; b=s3ouZqUp6A/d3iTkZniNglfoMN0qHpjOL+ufoHQyL28gC4fv0peo3p2KiHzwxwrHLw hdLNG4RyZcfGN4swLpPdgxmD9UlwJ7bU71UlZpYfezKv8QW9+j/HEP4MUoH43oCWjNih MtbPm+2P/7bXQqp4bils69dldKiHs2QNzge/N2UG954P2aczG8EmfpBh7f033om9rwuk bSFNAfvjEcEvYiPfcjayisim2HeB++7h1VZYfD+Aj9iOa6WjGaJph9a24j1WxTHXN+YF aIHFXLrdjp+/fT0ih/4fu9MdlMUpsFwdzEWopTForh8n8ntfCr74e+qY/F5fc9jv/Nwa qcxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NSl11iKBjkXKKypx42Go8erOrSLGadlk1BGnzSuiEW8=; b=cAFO6/AbcX+LvYS2cX5uvZTzb3M++csyfgIvzvyIP0Nwp2hNiVxAGe5/k1hmQKDOlG YlBG0YIkvDuMYniUSf158bsXyVVgTUlAJgrREloGHJyKr2zO9yOREzZhOCto1K9lhLZ1 x9tjorV4tmWGuDaDAL5/KMoTvGRlGFV8JYf3JKTkPWqVKaE+k9q3/F0a9aKT3TiwZcs7 J5OGnrxPmOaUU8nbfcL7xqm4RsE2gwqh2YjUotDM3yLVTHbvpPSzJy+2c6RSYSCsfocQ rdNkTxy6+Ae0aEd8btbK93qFdNN6Whhqqp+ciXPnyjZUvYhFz1mI/jfzIw9x3SMOw/Gm lqVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KX4KlwWz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si10880463edb.3.2021.09.13.13.08.25; Mon, 13 Sep 2021 13:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KX4KlwWz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243073AbhIMNqF (ORCPT + 99 others); Mon, 13 Sep 2021 09:46:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:43048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241737AbhIMNkL (ORCPT ); Mon, 13 Sep 2021 09:40:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3412E613DB; Mon, 13 Sep 2021 13:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539763; bh=VnAj9P3cej2pcKGGmXvcafGjL0xi4tKmJhucbnaHBqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KX4KlwWzpOF6z/m1yvbj5/Ze/q+3Oiye6MjOI0OArOeNyRD7QykQXUXIjgjbcZtlQ advp2NwY6U9VG4Bf2WuWoiGUQXxuUjzXVqyXgUuIvY0oEHJMKpXxglZjGi/QCJRMS1 zLfrcYcQq8eFOPpx3vqhJa/5/am7K+ntIVz4yTnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Heidelberg , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.10 134/236] drm/msm/mdp4: move HW revision detection to earlier phase Date: Mon, 13 Sep 2021 15:13:59 +0200 Message-Id: <20210913131104.919333814@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Heidelberg [ Upstream commit 4af4fc92939dc811ef291c0673946555aa4fb71f ] Fixes if condition, which never worked inside mdp4_kms_init, since HW detection has been done later in mdp4_hw_init. Fixes: eb2b47bb9a03 ("drm/msm/mdp4: only use lut_clk on mdp4.2+") Signed-off-by: David Heidelberg Link: https://lore.kernel.org/r/20210705231641.315804-2-david@ixit.cz Reviewed-by: Dmitry Baryshkov Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 45 ++++++++++++------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index b73af9ddcf72..c1c152e39918 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -19,23 +19,12 @@ static int mdp4_hw_init(struct msm_kms *kms) { struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); struct drm_device *dev = mdp4_kms->dev; - u32 major, minor, dmap_cfg, vg_cfg; + u32 dmap_cfg, vg_cfg; unsigned long clk; int ret = 0; pm_runtime_get_sync(dev->dev); - read_mdp_hw_revision(mdp4_kms, &major, &minor); - - if (major != 4) { - DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n", - major, minor); - ret = -ENXIO; - goto out; - } - - mdp4_kms->rev = minor; - if (mdp4_kms->rev > 1) { mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER0, 0x0707ffff); mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER1, 0x03073f3f); @@ -81,7 +70,6 @@ static int mdp4_hw_init(struct msm_kms *kms) if (mdp4_kms->rev > 1) mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1); -out: pm_runtime_put_sync(dev->dev); return ret; @@ -426,6 +414,7 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) struct msm_kms *kms = NULL; struct msm_gem_address_space *aspace; int irq, ret; + u32 major, minor; mdp4_kms = kzalloc(sizeof(*mdp4_kms), GFP_KERNEL); if (!mdp4_kms) { @@ -482,15 +471,6 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) if (IS_ERR(mdp4_kms->pclk)) mdp4_kms->pclk = NULL; - if (mdp4_kms->rev >= 2) { - mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk"); - if (IS_ERR(mdp4_kms->lut_clk)) { - DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n"); - ret = PTR_ERR(mdp4_kms->lut_clk); - goto fail; - } - } - mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "bus_clk"); if (IS_ERR(mdp4_kms->axi_clk)) { DRM_DEV_ERROR(dev->dev, "failed to get axi_clk\n"); @@ -499,8 +479,27 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) } clk_set_rate(mdp4_kms->clk, config->max_clk); - if (mdp4_kms->lut_clk) + + read_mdp_hw_revision(mdp4_kms, &major, &minor); + + if (major != 4) { + DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n", + major, minor); + ret = -ENXIO; + goto fail; + } + + mdp4_kms->rev = minor; + + if (mdp4_kms->rev >= 2) { + mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk"); + if (IS_ERR(mdp4_kms->lut_clk)) { + DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n"); + ret = PTR_ERR(mdp4_kms->lut_clk); + goto fail; + } clk_set_rate(mdp4_kms->lut_clk, config->max_clk); + } pm_runtime_enable(dev->dev); mdp4_kms->rpm_enabled = true; -- 2.30.2