Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7194695ybi; Mon, 8 Jul 2019 16:38:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxB2YLNLRfEocS4rplfnWjqFX6WiwyeXxJx2pUPIhEwh/cod5T5qCRHDNmLkWphijjpgCTV X-Received: by 2002:a17:902:f213:: with SMTP id gn19mr28844213plb.35.1562629119582; Mon, 08 Jul 2019 16:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562629119; cv=none; d=google.com; s=arc-20160816; b=TG9TYU/Gy50LUANed2eZgR/4YZ8HGzjBSW/VluTAl8qDHS+r5m9Mr5iGVFICWTUbmE AFyixODxEADbmo5/u+KYh8pEegarJ1WPcl7CDZKiyZsRRmZd3TCnBtoNk3h4cNmdyytW Nc108jLIubRj8VJcrrtzwUzHGadA7bpjb6A7B/+JtyHqdpM2WWmV43MYH2EjmqUNzNFU FryktHFE7+FdX6Xtvmrv8CzSQBbF7AokgBTh5J36aEXf4JBJjmClPKB1+C9T2jGc2hA3 IdNf3EiUi5uNLrA1ZS7Ifo+RkNKRvSoqvKG/o5D0bhCbV6C3yl7BUGPQYrmqUAfHk9A0 HLfw== 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=k6iLeV1PgHzh8wh7ozgxi1ktc+5YNyZkJSLSG9HoGoE=; b=DTSZGaIVAvidd6uQ2hskJr95AmYjD8ZUhzdrqFy2SJUx3aCB1H4il2qWkeK4p+yj5p aFnYWGYkd69gtt7OgA79UFMhkJ7joX76fIVov4zgr7156Ks8kr/8tgtXfGjjWs9yxfgJ 0ik05VUM6ihB3fsZXp5N8Ys+HXcJceF2okbNmSdVT9m+mjGPo/rwvBK6I9/R0KoDzbfG H9JTpuo7dXZ6a+X5Zn5VvLQTFGS3wz4xlAoV/cGFsdZlk9QGEdAuP+E0YP3k25zuFDMr mQ65rbRGbfUOcMcIJ79XunZOX3YQ8vD/W2Nr0hq6TS+Qt2UWovh1x+1FqvDD5P5sKCSl Xl/w== 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 a144si20700027pfd.72.2019.07.08.16.38.24; Mon, 08 Jul 2019 16:38:39 -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 S1728315AbfGHWgj (ORCPT + 99 others); Mon, 8 Jul 2019 18:36:39 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:40382 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727348AbfGHWeh (ORCPT ); Mon, 8 Jul 2019 18:34:37 -0400 X-UUID: 649ffb48337a46ceb5d8b95e6db3e5eb-20190709 X-UUID: 649ffb48337a46ceb5d8b95e6db3e5eb-20190709 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 810021551; Tue, 09 Jul 2019 06:34:30 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 9 Jul 2019 06:34:28 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 9 Jul 2019 06:34:28 +0800 From: To: CK Hu , Philipp Zabel , Rob Herring , Matthias Brugger CC: David Airlie , Daniel Vetter , Mark Rutland , , , , , , Yongqiang Niu Subject: [PATCH v4, 09/33] drm/mediatek: add mutex mod register offset into ddp private data Date: Tue, 9 Jul 2019 06:33:49 +0800 Message-ID: <1562625253-29254-10-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> References: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain 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 mutex mod register offset will be private data of ddp. Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c index 412b82f..8bde2cf 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c @@ -41,12 +41,14 @@ #define DISP_REG_CONFIG_DSI_SEL 0x050 #define DISP_REG_CONFIG_DPI_SEL 0x064 -#define DISP_REG_MUTEX_EN(n) (0x20 + 0x20 * (n)) -#define DISP_REG_MUTEX(n) (0x24 + 0x20 * (n)) -#define DISP_REG_MUTEX_RST(n) (0x28 + 0x20 * (n)) -#define DISP_REG_MUTEX_MOD(n) (0x2c + 0x20 * (n)) -#define DISP_REG_MUTEX_SOF(n) (0x30 + 0x20 * (n)) -#define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n)) +#define MT2701_DISP_MUTEX0_MOD0 0x2c + +#define DISP_REG_MUTEX_EN(n) (0x20 + 0x20 * (n)) +#define DISP_REG_MUTEX(n) (0x24 + 0x20 * (n)) +#define DISP_REG_MUTEX_RST(n) (0x28 + 0x20 * (n)) +#define DISP_REG_MUTEX_MOD(mutex_mod_reg, n) (mutex_mod_reg + 0x20 * (n)) +#define DISP_REG_MUTEX_SOF(n) (0x30 + 0x20 * (n)) +#define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n)) #define INT_MUTEX BIT(1) @@ -149,6 +151,7 @@ struct mtk_disp_mutex { struct mtk_ddp_data { const unsigned int *mutex_mod; + const unsigned int mutex_mod_reg; }; struct mtk_ddp { @@ -208,14 +211,17 @@ struct mtk_ddp { static const struct mtk_ddp_data mt2701_ddp_driver_data = { .mutex_mod = mt2701_mutex_mod, + .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, }; static const struct mtk_ddp_data mt2712_ddp_driver_data = { .mutex_mod = mt2712_mutex_mod, + .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, }; static const struct mtk_ddp_data mt8173_ddp_driver_data = { .mutex_mod = mt8173_mutex_mod, + .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, }; static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id cur, @@ -481,7 +487,8 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex, break; default: if (ddp->data->mutex_mod[id] < 32) { - offset = DISP_REG_MUTEX_MOD(mutex->id); + offset = DISP_REG_MUTEX_MOD(ddp->data->mutex_mod_reg, + mutex->id); reg = readl_relaxed(ddp->regs + offset); reg |= 1 << ddp->data->mutex_mod[id]; writel_relaxed(reg, ddp->regs + offset); @@ -519,7 +526,8 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex, break; default: if (ddp->data->mutex_mod[id] < 32) { - offset = DISP_REG_MUTEX_MOD(mutex->id); + offset = DISP_REG_MUTEX_MOD(ddp->data->mutex_mod_reg, + mutex->id); reg = readl_relaxed(ddp->regs + offset); reg &= ~(1 << ddp->data->mutex_mod[id]); writel_relaxed(reg, ddp->regs + offset); -- 1.8.1.1.dirty