Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1843159pxb; Mon, 13 Sep 2021 06:46:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ7HErlxRKpAamQJuKWJg/6SCIrk5bWLrakLebSkqzNyCo4vZ3X3v2qjxq4qy9Mb7lTPMu X-Received: by 2002:a6b:2c08:: with SMTP id s8mr8998839ios.216.1631540764022; Mon, 13 Sep 2021 06:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540764; cv=none; d=google.com; s=arc-20160816; b=W7bBBn0RUsSiL+wT+3LuejpOM7gfN2S9tE3nGlga/n6Ld21UFpkzVH8RJvuwl9Rcpr ZA+dX5rJI7zWNTkV6BD4772mfVCA8SHut1UuOUebTAVebfVp6oQZ8bomunb1Um53RBdN bf3R3ZVcrBGRDwEZMvdn1YlxAGTO2hfsjyD7aCG9P4swvxtzlqGXPQi+8QemvcfUZrAX 46C7gI23rD4xoYw3ZrNM9ikmFfmjvhKd4E4+TUNgwmXxqnVBNlrqDcjv0+tB7rfNUF4N u6VnokelM7h/dVxUXLCCuG8zppaGr+3cw4t/WFDeHE6IAQIyjpMlbLgqnFV6kuL+K10a CSrQ== 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=AaGipDqJtdD6s4/TJ712itGre5byGPML3rOEjGzs5GM=; b=VRAkrrZBzafGl3ONJRjY91AJnP8hhwwlfyttApQmhkO5PQP9xS+O6yLQJ5VDzXb6rk Ws6xQLQMgxYqF4ZcACrV77yaEOcIFKGDxgIPe41senV1ugUCykRtoirTYKoHanqCwpws +4R922AoKlneZoP2VCNUjgTeTdEd7SQBVtqDAnLAnNP8HclaK87/AUG4bnMHGbNYaT0p yIy6fKxyy6PeM9ubtI0gnunUv5E9rWm9fcM+NdXJ+Y1+0Pa5oiRLe+ADZM4OzGsrl29s kqSxJZv+PuZSiHxsJPTM2UnwLdn5Lg5AM89J71fPI7YrVxZd6rowYku/5ysBRIc1htaB ICPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="MDsw5/C7"; 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 i31si7410136jac.56.2021.09.13.06.45.44; Mon, 13 Sep 2021 06:46:04 -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="MDsw5/C7"; 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 S242472AbhIMNpj (ORCPT + 99 others); Mon, 13 Sep 2021 09:45:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:41932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243006AbhIMNjN (ORCPT ); Mon, 13 Sep 2021 09:39:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFB246108B; Mon, 13 Sep 2021 13:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539736; bh=Een1Y7zEbf8CwDcSUiMBFXt2z8N+XtYrWh68+U90V7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDsw5/C7f0yeO+JA3D2ysDJC5TfcRckBVLXuUH3ncanMg3z5rCodH19V3uDTY8ljL q00VWgp6rQA66T/8rdjKDAiacYqNATAQNG4dbx3Qu8RCZddpO03kVrnpJPqpZNtOoo urlD8i/scRRgVXtB5SSE7XuMQLcq05y5wUDuP/tU= 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 133/236] drm/msm/mdp4: refactor HW revision detection into read_mdp_hw_revision Date: Mon, 13 Sep 2021 15:13:58 +0200 Message-Id: <20210913131104.888041873@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 4d319afe666b0fc9a9855ba9bdf9ae3710ecf431 ] Inspired by MDP5 code. Also use DRM_DEV_INFO for MDP version as MDP5 does. Cosmetic change: uint32_t -> u32 - checkpatch suggestion. Signed-off-by: David Heidelberg Link: https://lore.kernel.org/r/20210705231641.315804-1-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 | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index 2f75e3905202..b73af9ddcf72 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -19,20 +19,13 @@ 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; - uint32_t version, major, minor, dmap_cfg, vg_cfg; + u32 major, minor, dmap_cfg, vg_cfg; unsigned long clk; int ret = 0; pm_runtime_get_sync(dev->dev); - mdp4_enable(mdp4_kms); - version = mdp4_read(mdp4_kms, REG_MDP4_VERSION); - mdp4_disable(mdp4_kms); - - major = FIELD(version, MDP4_VERSION_MAJOR); - minor = FIELD(version, MDP4_VERSION_MINOR); - - DBG("found MDP4 version v%d.%d", major, minor); + read_mdp_hw_revision(mdp4_kms, &major, &minor); if (major != 4) { DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n", @@ -409,6 +402,22 @@ fail: return ret; } +static void read_mdp_hw_revision(struct mdp4_kms *mdp4_kms, + u32 *major, u32 *minor) +{ + struct drm_device *dev = mdp4_kms->dev; + u32 version; + + mdp4_enable(mdp4_kms); + version = mdp4_read(mdp4_kms, REG_MDP4_VERSION); + mdp4_disable(mdp4_kms); + + *major = FIELD(version, MDP4_VERSION_MAJOR); + *minor = FIELD(version, MDP4_VERSION_MINOR); + + DRM_DEV_INFO(dev->dev, "MDP4 version v%d.%d", *major, *minor); +} + struct msm_kms *mdp4_kms_init(struct drm_device *dev) { struct platform_device *pdev = to_platform_device(dev->dev); -- 2.30.2