.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/sound/soc/ep93xx-i2s.c |
---|
3 | 4 | * EP93xx I2S driver |
---|
.. | .. |
---|
7 | 8 | * Based on the original driver by: |
---|
8 | 9 | * Copyright (C) 2007 Chase Douglas <chasedouglas@gmail> |
---|
9 | 10 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License version 2 as |
---|
13 | | - * published by the Free Software Foundation. |
---|
14 | | - * |
---|
15 | 11 | */ |
---|
16 | 12 | |
---|
17 | 13 | #include <linux/module.h> |
---|
.. | .. |
---|
27 | 23 | #include <sound/initval.h> |
---|
28 | 24 | #include <sound/soc.h> |
---|
29 | 25 | |
---|
30 | | -#include <mach/hardware.h> |
---|
31 | | -#include <mach/ep93xx-regs.h> |
---|
32 | 26 | #include <linux/platform_data/dma-ep93xx.h> |
---|
| 27 | +#include <linux/soc/cirrus/ep93xx.h> |
---|
33 | 28 | |
---|
34 | 29 | #include "ep93xx-pcm.h" |
---|
35 | 30 | |
---|
.. | .. |
---|
369 | 364 | } |
---|
370 | 365 | |
---|
371 | 366 | #ifdef CONFIG_PM |
---|
372 | | -static int ep93xx_i2s_suspend(struct snd_soc_dai *dai) |
---|
| 367 | +static int ep93xx_i2s_suspend(struct snd_soc_component *component) |
---|
373 | 368 | { |
---|
374 | | - struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
---|
| 369 | + struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component); |
---|
375 | 370 | |
---|
376 | | - if (!dai->active) |
---|
| 371 | + if (!snd_soc_component_active(component)) |
---|
377 | 372 | return 0; |
---|
378 | 373 | |
---|
379 | 374 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK); |
---|
.. | .. |
---|
382 | 377 | return 0; |
---|
383 | 378 | } |
---|
384 | 379 | |
---|
385 | | -static int ep93xx_i2s_resume(struct snd_soc_dai *dai) |
---|
| 380 | +static int ep93xx_i2s_resume(struct snd_soc_component *component) |
---|
386 | 381 | { |
---|
387 | | - struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
---|
| 382 | + struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component); |
---|
388 | 383 | |
---|
389 | | - if (!dai->active) |
---|
| 384 | + if (!snd_soc_component_active(component)) |
---|
390 | 385 | return 0; |
---|
391 | 386 | |
---|
392 | 387 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK); |
---|
.. | .. |
---|
411 | 406 | static struct snd_soc_dai_driver ep93xx_i2s_dai = { |
---|
412 | 407 | .symmetric_rates= 1, |
---|
413 | 408 | .probe = ep93xx_i2s_dai_probe, |
---|
414 | | - .suspend = ep93xx_i2s_suspend, |
---|
415 | | - .resume = ep93xx_i2s_resume, |
---|
416 | 409 | .playback = { |
---|
417 | 410 | .channels_min = 2, |
---|
418 | 411 | .channels_max = 2, |
---|
.. | .. |
---|
430 | 423 | |
---|
431 | 424 | static const struct snd_soc_component_driver ep93xx_i2s_component = { |
---|
432 | 425 | .name = "ep93xx-i2s", |
---|
| 426 | + .suspend = ep93xx_i2s_suspend, |
---|
| 427 | + .resume = ep93xx_i2s_resume, |
---|
433 | 428 | }; |
---|
434 | 429 | |
---|
435 | 430 | static int ep93xx_i2s_probe(struct platform_device *pdev) |
---|
436 | 431 | { |
---|
437 | 432 | struct ep93xx_i2s_info *info; |
---|
438 | | - struct resource *res; |
---|
439 | 433 | int err; |
---|
440 | 434 | |
---|
441 | 435 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); |
---|
442 | 436 | if (!info) |
---|
443 | 437 | return -ENOMEM; |
---|
444 | 438 | |
---|
445 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
446 | | - info->regs = devm_ioremap_resource(&pdev->dev, res); |
---|
| 439 | + info->regs = devm_platform_ioremap_resource(pdev, 0); |
---|
447 | 440 | if (IS_ERR(info->regs)) |
---|
448 | 441 | return PTR_ERR(info->regs); |
---|
449 | 442 | |
---|
.. | .. |
---|
478 | 471 | |
---|
479 | 472 | dev_set_drvdata(&pdev->dev, info); |
---|
480 | 473 | |
---|
481 | | - err = snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component, |
---|
| 474 | + err = devm_snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component, |
---|
482 | 475 | &ep93xx_i2s_dai, 1); |
---|
483 | 476 | if (err) |
---|
484 | 477 | goto fail_put_lrclk; |
---|
485 | 478 | |
---|
486 | 479 | err = devm_ep93xx_pcm_platform_register(&pdev->dev); |
---|
487 | 480 | if (err) |
---|
488 | | - goto fail_unregister; |
---|
| 481 | + goto fail_put_lrclk; |
---|
489 | 482 | |
---|
490 | 483 | return 0; |
---|
491 | 484 | |
---|
492 | | -fail_unregister: |
---|
493 | | - snd_soc_unregister_component(&pdev->dev); |
---|
494 | 485 | fail_put_lrclk: |
---|
495 | 486 | clk_put(info->lrclk); |
---|
496 | 487 | fail_put_sclk: |
---|
.. | .. |
---|
505 | 496 | { |
---|
506 | 497 | struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev); |
---|
507 | 498 | |
---|
508 | | - snd_soc_unregister_component(&pdev->dev); |
---|
509 | 499 | clk_put(info->lrclk); |
---|
510 | 500 | clk_put(info->sclk); |
---|
511 | 501 | clk_put(info->mclk); |
---|