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: 12815772 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 0744DC433EF for ; Sat, 16 Apr 2022 09:56:06 +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=+fQAacpgh1wbsNiUrh/hJXXwtkyrRDdBRkIBBgQcz94=; b=nG+6zlkYgTUxv+ 5yMpEz6LNXgkTgDsjEl9B4oqrBapq7IFfi32l48i9PG4X0GwjB7JbIKUfjTUeJcyBZgqD3FH7otAv YG0bi6XAqgjr7YWEZFfhCSoSOvuuZqlfntWwEJSV/CqX7ZVBJZXzg+mYnpgkhwdEDQtdCna9mS5La eFx8gwZk8StvOlgfd7CAKBgAiWWARnI6oByVXzmi8tWhuyGBzzVbZ6dEKF1XnT6hqd1p0iJMTpZrw YLn/2tedhLEOMXx3jVnqn1TzDIfX/Pvzh4dBCEjaHRQEZ8IPmoZgnoai7XhKObXRhER95s9iZm15Z HKBfoKR7VEyqtIzj/+bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nff8o-00CgNt-7t; Sat, 16 Apr 2022 09:54:54 +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-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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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__ */