.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
12 | 4 | * |
---|
13 | 5 | * storm.c -- ALSA SoC machine driver for QTi ipq806x-based Storm board |
---|
14 | 6 | */ |
---|
.. | .. |
---|
27 | 19 | static int storm_ops_hw_params(struct snd_pcm_substream *substream, |
---|
28 | 20 | struct snd_pcm_hw_params *params) |
---|
29 | 21 | { |
---|
30 | | - struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
---|
| 22 | + struct snd_soc_pcm_runtime *soc_runtime = asoc_substream_to_rtd(substream); |
---|
31 | 23 | struct snd_soc_card *card = soc_runtime->card; |
---|
32 | 24 | snd_pcm_format_t format = params_format(params); |
---|
33 | 25 | unsigned int rate = params_rate(params); |
---|
.. | .. |
---|
47 | 39 | */ |
---|
48 | 40 | sysclk_freq = rate * bitwidth * 2 * STORM_SYSCLK_MULT; |
---|
49 | 41 | |
---|
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); |
---|
51 | 43 | if (ret) { |
---|
52 | 44 | dev_err(card->dev, "error setting sysclk to %u: %d\n", |
---|
53 | 45 | sysclk_freq, ret); |
---|
.. | .. |
---|
61 | 53 | .hw_params = storm_ops_hw_params, |
---|
62 | 54 | }; |
---|
63 | 55 | |
---|
| 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 | + |
---|
64 | 61 | static struct snd_soc_dai_link storm_dai_link = { |
---|
65 | 62 | .name = "Primary", |
---|
66 | 63 | .stream_name = "Primary", |
---|
67 | | - .codec_dai_name = "HiFi", |
---|
68 | 64 | .ops = &storm_soc_ops, |
---|
| 65 | + SND_SOC_DAILINK_REG(hifi), |
---|
69 | 66 | }; |
---|
70 | 67 | |
---|
71 | 68 | static int storm_parse_of(struct snd_soc_card *card) |
---|
.. | .. |
---|
73 | 70 | struct snd_soc_dai_link *dai_link = card->dai_link; |
---|
74 | 71 | struct device_node *np = card->dev->of_node; |
---|
75 | 72 | |
---|
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) { |
---|
78 | 75 | dev_err(card->dev, "error getting cpu phandle\n"); |
---|
79 | 76 | return -EINVAL; |
---|
80 | 77 | } |
---|
81 | | - dai_link->platform_of_node = dai_link->cpu_of_node; |
---|
| 78 | + dai_link->platforms->of_node = dai_link->cpus->of_node; |
---|
82 | 79 | |
---|
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) { |
---|
85 | 82 | dev_err(card->dev, "error getting codec phandle\n"); |
---|
86 | 83 | return -EINVAL; |
---|
87 | 84 | } |
---|