xref: /openbmc/linux/sound/soc/uniphier/aio-ld11.c (revision 8413b9e00aa33604aa661d7271c3c02c86beb994)
1db4cb3d0SKatsuhiro Suzuki // SPDX-License-Identifier: GPL-2.0
2db4cb3d0SKatsuhiro Suzuki //
3db4cb3d0SKatsuhiro Suzuki // Socionext UniPhier AIO ALSA driver for LD11/LD20.
4db4cb3d0SKatsuhiro Suzuki //
5db4cb3d0SKatsuhiro Suzuki // Copyright (c) 2016-2018 Socionext Inc.
6db4cb3d0SKatsuhiro Suzuki //
7db4cb3d0SKatsuhiro Suzuki // This program is free software; you can redistribute it and/or
8db4cb3d0SKatsuhiro Suzuki // modify it under the terms of the GNU General Public License
9db4cb3d0SKatsuhiro Suzuki // as published by the Free Software Foundation; version 2
10db4cb3d0SKatsuhiro Suzuki // of the License.
11db4cb3d0SKatsuhiro Suzuki //
12db4cb3d0SKatsuhiro Suzuki // This program is distributed in the hope that it will be useful,
13db4cb3d0SKatsuhiro Suzuki // but WITHOUT ANY WARRANTY; without even the implied warranty of
14db4cb3d0SKatsuhiro Suzuki // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15db4cb3d0SKatsuhiro Suzuki // GNU General Public License for more details.
16db4cb3d0SKatsuhiro Suzuki //
17db4cb3d0SKatsuhiro Suzuki // You should have received a copy of the GNU General Public License
18db4cb3d0SKatsuhiro Suzuki // along with this program; if not, see <http://www.gnu.org/licenses/>.
19db4cb3d0SKatsuhiro Suzuki 
20db4cb3d0SKatsuhiro Suzuki #include <linux/module.h>
21db4cb3d0SKatsuhiro Suzuki 
22db4cb3d0SKatsuhiro Suzuki #include "aio.h"
23db4cb3d0SKatsuhiro Suzuki 
24db4cb3d0SKatsuhiro Suzuki static const struct uniphier_aio_spec uniphier_aio_ld11[] = {
25db4cb3d0SKatsuhiro Suzuki 	/* for HDMI PCM In, Pin:AI1Dx */
26db4cb3d0SKatsuhiro Suzuki 	{
27db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMIN1,
28db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_HDMI,
29db4cb3d0SKatsuhiro Suzuki 		.swm = {
30db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_I2S,
31db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_INPUT,
32db4cb3d0SKatsuhiro Suzuki 			.rb    = { 21, 14, },
33db4cb3d0SKatsuhiro Suzuki 			.ch    = { 21, 14, },
34db4cb3d0SKatsuhiro Suzuki 			.iif   = { 5, 3, },
35db4cb3d0SKatsuhiro Suzuki 			.iport = { 0, AUD_HW_PCMIN1, },
36db4cb3d0SKatsuhiro Suzuki 		},
37db4cb3d0SKatsuhiro Suzuki 	},
38db4cb3d0SKatsuhiro Suzuki 
39db4cb3d0SKatsuhiro Suzuki 	/* for SIF In, Pin:AI2Dx */
40db4cb3d0SKatsuhiro Suzuki 	{
41db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMIN2,
42db4cb3d0SKatsuhiro Suzuki 		.swm = {
43db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_I2S,
44db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_INPUT,
45db4cb3d0SKatsuhiro Suzuki 			.rb    = { 22, 15, },
46db4cb3d0SKatsuhiro Suzuki 			.ch    = { 22, 15, },
47db4cb3d0SKatsuhiro Suzuki 			.iif   = { 6, 4, },
48db4cb3d0SKatsuhiro Suzuki 			.iport = { 1, AUD_HW_PCMIN2, },
49db4cb3d0SKatsuhiro Suzuki 		},
50db4cb3d0SKatsuhiro Suzuki 	},
51db4cb3d0SKatsuhiro Suzuki 
52db4cb3d0SKatsuhiro Suzuki 	/* for Line In, Pin:AI3Dx */
53db4cb3d0SKatsuhiro Suzuki 	{
54db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMIN3,
55db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_LINE,
56db4cb3d0SKatsuhiro Suzuki 		.swm = {
57db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_EVE,
58db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_INPUT,
59db4cb3d0SKatsuhiro Suzuki 			.rb    = { 23, 16, },
60db4cb3d0SKatsuhiro Suzuki 			.ch    = { 23, 16, },
61db4cb3d0SKatsuhiro Suzuki 			.iif   = { 7, 5, },
62db4cb3d0SKatsuhiro Suzuki 			.iport = { 2, AUD_HW_PCMIN3, },
63db4cb3d0SKatsuhiro Suzuki 		},
64db4cb3d0SKatsuhiro Suzuki 	},
65db4cb3d0SKatsuhiro Suzuki 
66db4cb3d0SKatsuhiro Suzuki 	/* for S/PDIF In, Pin:AI1IEC */
67db4cb3d0SKatsuhiro Suzuki 	{
68db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_IECIN1,
69db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_IEC,
70db4cb3d0SKatsuhiro Suzuki 		.swm = {
71db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_SPDIF,
72db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_INPUT,
73db4cb3d0SKatsuhiro Suzuki 			.rb    = { 26, 17, },
74db4cb3d0SKatsuhiro Suzuki 			.ch    = { 26, 17, },
75db4cb3d0SKatsuhiro Suzuki 			.iif   = { 10, 6, },
76db4cb3d0SKatsuhiro Suzuki 			.iport = { 3, AUD_HW_IECIN1, },
77db4cb3d0SKatsuhiro Suzuki 		},
78db4cb3d0SKatsuhiro Suzuki 	},
79db4cb3d0SKatsuhiro Suzuki 
80db4cb3d0SKatsuhiro Suzuki 	/* for Speaker, Pin:AO1Dx */
81db4cb3d0SKatsuhiro Suzuki 	{
82db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_HPCMOUT1,
83db4cb3d0SKatsuhiro Suzuki 		.swm = {
84db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_I2S,
85db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
86db4cb3d0SKatsuhiro Suzuki 			.rb    = { 0, 0, },
87db4cb3d0SKatsuhiro Suzuki 			.ch    = { 0, 0, },
88db4cb3d0SKatsuhiro Suzuki 			.oif   = { 0, 0, },
89db4cb3d0SKatsuhiro Suzuki 			.oport = { 0, AUD_HW_HPCMOUT1, },
90db4cb3d0SKatsuhiro Suzuki 		},
91db4cb3d0SKatsuhiro Suzuki 	},
92db4cb3d0SKatsuhiro Suzuki 
93db4cb3d0SKatsuhiro Suzuki 	/* for HDMI PCM, Pin:AO2Dx */
94db4cb3d0SKatsuhiro Suzuki 	{
95db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMOUT1,
96db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_HDMI,
97db4cb3d0SKatsuhiro Suzuki 		.swm = {
98db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_I2S,
99db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
100db4cb3d0SKatsuhiro Suzuki 			.rb    = { 0, 0, },
101db4cb3d0SKatsuhiro Suzuki 			.ch    = { 0, 0, },
102db4cb3d0SKatsuhiro Suzuki 			.oif   = { 0, 0, },
103db4cb3d0SKatsuhiro Suzuki 			.oport = { 3, AUD_HW_PCMOUT1, },
104db4cb3d0SKatsuhiro Suzuki 		},
105db4cb3d0SKatsuhiro Suzuki 	},
106db4cb3d0SKatsuhiro Suzuki 
107db4cb3d0SKatsuhiro Suzuki 	/* for Line Out, Pin:LO2_x */
108db4cb3d0SKatsuhiro Suzuki 	{
109db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMOUT2,
110db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_LINE,
111db4cb3d0SKatsuhiro Suzuki 		.swm = {
112db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_EVE,
113db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
114db4cb3d0SKatsuhiro Suzuki 			.rb    = { 2, 2, },
115db4cb3d0SKatsuhiro Suzuki 			.ch    = { 2, 2, },
116db4cb3d0SKatsuhiro Suzuki 			.oif   = { 2, 2, },
117db4cb3d0SKatsuhiro Suzuki 			.oport = { 1, AUD_HW_PCMOUT2, },
118db4cb3d0SKatsuhiro Suzuki 		},
119db4cb3d0SKatsuhiro Suzuki 	},
120db4cb3d0SKatsuhiro Suzuki 
121db4cb3d0SKatsuhiro Suzuki 	/* for Headphone, Pin:HP1_x */
122db4cb3d0SKatsuhiro Suzuki 	{
123db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_PCMOUT3,
124db4cb3d0SKatsuhiro Suzuki 		.swm = {
125db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_EVE,
126db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
127db4cb3d0SKatsuhiro Suzuki 			.rb    = { 3, 3, },
128db4cb3d0SKatsuhiro Suzuki 			.ch    = { 3, 3, },
129db4cb3d0SKatsuhiro Suzuki 			.oif   = { 3, 3, },
130db4cb3d0SKatsuhiro Suzuki 			.oport = { 2, AUD_HW_PCMOUT3, },
131db4cb3d0SKatsuhiro Suzuki 		},
132db4cb3d0SKatsuhiro Suzuki 	},
133db4cb3d0SKatsuhiro Suzuki 
134db4cb3d0SKatsuhiro Suzuki 	/* for HW Sampling Rate Converter */
135db4cb3d0SKatsuhiro Suzuki 	{
136db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_EPCMOUT2,
137db4cb3d0SKatsuhiro Suzuki 		.swm = {
138db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_CONV,
139db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
140db4cb3d0SKatsuhiro Suzuki 			.rb    = { 7, 5, },
141db4cb3d0SKatsuhiro Suzuki 			.ch    = { 7, 5, },
142db4cb3d0SKatsuhiro Suzuki 			.oif   = { 7, 5, },
143db4cb3d0SKatsuhiro Suzuki 			.oport = { 6, AUD_HW_EPCMOUT2, },
144db4cb3d0SKatsuhiro Suzuki 			.och   = { 17, 12, },
145db4cb3d0SKatsuhiro Suzuki 			.iif   = { 1, 1, },
146db4cb3d0SKatsuhiro Suzuki 		},
147db4cb3d0SKatsuhiro Suzuki 	},
148db4cb3d0SKatsuhiro Suzuki 
149db4cb3d0SKatsuhiro Suzuki 	/* for HW Sampling Rate Converter 2 */
150db4cb3d0SKatsuhiro Suzuki 	{
151db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_EPCMOUT3,
152db4cb3d0SKatsuhiro Suzuki 		.swm = {
153db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_CONV,
154db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
155db4cb3d0SKatsuhiro Suzuki 			.rb    = { 8, 6, },
156db4cb3d0SKatsuhiro Suzuki 			.ch    = { 8, 6, },
157db4cb3d0SKatsuhiro Suzuki 			.oif   = { 8, 6, },
158db4cb3d0SKatsuhiro Suzuki 			.oport = { 7, AUD_HW_EPCMOUT3, },
159db4cb3d0SKatsuhiro Suzuki 			.och   = { 18, 13, },
160db4cb3d0SKatsuhiro Suzuki 			.iif   = { 2, 2, },
161db4cb3d0SKatsuhiro Suzuki 		},
162db4cb3d0SKatsuhiro Suzuki 	},
163db4cb3d0SKatsuhiro Suzuki 
164db4cb3d0SKatsuhiro Suzuki 	/* for S/PDIF Out, Pin:AO1IEC */
165db4cb3d0SKatsuhiro Suzuki 	{
166db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_HIECOUT1,
167db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_IEC,
168db4cb3d0SKatsuhiro Suzuki 		.swm = {
169db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_SPDIF,
170db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
171db4cb3d0SKatsuhiro Suzuki 			.rb    = { 1, 1, },
172db4cb3d0SKatsuhiro Suzuki 			.ch    = { 1, 1, },
173db4cb3d0SKatsuhiro Suzuki 			.oif   = { 1, 1, },
174db4cb3d0SKatsuhiro Suzuki 			.oport = { 12, AUD_HW_HIECOUT1, },
175db4cb3d0SKatsuhiro Suzuki 		},
176db4cb3d0SKatsuhiro Suzuki 	},
177db4cb3d0SKatsuhiro Suzuki 
178db4cb3d0SKatsuhiro Suzuki 	/* for S/PDIF Out, Pin:AO1IEC, Compress */
179db4cb3d0SKatsuhiro Suzuki 	{
180db4cb3d0SKatsuhiro Suzuki 		.name = AUD_NAME_HIECCOMPOUT1,
181db4cb3d0SKatsuhiro Suzuki 		.gname = AUD_GNAME_IEC,
182db4cb3d0SKatsuhiro Suzuki 		.swm = {
183db4cb3d0SKatsuhiro Suzuki 			.type  = PORT_TYPE_SPDIF,
184db4cb3d0SKatsuhiro Suzuki 			.dir   = PORT_DIR_OUTPUT,
185db4cb3d0SKatsuhiro Suzuki 			.rb    = { 1, 1, },
186db4cb3d0SKatsuhiro Suzuki 			.ch    = { 1, 1, },
187db4cb3d0SKatsuhiro Suzuki 			.oif   = { 1, 1, },
188db4cb3d0SKatsuhiro Suzuki 			.oport = { 12, AUD_HW_HIECOUT1, },
189db4cb3d0SKatsuhiro Suzuki 		},
190db4cb3d0SKatsuhiro Suzuki 	},
191db4cb3d0SKatsuhiro Suzuki };
192db4cb3d0SKatsuhiro Suzuki 
193db4cb3d0SKatsuhiro Suzuki static const struct uniphier_aio_pll uniphier_aio_pll_ld11[] = {
194db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_A1]   = { .enable = true, },
195db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_F1]   = { .enable = true, },
196db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_A2]   = { .enable = true, },
197db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_F2]   = { .enable = true, },
198db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_APLL] = { .enable = true, },
199db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_RX0]  = { .enable = true, },
200db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_USB0] = { .enable = true, },
201db4cb3d0SKatsuhiro Suzuki 	[AUD_PLL_HSC0] = { .enable = true, },
202db4cb3d0SKatsuhiro Suzuki };
203db4cb3d0SKatsuhiro Suzuki 
204db4cb3d0SKatsuhiro Suzuki static int uniphier_aio_ld11_probe(struct snd_soc_dai *dai)
205db4cb3d0SKatsuhiro Suzuki {
206db4cb3d0SKatsuhiro Suzuki 	int ret;
207db4cb3d0SKatsuhiro Suzuki 
208db4cb3d0SKatsuhiro Suzuki 	ret = uniphier_aio_dai_probe(dai);
209db4cb3d0SKatsuhiro Suzuki 	if (ret < 0)
210db4cb3d0SKatsuhiro Suzuki 		return ret;
211db4cb3d0SKatsuhiro Suzuki 
212db4cb3d0SKatsuhiro Suzuki 	ret = snd_soc_dai_set_pll(dai, AUD_PLL_A1, 0, 0, 36864000);
213db4cb3d0SKatsuhiro Suzuki 	if (ret < 0)
214db4cb3d0SKatsuhiro Suzuki 		return ret;
215db4cb3d0SKatsuhiro Suzuki 	ret = snd_soc_dai_set_pll(dai, AUD_PLL_F1, 0, 0, 36864000);
216db4cb3d0SKatsuhiro Suzuki 	if (ret < 0)
217db4cb3d0SKatsuhiro Suzuki 		return ret;
218db4cb3d0SKatsuhiro Suzuki 
219db4cb3d0SKatsuhiro Suzuki 	ret = snd_soc_dai_set_pll(dai, AUD_PLL_A2, 0, 0, 33868800);
220db4cb3d0SKatsuhiro Suzuki 	if (ret < 0)
221db4cb3d0SKatsuhiro Suzuki 		return ret;
222db4cb3d0SKatsuhiro Suzuki 	ret = snd_soc_dai_set_pll(dai, AUD_PLL_F2, 0, 0, 33868800);
223db4cb3d0SKatsuhiro Suzuki 	if (ret < 0)
224db4cb3d0SKatsuhiro Suzuki 		return ret;
225db4cb3d0SKatsuhiro Suzuki 
226db4cb3d0SKatsuhiro Suzuki 	return 0;
227db4cb3d0SKatsuhiro Suzuki }
228db4cb3d0SKatsuhiro Suzuki 
229db4cb3d0SKatsuhiro Suzuki static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
230db4cb3d0SKatsuhiro Suzuki 	{
231db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_GNAME_HDMI,
232db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
233db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
234db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
235db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
236db4cb3d0SKatsuhiro Suzuki 		.playback = {
237db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMOUT1,
238db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
239db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
240db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
241db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
242db4cb3d0SKatsuhiro Suzuki 		},
243db4cb3d0SKatsuhiro Suzuki 		.capture = {
244db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMIN1,
245db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
246db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000 |
247db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_44100 |
248db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_32000,
249db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
250db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
251db4cb3d0SKatsuhiro Suzuki 		},
252db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
253db4cb3d0SKatsuhiro Suzuki 	},
254db4cb3d0SKatsuhiro Suzuki 	{
255db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_PCMIN2,
256db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
257db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
258db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
259db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
260db4cb3d0SKatsuhiro Suzuki 		.capture = {
261db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMIN2,
262db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
263db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
264db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
265db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
266db4cb3d0SKatsuhiro Suzuki 		},
267db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
268db4cb3d0SKatsuhiro Suzuki 	},
269db4cb3d0SKatsuhiro Suzuki 	{
270db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_GNAME_LINE,
271db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
272db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
273db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
274db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
275db4cb3d0SKatsuhiro Suzuki 		.playback = {
276db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMOUT2,
277db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
278db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
279db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
280db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
281db4cb3d0SKatsuhiro Suzuki 		},
282db4cb3d0SKatsuhiro Suzuki 		.capture = {
283db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMIN3,
284db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
285db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
286db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
287db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
288db4cb3d0SKatsuhiro Suzuki 		},
289db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
290db4cb3d0SKatsuhiro Suzuki 	},
291db4cb3d0SKatsuhiro Suzuki 	{
292db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_HPCMOUT1,
293db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
294db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
295db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
296db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
297db4cb3d0SKatsuhiro Suzuki 		.playback = {
298db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_HPCMOUT1,
299db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
300db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
301db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
302db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
303db4cb3d0SKatsuhiro Suzuki 		},
304db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
305db4cb3d0SKatsuhiro Suzuki 	},
306db4cb3d0SKatsuhiro Suzuki 	{
307db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_PCMOUT3,
308db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
309db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
310db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
311db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
312db4cb3d0SKatsuhiro Suzuki 		.playback = {
313db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_PCMOUT3,
314db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
315db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
316db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
317db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
318db4cb3d0SKatsuhiro Suzuki 		},
319db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
320db4cb3d0SKatsuhiro Suzuki 	},
321db4cb3d0SKatsuhiro Suzuki 	{
322db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_HIECOUT1,
323db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
324db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
325db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
326db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
327db4cb3d0SKatsuhiro Suzuki 		.playback = {
328db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_HIECOUT1,
329db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
330db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000,
331db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
332db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
333db4cb3d0SKatsuhiro Suzuki 		},
334db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_spdif_ops,
335db4cb3d0SKatsuhiro Suzuki 	},
336db4cb3d0SKatsuhiro Suzuki 	{
337db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_EPCMOUT2,
338db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
339db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
340db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
341db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
342db4cb3d0SKatsuhiro Suzuki 		.playback = {
343db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_EPCMOUT2,
344db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
345db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000 |
346db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_44100 |
347db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_32000,
348db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
349db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
350db4cb3d0SKatsuhiro Suzuki 		},
351db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
352db4cb3d0SKatsuhiro Suzuki 	},
353db4cb3d0SKatsuhiro Suzuki 	{
354db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_EPCMOUT3,
355db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
356db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
357db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
358db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
359db4cb3d0SKatsuhiro Suzuki 		.playback = {
360db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_EPCMOUT3,
361db4cb3d0SKatsuhiro Suzuki 			.formats     = SNDRV_PCM_FMTBIT_S32_LE,
362db4cb3d0SKatsuhiro Suzuki 			.rates       = SNDRV_PCM_RATE_48000 |
363db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_44100 |
364db4cb3d0SKatsuhiro Suzuki 				SNDRV_PCM_RATE_32000,
365db4cb3d0SKatsuhiro Suzuki 			.channels_min = 2,
366db4cb3d0SKatsuhiro Suzuki 			.channels_max = 2,
367db4cb3d0SKatsuhiro Suzuki 		},
368db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_i2s_ops,
369db4cb3d0SKatsuhiro Suzuki 	},
370db4cb3d0SKatsuhiro Suzuki 	{
371db4cb3d0SKatsuhiro Suzuki 		.name    = AUD_NAME_HIECCOMPOUT1,
372db4cb3d0SKatsuhiro Suzuki 		.probe   = uniphier_aio_ld11_probe,
373db4cb3d0SKatsuhiro Suzuki 		.remove  = uniphier_aio_dai_remove,
374db4cb3d0SKatsuhiro Suzuki 		.suspend = uniphier_aio_dai_suspend,
375db4cb3d0SKatsuhiro Suzuki 		.resume  = uniphier_aio_dai_resume,
376db4cb3d0SKatsuhiro Suzuki 		.compress_new = snd_soc_new_compress,
377db4cb3d0SKatsuhiro Suzuki 		.playback = {
378db4cb3d0SKatsuhiro Suzuki 			.stream_name = AUD_NAME_HIECCOMPOUT1,
379db4cb3d0SKatsuhiro Suzuki 			.channels_min = 1,
380db4cb3d0SKatsuhiro Suzuki 			.channels_max = 1,
381db4cb3d0SKatsuhiro Suzuki 		},
382db4cb3d0SKatsuhiro Suzuki 		.ops = &uniphier_aio_spdif_ops,
383db4cb3d0SKatsuhiro Suzuki 	},
384db4cb3d0SKatsuhiro Suzuki };
385db4cb3d0SKatsuhiro Suzuki 
386db4cb3d0SKatsuhiro Suzuki static const struct uniphier_aio_chip_spec uniphier_aio_ld11_spec = {
387db4cb3d0SKatsuhiro Suzuki 	.specs     = uniphier_aio_ld11,
388db4cb3d0SKatsuhiro Suzuki 	.num_specs = ARRAY_SIZE(uniphier_aio_ld11),
389db4cb3d0SKatsuhiro Suzuki 	.dais      = uniphier_aio_dai_ld11,
390db4cb3d0SKatsuhiro Suzuki 	.num_dais  = ARRAY_SIZE(uniphier_aio_dai_ld11),
391db4cb3d0SKatsuhiro Suzuki 	.plls      = uniphier_aio_pll_ld11,
392db4cb3d0SKatsuhiro Suzuki 	.num_plls  = ARRAY_SIZE(uniphier_aio_pll_ld11),
393db4cb3d0SKatsuhiro Suzuki 	.addr_ext  = 0,
394db4cb3d0SKatsuhiro Suzuki };
395db4cb3d0SKatsuhiro Suzuki 
396db4cb3d0SKatsuhiro Suzuki static const struct uniphier_aio_chip_spec uniphier_aio_ld20_spec = {
397db4cb3d0SKatsuhiro Suzuki 	.specs     = uniphier_aio_ld11,
398db4cb3d0SKatsuhiro Suzuki 	.num_specs = ARRAY_SIZE(uniphier_aio_ld11),
399db4cb3d0SKatsuhiro Suzuki 	.dais      = uniphier_aio_dai_ld11,
400db4cb3d0SKatsuhiro Suzuki 	.num_dais  = ARRAY_SIZE(uniphier_aio_dai_ld11),
401db4cb3d0SKatsuhiro Suzuki 	.plls      = uniphier_aio_pll_ld11,
402db4cb3d0SKatsuhiro Suzuki 	.num_plls  = ARRAY_SIZE(uniphier_aio_pll_ld11),
403db4cb3d0SKatsuhiro Suzuki 	.addr_ext  = 1,
404db4cb3d0SKatsuhiro Suzuki };
405db4cb3d0SKatsuhiro Suzuki 
406db4cb3d0SKatsuhiro Suzuki static const struct of_device_id uniphier_aio_of_match[] = {
407db4cb3d0SKatsuhiro Suzuki 	{
408db4cb3d0SKatsuhiro Suzuki 		.compatible = "socionext,uniphier-ld11-aio",
409db4cb3d0SKatsuhiro Suzuki 		.data = &uniphier_aio_ld11_spec,
410db4cb3d0SKatsuhiro Suzuki 	},
411db4cb3d0SKatsuhiro Suzuki 	{
412db4cb3d0SKatsuhiro Suzuki 		.compatible = "socionext,uniphier-ld20-aio",
413db4cb3d0SKatsuhiro Suzuki 		.data = &uniphier_aio_ld20_spec,
414db4cb3d0SKatsuhiro Suzuki 	},
415db4cb3d0SKatsuhiro Suzuki 	{},
416db4cb3d0SKatsuhiro Suzuki };
417db4cb3d0SKatsuhiro Suzuki MODULE_DEVICE_TABLE(of, uniphier_aio_of_match);
418db4cb3d0SKatsuhiro Suzuki 
419db4cb3d0SKatsuhiro Suzuki static struct platform_driver uniphier_aio_driver = {
420db4cb3d0SKatsuhiro Suzuki 	.driver = {
421*8413b9e0SKatsuhiro Suzuki 		.name = "snd-uniphier-aio-ld11",
422db4cb3d0SKatsuhiro Suzuki 		.of_match_table = of_match_ptr(uniphier_aio_of_match),
423db4cb3d0SKatsuhiro Suzuki 	},
424db4cb3d0SKatsuhiro Suzuki 	.probe    = uniphier_aio_probe,
425db4cb3d0SKatsuhiro Suzuki 	.remove   = uniphier_aio_remove,
426db4cb3d0SKatsuhiro Suzuki };
427db4cb3d0SKatsuhiro Suzuki module_platform_driver(uniphier_aio_driver);
428db4cb3d0SKatsuhiro Suzuki 
429db4cb3d0SKatsuhiro Suzuki MODULE_AUTHOR("Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>");
430db4cb3d0SKatsuhiro Suzuki MODULE_DESCRIPTION("UniPhier LD11/LD20 AIO driver.");
431db4cb3d0SKatsuhiro Suzuki MODULE_LICENSE("GPL v2");
432