Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp391663ybi; Tue, 16 Jul 2019 22:29:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwPyzOcoJ4E1axfcXLx91av+bwTtn4xuSLhtXmMgppzgoOU5DS3mOhhb5CStis0Ki1t0bm X-Received: by 2002:a17:902:8205:: with SMTP id x5mr41465074pln.279.1563341346106; Tue, 16 Jul 2019 22:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563341346; cv=none; d=google.com; s=arc-20160816; b=DUCbCTD+7fsU9QjQOurEcvP2hNfccDZsrTVkQ0YWJ/Cx0tNaRQHK8usFBspE7Ygjze SkN+fjPVR2dvGRKv+GuFnby4AJGWpNPAmdFf5Leaf03DS7agOHKi5FceDmuGzb1wjp9y tBBLd7AFvOC3SZmQvOLEEnePzfgLqZXYmFyL1WnytbNjVjfF/4K9JntPJ73fyM73FCZu W3/X8dTUX+kLZRI3C60RyAUYhAsEhEpNWOzrFkZ/K5UtG0J52e0mEpKAHtVE4c7LVl2q T+zdp3a/ACM5zKXiO1GZY8eMPfldiR8gK6VrFJXqcawLZu6+INP7WCbMMZaysnsyBwVu +xOw== 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=AHdGkkZddVBOyFEt/OqcyDXcyZ16+gckGnxw/emomuY=; b=vqR8ANd/OLhaNgESIMuciuTh+2YuRXe3ZaRMOEtJTVj3dptFecBeoU7o5fi5Z/d5I+ 8boqObhvauZbISKn9CmfrBRzaOXNrAQvsdJPnIbeRu0vLM4FOCGwAXfrmSTr1SQZ+bof god5t8dYI9uzgNB0ewwE1lre51IPGwKsaOKdv8wSBhUf8KxD9iSEIMcEZ9ZYXmDjhaK/ hTc7l+r656dRs5TDUlZkFxiKP8w8IfYPM+lzo3pEIYyuL/ie5Mtp+ZyyC6T+VZpKsdY3 GsofR9+21W48ug9lw1ej3n7Cn8vat+h63yewei/JeYyAi5RYGHMt4S9ZHMGMekpy+fel pTfw== 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 m35si21806967pje.84.2019.07.16.22.28.49; Tue, 16 Jul 2019 22:29:06 -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 S1726463AbfGQF2a (ORCPT + 99 others); Wed, 17 Jul 2019 01:28:30 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:1936 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbfGQF2a (ORCPT ); Wed, 17 Jul 2019 01:28:30 -0400 X-UUID: 1a8adcc667254576bd55b0026e356277-20190717 X-UUID: 1a8adcc667254576bd55b0026e356277-20190717 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 203949510; Wed, 17 Jul 2019 13:28:18 +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:28:14 +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:28:14 +0800 Message-ID: <1563341294.29169.13.camel@mtksdaap41> Subject: Re: [PATCH v4, 10/33] drm/mediatek: add mutex sof 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:28:14 +0800 In-Reply-To: <1562625253-29254-11-git-send-email-yongqiang.niu@mediatek.com> References: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> <1562625253-29254-11-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: C7F92DD1F8BB564532194444A083C6D613D9FF2228190451A9C1CD2209C990482000: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 sof will be ddp private data > Reviewed-by: CK Hu > Signed-off-by: Yongqiang Niu > --- > drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 43 +++++++++++++++++++++++++++------- > 1 file changed, 35 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c > index 8bde2cf..ab396ee 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c > @@ -149,8 +149,19 @@ struct mtk_disp_mutex { > bool claimed; > }; > > +enum mtk_ddp_mutex_sof_id { > + DDP_MUTEX_SOF_SINGLE_MODE, > + DDP_MUTEX_SOF_DSI0, > + DDP_MUTEX_SOF_DSI1, > + DDP_MUTEX_SOF_DPI0, > + DDP_MUTEX_SOF_DPI1, > + DDP_MUTEX_SOF_DSI2, > + DDP_MUTEX_SOF_DSI3, > +}; > + > struct mtk_ddp_data { > const unsigned int *mutex_mod; > + const unsigned int *mutex_sof; > const unsigned int mutex_mod_reg; > }; > > @@ -209,18 +220,31 @@ struct mtk_ddp { > [DDP_COMPONENT_WDMA1] = MT8173_MUTEX_MOD_DISP_WDMA1, > }; > > +static const unsigned int mt2712_mutex_sof[DDP_MUTEX_SOF_DSI3 + 1] = { > + [DDP_MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, > + [DDP_MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0, > + [DDP_MUTEX_SOF_DSI1] = MUTEX_SOF_DSI1, > + [DDP_MUTEX_SOF_DPI0] = MUTEX_SOF_DPI0, > + [DDP_MUTEX_SOF_DPI1] = MUTEX_SOF_DPI1, > + [DDP_MUTEX_SOF_DSI2] = MUTEX_SOF_DSI2, > + [DDP_MUTEX_SOF_DSI3] = MUTEX_SOF_DSI3, > +}; > + > static const struct mtk_ddp_data mt2701_ddp_driver_data = { > .mutex_mod = mt2701_mutex_mod, > + .mutex_sof = mt2712_mutex_sof, > .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, > }; > > static const struct mtk_ddp_data mt2712_ddp_driver_data = { > .mutex_mod = mt2712_mutex_mod, > + .mutex_sof = mt2712_mutex_sof, > .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, > }; > > static const struct mtk_ddp_data mt8173_ddp_driver_data = { > .mutex_mod = mt8173_mutex_mod, > + .mutex_sof = mt2712_mutex_sof, > .mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0, > }; > > @@ -462,28 +486,29 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex, > struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp, > mutex[mutex->id]); > unsigned int reg; > + unsigned int sof_id; > unsigned int offset; > > WARN_ON(&ddp->mutex[mutex->id] != mutex); > > switch (id) { > case DDP_COMPONENT_DSI0: > - reg = MUTEX_SOF_DSI0; > + sof_id = DDP_MUTEX_SOF_DSI0; > break; > case DDP_COMPONENT_DSI1: > - reg = MUTEX_SOF_DSI0; > + sof_id = DDP_MUTEX_SOF_DSI0; > break; > case DDP_COMPONENT_DSI2: > - reg = MUTEX_SOF_DSI2; > + sof_id = DDP_MUTEX_SOF_DSI2; > break; > case DDP_COMPONENT_DSI3: > - reg = MUTEX_SOF_DSI3; > + sof_id = DDP_MUTEX_SOF_DSI3; > break; > case DDP_COMPONENT_DPI0: > - reg = MUTEX_SOF_DPI0; > + sof_id = DDP_MUTEX_SOF_DPI0; > break; > case DDP_COMPONENT_DPI1: > - reg = MUTEX_SOF_DPI1; > + sof_id = DDP_MUTEX_SOF_DPI1; > break; > default: > if (ddp->data->mutex_mod[id] < 32) { > @@ -501,7 +526,8 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex, > return; > } > > - writel_relaxed(reg, ddp->regs + DISP_REG_MUTEX_SOF(mutex->id)); > + writel_relaxed(ddp->data->mutex_sof[sof_id], > + ddp->regs + DISP_REG_MUTEX_SOF(mutex->id)); > } > > void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex, > @@ -522,7 +548,8 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex, > case DDP_COMPONENT_DPI0: > case DDP_COMPONENT_DPI1: > writel_relaxed(MUTEX_SOF_SINGLE_MODE, > - ddp->regs + DISP_REG_MUTEX_SOF(mutex->id)); > + ddp->regs + > + DISP_REG_MUTEX_SOF(mutex->id)); > break; > default: > if (ddp->data->mutex_mod[id] < 32) {