Skip to content

Commit 24a0171

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_asrc_m2m: Add memory to memory function
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 <[email protected]> Acked-by: Jaroslav Kysela <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2714769 commit 24a0171

File tree

4 files changed

+739
-1
lines changed

4 files changed

+739
-1
lines changed

sound/soc/fsl/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ config SND_SOC_FSL_ASRC
88
depends on HAS_DMA
99
select REGMAP_MMIO
1010
select SND_SOC_GENERIC_DMAENGINE_PCM
11+
select SND_COMPRESS_ACCEL
12+
select SND_COMPRESS_OFFLOAD
1113
help
1214
Say Y if you want to add Asynchronous Sample Rate Converter (ASRC)
1315
support for the Freescale CPUs.

sound/soc/fsl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o
1010
# Freescale SSI/DMA/SAI/SPDIF Support
1111
snd-soc-fsl-audmix-y := fsl_audmix.o
1212
snd-soc-fsl-asoc-card-y := fsl-asoc-card.o
13-
snd-soc-fsl-asrc-y := fsl_asrc.o fsl_asrc_dma.o
13+
snd-soc-fsl-asrc-y := fsl_asrc.o fsl_asrc_dma.o fsl_asrc_m2m.o
1414
snd-soc-fsl-lpc3xxx-y := lpc3xxx-pcm.o lpc3xxx-i2s.o
1515
snd-soc-fsl-sai-y := fsl_sai.o
1616
snd-soc-fsl-ssi-y := fsl_ssi.o

sound/soc/fsl/fsl_asrc_common.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct fsl_asrc_m2m_cap {
6060
* @buf_len: buffer length of m2m
6161
* @dma_buffer: buffer pointers
6262
* @first_convert: start of conversion
63+
* @ratio_mod_flag: flag for new ratio modifier
6364
* @ratio_mod: ratio modification
6465
*/
6566
struct fsl_asrc_pair {
@@ -84,6 +85,7 @@ struct fsl_asrc_pair {
8485
unsigned int buf_len[2];
8586
struct snd_dma_buffer dma_buffer[2];
8687
unsigned int first_convert;
88+
bool ratio_mod_flag;
8789
unsigned int ratio_mod;
8890
};
8991

@@ -98,6 +100,7 @@ struct fsl_asrc_pair {
98100
* @mem_clk: clock source to access register
99101
* @ipg_clk: clock source to drive peripheral
100102
* @spba_clk: SPBA clock (optional, depending on SoC design)
103+
* @card: compress sound card
101104
* @lock: spin lock for resource protection
102105
* @pair: pair pointers
103106
* @channel_avail: non-occupied channel numbers
@@ -131,6 +134,7 @@ struct fsl_asrc {
131134
struct clk *mem_clk;
132135
struct clk *ipg_clk;
133136
struct clk *spba_clk;
137+
struct snd_card *card;
134138
spinlock_t lock; /* spin lock for resource protection */
135139

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

173+
int fsl_asrc_m2m_init(struct fsl_asrc *asrc);
174+
void fsl_asrc_m2m_exit(struct fsl_asrc *asrc);
175+
int fsl_asrc_m2m_resume(struct fsl_asrc *asrc);
176+
int fsl_asrc_m2m_suspend(struct fsl_asrc *asrc);
177+
169178
#endif /* _FSL_ASRC_COMMON_H */

0 commit comments

Comments
 (0)