forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/sound/soc/cirrus/ep93xx-i2s.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/sound/soc/ep93xx-i2s.c
34 * EP93xx I2S driver
....@@ -7,11 +8,6 @@
78 * Based on the original driver by:
89 * Copyright (C) 2007 Chase Douglas <chasedouglas@gmail>
910 * 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
- *
1511 */
1612
1713 #include <linux/module.h>
....@@ -27,9 +23,8 @@
2723 #include <sound/initval.h>
2824 #include <sound/soc.h>
2925
30
-#include <mach/hardware.h>
31
-#include <mach/ep93xx-regs.h>
3226 #include <linux/platform_data/dma-ep93xx.h>
27
+#include <linux/soc/cirrus/ep93xx.h>
3328
3429 #include "ep93xx-pcm.h"
3530
....@@ -369,11 +364,11 @@
369364 }
370365
371366 #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)
373368 {
374
- struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
369
+ struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component);
375370
376
- if (!dai->active)
371
+ if (!snd_soc_component_active(component))
377372 return 0;
378373
379374 ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK);
....@@ -382,11 +377,11 @@
382377 return 0;
383378 }
384379
385
-static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
380
+static int ep93xx_i2s_resume(struct snd_soc_component *component)
386381 {
387
- struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
382
+ struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component);
388383
389
- if (!dai->active)
384
+ if (!snd_soc_component_active(component))
390385 return 0;
391386
392387 ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK);
....@@ -411,8 +406,6 @@
411406 static struct snd_soc_dai_driver ep93xx_i2s_dai = {
412407 .symmetric_rates= 1,
413408 .probe = ep93xx_i2s_dai_probe,
414
- .suspend = ep93xx_i2s_suspend,
415
- .resume = ep93xx_i2s_resume,
416409 .playback = {
417410 .channels_min = 2,
418411 .channels_max = 2,
....@@ -430,20 +423,20 @@
430423
431424 static const struct snd_soc_component_driver ep93xx_i2s_component = {
432425 .name = "ep93xx-i2s",
426
+ .suspend = ep93xx_i2s_suspend,
427
+ .resume = ep93xx_i2s_resume,
433428 };
434429
435430 static int ep93xx_i2s_probe(struct platform_device *pdev)
436431 {
437432 struct ep93xx_i2s_info *info;
438
- struct resource *res;
439433 int err;
440434
441435 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
442436 if (!info)
443437 return -ENOMEM;
444438
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);
447440 if (IS_ERR(info->regs))
448441 return PTR_ERR(info->regs);
449442
....@@ -478,19 +471,17 @@
478471
479472 dev_set_drvdata(&pdev->dev, info);
480473
481
- err = snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component,
474
+ err = devm_snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component,
482475 &ep93xx_i2s_dai, 1);
483476 if (err)
484477 goto fail_put_lrclk;
485478
486479 err = devm_ep93xx_pcm_platform_register(&pdev->dev);
487480 if (err)
488
- goto fail_unregister;
481
+ goto fail_put_lrclk;
489482
490483 return 0;
491484
492
-fail_unregister:
493
- snd_soc_unregister_component(&pdev->dev);
494485 fail_put_lrclk:
495486 clk_put(info->lrclk);
496487 fail_put_sclk:
....@@ -505,7 +496,6 @@
505496 {
506497 struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
507498
508
- snd_soc_unregister_component(&pdev->dev);
509499 clk_put(info->lrclk);
510500 clk_put(info->sclk);
511501 clk_put(info->mclk);