| .. | .. |
|---|
| 390 | 390 | .set_fmt = dw_i2s_set_fmt, |
|---|
| 391 | 391 | }; |
|---|
| 392 | 392 | |
|---|
| 393 | | -static const struct snd_soc_component_driver dw_i2s_component = { |
|---|
| 394 | | - .name = "dw-i2s", |
|---|
| 395 | | -}; |
|---|
| 396 | | - |
|---|
| 397 | 393 | #ifdef CONFIG_PM |
|---|
| 398 | 394 | static int dw_i2s_runtime_suspend(struct device *dev) |
|---|
| 399 | 395 | { |
|---|
| .. | .. |
|---|
| 407 | 403 | static int dw_i2s_runtime_resume(struct device *dev) |
|---|
| 408 | 404 | { |
|---|
| 409 | 405 | struct dw_i2s_dev *dw_dev = dev_get_drvdata(dev); |
|---|
| 406 | + int ret; |
|---|
| 410 | 407 | |
|---|
| 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 | + } |
|---|
| 413 | 413 | return 0; |
|---|
| 414 | 414 | } |
|---|
| 415 | 415 | |
|---|
| 416 | | -static int dw_i2s_suspend(struct snd_soc_dai *dai) |
|---|
| 416 | +static int dw_i2s_suspend(struct snd_soc_component *component) |
|---|
| 417 | 417 | { |
|---|
| 418 | | - struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); |
|---|
| 418 | + struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component); |
|---|
| 419 | 419 | |
|---|
| 420 | 420 | if (dev->capability & DW_I2S_MASTER) |
|---|
| 421 | 421 | clk_disable(dev->clk); |
|---|
| 422 | 422 | return 0; |
|---|
| 423 | 423 | } |
|---|
| 424 | 424 | |
|---|
| 425 | | -static int dw_i2s_resume(struct snd_soc_dai *dai) |
|---|
| 425 | +static int dw_i2s_resume(struct snd_soc_component *component) |
|---|
| 426 | 426 | { |
|---|
| 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; |
|---|
| 428 | 430 | |
|---|
| 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 | + } |
|---|
| 431 | 436 | |
|---|
| 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 | + |
|---|
| 436 | 443 | return 0; |
|---|
| 437 | 444 | } |
|---|
| 438 | 445 | |
|---|
| .. | .. |
|---|
| 440 | 447 | #define dw_i2s_suspend NULL |
|---|
| 441 | 448 | #define dw_i2s_resume NULL |
|---|
| 442 | 449 | #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 | +}; |
|---|
| 443 | 456 | |
|---|
| 444 | 457 | /* |
|---|
| 445 | 458 | * The following tables allow a direct lookup of various parameters |
|---|
| .. | .. |
|---|
| 629 | 642 | return -ENOMEM; |
|---|
| 630 | 643 | |
|---|
| 631 | 644 | dw_i2s_dai->ops = &dw_i2s_dai_ops; |
|---|
| 632 | | - dw_i2s_dai->suspend = dw_i2s_suspend; |
|---|
| 633 | | - dw_i2s_dai->resume = dw_i2s_resume; |
|---|
| 634 | 645 | |
|---|
| 635 | 646 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 636 | 647 | dev->i2s_base = devm_ioremap_resource(&pdev->dev, res); |
|---|