Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4999514img; Tue, 26 Mar 2019 23:20:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHmYgKbED+MtByz2oGqBJGXNbIXcBM+RZJo45LYhljx0KYt9ZOvU35d4HsuoJ/+RrX1QKU X-Received: by 2002:a63:4146:: with SMTP id o67mr32459469pga.122.1553667650942; Tue, 26 Mar 2019 23:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667650; cv=none; d=google.com; s=arc-20160816; b=hwZaDyx08x9prnFb498vqPOIt7QUFURK337ZmKGGxmnY2zj4eCBfvbmhuvHbuiQE+g N4DGDKXvVx/9PVMB2CX4zYsHsaLLFxm7MSQSDdSySe3NL0R4g2/KyWnlBpXBpxhVG1G2 ugYIRLLpoi8DmOMvubwznXPJk3zPin18dn21Ivfu7HFleTxsc+W1UFyktnG+Ng1caDmW aBN8rAufxv2B4mLy6BTpk2LbcuZLHW1iE5U228VtoholQBU3Re0jNpi0alFWJmP/OBc6 Lw+vFzzpk4kBzsCTxAIGaA8eyeCp75FawBMp50WCkHbsDiwXC7//3bN79HWa+6ypJNhv JkHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=tN11A+Y1pl8Y2Wp1XLf1gkRRzU3Xqo/epyhQNh/8FqQ=; b=lcLQdNllZxABnDKjfui698V+GJdR/n3fcff3HPIkDZLJyFBK1bT63SL/IwGM9/IVbN LDVabh7P7C+vQtqdAlk+FZXB/6yPLWF2EJRGO6i4eq2rU8BzXdTYbX6NkkqWHqAp0asw Z9u+CeMzljEdzgwcg7Vf6ClcJvm6jHpEajB04IER6pFAlq+ItW3hy3atKmnXXHKNZyFE VA6575X8LErrfKQT81IjXulw1vcPQeZKU60wNdUuzmtn+DNNauoc81BSj8yI1p0RFQp7 Tax7H0z6b0j/rlsJGnMa6OTh3FPeziqMdzk3xJkHV9ZDmPzOKEu96li2K8uRWU69SAmo HTtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r13si8715663pgj.413.2019.03.26.23.20.35; Tue, 26 Mar 2019 23:20:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733233AbfC0GTp (ORCPT + 99 others); Wed, 27 Mar 2019 02:19:45 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:1515 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1733081AbfC0GTo (ORCPT ); Wed, 27 Mar 2019 02:19:44 -0400 X-UUID: 039083a904ba4499ad155c941e6d3eb6-20190327 X-UUID: 039083a904ba4499ad155c941e6d3eb6-20190327 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 532935570; Wed, 27 Mar 2019 14:19:37 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:35 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:34 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 06/25] drm/mediatek: redefine mtk_ddp_sout_sel Date: Wed, 27 Mar 2019 14:19:02 +0800 Message-ID: <1553667561-25447-7-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 5AEE1B55E3EF7FD0BE4BB76705DEA127B8483D0E94718889E7F48FF622255B602000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu the format of "mtk_ddp_sout_sel"was not flexible, after we add more mediatek SOC support, that will be redundant Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c index 80dc91f..e4dafe0 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c @@ -391,20 +391,26 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur, return value; } -static void mtk_ddp_sout_sel(void __iomem *config_regs, - enum mtk_ddp_comp_id cur, - enum mtk_ddp_comp_id next) +static unsigned int mtk_ddp_sout_sel(enum mtk_ddp_comp_id cur, + enum mtk_ddp_comp_id next, + unsigned int *addr) { + unsigned int value; + if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0) { - writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1, - config_regs + DISP_REG_CONFIG_OUT_SEL); + *addr = DISP_REG_CONFIG_OUT_SEL; + value = BLS_TO_DSI_RDMA1_TO_DPI1; } else if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DPI0) { - writel_relaxed(BLS_TO_DPI_RDMA1_TO_DSI, - config_regs + DISP_REG_CONFIG_OUT_SEL); + *addr = DISP_REG_CONFIG_OUT_SEL; + value = BLS_TO_DPI_RDMA1_TO_DSI; } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI0) { - writel_relaxed(DSI_SEL_IN_RDMA, - config_regs + DISP_REG_CONFIG_DSI_SEL); + *addr = DISP_REG_CONFIG_DSI_SEL; + value = DSI_SEL_IN_RDMA; + } else { + value = 0; } + + return value; } void mtk_ddp_add_comp_to_path(void __iomem *config_regs, @@ -419,7 +425,9 @@ void mtk_ddp_add_comp_to_path(void __iomem *config_regs, writel_relaxed(reg, config_regs + addr); } - mtk_ddp_sout_sel(config_regs, cur, next); + value = mtk_ddp_sout_sel(cur, next, &addr); + if (value) + writel_relaxed(value, config_regs + addr); value = mtk_ddp_sel_in(cur, next, &addr); if (value) { -- 1.8.1.1.dirty