Skip to content

Commit

Permalink
ASoC: fsl_asrc_m2m: Add memory to memory function
Browse files Browse the repository at this point in the history
Implement the ASRC memory to memory function using
the compress framework, user can use this function with
compress ioctl interface.

This feature can be shared by ASRC and EASRC drivers

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://patch.msgid.link/20241212074509.3445859-5-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
TE-N-ShengjiuWang authored and broonie committed Dec 13, 2024
1 parent 2714769 commit 24a0171
Show file tree
Hide file tree
Showing 4 changed files with 739 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sound/soc/fsl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ config SND_SOC_FSL_ASRC
depends on HAS_DMA
select REGMAP_MMIO
select SND_SOC_GENERIC_DMAENGINE_PCM
select SND_COMPRESS_ACCEL
select SND_COMPRESS_OFFLOAD
help
Say Y if you want to add Asynchronous Sample Rate Converter (ASRC)
support for the Freescale CPUs.
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/fsl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o
# Freescale SSI/DMA/SAI/SPDIF Support
snd-soc-fsl-audmix-y := fsl_audmix.o
snd-soc-fsl-asoc-card-y := fsl-asoc-card.o
snd-soc-fsl-asrc-y := fsl_asrc.o fsl_asrc_dma.o
snd-soc-fsl-asrc-y := fsl_asrc.o fsl_asrc_dma.o fsl_asrc_m2m.o
snd-soc-fsl-lpc3xxx-y := lpc3xxx-pcm.o lpc3xxx-i2s.o
snd-soc-fsl-sai-y := fsl_sai.o
snd-soc-fsl-ssi-y := fsl_ssi.o
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/fsl/fsl_asrc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct fsl_asrc_m2m_cap {
* @buf_len: buffer length of m2m
* @dma_buffer: buffer pointers
* @first_convert: start of conversion
* @ratio_mod_flag: flag for new ratio modifier
* @ratio_mod: ratio modification
*/
struct fsl_asrc_pair {
Expand All @@ -84,6 +85,7 @@ struct fsl_asrc_pair {
unsigned int buf_len[2];
struct snd_dma_buffer dma_buffer[2];
unsigned int first_convert;
bool ratio_mod_flag;
unsigned int ratio_mod;
};

Expand All @@ -98,6 +100,7 @@ struct fsl_asrc_pair {
* @mem_clk: clock source to access register
* @ipg_clk: clock source to drive peripheral
* @spba_clk: SPBA clock (optional, depending on SoC design)
* @card: compress sound card
* @lock: spin lock for resource protection
* @pair: pair pointers
* @channel_avail: non-occupied channel numbers
Expand Down Expand Up @@ -131,6 +134,7 @@ struct fsl_asrc {
struct clk *mem_clk;
struct clk *ipg_clk;
struct clk *spba_clk;
struct snd_card *card;
spinlock_t lock; /* spin lock for resource protection */

struct fsl_asrc_pair *pair[PAIR_CTX_NUM];
Expand Down Expand Up @@ -166,4 +170,9 @@ struct fsl_asrc {
#define DRV_NAME "fsl-asrc-dai"
extern struct snd_soc_component_driver fsl_asrc_component;

int fsl_asrc_m2m_init(struct fsl_asrc *asrc);
void fsl_asrc_m2m_exit(struct fsl_asrc *asrc);
int fsl_asrc_m2m_resume(struct fsl_asrc *asrc);
int fsl_asrc_m2m_suspend(struct fsl_asrc *asrc);

#endif /* _FSL_ASRC_COMMON_H */
Loading

0 comments on commit 24a0171

Please sign in to comment.