From patchwork Mon Mar 29 07:57:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 410819 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3435953jai; Mon, 29 Mar 2021 01:41:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeNEkpF+CYbucyjRKtUP+F/P6NMHU1wsGtCKUzYT3AJTxx3bnwCjL3RzUqYCJslvOsRjGL X-Received: by 2002:a17:907:d1f:: with SMTP id gn31mr27048405ejc.536.1617007171013; Mon, 29 Mar 2021 01:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007171; cv=none; d=google.com; s=arc-20160816; b=Wtf74yvqdB7wZOj8pCFn9qk0nr1HQUd7fbvT8UHMdF9NIo0Syae/yWZ8EeaxRBh0gZ v403un/xy394w3t4vIANo50fqAImU64EwH3tMvKCpmXhTgMohlLGt+/it1DzeCNSDGXp XCR9VBBX1Ych6+WNxuLmKDzouaI0wxP6Jx8DlMgdqDBmUmwg6DJ+/FoFSEvFjgy0oiw+ xfOozEJeFwYVFi7kqRo6R7XGMW7XLrE/2kwjWZO12S+kCJhPhYGpIqY7+TvsKeqqCTTE uz2mDGva1sFnt6q84a132ql7QZ4MQKvyuJQ6X1Fw226NpAXowGTLyMM14DTphC6qylc3 N+ZA== 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=MumCDK00qhBd6L/LbcWbPolQLA/o7IjJ3fJYzlcMoZU=; b=fSQrgTrMacuivSlLk7eENoJUT/MX83DAlZuPzrYWMdD1e4R9oTLqYK2mqvpdT2gvE4 Fs12zS7BQErGNyRYPs2VtUK0NRAfxduXhnmkoXRfHke/f+WQBDsr4elVrbFB7qAdGQzj sZyTrsHjB5qWYYYGDlIK9CdN1n61jBK3JtFpmuxQSKFaLBcLxmAmcySSh8GROMGOa7vg JovP8CB5WVlYmyFHhqJY8kN2UJDAbguiDAMxXWI5CZriZajaoDj4VofdS4rb+aEhFXNQ 0BB1klHUZ7MM1TAmmn+tltYyB3bktJ4Y3vZY/jaxg9/1nnfICEyqrsh3wxvlrFxquvyk 9gcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BVnxLftJ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 t22si11690307ejj.746.2021.03.29.01.39.30; Mon, 29 Mar 2021 01:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=BVnxLftJ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S234394AbhC2IjH (ORCPT + 12 others); Mon, 29 Mar 2021 04:39:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:54738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234909AbhC2Ihe (ORCPT ); Mon, 29 Mar 2021 04:37:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7989461996; Mon, 29 Mar 2021 08:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617007039; bh=RHIqCcF0DTcyY7IN0URo8sQrH/fKoLvRgDD/wApvKZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVnxLftJQ0lOzUUKUxS1EvUrQWaRrB/CGHf81PvX9A5xuhxhNwqcVk9U0SdROKBD5 aCV65hZvPGG/+D/VHi1RqTpHHuiAGdySBWxkyQLjU6b1nFy8uKNss83faIbco16jKc KUvMamgdAVODpZ8MJtictlke5A/fBxKjGMRhgDwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Marek , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.11 163/254] drm/msm/dsi: fix check-before-set in the 7nm dsi_pll code Date: Mon, 29 Mar 2021 09:57:59 +0200 Message-Id: <20210329075638.543610619@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075633.135869143@linuxfoundation.org> References: <20210329075633.135869143@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Baryshkov [ Upstream commit 3b24cdfc721a5f1098da22f9f68ff5f4a5efccc9 ] Fix setting min/max DSI PLL rate for the V4.1 7nm DSI PLL (used on sm8250). Current code checks for pll->type before it is set (as it is set in the msm_dsi_pll_init() after calling device-specific functions. Cc: Jonathan Marek Fixes: 1ef7c99d145c ("drm/msm/dsi: add support for 7nm DSI PHY/PLL") Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dsi/pll/dsi_pll.c | 2 +- drivers/gpu/drm/msm/dsi/pll/dsi_pll.h | 6 ++++-- drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) -- 2.30.1 diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll.c index a45fe95aff49..3dc65877fa10 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll.c @@ -163,7 +163,7 @@ struct msm_dsi_pll *msm_dsi_pll_init(struct platform_device *pdev, break; case MSM_DSI_PHY_7NM: case MSM_DSI_PHY_7NM_V4_1: - pll = msm_dsi_pll_7nm_init(pdev, id); + pll = msm_dsi_pll_7nm_init(pdev, type, id); break; default: pll = ERR_PTR(-ENXIO); diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll.h b/drivers/gpu/drm/msm/dsi/pll/dsi_pll.h index 3405982a092c..bbecb1de5678 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll.h +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll.h @@ -117,10 +117,12 @@ msm_dsi_pll_10nm_init(struct platform_device *pdev, int id) } #endif #ifdef CONFIG_DRM_MSM_DSI_7NM_PHY -struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id); +struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, + enum msm_dsi_phy_type type, int id); #else static inline struct msm_dsi_pll * -msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) +msm_dsi_pll_7nm_init(struct platform_device *pdev, + enum msm_dsi_phy_type type, int id) { return ERR_PTR(-ENODEV); } diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c index 93bf142e4a4e..c1f6708367ae 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c @@ -852,7 +852,8 @@ err_base_clk_hw: return ret; } -struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) +struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, + enum msm_dsi_phy_type type, int id) { struct dsi_pll_7nm *pll_7nm; struct msm_dsi_pll *pll; @@ -885,7 +886,7 @@ struct msm_dsi_pll *msm_dsi_pll_7nm_init(struct platform_device *pdev, int id) pll = &pll_7nm->base; pll->min_rate = 1000000000UL; pll->max_rate = 3500000000UL; - if (pll->type == MSM_DSI_PHY_7NM_V4_1) { + if (type == MSM_DSI_PHY_7NM_V4_1) { pll->min_rate = 600000000UL; pll->max_rate = (unsigned long)5000000000ULL; /* workaround for max rate overflowing on 32-bit builds: */