hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/dwc/dwc-i2s.c
....@@ -390,10 +390,6 @@
390390 .set_fmt = dw_i2s_set_fmt,
391391 };
392392
393
-static const struct snd_soc_component_driver dw_i2s_component = {
394
- .name = "dw-i2s",
395
-};
396
-
397393 #ifdef CONFIG_PM
398394 static int dw_i2s_runtime_suspend(struct device *dev)
399395 {
....@@ -407,32 +403,43 @@
407403 static int dw_i2s_runtime_resume(struct device *dev)
408404 {
409405 struct dw_i2s_dev *dw_dev = dev_get_drvdata(dev);
406
+ int ret;
410407
411
- if (dw_dev->capability & DW_I2S_MASTER)
412
- clk_enable(dw_dev->clk);
408
+ if (dw_dev->capability & DW_I2S_MASTER) {
409
+ ret = clk_enable(dw_dev->clk);
410
+ if (ret)
411
+ return ret;
412
+ }
413413 return 0;
414414 }
415415
416
-static int dw_i2s_suspend(struct snd_soc_dai *dai)
416
+static int dw_i2s_suspend(struct snd_soc_component *component)
417417 {
418
- struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
418
+ struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component);
419419
420420 if (dev->capability & DW_I2S_MASTER)
421421 clk_disable(dev->clk);
422422 return 0;
423423 }
424424
425
-static int dw_i2s_resume(struct snd_soc_dai *dai)
425
+static int dw_i2s_resume(struct snd_soc_component *component)
426426 {
427
- struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
427
+ struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component);
428
+ struct snd_soc_dai *dai;
429
+ int stream, ret;
428430
429
- if (dev->capability & DW_I2S_MASTER)
430
- clk_enable(dev->clk);
431
+ if (dev->capability & DW_I2S_MASTER) {
432
+ ret = clk_enable(dev->clk);
433
+ if (ret)
434
+ return ret;
435
+ }
431436
432
- if (dai->playback_active)
433
- dw_i2s_config(dev, SNDRV_PCM_STREAM_PLAYBACK);
434
- if (dai->capture_active)
435
- dw_i2s_config(dev, SNDRV_PCM_STREAM_CAPTURE);
437
+ for_each_component_dais(component, dai) {
438
+ for_each_pcm_streams(stream)
439
+ if (snd_soc_dai_stream_active(dai, stream))
440
+ dw_i2s_config(dev, stream);
441
+ }
442
+
436443 return 0;
437444 }
438445
....@@ -440,6 +447,12 @@
440447 #define dw_i2s_suspend NULL
441448 #define dw_i2s_resume NULL
442449 #endif
450
+
451
+static const struct snd_soc_component_driver dw_i2s_component = {
452
+ .name = "dw-i2s",
453
+ .suspend = dw_i2s_suspend,
454
+ .resume = dw_i2s_resume,
455
+};
443456
444457 /*
445458 * The following tables allow a direct lookup of various parameters
....@@ -629,8 +642,6 @@
629642 return -ENOMEM;
630643
631644 dw_i2s_dai->ops = &dw_i2s_dai_ops;
632
- dw_i2s_dai->suspend = dw_i2s_suspend;
633
- dw_i2s_dai->resume = dw_i2s_resume;
634645
635646 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
636647 dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);