@@ -183,30 +183,6 @@ static void i2s_stop(struct dw_i2s_dev *dev,
183183 }
184184}
185185
186- static int dw_i2s_startup (struct snd_pcm_substream * substream ,
187- struct snd_soc_dai * cpu_dai )
188- {
189- struct dw_i2s_dev * dev = snd_soc_dai_get_drvdata (cpu_dai );
190- union dw_i2s_snd_dma_data * dma_data = NULL ;
191-
192- if (!(dev -> capability & DWC_I2S_RECORD ) &&
193- (substream -> stream == SNDRV_PCM_STREAM_CAPTURE ))
194- return - EINVAL ;
195-
196- if (!(dev -> capability & DWC_I2S_PLAY ) &&
197- (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ))
198- return - EINVAL ;
199-
200- if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK )
201- dma_data = & dev -> play_dma_data ;
202- else if (substream -> stream == SNDRV_PCM_STREAM_CAPTURE )
203- dma_data = & dev -> capture_dma_data ;
204-
205- snd_soc_dai_set_dma_data (cpu_dai , substream , (void * )dma_data );
206-
207- return 0 ;
208- }
209-
210186static void dw_i2s_config (struct dw_i2s_dev * dev , int stream )
211187{
212188 u32 ch_reg ;
@@ -305,12 +281,6 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
305281 return 0 ;
306282}
307283
308- static void dw_i2s_shutdown (struct snd_pcm_substream * substream ,
309- struct snd_soc_dai * dai )
310- {
311- snd_soc_dai_set_dma_data (dai , substream , NULL );
312- }
313-
314284static int dw_i2s_prepare (struct snd_pcm_substream * substream ,
315285 struct snd_soc_dai * dai )
316286{
@@ -382,8 +352,6 @@ static int dw_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
382352}
383353
384354static const struct snd_soc_dai_ops dw_i2s_dai_ops = {
385- .startup = dw_i2s_startup ,
386- .shutdown = dw_i2s_shutdown ,
387355 .hw_params = dw_i2s_hw_params ,
388356 .prepare = dw_i2s_prepare ,
389357 .trigger = dw_i2s_trigger ,
@@ -625,6 +593,14 @@ static int dw_configure_dai_by_dt(struct dw_i2s_dev *dev,
625593
626594}
627595
596+ static int dw_i2s_dai_probe (struct snd_soc_dai * dai )
597+ {
598+ struct dw_i2s_dev * dev = snd_soc_dai_get_drvdata (dai );
599+
600+ snd_soc_dai_init_dma_data (dai , & dev -> play_dma_data , & dev -> capture_dma_data );
601+ return 0 ;
602+ }
603+
628604static int dw_i2s_probe (struct platform_device * pdev )
629605{
630606 const struct i2s_platform_data * pdata = pdev -> dev .platform_data ;
@@ -643,6 +619,7 @@ static int dw_i2s_probe(struct platform_device *pdev)
643619 return - ENOMEM ;
644620
645621 dw_i2s_dai -> ops = & dw_i2s_dai_ops ;
622+ dw_i2s_dai -> probe = dw_i2s_dai_probe ;
646623
647624 dev -> i2s_base = devm_platform_get_and_ioremap_resource (pdev , 0 , & res );
648625 if (IS_ERR (dev -> i2s_base ))
0 commit comments