| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * Tobermory audio support |
|---|
| 3 | | - * |
|---|
| 4 | | - * Copyright 2011 Wolfson Microelectronics |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 8 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 9 | | - * option) any later version. |
|---|
| 10 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 2 | +// |
|---|
| 3 | +// Tobermory audio support |
|---|
| 4 | +// |
|---|
| 5 | +// Copyright 2011 Wolfson Microelectronics |
|---|
| 11 | 6 | |
|---|
| 12 | 7 | #include <sound/soc.h> |
|---|
| 13 | 8 | #include <sound/soc-dapm.h> |
|---|
| .. | .. |
|---|
| 27 | 22 | struct snd_soc_dai *codec_dai; |
|---|
| 28 | 23 | int ret; |
|---|
| 29 | 24 | |
|---|
| 30 | | - rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); |
|---|
| 31 | | - codec_dai = rtd->codec_dai; |
|---|
| 25 | + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); |
|---|
| 26 | + codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 32 | 27 | |
|---|
| 33 | 28 | if (dapm->dev != codec_dai->dev) |
|---|
| 34 | 29 | return 0; |
|---|
| .. | .. |
|---|
| 70 | 65 | struct snd_soc_dai *codec_dai; |
|---|
| 71 | 66 | int ret; |
|---|
| 72 | 67 | |
|---|
| 73 | | - rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); |
|---|
| 74 | | - codec_dai = rtd->codec_dai; |
|---|
| 68 | + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); |
|---|
| 69 | + codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 75 | 70 | |
|---|
| 76 | 71 | if (dapm->dev != codec_dai->dev) |
|---|
| 77 | 72 | return 0; |
|---|
| .. | .. |
|---|
| 114 | 109 | .hw_params = tobermory_hw_params, |
|---|
| 115 | 110 | }; |
|---|
| 116 | 111 | |
|---|
| 112 | +SND_SOC_DAILINK_DEFS(cpu, |
|---|
| 113 | + DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")), |
|---|
| 114 | + DAILINK_COMP_ARRAY(COMP_CODEC("wm8962.1-001a", "wm8962")), |
|---|
| 115 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0"))); |
|---|
| 116 | + |
|---|
| 117 | 117 | static struct snd_soc_dai_link tobermory_dai[] = { |
|---|
| 118 | 118 | { |
|---|
| 119 | 119 | .name = "CPU", |
|---|
| 120 | 120 | .stream_name = "CPU", |
|---|
| 121 | | - .cpu_dai_name = "samsung-i2s.0", |
|---|
| 122 | | - .codec_dai_name = "wm8962", |
|---|
| 123 | | - .platform_name = "samsung-i2s.0", |
|---|
| 124 | | - .codec_name = "wm8962.1-001a", |
|---|
| 125 | 121 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|---|
| 126 | 122 | | SND_SOC_DAIFMT_CBM_CFM, |
|---|
| 127 | 123 | .ops = &tobermory_ops, |
|---|
| 124 | + SND_SOC_DAILINK_REG(cpu), |
|---|
| 128 | 125 | }, |
|---|
| 129 | 126 | }; |
|---|
| 130 | 127 | |
|---|
| .. | .. |
|---|
| 183 | 180 | struct snd_soc_dai *codec_dai; |
|---|
| 184 | 181 | int ret; |
|---|
| 185 | 182 | |
|---|
| 186 | | - rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); |
|---|
| 187 | | - component = rtd->codec_dai->component; |
|---|
| 188 | | - codec_dai = rtd->codec_dai; |
|---|
| 183 | + rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); |
|---|
| 184 | + component = asoc_rtd_to_codec(rtd, 0)->component; |
|---|
| 185 | + codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 189 | 186 | |
|---|
| 190 | 187 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, |
|---|
| 191 | 188 | 32768, SND_SOC_CLOCK_IN); |
|---|
| .. | .. |
|---|
| 233 | 230 | |
|---|
| 234 | 231 | ret = devm_snd_soc_register_card(&pdev->dev, card); |
|---|
| 235 | 232 | if (ret) |
|---|
| 236 | | - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", |
|---|
| 237 | | - ret); |
|---|
| 233 | + dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n"); |
|---|
| 238 | 234 | |
|---|
| 239 | 235 | return ret; |
|---|
| 240 | 236 | } |
|---|