hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/soc/qcom/storm.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 and
6
- * only version 2 as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 *
135 * storm.c -- ALSA SoC machine driver for QTi ipq806x-based Storm board
146 */
....@@ -27,7 +19,7 @@
2719 static int storm_ops_hw_params(struct snd_pcm_substream *substream,
2820 struct snd_pcm_hw_params *params)
2921 {
30
- struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
22
+ struct snd_soc_pcm_runtime *soc_runtime = asoc_substream_to_rtd(substream);
3123 struct snd_soc_card *card = soc_runtime->card;
3224 snd_pcm_format_t format = params_format(params);
3325 unsigned int rate = params_rate(params);
....@@ -47,7 +39,7 @@
4739 */
4840 sysclk_freq = rate * bitwidth * 2 * STORM_SYSCLK_MULT;
4941
50
- ret = snd_soc_dai_set_sysclk(soc_runtime->cpu_dai, 0, sysclk_freq, 0);
42
+ ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(soc_runtime, 0), 0, sysclk_freq, 0);
5143 if (ret) {
5244 dev_err(card->dev, "error setting sysclk to %u: %d\n",
5345 sysclk_freq, ret);
....@@ -61,11 +53,16 @@
6153 .hw_params = storm_ops_hw_params,
6254 };
6355
56
+SND_SOC_DAILINK_DEFS(hifi,
57
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
58
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "HiFi")),
59
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
60
+
6461 static struct snd_soc_dai_link storm_dai_link = {
6562 .name = "Primary",
6663 .stream_name = "Primary",
67
- .codec_dai_name = "HiFi",
6864 .ops = &storm_soc_ops,
65
+ SND_SOC_DAILINK_REG(hifi),
6966 };
7067
7168 static int storm_parse_of(struct snd_soc_card *card)
....@@ -73,15 +70,15 @@
7370 struct snd_soc_dai_link *dai_link = card->dai_link;
7471 struct device_node *np = card->dev->of_node;
7572
76
- dai_link->cpu_of_node = of_parse_phandle(np, "cpu", 0);
77
- if (!dai_link->cpu_of_node) {
73
+ dai_link->cpus->of_node = of_parse_phandle(np, "cpu", 0);
74
+ if (!dai_link->cpus->of_node) {
7875 dev_err(card->dev, "error getting cpu phandle\n");
7976 return -EINVAL;
8077 }
81
- dai_link->platform_of_node = dai_link->cpu_of_node;
78
+ dai_link->platforms->of_node = dai_link->cpus->of_node;
8279
83
- dai_link->codec_of_node = of_parse_phandle(np, "codec", 0);
84
- if (!dai_link->codec_of_node) {
80
+ dai_link->codecs->of_node = of_parse_phandle(np, "codec", 0);
81
+ if (!dai_link->codecs->of_node) {
8582 dev_err(card->dev, "error getting codec phandle\n");
8683 return -EINVAL;
8784 }