|
20 | 20 | #include <sound/pxa2xx-lib.h> |
21 | 21 | #include <sound/dmaengine_pcm.h> |
22 | 22 |
|
23 | | -static int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, |
24 | | - struct snd_pcm_hw_params *params) |
25 | | -{ |
26 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
27 | | - struct snd_dmaengine_dai_dma_data *dma; |
28 | | - |
29 | | - dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
30 | | - |
31 | | - /* return if this is a bufferless transfer e.g. |
32 | | - * codec <--> BT codec or GSM modem -- lg FIXME */ |
33 | | - if (!dma) |
34 | | - return 0; |
35 | | - |
36 | | - return pxa2xx_pcm_hw_params(substream, params); |
37 | | -} |
38 | | - |
39 | | -static const struct snd_pcm_ops pxa2xx_pcm_ops = { |
40 | | - .open = pxa2xx_pcm_open, |
41 | | - .close = pxa2xx_pcm_close, |
42 | | - .ioctl = snd_pcm_lib_ioctl, |
43 | | - .hw_params = __pxa2xx_pcm_hw_params, |
44 | | - .hw_free = pxa2xx_pcm_hw_free, |
45 | | - .prepare = pxa2xx_pcm_prepare, |
46 | | - .trigger = pxa2xx_pcm_trigger, |
47 | | - .pointer = pxa2xx_pcm_pointer, |
48 | | - .mmap = pxa2xx_pcm_mmap, |
49 | | -}; |
50 | | - |
51 | | -static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) |
52 | | -{ |
53 | | - struct snd_card *card = rtd->card->snd_card; |
54 | | - struct snd_pcm *pcm = rtd->pcm; |
55 | | - int ret; |
56 | | - |
57 | | - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); |
58 | | - if (ret) |
59 | | - return ret; |
60 | | - |
61 | | - if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { |
62 | | - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
63 | | - SNDRV_PCM_STREAM_PLAYBACK); |
64 | | - if (ret) |
65 | | - goto out; |
66 | | - } |
67 | | - |
68 | | - if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { |
69 | | - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, |
70 | | - SNDRV_PCM_STREAM_CAPTURE); |
71 | | - if (ret) |
72 | | - goto out; |
73 | | - } |
74 | | - out: |
75 | | - return ret; |
76 | | -} |
77 | | - |
78 | 23 | static const struct snd_soc_component_driver pxa2xx_soc_platform = { |
79 | 24 | .ops = &pxa2xx_pcm_ops, |
80 | 25 | .pcm_new = pxa2xx_soc_pcm_new, |
|
0 commit comments