| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * atmel_wm8904 - Atmel ASoC driver for boards with WM8904 codec. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2012 Atmel |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Bo Shen <voice.shen@atmel.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * GPLv2 or later |
|---|
| 9 | 8 | */ |
|---|
| 10 | 9 | |
|---|
| 11 | 10 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 27 | 26 | static int atmel_asoc_wm8904_hw_params(struct snd_pcm_substream *substream, |
|---|
| 28 | 27 | struct snd_pcm_hw_params *params) |
|---|
| 29 | 28 | { |
|---|
| 30 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 31 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 29 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 30 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 32 | 31 | int ret; |
|---|
| 33 | 32 | |
|---|
| 34 | 33 | ret = snd_soc_dai_set_pll(codec_dai, WM8904_FLL_MCLK, WM8904_FLL_MCLK, |
|---|
| .. | .. |
|---|
| 57 | 56 | .hw_params = atmel_asoc_wm8904_hw_params, |
|---|
| 58 | 57 | }; |
|---|
| 59 | 58 | |
|---|
| 59 | +SND_SOC_DAILINK_DEFS(pcm, |
|---|
| 60 | + DAILINK_COMP_ARRAY(COMP_EMPTY()), |
|---|
| 61 | + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8904-hifi")), |
|---|
| 62 | + DAILINK_COMP_ARRAY(COMP_EMPTY())); |
|---|
| 63 | + |
|---|
| 60 | 64 | static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = { |
|---|
| 61 | 65 | .name = "WM8904", |
|---|
| 62 | 66 | .stream_name = "WM8904 PCM", |
|---|
| 63 | | - .codec_dai_name = "wm8904-hifi", |
|---|
| 64 | 67 | .dai_fmt = SND_SOC_DAIFMT_I2S |
|---|
| 65 | 68 | | SND_SOC_DAIFMT_NB_NF |
|---|
| 66 | 69 | | SND_SOC_DAIFMT_CBM_CFM, |
|---|
| 67 | 70 | .ops = &atmel_asoc_wm8904_ops, |
|---|
| 71 | + SND_SOC_DAILINK_REG(pcm), |
|---|
| 68 | 72 | }; |
|---|
| 69 | 73 | |
|---|
| 70 | 74 | static struct snd_soc_card atmel_asoc_wm8904_card = { |
|---|
| .. | .. |
|---|
| 108 | 112 | ret = -EINVAL; |
|---|
| 109 | 113 | return ret; |
|---|
| 110 | 114 | } |
|---|
| 111 | | - dailink->cpu_of_node = cpu_np; |
|---|
| 112 | | - dailink->platform_of_node = cpu_np; |
|---|
| 115 | + dailink->cpus->of_node = cpu_np; |
|---|
| 116 | + dailink->platforms->of_node = cpu_np; |
|---|
| 113 | 117 | of_node_put(cpu_np); |
|---|
| 114 | 118 | |
|---|
| 115 | 119 | codec_np = of_parse_phandle(np, "atmel,audio-codec", 0); |
|---|
| .. | .. |
|---|
| 118 | 122 | ret = -EINVAL; |
|---|
| 119 | 123 | return ret; |
|---|
| 120 | 124 | } |
|---|
| 121 | | - dailink->codec_of_node = codec_np; |
|---|
| 125 | + dailink->codecs->of_node = codec_np; |
|---|
| 122 | 126 | of_node_put(codec_np); |
|---|
| 123 | 127 | |
|---|
| 124 | 128 | return 0; |
|---|
| .. | .. |
|---|
| 137 | 141 | return ret; |
|---|
| 138 | 142 | } |
|---|
| 139 | 143 | |
|---|
| 140 | | - id = of_alias_get_id((struct device_node *)dailink->cpu_of_node, "ssc"); |
|---|
| 144 | + id = of_alias_get_id((struct device_node *)dailink->cpus->of_node, "ssc"); |
|---|
| 141 | 145 | ret = atmel_ssc_set_audio(id); |
|---|
| 142 | 146 | if (ret != 0) { |
|---|
| 143 | 147 | dev_err(&pdev->dev, "failed to set SSC %d for audio\n", id); |
|---|
| .. | .. |
|---|
| 163 | 167 | struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink; |
|---|
| 164 | 168 | int id; |
|---|
| 165 | 169 | |
|---|
| 166 | | - id = of_alias_get_id((struct device_node *)dailink->cpu_of_node, "ssc"); |
|---|
| 170 | + id = of_alias_get_id((struct device_node *)dailink->cpus->of_node, "ssc"); |
|---|
| 167 | 171 | |
|---|
| 168 | 172 | snd_soc_unregister_card(card); |
|---|
| 169 | 173 | atmel_ssc_put_audio(id); |
|---|