diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2020-08-25 13:46:02 +0800 |
---|---|---|
committer | Shengjiu Wang <shengjiu.wang@nxp.com> | 2020-08-31 18:08:17 +0800 |
commit | 3184f6eabe276bea8d3b7e5448bbce634efd3941 (patch) | |
tree | a474249e95467f4e21521c9178a8a51be6768915 /sound/soc/fsl/fsl_esai_mix.h | |
parent | d5986dc1d41899a11bd636fe337ef7d503183683 (diff) |
MLK-24612-2: ASoC: fsl_esai: Add esai mix driver
ESAI mixer is for mixing the data from clients. There is
a ping-pong buffer in the mixer for storing the mixed data.
The period size is same as the period size in client (unit is
sample number).
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Zhang <peng.zhang_8@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_esai_mix.h')
-rw-r--r-- | sound/soc/fsl/fsl_esai_mix.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_esai_mix.h b/sound/soc/fsl/fsl_esai_mix.h new file mode 100644 index 000000000000..7d117154b27a --- /dev/null +++ b/sound/soc/fsl/fsl_esai_mix.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _FSL_ESAI_MIX_H +#define _FSL_ESAI_MIX_H + +/* maximum client number is 4; */ +#define MAX_CLIENT_NUM 4 + +/** + * fsl_esai_mix: esai mix/split data + * @chan: dma channel + * @fe_substream: handler of front end substream + * @client: handler of client + * @dma_buffer: structure of dma buffer + * @buffer_offset: read offset of buffer + * @buffer_bytes: buffer size in bytes + * @period_bytes: period size in bytes + * @period_num: period number + * @word_width: word width in bytes + * @channels: channel number + * @client_cnt: client number, default 2. + * @sdo_cnt: output pin number of esai + * @sdi_cnt: input pin number of esai + * @active: mixer is enabled or not + */ +struct fsl_esai_mix { + struct dma_chan *chan; + struct snd_pcm_substream *fe_substream[MAX_CLIENT_NUM]; + struct fsl_esai_client *client[MAX_CLIENT_NUM]; + struct snd_dma_buffer dma_buffer; + u32 buffer_offset; + u32 buffer_bytes; + u32 period_bytes; + u32 period_num; + u32 word_width; + u32 channels; + u32 client_cnt; + u32 sdo_cnt; + u32 sdi_cnt; + atomic_t active; +}; + +int fsl_esai_mix_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct fsl_esai_mix *mix); +int fsl_esai_mix_open(struct snd_pcm_substream *substream, struct fsl_esai_mix *mix); +int fsl_esai_mix_close(struct snd_pcm_substream *substream, struct fsl_esai_mix *mix); +int fsl_esai_mix_trigger(struct snd_pcm_substream *substream, int cmd, + struct fsl_esai_mix *mix); +int fsl_esai_mix_probe(struct device *dev, struct fsl_esai_mix *mix_rx, struct fsl_esai_mix *mix_tx); +int fsl_esai_mix_remove(struct device *dev, struct fsl_esai_mix *mix_rx, struct fsl_esai_mix *mix_tx); + +#endif /* _FSL_ESAI_MIX_H */ |