forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/soc/cirrus/edb93xx.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * SoC audio for EDB93xx
34 *
45 * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version 2
9
- * of the License, or (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
156 *
167 * This driver support CS4271 codec being master or slave, working
178 * in control port mode, connected either via SPI or I2C.
....@@ -22,18 +13,18 @@
2213 #include <linux/platform_device.h>
2314 #include <linux/gpio.h>
2415 #include <linux/module.h>
16
+#include <linux/soc/cirrus/ep93xx.h>
2517 #include <sound/core.h>
2618 #include <sound/pcm.h>
2719 #include <sound/soc.h>
2820 #include <asm/mach-types.h>
29
-#include <mach/hardware.h>
3021
3122 static int edb93xx_hw_params(struct snd_pcm_substream *substream,
3223 struct snd_pcm_hw_params *params)
3324 {
34
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
35
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
36
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
25
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
26
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
27
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
3728 int err;
3829 unsigned int mclk_rate;
3930 unsigned int rate = params_rate(params);
....@@ -60,16 +51,18 @@
6051 .hw_params = edb93xx_hw_params,
6152 };
6253
54
+SND_SOC_DAILINK_DEFS(hifi,
55
+ DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-i2s")),
56
+ DAILINK_COMP_ARRAY(COMP_CODEC("spi0.0", "cs4271-hifi")),
57
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-i2s")));
58
+
6359 static struct snd_soc_dai_link edb93xx_dai = {
6460 .name = "CS4271",
6561 .stream_name = "CS4271 HiFi",
66
- .platform_name = "ep93xx-i2s",
67
- .cpu_dai_name = "ep93xx-i2s",
68
- .codec_name = "spi0.0",
69
- .codec_dai_name = "cs4271-hifi",
7062 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
7163 SND_SOC_DAIFMT_CBS_CFS,
7264 .ops = &edb93xx_ops,
65
+ SND_SOC_DAILINK_REG(hifi),
7366 };
7467
7568 static struct snd_soc_card snd_soc_edb93xx = {