From patchwork Tue Oct 9 04:27:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10631885 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A461112B for ; Tue, 9 Oct 2018 04:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B78329A51 for ; Tue, 9 Oct 2018 04:28:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FFA929A52; Tue, 9 Oct 2018 04:28:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADCA629A71 for ; Tue, 9 Oct 2018 04:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726427AbeJILnz (ORCPT ); Tue, 9 Oct 2018 07:43:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33576 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726485AbeJILnz (ORCPT ); Tue, 9 Oct 2018 07:43:55 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C773360CC8; Tue, 9 Oct 2018 04:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059337; bh=FzKVFwf0TSeARhTuM/gotOW7Y31zH59Qypaag6OiFQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/pu0W8XmgXdpl01mVsPXVddGk/fMwh4zPlyxl3AWLazEJRLR/333T1G0LYaKXUN3 DlM8l4gN+wydbJAEuuCjj0SzbYxU8DW51xDaDzcoGk6QcwOwwE3rHTZx5yJD1tHYLq Qj3n7bcNyAmdHCeHPpANpTWkL51jhfj3aU0Fbv+U= Received: from jeykumar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jsanka@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CB8F760E74; Tue, 9 Oct 2018 04:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059305; bh=FzKVFwf0TSeARhTuM/gotOW7Y31zH59Qypaag6OiFQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOeyYvmyfDj5vHaAuiahzV5z+82TZZ/5rAzYUR4kvQlVBSuPweUgbV+Od1/rq+df6 lfwwg/47bOsOatzHZADx6tWSjVzbBZnLT1KNtxlVX/l5wdQwl5KK5OUH+aPMMwrYAz bk+O/5eqDDQACjwFzUJ/uCMCGy9xtE7fGmU8NR2Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CB8F760E74 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jsanka@codeaurora.org From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Jeykumar Sankaran , seanpaul@chromium.org, robdclark@gmail.com, hoegsberg@google.com, jcrouse@codeaurora.org Subject: [PATCH 25/25] drm/msm/dpu: maintain RM init check internally Date: Mon, 8 Oct 2018 21:27:42 -0700 Message-Id: <1539059262-8326-26-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539059262-8326-1-git-send-email-jsanka@codeaurora.org> References: <1539059262-8326-1-git-send-email-jsanka@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move and maintain RM initialization flag checks from KMS to RM. Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +----- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 12 ++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index fdc89a8..59ccc46 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -668,9 +668,7 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) } } - if (dpu_kms->rm_init) - dpu_rm_destroy(&dpu_kms->rm); - dpu_kms->rm_init = false; + dpu_rm_destroy(&dpu_kms->rm); if (dpu_kms->catalog) dpu_hw_catalog_deinit(dpu_kms->catalog); @@ -1085,8 +1083,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) goto power_error; } - dpu_kms->rm_init = true; - dpu_kms->hw_mdp = dpu_hw_mdptop_init(MDP_TOP, dpu_kms->mmio, dpu_kms->catalog); if (IS_ERR_OR_NULL(dpu_kms->hw_mdp)) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 66d4666..1fff795 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -140,7 +140,6 @@ struct dpu_kms { bool suspend_block; struct dpu_rm rm; - bool rm_init; struct dpu_hw_vbif *hw_vbif[VBIF_MAX]; struct dpu_hw_mdp *hw_mdp; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 9a63128..3452fb9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -65,6 +65,9 @@ int dpu_rm_destroy(struct dpu_rm *rm) struct dpu_rm_hw_blk *hw_cur, *hw_nxt; enum dpu_hw_blk_type type; + if (!rm->initialized) + return 0; + for (type = 0; type < DPU_HW_BLK_MAX; type++) { list_for_each_entry_safe(hw_cur, hw_nxt, &rm->hw_blks[type], list) { @@ -74,6 +77,8 @@ int dpu_rm_destroy(struct dpu_rm *rm) } } + rm->initialized = false; + return 0; } @@ -141,6 +146,11 @@ int dpu_rm_init(struct dpu_rm *rm, return -EINVAL; } + if (rm->initialized) { + DPU_DEBUG("RM is already initialized\n"); + return 0; + } + /* Clear, setup lists */ memset(rm, 0, sizeof(*rm)); @@ -196,6 +206,8 @@ int dpu_rm_init(struct dpu_rm *rm, } } + rm->initialized = true; + return 0; fail: diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 9acbeba..74e5d58 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -24,9 +24,12 @@ * struct dpu_rm - DPU dynamic hardware resource manager * @hw_blks: array of lists of hardware resources present in the system, one * list per type of hardware block + * @initialized: True, when RM is initialized with hw block list. + * False, otherwise */ struct dpu_rm { struct list_head hw_blks[DPU_HW_BLK_MAX]; + bool initialized; }; /**