blob: 90a89276662597b4ebd6c65bae4328b7aad515f1 [file] [log] [blame]
Jyri Sarha09184112016-03-31 16:36:00 +03001/*
2 * ALSA SoC codec for HDMI encoder drivers
3 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
4 * Author: Jyri Sarha <jsarha@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15#include <linux/module.h>
16#include <linux/string.h>
17#include <sound/core.h>
18#include <sound/pcm.h>
19#include <sound/pcm_params.h>
20#include <sound/soc.h>
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +010021#include <sound/tlv.h>
Jyri Sarha09184112016-03-31 16:36:00 +030022#include <sound/pcm_drm_eld.h>
23#include <sound/hdmi-codec.h>
24#include <sound/pcm_iec958.h>
25
26#include <drm/drm_crtc.h> /* This is only to get MAX_ELD_BYTES */
27
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +010028#define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1
29
30struct hdmi_codec_channel_map_table {
31 unsigned char map; /* ALSA API channel map position */
32 unsigned long spk_mask; /* speaker position bit mask */
33};
34
35/*
36 * CEA speaker placement for HDMI 1.4:
37 *
38 * FL FLC FC FRC FR FRW
39 *
40 * LFE
41 *
42 * RL RLC RC RRC RR
43 *
44 * Speaker placement has to be extended to support HDMI 2.0
45 */
46enum hdmi_codec_cea_spk_placement {
47 FL = BIT(0), /* Front Left */
48 FC = BIT(1), /* Front Center */
49 FR = BIT(2), /* Front Right */
50 FLC = BIT(3), /* Front Left Center */
51 FRC = BIT(4), /* Front Right Center */
52 RL = BIT(5), /* Rear Left */
53 RC = BIT(6), /* Rear Center */
54 RR = BIT(7), /* Rear Right */
55 RLC = BIT(8), /* Rear Left Center */
56 RRC = BIT(9), /* Rear Right Center */
57 LFE = BIT(10), /* Low Frequency Effect */
58};
59
60/*
61 * cea Speaker allocation structure
62 */
63struct hdmi_codec_cea_spk_alloc {
64 const int ca_id;
65 unsigned int n_ch;
66 unsigned long mask;
67};
68
69/* Channel maps stereo HDMI */
Colin Ian King3013c752017-08-12 23:50:28 +010070static const struct snd_pcm_chmap_elem hdmi_codec_stereo_chmaps[] = {
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +010071 { .channels = 2,
72 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
73 { }
74};
75
76/* Channel maps for multi-channel playbacks, up to 8 n_ch */
Colin Ian King3013c752017-08-12 23:50:28 +010077static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +010078 { .channels = 2, /* CA_ID 0x00 */
79 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
80 { .channels = 4, /* CA_ID 0x01 */
81 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
82 SNDRV_CHMAP_NA } },
83 { .channels = 4, /* CA_ID 0x02 */
84 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
85 SNDRV_CHMAP_FC } },
86 { .channels = 4, /* CA_ID 0x03 */
87 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
88 SNDRV_CHMAP_FC } },
89 { .channels = 6, /* CA_ID 0x04 */
90 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
91 SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
92 { .channels = 6, /* CA_ID 0x05 */
93 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
94 SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
95 { .channels = 6, /* CA_ID 0x06 */
96 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
97 SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
98 { .channels = 6, /* CA_ID 0x07 */
99 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
100 SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
101 { .channels = 6, /* CA_ID 0x08 */
102 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
103 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
104 { .channels = 6, /* CA_ID 0x09 */
105 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
106 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
107 { .channels = 6, /* CA_ID 0x0A */
108 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
109 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
110 { .channels = 6, /* CA_ID 0x0B */
111 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
112 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
113 { .channels = 8, /* CA_ID 0x0C */
114 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
115 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
116 SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
117 { .channels = 8, /* CA_ID 0x0D */
118 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
119 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
120 SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
121 { .channels = 8, /* CA_ID 0x0E */
122 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
123 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
124 SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
125 { .channels = 8, /* CA_ID 0x0F */
126 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
127 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
128 SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
129 { .channels = 8, /* CA_ID 0x10 */
130 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
131 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
132 SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
133 { .channels = 8, /* CA_ID 0x11 */
134 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
135 SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
136 SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
137 { .channels = 8, /* CA_ID 0x12 */
138 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
139 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
140 SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
141 { .channels = 8, /* CA_ID 0x13 */
142 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
143 SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
144 SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
145 { .channels = 8, /* CA_ID 0x14 */
146 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
147 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
148 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
149 { .channels = 8, /* CA_ID 0x15 */
150 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
151 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
152 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
153 { .channels = 8, /* CA_ID 0x16 */
154 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
155 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
156 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
157 { .channels = 8, /* CA_ID 0x17 */
158 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
159 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
160 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
161 { .channels = 8, /* CA_ID 0x18 */
162 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
163 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
164 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
165 { .channels = 8, /* CA_ID 0x19 */
166 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
167 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
168 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
169 { .channels = 8, /* CA_ID 0x1A */
170 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
171 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
172 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
173 { .channels = 8, /* CA_ID 0x1B */
174 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
175 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
176 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
177 { .channels = 8, /* CA_ID 0x1C */
178 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
179 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
180 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
181 { .channels = 8, /* CA_ID 0x1D */
182 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
183 SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
184 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
185 { .channels = 8, /* CA_ID 0x1E */
186 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
187 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
188 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
189 { .channels = 8, /* CA_ID 0x1F */
190 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
191 SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
192 SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
193 { }
194};
195
196/*
197 * hdmi_codec_channel_alloc: speaker configuration available for CEA
198 *
199 * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct
200 * The preceding ones have better chances to be selected by
201 * hdmi_codec_get_ch_alloc_table_idx().
202 */
203static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {
204 { .ca_id = 0x00, .n_ch = 2,
205 .mask = FL | FR},
206 /* 2.1 */
207 { .ca_id = 0x01, .n_ch = 4,
208 .mask = FL | FR | LFE},
209 /* Dolby Surround */
210 { .ca_id = 0x02, .n_ch = 4,
211 .mask = FL | FR | FC },
212 /* surround51 */
213 { .ca_id = 0x0b, .n_ch = 6,
214 .mask = FL | FR | LFE | FC | RL | RR},
215 /* surround40 */
216 { .ca_id = 0x08, .n_ch = 6,
217 .mask = FL | FR | RL | RR },
218 /* surround41 */
219 { .ca_id = 0x09, .n_ch = 6,
220 .mask = FL | FR | LFE | RL | RR },
221 /* surround50 */
222 { .ca_id = 0x0a, .n_ch = 6,
223 .mask = FL | FR | FC | RL | RR },
224 /* 6.1 */
225 { .ca_id = 0x0f, .n_ch = 8,
226 .mask = FL | FR | LFE | FC | RL | RR | RC },
227 /* surround71 */
228 { .ca_id = 0x13, .n_ch = 8,
229 .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
230 /* others */
231 { .ca_id = 0x03, .n_ch = 8,
232 .mask = FL | FR | LFE | FC },
233 { .ca_id = 0x04, .n_ch = 8,
234 .mask = FL | FR | RC},
235 { .ca_id = 0x05, .n_ch = 8,
236 .mask = FL | FR | LFE | RC },
237 { .ca_id = 0x06, .n_ch = 8,
238 .mask = FL | FR | FC | RC },
239 { .ca_id = 0x07, .n_ch = 8,
240 .mask = FL | FR | LFE | FC | RC },
241 { .ca_id = 0x0c, .n_ch = 8,
242 .mask = FL | FR | RC | RL | RR },
243 { .ca_id = 0x0d, .n_ch = 8,
244 .mask = FL | FR | LFE | RL | RR | RC },
245 { .ca_id = 0x0e, .n_ch = 8,
246 .mask = FL | FR | FC | RL | RR | RC },
247 { .ca_id = 0x10, .n_ch = 8,
248 .mask = FL | FR | RL | RR | RLC | RRC },
249 { .ca_id = 0x11, .n_ch = 8,
250 .mask = FL | FR | LFE | RL | RR | RLC | RRC },
251 { .ca_id = 0x12, .n_ch = 8,
252 .mask = FL | FR | FC | RL | RR | RLC | RRC },
253 { .ca_id = 0x14, .n_ch = 8,
254 .mask = FL | FR | FLC | FRC },
255 { .ca_id = 0x15, .n_ch = 8,
256 .mask = FL | FR | LFE | FLC | FRC },
257 { .ca_id = 0x16, .n_ch = 8,
258 .mask = FL | FR | FC | FLC | FRC },
259 { .ca_id = 0x17, .n_ch = 8,
260 .mask = FL | FR | LFE | FC | FLC | FRC },
261 { .ca_id = 0x18, .n_ch = 8,
262 .mask = FL | FR | RC | FLC | FRC },
263 { .ca_id = 0x19, .n_ch = 8,
264 .mask = FL | FR | LFE | RC | FLC | FRC },
265 { .ca_id = 0x1a, .n_ch = 8,
266 .mask = FL | FR | RC | FC | FLC | FRC },
267 { .ca_id = 0x1b, .n_ch = 8,
268 .mask = FL | FR | LFE | RC | FC | FLC | FRC },
269 { .ca_id = 0x1c, .n_ch = 8,
270 .mask = FL | FR | RL | RR | FLC | FRC },
271 { .ca_id = 0x1d, .n_ch = 8,
272 .mask = FL | FR | LFE | RL | RR | FLC | FRC },
273 { .ca_id = 0x1e, .n_ch = 8,
274 .mask = FL | FR | FC | RL | RR | FLC | FRC },
275 { .ca_id = 0x1f, .n_ch = 8,
276 .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
277};
278
Jyri Sarha09184112016-03-31 16:36:00 +0300279struct hdmi_codec_priv {
280 struct hdmi_codec_pdata hcd;
Jyri Sarha09184112016-03-31 16:36:00 +0300281 uint8_t eld[MAX_ELD_BYTES];
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100282 struct snd_pcm_chmap *chmap_info;
283 unsigned int chmap_idx;
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200284 unsigned long busy;
Jyri Sarha09184112016-03-31 16:36:00 +0300285};
286
287static const struct snd_soc_dapm_widget hdmi_widgets[] = {
288 SND_SOC_DAPM_OUTPUT("TX"),
289};
290
Jyri Sarha09184112016-03-31 16:36:00 +0300291enum {
292 DAI_ID_I2S = 0,
293 DAI_ID_SPDIF,
294};
295
Philipp Zabel81151cf2016-04-20 10:59:58 +0200296static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol,
297 struct snd_ctl_elem_info *uinfo)
298{
Philipp Zabel81151cf2016-04-20 10:59:58 +0200299 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
Colin Ian King0607aa32017-09-18 10:48:43 +0100300 uinfo->count = FIELD_SIZEOF(struct hdmi_codec_priv, eld);
Philipp Zabel81151cf2016-04-20 10:59:58 +0200301
302 return 0;
303}
304
305static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
306 struct snd_ctl_elem_value *ucontrol)
307{
308 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
309 struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
310
Philipp Zabel81151cf2016-04-20 10:59:58 +0200311 memcpy(ucontrol->value.bytes.data, hcp->eld, sizeof(hcp->eld));
Philipp Zabel81151cf2016-04-20 10:59:58 +0200312
313 return 0;
314}
315
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100316static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc)
317{
318 int i;
Colin Ian King1d6463a2017-07-11 15:08:55 +0100319 static const unsigned long hdmi_codec_eld_spk_alloc_bits[] = {
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100320 [0] = FL | FR, [1] = LFE, [2] = FC, [3] = RL | RR,
321 [4] = RC, [5] = FLC | FRC, [6] = RLC | RRC,
322 };
323 unsigned long spk_mask = 0;
324
325 for (i = 0; i < ARRAY_SIZE(hdmi_codec_eld_spk_alloc_bits); i++) {
326 if (spk_alloc & (1 << i))
327 spk_mask |= hdmi_codec_eld_spk_alloc_bits[i];
328 }
329
330 return spk_mask;
331}
332
Colin Ian King3013c752017-08-12 23:50:28 +0100333static void hdmi_codec_eld_chmap(struct hdmi_codec_priv *hcp)
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100334{
335 u8 spk_alloc;
336 unsigned long spk_mask;
337
338 spk_alloc = drm_eld_get_spk_alloc(hcp->eld);
339 spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc);
340
341 /* Detect if only stereo supported, else return 8 channels mappings */
342 if ((spk_mask & ~(FL | FR)) && hcp->chmap_info->max_channels > 2)
343 hcp->chmap_info->chmap = hdmi_codec_8ch_chmaps;
344 else
345 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps;
346}
347
348static int hdmi_codec_get_ch_alloc_table_idx(struct hdmi_codec_priv *hcp,
349 unsigned char channels)
350{
351 int i;
352 u8 spk_alloc;
353 unsigned long spk_mask;
354 const struct hdmi_codec_cea_spk_alloc *cap = hdmi_codec_channel_alloc;
355
356 spk_alloc = drm_eld_get_spk_alloc(hcp->eld);
357 spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc);
358
359 for (i = 0; i < ARRAY_SIZE(hdmi_codec_channel_alloc); i++, cap++) {
360 /* If spk_alloc == 0, HDMI is unplugged return stereo config*/
361 if (!spk_alloc && cap->ca_id == 0)
362 return i;
363 if (cap->n_ch != channels)
364 continue;
365 if (!(cap->mask == (spk_mask & cap->mask)))
366 continue;
367 return i;
368 }
369
370 return -EINVAL;
371}
372static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,
373 struct snd_ctl_elem_value *ucontrol)
374{
375 unsigned const char *map;
376 unsigned int i;
377 struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
378 struct hdmi_codec_priv *hcp = info->private_data;
379
380 map = info->chmap[hcp->chmap_idx].map;
381
382 for (i = 0; i < info->max_channels; i++) {
383 if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN)
384 ucontrol->value.integer.value[i] = 0;
385 else
386 ucontrol->value.integer.value[i] = map[i];
387 }
388
389 return 0;
390}
391
Jyri Sarha09184112016-03-31 16:36:00 +0300392static int hdmi_codec_startup(struct snd_pcm_substream *substream,
393 struct snd_soc_dai *dai)
394{
395 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
396 int ret = 0;
397
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200398 ret = test_and_set_bit(0, &hcp->busy);
399 if (ret) {
400 dev_err(dai->dev, "Only one simultaneous stream supported!\n");
401 return -EINVAL;
402 }
Jyri Sarha09184112016-03-31 16:36:00 +0300403
404 if (hcp->hcd.ops->audio_startup) {
Kuninori Morimotoefc91942016-06-24 02:47:55 +0000405 ret = hcp->hcd.ops->audio_startup(dai->dev->parent, hcp->hcd.data);
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200406 if (ret)
407 goto err;
Jyri Sarha09184112016-03-31 16:36:00 +0300408 }
409
410 if (hcp->hcd.ops->get_eld) {
Kuninori Morimotoefc91942016-06-24 02:47:55 +0000411 ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data,
412 hcp->eld, sizeof(hcp->eld));
Jyri Sarha09184112016-03-31 16:36:00 +0300413
414 if (!ret) {
415 ret = snd_pcm_hw_constraint_eld(substream->runtime,
416 hcp->eld);
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200417 if (ret)
418 goto err;
Jyri Sarha09184112016-03-31 16:36:00 +0300419 }
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100420 /* Select chmap supported */
421 hdmi_codec_eld_chmap(hcp);
Jyri Sarha09184112016-03-31 16:36:00 +0300422 }
423 return 0;
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200424
425err:
426 /* Release the exclusive lock on error */
427 clear_bit(0, &hcp->busy);
428 return ret;
Jyri Sarha09184112016-03-31 16:36:00 +0300429}
430
431static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
432 struct snd_soc_dai *dai)
433{
434 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
435
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100436 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
Kuninori Morimotoefc91942016-06-24 02:47:55 +0000437 hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data);
Jyri Sarha09184112016-03-31 16:36:00 +0300438
Jerome Brunet3fcf94e2019-05-06 11:58:13 +0200439 clear_bit(0, &hcp->busy);
Jyri Sarha09184112016-03-31 16:36:00 +0300440}
441
442static int hdmi_codec_hw_params(struct snd_pcm_substream *substream,
443 struct snd_pcm_hw_params *params,
444 struct snd_soc_dai *dai)
445{
446 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
Jerome Brunet0cf46102019-05-06 11:58:15 +0200447 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
Jyri Sarha09184112016-03-31 16:36:00 +0300448 struct hdmi_codec_params hp = {
449 .iec = {
450 .status = { 0 },
451 .subcode = { 0 },
452 .pad = 0,
453 .dig_subframe = { 0 },
454 }
455 };
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100456 int ret, idx;
Jyri Sarha09184112016-03-31 16:36:00 +0300457
458 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__,
459 params_width(params), params_rate(params),
460 params_channels(params));
461
Jyri Sarha09184112016-03-31 16:36:00 +0300462 ret = snd_pcm_create_iec958_consumer_hw_params(params, hp.iec.status,
463 sizeof(hp.iec.status));
464 if (ret < 0) {
465 dev_err(dai->dev, "Creating IEC958 channel status failed %d\n",
466 ret);
467 return ret;
468 }
469
Jyri Sarha09184112016-03-31 16:36:00 +0300470 hdmi_audio_infoframe_init(&hp.cea);
471 hp.cea.channels = params_channels(params);
472 hp.cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
473 hp.cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
474 hp.cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
475
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100476 /* Select a channel allocation that matches with ELD and pcm channels */
477 idx = hdmi_codec_get_ch_alloc_table_idx(hcp, hp.cea.channels);
478 if (idx < 0) {
479 dev_err(dai->dev, "Not able to map channels to speakers (%d)\n",
480 idx);
481 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
482 return idx;
483 }
484 hp.cea.channel_allocation = hdmi_codec_channel_alloc[idx].ca_id;
485 hcp->chmap_idx = hdmi_codec_channel_alloc[idx].ca_id;
486
Jyri Sarha09184112016-03-31 16:36:00 +0300487 hp.sample_width = params_width(params);
488 hp.sample_rate = params_rate(params);
489 hp.channels = params_channels(params);
490
Kuninori Morimotoefc91942016-06-24 02:47:55 +0000491 return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data,
Jerome Brunet0cf46102019-05-06 11:58:15 +0200492 cf, &hp);
Jyri Sarha09184112016-03-31 16:36:00 +0300493}
494
Jerome Brunet0cf46102019-05-06 11:58:15 +0200495static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai,
496 unsigned int fmt)
Jyri Sarha09184112016-03-31 16:36:00 +0300497{
Jerome Brunet0cf46102019-05-06 11:58:15 +0200498 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
Jyri Sarha09184112016-03-31 16:36:00 +0300499
Jerome Brunet0cf46102019-05-06 11:58:15 +0200500 /* Reset daifmt */
501 memset(cf, 0, sizeof(*cf));
Jyri Sarha09184112016-03-31 16:36:00 +0300502
Russell King2e95f982019-02-28 15:30:34 +0000503 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
504 case SND_SOC_DAIFMT_CBM_CFM:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200505 cf->bit_clk_master = 1;
506 cf->frame_clk_master = 1;
Russell King2e95f982019-02-28 15:30:34 +0000507 break;
508 case SND_SOC_DAIFMT_CBS_CFM:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200509 cf->frame_clk_master = 1;
Russell King2e95f982019-02-28 15:30:34 +0000510 break;
511 case SND_SOC_DAIFMT_CBM_CFS:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200512 cf->bit_clk_master = 1;
Russell King2e95f982019-02-28 15:30:34 +0000513 break;
514 case SND_SOC_DAIFMT_CBS_CFS:
515 break;
516 default:
517 return -EINVAL;
518 }
Jyri Sarha09184112016-03-31 16:36:00 +0300519
Russell King2e95f982019-02-28 15:30:34 +0000520 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
521 case SND_SOC_DAIFMT_NB_NF:
522 break;
523 case SND_SOC_DAIFMT_NB_IF:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200524 cf->frame_clk_inv = 1;
Russell King2e95f982019-02-28 15:30:34 +0000525 break;
526 case SND_SOC_DAIFMT_IB_NF:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200527 cf->bit_clk_inv = 1;
Russell King2e95f982019-02-28 15:30:34 +0000528 break;
529 case SND_SOC_DAIFMT_IB_IF:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200530 cf->frame_clk_inv = 1;
531 cf->bit_clk_inv = 1;
Russell King2e95f982019-02-28 15:30:34 +0000532 break;
533 }
534
535 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
536 case SND_SOC_DAIFMT_I2S:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200537 cf->fmt = HDMI_I2S;
Russell King2e95f982019-02-28 15:30:34 +0000538 break;
539 case SND_SOC_DAIFMT_DSP_A:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200540 cf->fmt = HDMI_DSP_A;
Russell King2e95f982019-02-28 15:30:34 +0000541 break;
542 case SND_SOC_DAIFMT_DSP_B:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200543 cf->fmt = HDMI_DSP_B;
Russell King2e95f982019-02-28 15:30:34 +0000544 break;
545 case SND_SOC_DAIFMT_RIGHT_J:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200546 cf->fmt = HDMI_RIGHT_J;
Russell King2e95f982019-02-28 15:30:34 +0000547 break;
548 case SND_SOC_DAIFMT_LEFT_J:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200549 cf->fmt = HDMI_LEFT_J;
Russell King2e95f982019-02-28 15:30:34 +0000550 break;
551 case SND_SOC_DAIFMT_AC97:
Jerome Brunet0cf46102019-05-06 11:58:15 +0200552 cf->fmt = HDMI_AC97;
Russell King2e95f982019-02-28 15:30:34 +0000553 break;
554 default:
555 dev_err(dai->dev, "Invalid DAI interface format\n");
556 return -EINVAL;
Jyri Sarha09184112016-03-31 16:36:00 +0300557 }
558
Russell King2e95f982019-02-28 15:30:34 +0000559 return 0;
Jyri Sarha09184112016-03-31 16:36:00 +0300560}
561
562static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)
563{
564 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
565
Jyri Sarha09184112016-03-31 16:36:00 +0300566 if (hcp->hcd.ops->digital_mute)
Kuninori Morimotoefc91942016-06-24 02:47:55 +0000567 return hcp->hcd.ops->digital_mute(dai->dev->parent,
568 hcp->hcd.data, mute);
Jyri Sarha09184112016-03-31 16:36:00 +0300569
570 return 0;
571}
572
Jerome Brunet0cf46102019-05-06 11:58:15 +0200573static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = {
Jyri Sarha09184112016-03-31 16:36:00 +0300574 .startup = hdmi_codec_startup,
575 .shutdown = hdmi_codec_shutdown,
576 .hw_params = hdmi_codec_hw_params,
Jerome Brunet0cf46102019-05-06 11:58:15 +0200577 .set_fmt = hdmi_codec_i2s_set_fmt,
Jyri Sarha09184112016-03-31 16:36:00 +0300578 .digital_mute = hdmi_codec_digital_mute,
579};
580
Jerome Brunet0cf46102019-05-06 11:58:15 +0200581static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = {
582 .startup = hdmi_codec_startup,
583 .shutdown = hdmi_codec_shutdown,
584 .hw_params = hdmi_codec_hw_params,
585 .digital_mute = hdmi_codec_digital_mute,
586};
Jyri Sarha09184112016-03-31 16:36:00 +0300587
588#define HDMI_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
589 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |\
590 SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\
591 SNDRV_PCM_RATE_192000)
592
593#define SPDIF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |\
594 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE |\
595 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |\
596 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE)
597
598/*
599 * This list is only for formats allowed on the I2S bus. So there is
600 * some formats listed that are not supported by HDMI interface. For
601 * instance allowing the 32-bit formats enables 24-precision with CPU
602 * DAIs that do not support 24-bit formats. If the extra formats cause
603 * problems, we should add the video side driver an option to disable
604 * them.
605 */
606#define I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |\
607 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE |\
608 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |\
609 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE |\
610 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE)
611
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100612static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
613 struct snd_soc_dai *dai)
614{
615 struct snd_soc_dai_driver *drv = dai->driver;
616 struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
Kuninori Morimotoecbb1b82017-07-06 00:39:29 +0000617 struct snd_kcontrol *kctl;
618 struct snd_kcontrol_new hdmi_eld_ctl = {
619 .access = SNDRV_CTL_ELEM_ACCESS_READ |
620 SNDRV_CTL_ELEM_ACCESS_VOLATILE,
621 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
622 .name = "ELD",
623 .info = hdmi_eld_ctl_info,
624 .get = hdmi_eld_ctl_get,
625 .device = rtd->pcm->device,
626 };
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100627 int ret;
628
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100629 ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK,
630 NULL, drv->playback.channels_max, 0,
631 &hcp->chmap_info);
632 if (ret < 0)
633 return ret;
634
635 /* override handlers */
636 hcp->chmap_info->private_data = hcp;
637 hcp->chmap_info->kctl->get = hdmi_codec_chmap_ctl_get;
638
639 /* default chmap supported is stereo */
640 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps;
641 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
642
Kuninori Morimotoecbb1b82017-07-06 00:39:29 +0000643 /* add ELD ctl with the device number corresponding to the PCM stream */
644 kctl = snd_ctl_new1(&hdmi_eld_ctl, dai->component);
645 if (!kctl)
646 return -ENOMEM;
647
648 return snd_ctl_add(rtd->card->snd_card, kctl);
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100649}
650
Russell Kingd30e23d2018-07-14 16:01:06 +0100651static int hdmi_dai_probe(struct snd_soc_dai *dai)
652{
653 struct snd_soc_dapm_context *dapm;
Jerome Brunet0cf46102019-05-06 11:58:15 +0200654 struct hdmi_codec_daifmt *daifmt;
Russell Kingd30e23d2018-07-14 16:01:06 +0100655 struct snd_soc_dapm_route route = {
656 .sink = "TX",
657 .source = dai->driver->playback.stream_name,
658 };
Jerome Brunet0cf46102019-05-06 11:58:15 +0200659 int ret;
Russell Kingd30e23d2018-07-14 16:01:06 +0100660
661 dapm = snd_soc_component_get_dapm(dai->component);
Jerome Brunet0cf46102019-05-06 11:58:15 +0200662 ret = snd_soc_dapm_add_routes(dapm, &route, 1);
663 if (ret)
664 return ret;
Russell Kingd30e23d2018-07-14 16:01:06 +0100665
Jerome Brunet0cf46102019-05-06 11:58:15 +0200666 daifmt = kzalloc(sizeof(*daifmt), GFP_KERNEL);
667 if (!daifmt)
668 return -ENOMEM;
669
670 dai->playback_dma_data = daifmt;
671 return 0;
672}
673
674static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
675{
676 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
677 int ret;
678
679 ret = hdmi_dai_probe(dai);
680 if (ret)
681 return ret;
682
683 cf = dai->playback_dma_data;
684 cf->fmt = HDMI_SPDIF;
685
686 return 0;
687}
688
689static int hdmi_codec_dai_remove(struct snd_soc_dai *dai)
690{
691 kfree(dai->playback_dma_data);
692 return 0;
Russell Kingd30e23d2018-07-14 16:01:06 +0100693}
694
Bhumika Goyal6e37f932017-08-16 22:45:09 +0530695static const struct snd_soc_dai_driver hdmi_i2s_dai = {
Kuninori Morimoto24069b52017-05-18 01:40:02 +0000696 .name = "i2s-hifi",
Jyri Sarha09184112016-03-31 16:36:00 +0300697 .id = DAI_ID_I2S,
Russell Kingd30e23d2018-07-14 16:01:06 +0100698 .probe = hdmi_dai_probe,
Jerome Brunet0cf46102019-05-06 11:58:15 +0200699 .remove = hdmi_codec_dai_remove,
Jyri Sarha09184112016-03-31 16:36:00 +0300700 .playback = {
Jeffy Chen943fa022017-08-12 08:40:38 +0800701 .stream_name = "I2S Playback",
Jyri Sarha09184112016-03-31 16:36:00 +0300702 .channels_min = 2,
703 .channels_max = 8,
704 .rates = HDMI_RATES,
705 .formats = I2S_FORMATS,
706 .sig_bits = 24,
707 },
Jerome Brunet0cf46102019-05-06 11:58:15 +0200708 .ops = &hdmi_codec_i2s_dai_ops,
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100709 .pcm_new = hdmi_codec_pcm_new,
Jyri Sarha09184112016-03-31 16:36:00 +0300710};
711
712static const struct snd_soc_dai_driver hdmi_spdif_dai = {
Kuninori Morimoto24069b52017-05-18 01:40:02 +0000713 .name = "spdif-hifi",
Jyri Sarha09184112016-03-31 16:36:00 +0300714 .id = DAI_ID_SPDIF,
Jerome Brunet0cf46102019-05-06 11:58:15 +0200715 .probe = hdmi_dai_spdif_probe,
716 .remove = hdmi_codec_dai_remove,
Jyri Sarha09184112016-03-31 16:36:00 +0300717 .playback = {
Jeffy Chen943fa022017-08-12 08:40:38 +0800718 .stream_name = "SPDIF Playback",
Jyri Sarha09184112016-03-31 16:36:00 +0300719 .channels_min = 2,
720 .channels_max = 2,
721 .rates = HDMI_RATES,
722 .formats = SPDIF_FORMATS,
723 },
Jerome Brunet0cf46102019-05-06 11:58:15 +0200724 .ops = &hdmi_codec_spdif_dai_ops,
Arnaud Pouliquencd6111b2017-01-03 16:52:52 +0100725 .pcm_new = hdmi_codec_pcm_new,
Jyri Sarha09184112016-03-31 16:36:00 +0300726};
727
Kuninori Morimoto96203fb2017-05-18 01:40:20 +0000728static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
729 struct device_node *endpoint)
730{
731 struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
732 int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */
733
734 if (hcp->hcd.ops->get_dai_id)
735 ret = hcp->hcd.ops->get_dai_id(component, endpoint);
736
737 return ret;
738}
739
Kuninori Morimotod20aa602018-01-29 04:34:21 +0000740static const struct snd_soc_component_driver hdmi_driver = {
741 .dapm_widgets = hdmi_widgets,
742 .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),
Kuninori Morimotod20aa602018-01-29 04:34:21 +0000743 .of_xlate_dai_id = hdmi_of_xlate_dai_id,
744 .idle_bias_on = 1,
745 .use_pmdown_time = 1,
746 .endianness = 1,
747 .non_legacy_dai_naming = 1,
Jyri Sarha09184112016-03-31 16:36:00 +0300748};
749
750static int hdmi_codec_probe(struct platform_device *pdev)
751{
752 struct hdmi_codec_pdata *hcd = pdev->dev.platform_data;
Jerome Brunet1de005d2019-05-06 11:58:14 +0200753 struct snd_soc_dai_driver *daidrv;
Jyri Sarha09184112016-03-31 16:36:00 +0300754 struct device *dev = &pdev->dev;
755 struct hdmi_codec_priv *hcp;
756 int dai_count, i = 0;
757 int ret;
758
Jyri Sarha09184112016-03-31 16:36:00 +0300759 if (!hcd) {
Colin Ian King7b6531c2019-04-17 17:26:28 +0100760 dev_err(dev, "%s: No platform data\n", __func__);
Jyri Sarha09184112016-03-31 16:36:00 +0300761 return -EINVAL;
762 }
763
764 dai_count = hcd->i2s + hcd->spdif;
765 if (dai_count < 1 || !hcd->ops || !hcd->ops->hw_params ||
766 !hcd->ops->audio_shutdown) {
767 dev_err(dev, "%s: Invalid parameters\n", __func__);
768 return -EINVAL;
769 }
770
771 hcp = devm_kzalloc(dev, sizeof(*hcp), GFP_KERNEL);
772 if (!hcp)
773 return -ENOMEM;
774
775 hcp->hcd = *hcd;
Jerome Brunet1de005d2019-05-06 11:58:14 +0200776 daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL);
777 if (!daidrv)
Jyri Sarha09184112016-03-31 16:36:00 +0300778 return -ENOMEM;
779
780 if (hcd->i2s) {
Jerome Brunet1de005d2019-05-06 11:58:14 +0200781 daidrv[i] = hdmi_i2s_dai;
782 daidrv[i].playback.channels_max = hcd->max_i2s_channels;
Jyri Sarha09184112016-03-31 16:36:00 +0300783 i++;
784 }
785
Jerome Brunet0cf46102019-05-06 11:58:15 +0200786 if (hcd->spdif)
Jerome Brunet1de005d2019-05-06 11:58:14 +0200787 daidrv[i] = hdmi_spdif_dai;
Jyri Sarha09184112016-03-31 16:36:00 +0300788
Russell King0ce23d62019-01-17 17:32:05 +0000789 dev_set_drvdata(dev, hcp);
790
Jerome Brunet1de005d2019-05-06 11:58:14 +0200791 ret = devm_snd_soc_register_component(dev, &hdmi_driver, daidrv,
792 dai_count);
Jyri Sarha09184112016-03-31 16:36:00 +0300793 if (ret) {
Kuninori Morimotod20aa602018-01-29 04:34:21 +0000794 dev_err(dev, "%s: snd_soc_register_component() failed (%d)\n",
Jyri Sarha09184112016-03-31 16:36:00 +0300795 __func__, ret);
796 return ret;
797 }
Jyri Sarha09184112016-03-31 16:36:00 +0300798 return 0;
799}
800
Jyri Sarha09184112016-03-31 16:36:00 +0300801static struct platform_driver hdmi_codec_driver = {
802 .driver = {
803 .name = HDMI_CODEC_DRV_NAME,
804 },
805 .probe = hdmi_codec_probe,
Jyri Sarha09184112016-03-31 16:36:00 +0300806};
807
808module_platform_driver(hdmi_codec_driver);
809
810MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
811MODULE_DESCRIPTION("HDMI Audio Codec Driver");
812MODULE_LICENSE("GPL");
813MODULE_ALIAS("platform:" HDMI_CODEC_DRV_NAME);