1 // SPDX-License-Identifier: GPL-2.0
3 // Socionext UniPhier AIO ALSA driver for PXs2.
5 // Copyright (c) 2018 Socionext Inc.
7 #include <linux/module.h>
11 static const struct uniphier_aio_spec uniphier_aio_pxs2
[] = {
12 /* for Line PCM In, Pin:AI1Dx */
14 .name
= AUD_NAME_PCMIN1
,
15 .gname
= AUD_GNAME_LINE
,
17 .type
= PORT_TYPE_I2S
,
18 .dir
= PORT_DIR_INPUT
,
22 .iport
= { 0, AUD_HW_PCMIN1
, },
26 /* for Speaker/Headphone/Mic PCM In, Pin:AI2Dx */
28 .name
= AUD_NAME_PCMIN2
,
29 .gname
= AUD_GNAME_AUX
,
31 .type
= PORT_TYPE_I2S
,
32 .dir
= PORT_DIR_INPUT
,
36 .iport
= { 1, AUD_HW_PCMIN2
, },
40 /* for HDMI PCM Out, Pin:AO1Dx (inner) */
42 .name
= AUD_NAME_HPCMOUT1
,
43 .gname
= AUD_GNAME_HDMI
,
45 .type
= PORT_TYPE_I2S
,
46 .dir
= PORT_DIR_OUTPUT
,
50 .oport
= { 3, AUD_HW_HPCMOUT1
, },
54 /* for Line PCM Out, Pin:AO2Dx */
56 .name
= AUD_NAME_PCMOUT1
,
57 .gname
= AUD_GNAME_LINE
,
59 .type
= PORT_TYPE_I2S
,
60 .dir
= PORT_DIR_OUTPUT
,
64 .oport
= { 0, AUD_HW_PCMOUT1
, },
68 /* for Speaker/Headphone/Mic PCM Out, Pin:AO3Dx */
70 .name
= AUD_NAME_PCMOUT2
,
71 .gname
= AUD_GNAME_AUX
,
73 .type
= PORT_TYPE_I2S
,
74 .dir
= PORT_DIR_OUTPUT
,
78 .oport
= { 1, AUD_HW_PCMOUT2
, },
82 /* for HDMI Out, Pin:AO1IEC */
84 .name
= AUD_NAME_HIECOUT1
,
86 .type
= PORT_TYPE_SPDIF
,
87 .dir
= PORT_DIR_OUTPUT
,
91 .oport
= { 12, AUD_HW_HIECOUT1
, },
95 /* for HDMI Out, Pin:AO1IEC, Compress */
97 .name
= AUD_NAME_HIECCOMPOUT1
,
99 .type
= PORT_TYPE_SPDIF
,
100 .dir
= PORT_DIR_OUTPUT
,
104 .oport
= { 12, AUD_HW_HIECOUT1
, },
108 /* for S/PDIF Out, Pin:AO2IEC */
110 .name
= AUD_NAME_IECOUT1
,
112 .type
= PORT_TYPE_SPDIF
,
113 .dir
= PORT_DIR_OUTPUT
,
117 .oport
= { 13, AUD_HW_IECOUT1
, },
121 /* for S/PDIF Out, Pin:AO2IEC */
123 .name
= AUD_NAME_IECCOMPOUT1
,
125 .type
= PORT_TYPE_SPDIF
,
126 .dir
= PORT_DIR_OUTPUT
,
130 .oport
= { 13, AUD_HW_IECOUT1
, },
135 static const struct uniphier_aio_pll uniphier_aio_pll_pxs2
[] = {
136 [AUD_PLL_A1
] = { .enable
= true, },
137 [AUD_PLL_F1
] = { .enable
= true, },
138 [AUD_PLL_A2
] = { .enable
= true, },
139 [AUD_PLL_F2
] = { .enable
= true, },
140 [AUD_PLL_APLL
] = { .enable
= true, },
141 [AUD_PLL_HSC0
] = { .enable
= true, },
144 static struct snd_soc_dai_driver uniphier_aio_dai_pxs2
[] = {
146 .name
= AUD_GNAME_HDMI
,
148 .stream_name
= AUD_NAME_HPCMOUT1
,
149 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
150 .rates
= SNDRV_PCM_RATE_48000
,
154 .ops
= &uniphier_aio_i2s_pxs2_ops
,
157 .name
= AUD_GNAME_LINE
,
159 .stream_name
= AUD_NAME_PCMOUT1
,
160 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
161 .rates
= SNDRV_PCM_RATE_48000
,
166 .stream_name
= AUD_NAME_PCMIN1
,
167 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
168 .rates
= SNDRV_PCM_RATE_48000
,
172 .ops
= &uniphier_aio_i2s_pxs2_ops
,
175 .name
= AUD_GNAME_AUX
,
177 .stream_name
= AUD_NAME_PCMOUT2
,
178 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
179 .rates
= SNDRV_PCM_RATE_48000
,
184 .stream_name
= AUD_NAME_PCMIN2
,
185 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
186 .rates
= SNDRV_PCM_RATE_48000
,
190 .ops
= &uniphier_aio_i2s_pxs2_ops
,
193 .name
= AUD_NAME_HIECOUT1
,
195 .stream_name
= AUD_NAME_HIECOUT1
,
196 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
197 .rates
= SNDRV_PCM_RATE_48000
,
201 .ops
= &uniphier_aio_spdif_pxs2_ops
,
204 .name
= AUD_NAME_IECOUT1
,
206 .stream_name
= AUD_NAME_IECOUT1
,
207 .formats
= SNDRV_PCM_FMTBIT_S32_LE
,
208 .rates
= SNDRV_PCM_RATE_48000
,
212 .ops
= &uniphier_aio_spdif_pxs2_ops
,
215 .name
= AUD_NAME_HIECCOMPOUT1
,
217 .stream_name
= AUD_NAME_HIECCOMPOUT1
,
221 .ops
= &uniphier_aio_spdif_pxs2_ops2
,
224 .name
= AUD_NAME_IECCOMPOUT1
,
226 .stream_name
= AUD_NAME_IECCOMPOUT1
,
230 .ops
= &uniphier_aio_spdif_pxs2_ops2
,
234 static const struct uniphier_aio_chip_spec uniphier_aio_pxs2_spec
= {
235 .specs
= uniphier_aio_pxs2
,
236 .num_specs
= ARRAY_SIZE(uniphier_aio_pxs2
),
237 .dais
= uniphier_aio_dai_pxs2
,
238 .num_dais
= ARRAY_SIZE(uniphier_aio_dai_pxs2
),
239 .plls
= uniphier_aio_pll_pxs2
,
240 .num_plls
= ARRAY_SIZE(uniphier_aio_pll_pxs2
),
244 static const struct of_device_id uniphier_aio_of_match
[] __maybe_unused
= {
246 .compatible
= "socionext,uniphier-pxs2-aio",
247 .data
= &uniphier_aio_pxs2_spec
,
251 MODULE_DEVICE_TABLE(of
, uniphier_aio_of_match
);
253 static struct platform_driver uniphier_aio_driver
= {
255 .name
= "snd-uniphier-aio-pxs2",
256 .of_match_table
= of_match_ptr(uniphier_aio_of_match
),
258 .probe
= uniphier_aio_probe
,
259 .remove
= uniphier_aio_remove
,
261 module_platform_driver(uniphier_aio_driver
);
263 MODULE_AUTHOR("Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>");
264 MODULE_DESCRIPTION("UniPhier PXs2 AIO driver.");
265 MODULE_LICENSE("GPL v2");