.. | .. |
---|
1 | | -/* |
---|
2 | | - * imx-mc13783.c -- SoC audio for imx based boards with mc13783 codec |
---|
3 | | - * |
---|
4 | | - * Copyright 2012 Philippe Retornaz, <philippe.retornaz@epfl.ch> |
---|
5 | | - * |
---|
6 | | - * Heavly based on phycore-mc13783: |
---|
7 | | - * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify it |
---|
10 | | - * under the terms of the GNU General Public License as published by the |
---|
11 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
12 | | - * option) any later version. |
---|
13 | | - * |
---|
14 | | - */ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
| 2 | +// |
---|
| 3 | +// imx-mc13783.c -- SoC audio for imx based boards with mc13783 codec |
---|
| 4 | +// |
---|
| 5 | +// Copyright 2012 Philippe Retornaz, <philippe.retornaz@epfl.ch> |
---|
| 6 | +// |
---|
| 7 | +// Heavly based on phycore-mc13783: |
---|
| 8 | +// Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> |
---|
15 | 9 | |
---|
16 | 10 | #include <linux/module.h> |
---|
17 | 11 | #include <linux/moduleparam.h> |
---|
.. | .. |
---|
32 | 26 | static int imx_mc13783_hifi_hw_params(struct snd_pcm_substream *substream, |
---|
33 | 27 | struct snd_pcm_hw_params *params) |
---|
34 | 28 | { |
---|
35 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
36 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
---|
37 | | - 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 *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
---|
| 31 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
---|
38 | 32 | int ret; |
---|
39 | 33 | |
---|
40 | 34 | ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 4, 16); |
---|
.. | .. |
---|
52 | 46 | .hw_params = imx_mc13783_hifi_hw_params, |
---|
53 | 47 | }; |
---|
54 | 48 | |
---|
| 49 | +SND_SOC_DAILINK_DEFS(hifi, |
---|
| 50 | + DAILINK_COMP_ARRAY(COMP_CPU("imx-ssi.0")), |
---|
| 51 | + DAILINK_COMP_ARRAY(COMP_CODEC("mc13783-codec", "mc13783-hifi")), |
---|
| 52 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("imx-ssi.0"))); |
---|
| 53 | + |
---|
55 | 54 | static struct snd_soc_dai_link imx_mc13783_dai_mc13783[] = { |
---|
56 | 55 | { |
---|
57 | 56 | .name = "MC13783", |
---|
58 | 57 | .stream_name = "Sound", |
---|
59 | | - .codec_dai_name = "mc13783-hifi", |
---|
60 | | - .codec_name = "mc13783-codec", |
---|
61 | | - .cpu_dai_name = "imx-ssi.0", |
---|
62 | | - .platform_name = "imx-ssi.0", |
---|
63 | 58 | .ops = &imx_mc13783_hifi_ops, |
---|
64 | 59 | .symmetric_rates = 1, |
---|
65 | 60 | .dai_fmt = FMT_SSI, |
---|
| 61 | + SND_SOC_DAILINK_REG(hifi), |
---|
66 | 62 | }, |
---|
67 | 63 | }; |
---|
68 | 64 | |
---|
.. | .. |
---|
100 | 96 | |
---|
101 | 97 | imx_mc13783.dev = &pdev->dev; |
---|
102 | 98 | |
---|
103 | | - ret = snd_soc_register_card(&imx_mc13783); |
---|
| 99 | + ret = devm_snd_soc_register_card(&pdev->dev, &imx_mc13783); |
---|
104 | 100 | if (ret) { |
---|
105 | 101 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |
---|
106 | 102 | ret); |
---|
.. | .. |
---|
144 | 140 | return ret; |
---|
145 | 141 | } |
---|
146 | 142 | |
---|
147 | | -static int imx_mc13783_remove(struct platform_device *pdev) |
---|
148 | | -{ |
---|
149 | | - snd_soc_unregister_card(&imx_mc13783); |
---|
150 | | - |
---|
151 | | - return 0; |
---|
152 | | -} |
---|
153 | | - |
---|
154 | 143 | static struct platform_driver imx_mc13783_audio_driver = { |
---|
155 | 144 | .driver = { |
---|
156 | 145 | .name = "imx_mc13783", |
---|
157 | 146 | }, |
---|
158 | 147 | .probe = imx_mc13783_probe, |
---|
159 | | - .remove = imx_mc13783_remove |
---|
160 | 148 | }; |
---|
161 | 149 | |
---|
162 | 150 | module_platform_driver(imx_mc13783_audio_driver); |
---|