Skip to content

Commit cefcc03

Browse files
committed
ASoC: Provide a more complete DMA driver stub
Allow userspace applications to do more parameter setting by providing a more complete stub DMA driver specifying a wildcard set of formats and channels and essentially random values for the DMA parameters. This is required for useful runtime operation of the dummy DMA driver until we are able to figure out how to power up links and do hw_params() from DAPM. Sending to stable as without this the dummy driver is not terribly useful. Reported-by: Kyung-Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.com> Tested-by: Kyung-Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
1 parent 145294c commit cefcc03

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

‎sound/soc/soc-utils.c‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,36 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
5858
}
5959
EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
6060

61-
static struct snd_soc_platform_driver dummy_platform;
61+
static const struct snd_pcm_hardware dummy_dma_hardware = {
62+
.formats = 0xffffffff,
63+
.channels_min = 1,
64+
.channels_max = UINT_MAX,
65+
66+
/* Random values to keep userspace happy when checking constraints */
67+
.info = SNDRV_PCM_INFO_INTERLEAVED |
68+
SNDRV_PCM_INFO_BLOCK_TRANSFER,
69+
.buffer_bytes_max = 128*1024,
70+
.period_bytes_min = PAGE_SIZE,
71+
.period_bytes_max = PAGE_SIZE*2,
72+
.periods_min = 2,
73+
.periods_max = 128,
74+
};
75+
76+
static int dummy_dma_open(struct snd_pcm_substream *substream)
77+
{
78+
snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware);
79+
80+
return 0;
81+
}
82+
83+
static struct snd_pcm_ops dummy_dma_ops = {
84+
.open = dummy_dma_open,
85+
.ioctl = snd_pcm_lib_ioctl,
86+
};
87+
88+
static struct snd_soc_platform_driver dummy_platform = {
89+
.ops = &dummy_dma_ops,
90+
};
6291

6392
static __devinit int snd_soc_dummy_probe(struct platform_device *pdev)
6493
{

0 commit comments

Comments
 (0)