| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * mx27vis-aic32x4.c |
|---|
| 3 | | - * |
|---|
| 4 | | - * Copyright 2011 Vista Silicon S.L. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Author: Javier Martin <javier.martin@vista-silicon.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|---|
| 21 | | - * MA 02110-1301, USA. |
|---|
| 22 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 2 | +// |
|---|
| 3 | +// mx27vis-aic32x4.c |
|---|
| 4 | +// |
|---|
| 5 | +// Copyright 2011 Vista Silicon S.L. |
|---|
| 6 | +// |
|---|
| 7 | +// Author: Javier Martin <javier.martin@vista-silicon.com> |
|---|
| 23 | 8 | |
|---|
| 24 | 9 | #include <linux/module.h> |
|---|
| 25 | 10 | #include <linux/moduleparam.h> |
|---|
| .. | .. |
|---|
| 51 | 36 | static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream, |
|---|
| 52 | 37 | struct snd_pcm_hw_params *params) |
|---|
| 53 | 38 | { |
|---|
| 54 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 55 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 56 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 39 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 40 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 41 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 57 | 42 | int ret; |
|---|
| 58 | 43 | |
|---|
| 59 | 44 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, |
|---|
| .. | .. |
|---|
| 147 | 132 | {"IN3_L", NULL, "Mic Bias"}, |
|---|
| 148 | 133 | }; |
|---|
| 149 | 134 | |
|---|
| 135 | +SND_SOC_DAILINK_DEFS(hifi, |
|---|
| 136 | + DAILINK_COMP_ARRAY(COMP_CPU("imx-ssi.0")), |
|---|
| 137 | + DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic32x4.0-0018", |
|---|
| 138 | + "tlv320aic32x4-hifi")), |
|---|
| 139 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("imx-ssi.0"))); |
|---|
| 140 | + |
|---|
| 150 | 141 | static struct snd_soc_dai_link mx27vis_aic32x4_dai = { |
|---|
| 151 | 142 | .name = "tlv320aic32x4", |
|---|
| 152 | 143 | .stream_name = "TLV320AIC32X4", |
|---|
| 153 | | - .codec_dai_name = "tlv320aic32x4-hifi", |
|---|
| 154 | | - .platform_name = "imx-ssi.0", |
|---|
| 155 | | - .codec_name = "tlv320aic32x4.0-0018", |
|---|
| 156 | | - .cpu_dai_name = "imx-ssi.0", |
|---|
| 157 | 144 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | |
|---|
| 158 | 145 | SND_SOC_DAIFMT_CBM_CFM, |
|---|
| 159 | 146 | .ops = &mx27vis_aic32x4_snd_ops, |
|---|
| 147 | + SND_SOC_DAILINK_REG(hifi), |
|---|
| 160 | 148 | }; |
|---|
| 161 | 149 | |
|---|
| 162 | 150 | static struct snd_soc_card mx27vis_aic32x4 = { |
|---|
| .. | .. |
|---|
| 188 | 176 | mx27vis_amp_muter_gpio = pdata->amp_muter_gpio; |
|---|
| 189 | 177 | |
|---|
| 190 | 178 | mx27vis_aic32x4.dev = &pdev->dev; |
|---|
| 191 | | - ret = snd_soc_register_card(&mx27vis_aic32x4); |
|---|
| 179 | + ret = devm_snd_soc_register_card(&pdev->dev, &mx27vis_aic32x4); |
|---|
| 192 | 180 | if (ret) { |
|---|
| 193 | 181 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |
|---|
| 194 | 182 | ret); |
|---|
| .. | .. |
|---|
| 211 | 199 | return ret; |
|---|
| 212 | 200 | } |
|---|
| 213 | 201 | |
|---|
| 214 | | -static int mx27vis_aic32x4_remove(struct platform_device *pdev) |
|---|
| 215 | | -{ |
|---|
| 216 | | - snd_soc_unregister_card(&mx27vis_aic32x4); |
|---|
| 217 | | - |
|---|
| 218 | | - return 0; |
|---|
| 219 | | -} |
|---|
| 220 | | - |
|---|
| 221 | 202 | static struct platform_driver mx27vis_aic32x4_audio_driver = { |
|---|
| 222 | 203 | .driver = { |
|---|
| 223 | 204 | .name = "mx27vis", |
|---|
| 224 | 205 | }, |
|---|
| 225 | 206 | .probe = mx27vis_aic32x4_probe, |
|---|
| 226 | | - .remove = mx27vis_aic32x4_remove, |
|---|
| 227 | 207 | }; |
|---|
| 228 | 208 | |
|---|
| 229 | 209 | module_platform_driver(mx27vis_aic32x4_audio_driver); |
|---|