Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp389445ybi; Tue, 16 Jul 2019 22:26:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNiYzzEyFDzvh6zAaVxdEygjmLjwQBPM5/oYmqvrss33iGvMm2wX3Feo0KwSKRWRWJUelH X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr41785455pla.324.1563341201852; Tue, 16 Jul 2019 22:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563341201; cv=none; d=google.com; s=arc-20160816; b=xkGaSa0zvXut1WMrBF0xPhMciokc/vaRXvjIWUhSvpsQlUabcCFhpGss9tovkLcdZc 0cFdPomSPzBL4bHWU+sMyaVFp8VlI3GyHIgQNkyAC6aKXv8ReKax0OsmIOo4AHPIfAwR +vTUOxSD2BnrBwLL9Lq2nhu8c2X2iS98HknPdvDz3cNQKaNdV07k7CWZXfpTpZLMobFO Avo9I8RmWYwaPDQmEB71BU5ZM7FpZxICnsfvTa3sGz4NHmLjOih3r98zUU4NAIzUGble IfVhdPlkwphoV3b+aG5SVkJ2KXVpCQKKa7eVstdd0iSfG9spzRPgbPXLztxY7T7p671r Gl3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=y38c8iNmtr8Ln4qPIeK0EbE/HBVO84h0TU+44yE+fHw=; b=keqQkyRdw3iGYmdkcyXuY29WTDzj5EeaNiure5f3tJctPgzbP2jpLV8moeKBMOmKmp o7PPgmN1PDcReDgS1VmmRr7PiY9LlpVq7RP78fdgmXxEsHRskrO6KDv/OeIZbdCzyzOW ki+67E0hwEaquUDg3Q+VHYp/t4wZCe6byl7YWQs5jk8Dz3PPuS9sOjcysEbuWMqpzU/9 5iC1QWA4bJ3O9vr9E2kNyqhp28r7EDbfATxC2qnJIE1jQ+nUYzSKzkknlSAKolduwDgi fAe6mB7i4bBzb4X/X4bIgSHMZptoiHyhvBymPW+thcjna/5PHrDxkMHu1Ow+bklScuLz R6cQ== 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 y12si23952456pgg.585.2019.07.16.22.26.25; Tue, 16 Jul 2019 22:26:41 -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 S1726836AbfGQFYS (ORCPT + 99 others); Wed, 17 Jul 2019 01:24:18 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:63549 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbfGQFYS (ORCPT ); Wed, 17 Jul 2019 01:24:18 -0400 X-UUID: 41acc4304b8543639ab5b18f93e15b77-20190717 X-UUID: 41acc4304b8543639ab5b18f93e15b77-20190717 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 19208423; Wed, 17 Jul 2019 13:23:56 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 17 Jul 2019 13:23:54 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 17 Jul 2019 13:23:54 +0800 Message-ID: <1563341033.29169.12.camel@mtksdaap41> Subject: Re: [PATCH v4, 09/33] drm/mediatek: add mutex mod register offset into ddp private data From: CK Hu To: CC: Philipp Zabel , Rob Herring , Matthias Brugger , "David Airlie" , Daniel Vetter , Mark Rutland , , , , , Date: Wed, 17 Jul 2019 13:23:53 +0800 In-Reply-To: <1562625253-29254-10-git-send-email-yongqiang.niu@mediatek.com> References: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> <1562625253-29254-10-git-send-email-yongqiang.niu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 8E5985605A1A1B50372F59E3FDB9FBBFDDD2B883BAD63194D3C420C112E8049A2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yongqiang: On Tue, 2019-07-09 at 06:33 +0800, yongqiang.niu@mediatek.com wrote: > From: Yongqiang Niu > > mutex mod register offset will be private data of ddp. > Reviewed-by: CK Hu > 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);