hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/soc/dwc/dwc-i2s.c
....@@ -132,13 +132,13 @@
132132
133133 /* Error Handling: TX */
134134 if (isr[i] & ISR_TXFO) {
135
- dev_err(dev->dev, "TX overrun (ch_id=%d)\n", i);
135
+ dev_err_ratelimited(dev->dev, "TX overrun (ch_id=%d)\n", i);
136136 irq_valid = true;
137137 }
138138
139139 /* Error Handling: TX */
140140 if (isr[i] & ISR_RXFO) {
141
- dev_err(dev->dev, "RX overrun (ch_id=%d)\n", i);
141
+ dev_err_ratelimited(dev->dev, "RX overrun (ch_id=%d)\n", i);
142142 irq_valid = true;
143143 }
144144 }
....@@ -181,30 +181,6 @@
181181 i2s_write_reg(dev->i2s_base, CER, 0);
182182 i2s_write_reg(dev->i2s_base, IER, 0);
183183 }
184
-}
185
-
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;
208184 }
209185
210186 static void dw_i2s_config(struct dw_i2s_dev *dev, int stream)
....@@ -305,12 +281,6 @@
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
-
314284 static int dw_i2s_prepare(struct snd_pcm_substream *substream,
315285 struct snd_soc_dai *dai)
316286 {
....@@ -382,8 +352,6 @@
382352 }
383353
384354 static 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,
....@@ -624,6 +592,14 @@
624592
625593 }
626594
595
+static int dw_i2s_dai_probe(struct snd_soc_dai *dai)
596
+{
597
+ struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
598
+
599
+ snd_soc_dai_init_dma_data(dai, &dev->play_dma_data, &dev->capture_dma_data);
600
+ return 0;
601
+}
602
+
627603 static int dw_i2s_probe(struct platform_device *pdev)
628604 {
629605 const struct i2s_platform_data *pdata = pdev->dev.platform_data;
....@@ -642,6 +618,7 @@
642618 return -ENOMEM;
643619
644620 dw_i2s_dai->ops = &dw_i2s_dai_ops;
621
+ dw_i2s_dai->probe = dw_i2s_dai_probe;
645622
646623 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
647624 dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);