| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * smdk_wm8994.c |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 6 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 7 | | - * option) any later version. |
|---|
| 8 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 9 | 2 | |
|---|
| 10 | 3 | #include "../codecs/wm8994.h" |
|---|
| 11 | 4 | #include <sound/pcm_params.h> |
|---|
| .. | .. |
|---|
| 51 | 44 | static int smdk_hw_params(struct snd_pcm_substream *substream, |
|---|
| 52 | 45 | struct snd_pcm_hw_params *params) |
|---|
| 53 | 46 | { |
|---|
| 54 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 55 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 47 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 48 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 56 | 49 | unsigned int pll_out; |
|---|
| 57 | 50 | int ret; |
|---|
| 58 | 51 | |
|---|
| .. | .. |
|---|
| 107 | 100 | return 0; |
|---|
| 108 | 101 | } |
|---|
| 109 | 102 | |
|---|
| 103 | +SND_SOC_DAILINK_DEFS(aif1, |
|---|
| 104 | + DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")), |
|---|
| 105 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm8994-codec", "wm8994-aif1")), |
|---|
| 106 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0"))); |
|---|
| 107 | + |
|---|
| 108 | +SND_SOC_DAILINK_DEFS(fifo_tx, |
|---|
| 109 | + DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s-sec")), |
|---|
| 110 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm8994-codec", "wm8994-aif1")), |
|---|
| 111 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s-sec"))); |
|---|
| 112 | + |
|---|
| 110 | 113 | static struct snd_soc_dai_link smdk_dai[] = { |
|---|
| 111 | 114 | { /* Primary DAI i/f */ |
|---|
| 112 | 115 | .name = "WM8994 AIF1", |
|---|
| 113 | 116 | .stream_name = "Pri_Dai", |
|---|
| 114 | | - .cpu_dai_name = "samsung-i2s.0", |
|---|
| 115 | | - .codec_dai_name = "wm8994-aif1", |
|---|
| 116 | | - .platform_name = "samsung-i2s.0", |
|---|
| 117 | | - .codec_name = "wm8994-codec", |
|---|
| 118 | 117 | .init = smdk_wm8994_init_paiftx, |
|---|
| 119 | 118 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
|---|
| 120 | 119 | SND_SOC_DAIFMT_CBM_CFM, |
|---|
| 121 | 120 | .ops = &smdk_ops, |
|---|
| 121 | + SND_SOC_DAILINK_REG(aif1), |
|---|
| 122 | 122 | }, { /* Sec_Fifo Playback i/f */ |
|---|
| 123 | 123 | .name = "Sec_FIFO TX", |
|---|
| 124 | 124 | .stream_name = "Sec_Dai", |
|---|
| 125 | | - .cpu_dai_name = "samsung-i2s-sec", |
|---|
| 126 | | - .codec_dai_name = "wm8994-aif1", |
|---|
| 127 | | - .platform_name = "samsung-i2s-sec", |
|---|
| 128 | | - .codec_name = "wm8994-codec", |
|---|
| 129 | 125 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
|---|
| 130 | 126 | SND_SOC_DAIFMT_CBM_CFM, |
|---|
| 131 | 127 | .ops = &smdk_ops, |
|---|
| 128 | + SND_SOC_DAILINK_REG(fifo_tx), |
|---|
| 132 | 129 | }, |
|---|
| 133 | 130 | }; |
|---|
| 134 | 131 | |
|---|
| .. | .. |
|---|
| 160 | 157 | return -ENOMEM; |
|---|
| 161 | 158 | |
|---|
| 162 | 159 | if (np) { |
|---|
| 163 | | - smdk_dai[0].cpu_dai_name = NULL; |
|---|
| 164 | | - smdk_dai[0].cpu_of_node = of_parse_phandle(np, |
|---|
| 160 | + smdk_dai[0].cpus->dai_name = NULL; |
|---|
| 161 | + smdk_dai[0].cpus->of_node = of_parse_phandle(np, |
|---|
| 165 | 162 | "samsung,i2s-controller", 0); |
|---|
| 166 | | - if (!smdk_dai[0].cpu_of_node) { |
|---|
| 163 | + if (!smdk_dai[0].cpus->of_node) { |
|---|
| 167 | 164 | dev_err(&pdev->dev, |
|---|
| 168 | 165 | "Property 'samsung,i2s-controller' missing or invalid\n"); |
|---|
| 169 | 166 | ret = -EINVAL; |
|---|
| 170 | 167 | } |
|---|
| 171 | 168 | |
|---|
| 172 | | - smdk_dai[0].platform_name = NULL; |
|---|
| 173 | | - smdk_dai[0].platform_of_node = smdk_dai[0].cpu_of_node; |
|---|
| 169 | + smdk_dai[0].platforms->name = NULL; |
|---|
| 170 | + smdk_dai[0].platforms->of_node = smdk_dai[0].cpus->of_node; |
|---|
| 174 | 171 | } |
|---|
| 175 | 172 | |
|---|
| 176 | 173 | id = of_match_device(of_match_ptr(samsung_wm8994_of_match), &pdev->dev); |
|---|
| .. | .. |
|---|
| 182 | 179 | ret = devm_snd_soc_register_card(&pdev->dev, card); |
|---|
| 183 | 180 | |
|---|
| 184 | 181 | if (ret) |
|---|
| 185 | | - dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret); |
|---|
| 182 | + dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n"); |
|---|
| 186 | 183 | |
|---|
| 187 | 184 | return ret; |
|---|
| 188 | 185 | } |
|---|