linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb
@ 2021-09-15 23:27 Chun-Kuang Hu
  2021-10-08 14:15 ` Chun-Kuang Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Chun-Kuang Hu @ 2021-09-15 23:27 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Houlong Wei, Bibby Hsieh, Dennis YC Hsieh, linux-kernel,
	linux-arm-kernel, linux-mediatek, Chun-Kuang Hu

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 <chunkuang.hu@kernel.org>
---
 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 3c8e4212d941..c1837a468267 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 ac6b5f3cba95..2b498f4f3946 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__ */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb
  2021-09-15 23:27 [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb Chun-Kuang Hu
@ 2021-10-08 14:15 ` Chun-Kuang Hu
  2021-10-08 14:30   ` Matthias Brugger
  0 siblings, 1 reply; 4+ messages in thread
From: Chun-Kuang Hu @ 2021-10-08 14:15 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Matthias Brugger, Houlong Wei, Bibby Hsieh, Dennis YC Hsieh,
	linux-kernel, Linux ARM, moderated list:ARM/Mediatek SoC support

Hi, Matthias:

Please ignore this patch because this patch depend on [1] which would
cause numerous warning message. So I would revert that patch in [2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.15-rc4&id=c1ec54b7b5af25c779192253f5a9f05e95cb43d7
[2] https://patchwork.kernel.org/project/linux-mediatek/patch/20211007235310.14626-6-chunkuang.hu@kernel.org/

Regards,
Chun-Kuang.

Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2021年9月16日 週四 上午7:27寫道:
>
> 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 <chunkuang.hu@kernel.org>
> ---
>  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 3c8e4212d941..c1837a468267 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 ac6b5f3cba95..2b498f4f3946 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__ */
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb
  2021-10-08 14:15 ` Chun-Kuang Hu
@ 2021-10-08 14:30   ` Matthias Brugger
  2022-02-10 23:02     ` Chun-Kuang Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Brugger @ 2021-10-08 14:30 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Houlong Wei, Bibby Hsieh, Dennis YC Hsieh, linux-kernel,
	Linux ARM, moderated list:ARM/Mediatek SoC support

Hi Chun-Kuang,

On 08/10/2021 16:15, Chun-Kuang Hu wrote:
> Hi, Matthias:
> 
> Please ignore this patch because this patch depend on [1] which would
> cause numerous warning message. So I would revert that patch in [2].
> 

Thanks for the head-ups. I'll ignore this patch.

Regards,
Matthias

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.15-rc4&id=c1ec54b7b5af25c779192253f5a9f05e95cb43d7
> [2] https://patchwork.kernel.org/project/linux-mediatek/patch/20211007235310.14626-6-chunkuang.hu@kernel.org/
> 
> Regards,
> Chun-Kuang.
> 
> Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2021年9月16日 週四 上午7:27寫道:
>>
>> 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 <chunkuang.hu@kernel.org>
>> ---
>>   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 3c8e4212d941..c1837a468267 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 ac6b5f3cba95..2b498f4f3946 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__ */
>> --
>> 2.25.1
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb
  2021-10-08 14:30   ` Matthias Brugger
@ 2022-02-10 23:02     ` Chun-Kuang Hu
  0 siblings, 0 replies; 4+ messages in thread
From: Chun-Kuang Hu @ 2022-02-10 23:02 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Chun-Kuang Hu, Houlong Wei, Bibby Hsieh, Dennis YC Hsieh,
	linux-kernel, Linux ARM, moderated list:ARM/Mediatek SoC support

Hi, Matthias:

Matthias Brugger <matthias.bgg@gmail.com> 於 2021年10月8日 週五 下午10:30寫道:
>
> Hi Chun-Kuang,
>
> On 08/10/2021 16:15, Chun-Kuang Hu wrote:
> > Hi, Matthias:
> >
> > Please ignore this patch because this patch depend on [1] which would
> > cause numerous warning message. So I would revert that patch in [2].
> >
>
> Thanks for the head-ups. I'll ignore this patch.

This patch depend on [3] which has been merged into mainline, so you
could  start to review this parch.

[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.17-rc3&id=1ee07a683b7e4e6ad9ad4f77fce4751741bc8ceb

Regards,
Chun-Kuang.

>
> Regards,
> Matthias
>
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.15-rc4&id=c1ec54b7b5af25c779192253f5a9f05e95cb43d7
> > [2] https://patchwork.kernel.org/project/linux-mediatek/patch/20211007235310.14626-6-chunkuang.hu@kernel.org/
> >
> > Regards,
> > Chun-Kuang.
> >
> > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2021年9月16日 週四 上午7:27寫道:
> >>
> >> 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 <chunkuang.hu@kernel.org>
> >> ---
> >>   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 3c8e4212d941..c1837a468267 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 ac6b5f3cba95..2b498f4f3946 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__ */
> >> --
> >> 2.25.1
> >>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-10 23:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 23:27 [PATCH] soc: mediatek: cmdq: Use mailbox rx_callback instead of cmdq_task_cb Chun-Kuang Hu
2021-10-08 14:15 ` Chun-Kuang Hu
2021-10-08 14:30   ` Matthias Brugger
2022-02-10 23:02     ` Chun-Kuang Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).