From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8D30C433EF for ; Mon, 25 Apr 2022 03:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HqU8sasrBXPMmSbP75+0fO7h8YLfCn+I6OdfScmPvYo=; b=rJ9LyeVQxJE6qm /Zi8AbUtxOQh+7Iau5RsfasQ0JudPrAa/YjV4Q++Jkqpt1g14GwsQ6mPDGRjvz+y2sFVKUJNaI/TG gaVJSxUy7EvHpCx62GhVaGT/oOYKVPc7AnkCPRrg61jcRDU6ahEHGrkXMXh5pOkbOn48MWN0tnve8 NPMmv5x6D8X2NzVhiNGTdMD5u8q76NvTGvBgKr52iKYNRzeY7WcaLQN+hbT+U+aVta9+EF7FC7jxc +iobgWZ0wbth8Som4Qb72YX6th+YbB6toG0tpHs4Vvm7qrYOZYYm8eXONQqE2H8GObS9pN/iisLuf dgPMjqpQiyYdesVq/v4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipAF-007x4l-En; Mon, 25 Apr 2022 03:13:27 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipAB-007x3x-Vi; Mon, 25 Apr 2022 03:13:25 +0000 X-UUID: 440eb51a461e4a2e954d34124aee72aa-20220424 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4, REQID:bdddcbc5-299d-430b-a872-050710f79b87, OB:0, LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:faefae9, CLOUDID:698bccf0-da02-41b4-b6df-58f4ccd36682, C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: 440eb51a461e4a2e954d34124aee72aa-20220424 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 618521982; Sun, 24 Apr 2022 20:13:11 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 24 Apr 2022 20:03:08 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 25 Apr 2022 11:02:53 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 25 Apr 2022 11:02:53 +0800 Message-ID: Subject: Re: [PATCH v16 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ From: moudy.ho To: Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , "Hans Verkuil" CC: Chun-Kuang Hu , Rob Landley , Laurent Pinchart , , , , , , Alexandre Courbot , , , , , Benjamin Gaignard , AngeloGioacchino Del Regno , "daoyuan huang" , Ping-Hsun Wu , , , , , , , , Date: Mon, 25 Apr 2022 11:02:53 +0800 In-Reply-To: <20220418083018.1907-7-moudy.ho@mediatek.com> References: <20220418083018.1907-1-moudy.ho@mediatek.com> <20220418083018.1907-7-moudy.ho@mediatek.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_201324_071073_9D749DA1 X-CRM114-Status: GOOD ( 27.56 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Mon, 2022-04-18 at 16:30 +0800, Moudy Ho wrote: > Due to HW limitations, MDP3 is necessary to enable MUTEX in each > frame > for SOF triggering and cooperate with CMDQ control to reduce the > amount > of interrupts generated(also, reduce frame latency). > > In response to the above situation, a new interface > "mtk_mutex_enable_by_cmdq" has been added to achieve the purpose. > > Signed-off-by: Moudy Ho > --- > drivers/soc/mediatek/mtk-mutex.c | 44 > +++++++++++++++++++++++++- > include/linux/soc/mediatek/mtk-mutex.h | 2 ++ > 2 files changed, 45 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/mediatek/mtk-mutex.c > b/drivers/soc/mediatek/mtk-mutex.c > index 92afdee14d43..4a3b11d31581 100644 > --- a/drivers/soc/mediatek/mtk-mutex.c > +++ b/drivers/soc/mediatek/mtk-mutex.c > @@ -7,10 +7,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#include > > #define MT2701_MUTEX0_MOD0 0x2c > #define MT2701_MUTEX0_SOF0 0x30 > @@ -176,6 +178,9 @@ struct mtk_mutex_ctx { > void __iomem *regs; > struct mtk_mutex mutex[10]; > const struct mtk_mutex_data *data; > + phys_addr_t addr; > + struct cmdq_client_reg cmdq_reg; > + bool has_gce_client_reg; > }; > > static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = { > @@ -531,6 +536,30 @@ void mtk_mutex_enable(struct mtk_mutex *mutex) > } > EXPORT_SYMBOL_GPL(mtk_mutex_enable); > > +int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, void *pkt) > +{ > +#if IS_REACHABLE(CONFIG_MTK_CMDQ) > + struct mtk_mutex_ctx *mtx = container_of(mutex, struct > mtk_mutex_ctx, > + mutex[mutex->id]); Hi, Sorry for the misplacement of the definition here, and a compilation error will occur if CMDQ is not supported. Thanks, Moudy > + struct cmdq_pkt *cmdq_pkt = (struct cmdq_pkt *)pkt; > + > + WARN_ON(&mtx->mutex[mutex->id] != mutex); > + > + if (!mtx->has_gce_client_reg) { > + dev_err(mtx->dev, "mediatek,gce-client-reg hasn't been > set in dts"); > + return -EINVAL; > + } > + > + cmdq_pkt_write(cmdq_pkt, mtx->cmdq_reg.subsys, > + mtx->addr + DISP_REG_MUTEX_EN(mutex->id), 1); > + return 0; > +#else > + dev_err(mtx->dev, "Not support for enable MUTEX by CMDQ"); > + return -ENODEV; > +#endif > +} > +EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq); > + > void mtk_mutex_disable(struct mtk_mutex *mutex) > { > struct mtk_mutex_ctx *mtx = container_of(mutex, struct > mtk_mutex_ctx, > @@ -655,7 +684,7 @@ static int mtk_mutex_probe(struct platform_device > *pdev) > { > struct device *dev = &pdev->dev; > struct mtk_mutex_ctx *mtx; > - struct resource *regs; > + struct resource *regs, addr; > int i; > > mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); > @@ -676,6 +705,19 @@ static int mtk_mutex_probe(struct > platform_device *pdev) > } > } > > + if (of_address_to_resource(dev->of_node, 0, &addr) < 0) > + mtx->addr = 0L; > + else > + mtx->addr = addr.start; > + > +#if IS_REACHABLE(CONFIG_MTK_CMDQ) > + ret = cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0); > + if (ret) > + dev_dbg(dev, "No mediatek,gce-client-reg!\n"); > + else > + mtx->has_gce_client_reg = true; > +#endif > + > regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); > mtx->regs = devm_ioremap_resource(dev, regs); > if (IS_ERR(mtx->regs)) { > diff --git a/include/linux/soc/mediatek/mtk-mutex.h > b/include/linux/soc/mediatek/mtk-mutex.h > index f174452212d6..80425ae19fb7 100644 > --- a/include/linux/soc/mediatek/mtk-mutex.h > +++ b/include/linux/soc/mediatek/mtk-mutex.h > @@ -29,6 +29,8 @@ int mtk_mutex_prepare(struct mtk_mutex *mutex); > void mtk_mutex_add_comp(struct mtk_mutex *mutex, > enum mtk_ddp_comp_id id); > void mtk_mutex_enable(struct mtk_mutex *mutex); > +int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, > + void *pkt); > void mtk_mutex_disable(struct mtk_mutex *mutex); > void mtk_mutex_remove_comp(struct mtk_mutex *mutex, > enum mtk_ddp_comp_id id); _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC313C433EF for ; Mon, 25 Apr 2022 03:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oEVnP7999evno4io/Us9zj6OZhPjBSS/3yAYOmDFQ8g=; b=t3PuBHN3Zt+Zfb WHtdlR2AFHU2O3s1kecTO6n2p8On+AZFXInEFC+46tukvrwlgpv7zKPKs9LfSkKBOUyhzKygMfp7o wuXgsQL2TmcKZaxjzp8uLR6iiFs+RbzQ+RKKDiYRe4662t/SQ1SKbA+gzqQfx8Z0fJyVj2NKdqW7a 93YYIU4/R35pNWNcDov90oXnQMzA390QRhxC1EBKT/CjX3LaTfvvJcw/yDBfunq0vuVA8kW2fzEUN uppMoNRaFFZ+zmlKmvamQoXHTlH58fsqjNB/uHDtAE8tefeEgoBKMHjHXQiI1TYdg3YI0nQc+pdjI E+J6cdCPLmR2fPDQkkxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipAG-007x4x-JX; Mon, 25 Apr 2022 03:13:28 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nipAB-007x3x-Vi; Mon, 25 Apr 2022 03:13:25 +0000 X-UUID: 440eb51a461e4a2e954d34124aee72aa-20220424 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4, REQID:bdddcbc5-299d-430b-a872-050710f79b87, OB:0, LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:faefae9, CLOUDID:698bccf0-da02-41b4-b6df-58f4ccd36682, C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: 440eb51a461e4a2e954d34124aee72aa-20220424 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 618521982; Sun, 24 Apr 2022 20:13:11 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 24 Apr 2022 20:03:08 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 25 Apr 2022 11:02:53 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 25 Apr 2022 11:02:53 +0800 Message-ID: Subject: Re: [PATCH v16 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ From: moudy.ho To: Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , "Hans Verkuil" CC: Chun-Kuang Hu , Rob Landley , Laurent Pinchart , , , , , , Alexandre Courbot , , , , , Benjamin Gaignard , AngeloGioacchino Del Regno , "daoyuan huang" , Ping-Hsun Wu , , , , , , , , Date: Mon, 25 Apr 2022 11:02:53 +0800 In-Reply-To: <20220418083018.1907-7-moudy.ho@mediatek.com> References: <20220418083018.1907-1-moudy.ho@mediatek.com> <20220418083018.1907-7-moudy.ho@mediatek.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_201324_071073_9D749DA1 X-CRM114-Status: GOOD ( 27.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 2022-04-18 at 16:30 +0800, Moudy Ho wrote: > Due to HW limitations, MDP3 is necessary to enable MUTEX in each > frame > for SOF triggering and cooperate with CMDQ control to reduce the > amount > of interrupts generated(also, reduce frame latency). > > In response to the above situation, a new interface > "mtk_mutex_enable_by_cmdq" has been added to achieve the purpose. > > Signed-off-by: Moudy Ho > --- > drivers/soc/mediatek/mtk-mutex.c | 44 > +++++++++++++++++++++++++- > include/linux/soc/mediatek/mtk-mutex.h | 2 ++ > 2 files changed, 45 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/mediatek/mtk-mutex.c > b/drivers/soc/mediatek/mtk-mutex.c > index 92afdee14d43..4a3b11d31581 100644 > --- a/drivers/soc/mediatek/mtk-mutex.c > +++ b/drivers/soc/mediatek/mtk-mutex.c > @@ -7,10 +7,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#include > > #define MT2701_MUTEX0_MOD0 0x2c > #define MT2701_MUTEX0_SOF0 0x30 > @@ -176,6 +178,9 @@ struct mtk_mutex_ctx { > void __iomem *regs; > struct mtk_mutex mutex[10]; > const struct mtk_mutex_data *data; > + phys_addr_t addr; > + struct cmdq_client_reg cmdq_reg; > + bool has_gce_client_reg; > }; > > static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = { > @@ -531,6 +536,30 @@ void mtk_mutex_enable(struct mtk_mutex *mutex) > } > EXPORT_SYMBOL_GPL(mtk_mutex_enable); > > +int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, void *pkt) > +{ > +#if IS_REACHABLE(CONFIG_MTK_CMDQ) > + struct mtk_mutex_ctx *mtx = container_of(mutex, struct > mtk_mutex_ctx, > + mutex[mutex->id]); Hi, Sorry for the misplacement of the definition here, and a compilation error will occur if CMDQ is not supported. Thanks, Moudy > + struct cmdq_pkt *cmdq_pkt = (struct cmdq_pkt *)pkt; > + > + WARN_ON(&mtx->mutex[mutex->id] != mutex); > + > + if (!mtx->has_gce_client_reg) { > + dev_err(mtx->dev, "mediatek,gce-client-reg hasn't been > set in dts"); > + return -EINVAL; > + } > + > + cmdq_pkt_write(cmdq_pkt, mtx->cmdq_reg.subsys, > + mtx->addr + DISP_REG_MUTEX_EN(mutex->id), 1); > + return 0; > +#else > + dev_err(mtx->dev, "Not support for enable MUTEX by CMDQ"); > + return -ENODEV; > +#endif > +} > +EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq); > + > void mtk_mutex_disable(struct mtk_mutex *mutex) > { > struct mtk_mutex_ctx *mtx = container_of(mutex, struct > mtk_mutex_ctx, > @@ -655,7 +684,7 @@ static int mtk_mutex_probe(struct platform_device > *pdev) > { > struct device *dev = &pdev->dev; > struct mtk_mutex_ctx *mtx; > - struct resource *regs; > + struct resource *regs, addr; > int i; > > mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); > @@ -676,6 +705,19 @@ static int mtk_mutex_probe(struct > platform_device *pdev) > } > } > > + if (of_address_to_resource(dev->of_node, 0, &addr) < 0) > + mtx->addr = 0L; > + else > + mtx->addr = addr.start; > + > +#if IS_REACHABLE(CONFIG_MTK_CMDQ) > + ret = cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0); > + if (ret) > + dev_dbg(dev, "No mediatek,gce-client-reg!\n"); > + else > + mtx->has_gce_client_reg = true; > +#endif > + > regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); > mtx->regs = devm_ioremap_resource(dev, regs); > if (IS_ERR(mtx->regs)) { > diff --git a/include/linux/soc/mediatek/mtk-mutex.h > b/include/linux/soc/mediatek/mtk-mutex.h > index f174452212d6..80425ae19fb7 100644 > --- a/include/linux/soc/mediatek/mtk-mutex.h > +++ b/include/linux/soc/mediatek/mtk-mutex.h > @@ -29,6 +29,8 @@ int mtk_mutex_prepare(struct mtk_mutex *mutex); > void mtk_mutex_add_comp(struct mtk_mutex *mutex, > enum mtk_ddp_comp_id id); > void mtk_mutex_enable(struct mtk_mutex *mutex); > +int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, > + void *pkt); > void mtk_mutex_disable(struct mtk_mutex *mutex); > void mtk_mutex_remove_comp(struct mtk_mutex *mutex, > enum mtk_ddp_comp_id id); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel