mbox series

[RFC,v3,0/6] ASoC: fsl: add memory to memory function for ASRC

Message ID 1725615837-24872-1-git-send-email-shengjiu.wang@nxp.com (mailing list archive)
Headers show
Series ASoC: fsl: add memory to memory function for ASRC | expand

Message

S.J. Wang Sept. 6, 2024, 9:43 a.m. UTC
This function is base on the accelerator implementation
for compress API:
https://patchwork.kernel.org/project/alsa-devel/patch/20240731083843.59911-1-perex@perex.cz/

Audio signal processing also has the requirement for memory to
memory similar as Video.

This asrc memory to memory (memory ->asrc->memory) case is a non
real time use case.

User fills the input buffer to the asrc module, after conversion, then asrc
sends back the output buffer to user. So it is not a traditional ALSA playback
and capture case.

Because we had implemented the "memory -> asrc ->i2s device-> codec"
use case in ALSA.  Now the "memory->asrc->memory" needs
to reuse the code in asrc driver, so the patch 1 and patch 2 is for refining
the code to make it can be shared by the "memory->asrc->memory"
driver.

Other change is to add memory to memory support for two kinds of i.MX ASRC
modules.

changes in v3:
- use Jaroslav's suggestion for header file compress_params.h (PATCH 01)
- remove the ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE definition
- remove ASRC_RATIO_MOD in this version because it uses .set_metadata()
  Will wait Jaroslav's update or other better method in the future.
- Address some comments from Pierre.

changes in v2:
- Remove the changes in compress API
- drop the SNDRV_COMPRESS_SRC_RATIO_MOD
- drop the SND_AUDIOCODEC_SRC and struct snd_dec_src
- define private metadata key value
  ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE/ASRC_RATIO_MOD

Shengjiu Wang (6):
  ALSA: compress: Add output rate and output format support
  ASoC: fsl_asrc: define functions for memory to memory usage
  ASoC: fsl_easrc: define functions for memory to memory usage
  ASoC: fsl_asrc_m2m: Add memory to memory function
  ASoC: fsl_asrc: register m2m platform device
  ASoC: fsl_easrc: register m2m platform device

 include/uapi/sound/compress_params.h |  23 +-
 sound/soc/fsl/Kconfig                |   1 +
 sound/soc/fsl/Makefile               |   2 +-
 sound/soc/fsl/fsl_asrc.c             | 179 ++++++-
 sound/soc/fsl/fsl_asrc.h             |   2 +
 sound/soc/fsl/fsl_asrc_common.h      |  70 +++
 sound/soc/fsl/fsl_asrc_m2m.c         | 727 +++++++++++++++++++++++++++
 sound/soc/fsl/fsl_easrc.c            | 261 +++++++++-
 sound/soc/fsl/fsl_easrc.h            |   4 +
 9 files changed, 1260 insertions(+), 9 deletions(-)
 create mode 100644 sound/soc/fsl/fsl_asrc_m2m.c

Comments

Shengjiu Wang Sept. 13, 2024, 2:29 a.m. UTC | #1
On Fri, Sep 6, 2024 at 6:05 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> This function is base on the accelerator implementation
> for compress API:
> https://patchwork.kernel.org/project/alsa-devel/patch/20240731083843.59911-1-perex@perex.cz/

Hi Jaroslav

    Shall I add this patch to my patch set next time? Last time I
reported an issue
about "list_for_each_entry_safe_reverse", I can help to add it.  or
will you send
another version by yourself?

Best regards
Shengjiu Wang

>
> Audio signal processing also has the requirement for memory to
> memory similar as Video.
>
> This asrc memory to memory (memory ->asrc->memory) case is a non
> real time use case.
>
> User fills the input buffer to the asrc module, after conversion, then asrc
> sends back the output buffer to user. So it is not a traditional ALSA playback
> and capture case.
>
> Because we had implemented the "memory -> asrc ->i2s device-> codec"
> use case in ALSA.  Now the "memory->asrc->memory" needs
> to reuse the code in asrc driver, so the patch 1 and patch 2 is for refining
> the code to make it can be shared by the "memory->asrc->memory"
> driver.
>
> Other change is to add memory to memory support for two kinds of i.MX ASRC
> modules.
>
> changes in v3:
> - use Jaroslav's suggestion for header file compress_params.h (PATCH 01)
> - remove the ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE definition
> - remove ASRC_RATIO_MOD in this version because it uses .set_metadata()
>   Will wait Jaroslav's update or other better method in the future.
> - Address some comments from Pierre.
>
> changes in v2:
> - Remove the changes in compress API
> - drop the SNDRV_COMPRESS_SRC_RATIO_MOD
> - drop the SND_AUDIOCODEC_SRC and struct snd_dec_src
> - define private metadata key value
>   ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE/ASRC_RATIO_MOD
>
> Shengjiu Wang (6):
>   ALSA: compress: Add output rate and output format support
>   ASoC: fsl_asrc: define functions for memory to memory usage
>   ASoC: fsl_easrc: define functions for memory to memory usage
>   ASoC: fsl_asrc_m2m: Add memory to memory function
>   ASoC: fsl_asrc: register m2m platform device
>   ASoC: fsl_easrc: register m2m platform device
>
>  include/uapi/sound/compress_params.h |  23 +-
>  sound/soc/fsl/Kconfig                |   1 +
>  sound/soc/fsl/Makefile               |   2 +-
>  sound/soc/fsl/fsl_asrc.c             | 179 ++++++-
>  sound/soc/fsl/fsl_asrc.h             |   2 +
>  sound/soc/fsl/fsl_asrc_common.h      |  70 +++
>  sound/soc/fsl/fsl_asrc_m2m.c         | 727 +++++++++++++++++++++++++++
>  sound/soc/fsl/fsl_easrc.c            | 261 +++++++++-
>  sound/soc/fsl/fsl_easrc.h            |   4 +
>  9 files changed, 1260 insertions(+), 9 deletions(-)
>  create mode 100644 sound/soc/fsl/fsl_asrc_m2m.c
>
> --
> 2.34.1
>
Shengjiu Wang Sept. 19, 2024, 1:44 a.m. UTC | #2
Hi Jaroslav

On Fri, Sep 13, 2024 at 10:29 AM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
>
> On Fri, Sep 6, 2024 at 6:05 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
> >
> > This function is base on the accelerator implementation
> > for compress API:
> > https://patchwork.kernel.org/project/alsa-devel/patch/20240731083843.59911-1-perex@perex.cz/
>
> Hi Jaroslav
>
>     Shall I add this patch to my patch set next time? Last time I
> reported an issue
> about "list_for_each_entry_safe_reverse", I can help to add it.  or
> will you send
> another version by yourself?

A gentle reminder, look forward to your reply.
Thanks.

Best regards
Shengjiu Wang

>
> Best regards
> Shengjiu Wang
>
> >
> > Audio signal processing also has the requirement for memory to
> > memory similar as Video.
> >
> > This asrc memory to memory (memory ->asrc->memory) case is a non
> > real time use case.
> >
> > User fills the input buffer to the asrc module, after conversion, then asrc
> > sends back the output buffer to user. So it is not a traditional ALSA playback
> > and capture case.
> >
> > Because we had implemented the "memory -> asrc ->i2s device-> codec"
> > use case in ALSA.  Now the "memory->asrc->memory" needs
> > to reuse the code in asrc driver, so the patch 1 and patch 2 is for refining
> > the code to make it can be shared by the "memory->asrc->memory"
> > driver.
> >
> > Other change is to add memory to memory support for two kinds of i.MX ASRC
> > modules.
> >
> > changes in v3:
> > - use Jaroslav's suggestion for header file compress_params.h (PATCH 01)
> > - remove the ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE definition
> > - remove ASRC_RATIO_MOD in this version because it uses .set_metadata()
> >   Will wait Jaroslav's update or other better method in the future.
> > - Address some comments from Pierre.
> >
> > changes in v2:
> > - Remove the changes in compress API
> > - drop the SNDRV_COMPRESS_SRC_RATIO_MOD
> > - drop the SND_AUDIOCODEC_SRC and struct snd_dec_src
> > - define private metadata key value
> >   ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE/ASRC_RATIO_MOD
> >
> > Shengjiu Wang (6):
> >   ALSA: compress: Add output rate and output format support
> >   ASoC: fsl_asrc: define functions for memory to memory usage
> >   ASoC: fsl_easrc: define functions for memory to memory usage
> >   ASoC: fsl_asrc_m2m: Add memory to memory function
> >   ASoC: fsl_asrc: register m2m platform device
> >   ASoC: fsl_easrc: register m2m platform device
> >
> >  include/uapi/sound/compress_params.h |  23 +-
> >  sound/soc/fsl/Kconfig                |   1 +
> >  sound/soc/fsl/Makefile               |   2 +-
> >  sound/soc/fsl/fsl_asrc.c             | 179 ++++++-
> >  sound/soc/fsl/fsl_asrc.h             |   2 +
> >  sound/soc/fsl/fsl_asrc_common.h      |  70 +++
> >  sound/soc/fsl/fsl_asrc_m2m.c         | 727 +++++++++++++++++++++++++++
> >  sound/soc/fsl/fsl_easrc.c            | 261 +++++++++-
> >  sound/soc/fsl/fsl_easrc.h            |   4 +
> >  9 files changed, 1260 insertions(+), 9 deletions(-)
> >  create mode 100644 sound/soc/fsl/fsl_asrc_m2m.c
> >
> > --
> > 2.34.1
> >
Jaroslav Kysela Oct. 2, 2024, 10:10 a.m. UTC | #3
On 06. 09. 24 11:43, Shengjiu Wang wrote:
> This function is base on the accelerator implementation
> for compress API:
> https://patchwork.kernel.org/project/alsa-devel/patch/20240731083843.59911-1-perex@perex.cz/
> 
> Audio signal processing also has the requirement for memory to
> memory similar as Video.
> 
> This asrc memory to memory (memory ->asrc->memory) case is a non
> real time use case.
> 
> User fills the input buffer to the asrc module, after conversion, then asrc
> sends back the output buffer to user. So it is not a traditional ALSA playback
> and capture case.
> 
> Because we had implemented the "memory -> asrc ->i2s device-> codec"
> use case in ALSA.  Now the "memory->asrc->memory" needs
> to reuse the code in asrc driver, so the patch 1 and patch 2 is for refining
> the code to make it can be shared by the "memory->asrc->memory"
> driver.
> 
> Other change is to add memory to memory support for two kinds of i.MX ASRC
> modules.

Acked-by: Jaroslav Kysela <perex@perex.cz>