From patchwork Sat Apr 16 09:54:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 12815773 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 C9A25C433EF for ; Sat, 16 Apr 2022 09:55:08 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=w4C5/WQgbmPbJ3CZnsHZlbrURjzU3ktDLVvGDibB5gg=; b=tVPVnNey81SrUR vha7uR1MazFDMfoCy1JIHE0UNXDrKrc6ZccKblKc0q3kLrq+Bl26yykSed45JZtwbfBRYGwSWRetn tmSp6z05ayjWDgpZ7MoGkL4rDCnsWrB42j5nhDBBVX7fdLb0Txj7ZI4wwy+O/TgCm5asWz4kBcbir i9Ph7wUvepRwnDtHzFWGBX10dIc57HXTqAhvcvyFnpOqL3xqMDUQv8dKMCX+0TZNYl1fWQeisuJCy D/udGMh0BTHsoZP7eQOpUlbgg0LyDYwt0ITf5MtQ0LW2JFGZ023Z0yCflVwwgEOn1UHaU5CWudvlJ fNiLLGH8tEyefBkfWBMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nff8v-00CgOh-Ss; Sat, 16 Apr 2022 09:55:01 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nff8k-00CgNN-U4; Sat, 16 Apr 2022 09:54:52 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79EC8B81D08; Sat, 16 Apr 2022 09:54:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11875C385A3; Sat, 16 Apr 2022 09:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650102887; bh=75R1UEWugAKgPowTPgnhtbX6VQG5h2cX089a+YURiW0=; h=From:To:Cc:Subject:Date:From; b=quZSnKZVkLtXwXwETZFSIhf4J0rdmTRUIKssNt7xjoj5sN0AFweRpLak+xhRVU8bN USFxXVHXNWMMSBaWVHFLHjY/yYSt93Yx3Nw8JIomYwAWjVC8Y+f4vcvtHA1rNPCypk 2D8sjl7ijL0Qwcd9DQtOXu5mQiAfKP4wPpX7hZxfcha7QvFsunNUtDXW2Tak24AGtK iEKBvWZ57C133dG2b5ne90IQM+7+tngMLJq0Mes0XGvN81V0LIwhFYgotVRmf4dMJw Di1bDxJEtDyrsYYArUCzd7w4PyRA6JnjDrlkP9If91yGUgX+chxhZYpfOC/In92rOp 6H4+K+0PJIG8g== From: Chun-Kuang Hu To: Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Chun-Kuang Hu Subject: [RESEND PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb Date: Sat, 16 Apr 2022 17:54:28 +0800 Message-Id: <1650102868-26219-1-git-send-email-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220416_025451_308590_DBB241B9 X-CRM114-Status: GOOD ( 14.07 ) 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: , MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org rx_callback is a standard mailbox callback mechanism and could cover the function of proprietary cmdq_task_cb, so use the standard one instead of the proprietary one. Client has changed to use the standard callback machanism and sync dma buffer in client driver, so remove the proprietary callback in cmdq helper. Signed-off-by: Chun-Kuang Hu Reviewed-by: jason-jh.lin Tested-by: jason-jh.lin --- drivers/soc/mediatek/mtk-cmdq-helper.c | 25 +------------------------ include/linux/soc/mediatek/mtk-cmdq.h | 5 +---- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 3c8e421..c1837a4 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -425,34 +425,11 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt) } EXPORT_SYMBOL(cmdq_pkt_finalize); -static void cmdq_pkt_flush_async_cb(struct cmdq_cb_data data) -{ - struct cmdq_pkt *pkt = (struct cmdq_pkt *)data.data; - struct cmdq_task_cb *cb = &pkt->cb; - struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - - dma_sync_single_for_cpu(client->chan->mbox->dev, pkt->pa_base, - pkt->cmd_buf_size, DMA_TO_DEVICE); - if (cb->cb) { - data.data = cb->data; - cb->cb(data); - } -} - -int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, - void *data) +int cmdq_pkt_flush_async(struct cmdq_pkt *pkt) { int err; struct cmdq_client *client = (struct cmdq_client *)pkt->cl; - pkt->cb.cb = cb; - pkt->cb.data = data; - pkt->async_cb.cb = cmdq_pkt_flush_async_cb; - pkt->async_cb.data = pkt; - - dma_sync_single_for_device(client->chan->mbox->dev, pkt->pa_base, - pkt->cmd_buf_size, DMA_TO_DEVICE); - err = mbox_send_message(client->chan, pkt); if (err < 0) return err; diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index ac6b5f3..2b498f4 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -268,8 +268,6 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); * cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute the CMDQ * packet and call back at the end of done packet * @pkt: the CMDQ packet - * @cb: called at the end of done packet - * @data: this data will pass back to cb * * Return: 0 for success; else the error code is returned * @@ -277,7 +275,6 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); * at the end of done packet. Note that this is an ASYNC function. When the * function returned, it may or may not be finished. */ -int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, - void *data); +int cmdq_pkt_flush_async(struct cmdq_pkt *pkt); #endif /* __MTK_CMDQ_H__ */