.. | .. |
---|
77 | 77 | } |
---|
78 | 78 | EXPORT_SYMBOL_GPL(mtk_afe_add_sub_dai_control); |
---|
79 | 79 | |
---|
80 | | -static snd_pcm_uframes_t mtk_afe_pcm_pointer |
---|
81 | | - (struct snd_pcm_substream *substream) |
---|
| 80 | +snd_pcm_uframes_t mtk_afe_pcm_pointer(struct snd_soc_component *component, |
---|
| 81 | + struct snd_pcm_substream *substream) |
---|
82 | 82 | { |
---|
83 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
84 | | - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
---|
| 83 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
85 | 84 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); |
---|
86 | | - struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
---|
| 85 | + struct mtk_base_afe_memif *memif = &afe->memif[asoc_rtd_to_cpu(rtd, 0)->id]; |
---|
87 | 86 | const struct mtk_base_memif_data *memif_data = memif->data; |
---|
88 | 87 | struct regmap *regmap = afe->regmap; |
---|
89 | 88 | struct device *dev = afe->dev; |
---|
.. | .. |
---|
111 | 110 | POINTER_RETURN_FRAMES: |
---|
112 | 111 | return bytes_to_frames(substream->runtime, pcm_ptr_bytes); |
---|
113 | 112 | } |
---|
| 113 | +EXPORT_SYMBOL_GPL(mtk_afe_pcm_pointer); |
---|
114 | 114 | |
---|
115 | | -const struct snd_pcm_ops mtk_afe_pcm_ops = { |
---|
116 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
117 | | - .pointer = mtk_afe_pcm_pointer, |
---|
118 | | -}; |
---|
119 | | -EXPORT_SYMBOL_GPL(mtk_afe_pcm_ops); |
---|
120 | | - |
---|
121 | | -int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd) |
---|
| 115 | +int mtk_afe_pcm_new(struct snd_soc_component *component, |
---|
| 116 | + struct snd_soc_pcm_runtime *rtd) |
---|
122 | 117 | { |
---|
123 | 118 | size_t size; |
---|
124 | 119 | struct snd_pcm *pcm = rtd->pcm; |
---|
125 | | - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
---|
126 | 120 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); |
---|
127 | 121 | |
---|
128 | 122 | size = afe->mtk_afe_hardware->buffer_bytes_max; |
---|
129 | | - return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
130 | | - afe->dev, |
---|
131 | | - size, size); |
---|
| 123 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
| 124 | + afe->dev, size, size); |
---|
| 125 | + return 0; |
---|
132 | 126 | } |
---|
133 | 127 | EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); |
---|
134 | 128 | |
---|
135 | | -void mtk_afe_pcm_free(struct snd_pcm *pcm) |
---|
136 | | -{ |
---|
137 | | - snd_pcm_lib_preallocate_free_for_all(pcm); |
---|
138 | | -} |
---|
139 | | -EXPORT_SYMBOL_GPL(mtk_afe_pcm_free); |
---|
140 | | - |
---|
141 | 129 | const struct snd_soc_component_driver mtk_afe_pcm_platform = { |
---|
142 | | - .name = AFE_PCM_NAME, |
---|
143 | | - .ops = &mtk_afe_pcm_ops, |
---|
144 | | - .pcm_new = mtk_afe_pcm_new, |
---|
145 | | - .pcm_free = mtk_afe_pcm_free, |
---|
| 130 | + .name = AFE_PCM_NAME, |
---|
| 131 | + .pointer = mtk_afe_pcm_pointer, |
---|
| 132 | + .pcm_construct = mtk_afe_pcm_new, |
---|
146 | 133 | }; |
---|
147 | 134 | EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform); |
---|
148 | 135 | |
---|