Lines Matching +full:int +full:- +full:map +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
16 #include <sound/hdmi-codec.h>
21 #define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1
52 const int ca_id;
53 unsigned int n_ch;
54 unsigned long mask; member
60 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
64 /* Channel maps for multi-channel playbacks, up to 8 n_ch */
67 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
69 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
72 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
75 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
78 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
81 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
84 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
87 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
90 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
93 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
96 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
99 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
102 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
106 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
110 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
114 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
118 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
122 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
126 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
130 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
134 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
138 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
142 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
146 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
150 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
154 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
158 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
162 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
166 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
170 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
174 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
178 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
193 .mask = FL | FR},
196 .mask = FL | FR | LFE},
199 .mask = FL | FR | FC },
202 .mask = FL | FR | LFE | FC | RL | RR},
205 .mask = FL | FR | RL | RR },
208 .mask = FL | FR | LFE | RL | RR },
211 .mask = FL | FR | FC | RL | RR },
214 .mask = FL | FR | LFE | FC | RL | RR | RC },
217 .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
220 .mask = FL | FR | LFE | FC },
222 .mask = FL | FR | RC},
224 .mask = FL | FR | LFE | RC },
226 .mask = FL | FR | FC | RC },
228 .mask = FL | FR | LFE | FC | RC },
230 .mask = FL | FR | RC | RL | RR },
232 .mask = FL | FR | LFE | RL | RR | RC },
234 .mask = FL | FR | FC | RL | RR | RC },
236 .mask = FL | FR | RL | RR | RLC | RRC },
238 .mask = FL | FR | LFE | RL | RR | RLC | RRC },
240 .mask = FL | FR | FC | RL | RR | RLC | RRC },
242 .mask = FL | FR | FLC | FRC },
244 .mask = FL | FR | LFE | FLC | FRC },
246 .mask = FL | FR | FC | FLC | FRC },
248 .mask = FL | FR | LFE | FC | FLC | FRC },
250 .mask = FL | FR | RC | FLC | FRC },
252 .mask = FL | FR | LFE | RC | FLC | FRC },
254 .mask = FL | FR | RC | FC | FLC | FRC },
256 .mask = FL | FR | LFE | RC | FC | FLC | FRC },
258 .mask = FL | FR | RL | RR | FLC | FRC },
260 .mask = FL | FR | LFE | RL | RR | FLC | FRC },
262 .mask = FL | FR | FC | RL | RR | FLC | FRC },
264 .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
271 unsigned int chmap_idx;
275 unsigned int jack_status;
289 static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol, in hdmi_eld_ctl_info()
292 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in hdmi_eld_ctl_info()
293 uinfo->count = sizeof_field(struct hdmi_codec_priv, eld); in hdmi_eld_ctl_info()
298 static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, in hdmi_eld_ctl_get()
304 memcpy(ucontrol->value.bytes.data, hcp->eld, sizeof(hcp->eld)); in hdmi_eld_ctl_get()
309 static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc) in hdmi_codec_spk_mask_from_alloc()
311 int i; in hdmi_codec_spk_mask_from_alloc()
331 spk_alloc = drm_eld_get_spk_alloc(hcp->eld); in hdmi_codec_eld_chmap()
335 if ((spk_mask & ~(FL | FR)) && hcp->chmap_info->max_channels > 2) in hdmi_codec_eld_chmap()
336 hcp->chmap_info->chmap = hdmi_codec_8ch_chmaps; in hdmi_codec_eld_chmap()
338 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; in hdmi_codec_eld_chmap()
341 static int hdmi_codec_get_ch_alloc_table_idx(struct hdmi_codec_priv *hcp, in hdmi_codec_get_ch_alloc_table_idx()
344 int i; in hdmi_codec_get_ch_alloc_table_idx()
349 spk_alloc = drm_eld_get_spk_alloc(hcp->eld); in hdmi_codec_get_ch_alloc_table_idx()
354 if (!spk_alloc && cap->ca_id == 0) in hdmi_codec_get_ch_alloc_table_idx()
356 if (cap->n_ch != channels) in hdmi_codec_get_ch_alloc_table_idx()
358 if (!(cap->mask == (spk_mask & cap->mask))) in hdmi_codec_get_ch_alloc_table_idx()
363 return -EINVAL; in hdmi_codec_get_ch_alloc_table_idx()
365 static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, in hdmi_codec_chmap_ctl_get()
368 unsigned const char *map; in hdmi_codec_chmap_ctl_get() local
369 unsigned int i; in hdmi_codec_chmap_ctl_get()
371 struct hdmi_codec_priv *hcp = info->private_data; in hdmi_codec_chmap_ctl_get()
373 map = info->chmap[hcp->chmap_idx].map; in hdmi_codec_chmap_ctl_get()
375 for (i = 0; i < info->max_channels; i++) { in hdmi_codec_chmap_ctl_get()
376 if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) in hdmi_codec_chmap_ctl_get()
377 ucontrol->value.integer.value[i] = 0; in hdmi_codec_chmap_ctl_get()
379 ucontrol->value.integer.value[i] = map[i]; in hdmi_codec_chmap_ctl_get()
385 static int hdmi_codec_iec958_info(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_info()
388 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in hdmi_codec_iec958_info()
389 uinfo->count = 1; in hdmi_codec_iec958_info()
393 static int hdmi_codec_iec958_default_get(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_default_get()
399 memcpy(ucontrol->value.iec958.status, hcp->iec_status, in hdmi_codec_iec958_default_get()
400 sizeof(hcp->iec_status)); in hdmi_codec_iec958_default_get()
405 static int hdmi_codec_iec958_default_put(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_default_put()
411 memcpy(hcp->iec_status, ucontrol->value.iec958.status, in hdmi_codec_iec958_default_put()
412 sizeof(hcp->iec_status)); in hdmi_codec_iec958_default_put()
417 static int hdmi_codec_iec958_mask_get(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_mask_get()
420 memset(ucontrol->value.iec958.status, 0xff, in hdmi_codec_iec958_mask_get()
426 static int hdmi_codec_startup(struct snd_pcm_substream *substream, in hdmi_codec_startup()
430 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in hdmi_codec_startup()
431 bool has_capture = !hcp->hcd.no_i2s_capture; in hdmi_codec_startup()
432 bool has_playback = !hcp->hcd.no_i2s_playback; in hdmi_codec_startup()
433 int ret = 0; in hdmi_codec_startup()
438 mutex_lock(&hcp->lock); in hdmi_codec_startup()
439 if (hcp->busy) { in hdmi_codec_startup()
440 dev_err(dai->dev, "Only one simultaneous stream supported!\n"); in hdmi_codec_startup()
441 mutex_unlock(&hcp->lock); in hdmi_codec_startup()
442 return -EINVAL; in hdmi_codec_startup()
445 if (hcp->hcd.ops->audio_startup) { in hdmi_codec_startup()
446 ret = hcp->hcd.ops->audio_startup(dai->dev->parent, hcp->hcd.data); in hdmi_codec_startup()
451 if (tx && hcp->hcd.ops->get_eld) { in hdmi_codec_startup()
452 ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, in hdmi_codec_startup()
453 hcp->eld, sizeof(hcp->eld)); in hdmi_codec_startup()
457 ret = snd_pcm_hw_constraint_eld(substream->runtime, hcp->eld); in hdmi_codec_startup()
465 hcp->busy = true; in hdmi_codec_startup()
468 mutex_unlock(&hcp->lock); in hdmi_codec_startup()
476 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in hdmi_codec_shutdown()
477 bool has_capture = !hcp->hcd.no_i2s_capture; in hdmi_codec_shutdown()
478 bool has_playback = !hcp->hcd.no_i2s_playback; in hdmi_codec_shutdown()
483 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_shutdown()
484 hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); in hdmi_codec_shutdown()
486 mutex_lock(&hcp->lock); in hdmi_codec_shutdown()
487 hcp->busy = false; in hdmi_codec_shutdown()
488 mutex_unlock(&hcp->lock); in hdmi_codec_shutdown()
491 static int hdmi_codec_fill_codec_params(struct snd_soc_dai *dai, in hdmi_codec_fill_codec_params()
492 unsigned int sample_width, in hdmi_codec_fill_codec_params()
493 unsigned int sample_rate, in hdmi_codec_fill_codec_params()
494 unsigned int channels, in hdmi_codec_fill_codec_params()
498 int idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
500 bool pcm_audio = !(hcp->iec_status[0] & IEC958_AES0_NONAUDIO); in hdmi_codec_fill_codec_params()
507 dev_err(dai->dev, "Not able to map channels to speakers (%d)\n", in hdmi_codec_fill_codec_params()
509 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
518 hdmi_audio_infoframe_init(&hp->cea); in hdmi_codec_fill_codec_params()
521 hp->cea.channels = channels; in hdmi_codec_fill_codec_params()
523 hp->cea.channels = 0; in hdmi_codec_fill_codec_params()
525 hp->cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; in hdmi_codec_fill_codec_params()
526 hp->cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; in hdmi_codec_fill_codec_params()
527 hp->cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; in hdmi_codec_fill_codec_params()
528 hp->cea.channel_allocation = ca_id; in hdmi_codec_fill_codec_params()
530 hp->sample_width = sample_width; in hdmi_codec_fill_codec_params()
531 hp->sample_rate = sample_rate; in hdmi_codec_fill_codec_params()
532 hp->channels = channels; in hdmi_codec_fill_codec_params()
535 hcp->chmap_idx = ca_id; in hdmi_codec_fill_codec_params()
537 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
542 static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, in hdmi_codec_hw_params()
556 int ret; in hdmi_codec_hw_params()
558 if (!hcp->hcd.ops->hw_params) in hdmi_codec_hw_params()
561 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, in hdmi_codec_hw_params()
573 memcpy(hp.iec.status, hcp->iec_status, sizeof(hp.iec.status)); in hdmi_codec_hw_params()
577 dev_err(dai->dev, "Creating IEC958 channel status failed %d\n", in hdmi_codec_hw_params()
582 cf->bit_fmt = params_format(params); in hdmi_codec_hw_params()
583 return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data, in hdmi_codec_hw_params()
587 static int hdmi_codec_prepare(struct snd_pcm_substream *substream, in hdmi_codec_prepare()
592 struct snd_pcm_runtime *runtime = substream->runtime; in hdmi_codec_prepare()
593 unsigned int channels = runtime->channels; in hdmi_codec_prepare()
594 unsigned int width = snd_pcm_format_width(runtime->format); in hdmi_codec_prepare()
595 unsigned int rate = runtime->rate; in hdmi_codec_prepare()
597 int ret; in hdmi_codec_prepare()
599 if (!hcp->hcd.ops->prepare) in hdmi_codec_prepare()
602 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, in hdmi_codec_prepare()
609 memcpy(hp.iec.status, hcp->iec_status, sizeof(hp.iec.status)); in hdmi_codec_prepare()
613 dev_err(dai->dev, "Creating IEC958 channel status failed %d\n", in hdmi_codec_prepare()
618 cf->bit_fmt = runtime->format; in hdmi_codec_prepare()
619 return hcp->hcd.ops->prepare(dai->dev->parent, hcp->hcd.data, in hdmi_codec_prepare()
623 static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai, in hdmi_codec_i2s_set_fmt()
624 unsigned int fmt) in hdmi_codec_i2s_set_fmt()
633 cf->bit_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
634 cf->frame_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
637 cf->frame_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
640 cf->bit_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
645 return -EINVAL; in hdmi_codec_i2s_set_fmt()
652 cf->frame_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
655 cf->bit_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
658 cf->frame_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
659 cf->bit_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
665 cf->fmt = HDMI_I2S; in hdmi_codec_i2s_set_fmt()
668 cf->fmt = HDMI_DSP_A; in hdmi_codec_i2s_set_fmt()
671 cf->fmt = HDMI_DSP_B; in hdmi_codec_i2s_set_fmt()
674 cf->fmt = HDMI_RIGHT_J; in hdmi_codec_i2s_set_fmt()
677 cf->fmt = HDMI_LEFT_J; in hdmi_codec_i2s_set_fmt()
680 cf->fmt = HDMI_AC97; in hdmi_codec_i2s_set_fmt()
683 dev_err(dai->dev, "Invalid DAI interface format\n"); in hdmi_codec_i2s_set_fmt()
684 return -EINVAL; in hdmi_codec_i2s_set_fmt()
690 static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction) in hdmi_codec_mute()
700 if (hcp->hcd.ops->mute_stream && in hdmi_codec_mute()
702 !hcp->hcd.ops->no_capture_mute)) in hdmi_codec_mute()
703 return hcp->hcd.ops->mute_stream(dai->dev->parent, in hdmi_codec_mute()
704 hcp->hcd.data, in hdmi_codec_mute()
707 return -ENOTSUPP; in hdmi_codec_mute()
715 * ${LINUX}/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
740 * instance allowing the 32-bit formats enables 24-precision with CPU
741 * DAIs that do not support 24-bit formats. If the extra formats cause
753 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, MASK),
774 static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, in hdmi_codec_pcm_new()
777 struct snd_soc_dai_driver *drv = dai->driver; in hdmi_codec_pcm_new()
779 unsigned int i; in hdmi_codec_pcm_new()
780 int ret; in hdmi_codec_pcm_new()
782 ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, in hdmi_codec_pcm_new()
783 NULL, drv->playback.channels_max, 0, in hdmi_codec_pcm_new()
784 &hcp->chmap_info); in hdmi_codec_pcm_new()
789 hcp->chmap_info->private_data = hcp; in hdmi_codec_pcm_new()
790 hcp->chmap_info->kctl->get = hdmi_codec_chmap_ctl_get; in hdmi_codec_pcm_new()
793 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; in hdmi_codec_pcm_new()
794 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_pcm_new()
800 kctl = snd_ctl_new1(&hdmi_codec_controls[i], dai->component); in hdmi_codec_pcm_new()
802 return -ENOMEM; in hdmi_codec_pcm_new()
804 kctl->id.device = rtd->pcm->device; in hdmi_codec_pcm_new()
805 ret = snd_ctl_add(rtd->card->snd_card, kctl); in hdmi_codec_pcm_new()
813 static int hdmi_dai_probe(struct snd_soc_dai *dai) in hdmi_dai_probe()
820 .source = dai->driver->playback.stream_name, in hdmi_dai_probe()
823 .sink = dai->driver->capture.stream_name, in hdmi_dai_probe()
827 int ret, i; in hdmi_dai_probe()
829 dapm = snd_soc_component_get_dapm(dai->component); in hdmi_dai_probe()
841 daifmt = devm_kzalloc(dai->dev, sizeof(*daifmt), GFP_KERNEL); in hdmi_dai_probe()
843 return -ENOMEM; in hdmi_dai_probe()
851 unsigned int jack_status) in hdmi_codec_jack_report()
853 if (hcp->jack && jack_status != hcp->jack_status) { in hdmi_codec_jack_report()
854 snd_soc_jack_report(hcp->jack, jack_status, SND_JACK_LINEOUT); in hdmi_codec_jack_report()
855 hcp->jack_status = jack_status; in hdmi_codec_jack_report()
864 if (hcp->hcd.ops->get_eld) { in plugged_cb()
865 hcp->hcd.ops->get_eld(dev->parent, hcp->hcd.data, in plugged_cb()
866 hcp->eld, sizeof(hcp->eld)); in plugged_cb()
871 memset(hcp->eld, 0, sizeof(hcp->eld)); in plugged_cb()
875 static int hdmi_codec_set_jack(struct snd_soc_component *component, in hdmi_codec_set_jack()
880 int ret = -ENOTSUPP; in hdmi_codec_set_jack()
882 if (hcp->hcd.ops->hook_plugged_cb) { in hdmi_codec_set_jack()
883 hcp->jack = jack; in hdmi_codec_set_jack()
884 ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, in hdmi_codec_set_jack()
885 hcp->hcd.data, in hdmi_codec_set_jack()
887 component->dev); in hdmi_codec_set_jack()
889 hcp->jack = NULL; in hdmi_codec_set_jack()
894 static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai) in hdmi_dai_spdif_probe()
897 int ret; in hdmi_dai_spdif_probe()
904 cf->fmt = HDMI_SPDIF; in hdmi_dai_spdif_probe()
932 .name = "i2s-hifi",
954 .name = "spdif-hifi",
973 static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, in hdmi_of_xlate_dai_id()
977 int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ in hdmi_of_xlate_dai_id()
979 if (hcp->hcd.ops->get_dai_id) in hdmi_of_xlate_dai_id()
980 ret = hcp->hcd.ops->get_dai_id(component, endpoint); in hdmi_of_xlate_dai_id()
989 if (hcp->hcd.ops->hook_plugged_cb) in hdmi_remove()
990 hcp->hcd.ops->hook_plugged_cb(component->dev->parent, in hdmi_remove()
991 hcp->hcd.data, NULL, NULL); in hdmi_remove()
1005 static int hdmi_codec_probe(struct platform_device *pdev) in hdmi_codec_probe()
1007 struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; in hdmi_codec_probe()
1009 struct device *dev = &pdev->dev; in hdmi_codec_probe()
1011 int dai_count, i = 0; in hdmi_codec_probe()
1012 int ret; in hdmi_codec_probe()
1016 return -EINVAL; in hdmi_codec_probe()
1019 dai_count = hcd->i2s + hcd->spdif; in hdmi_codec_probe()
1020 if (dai_count < 1 || !hcd->ops || in hdmi_codec_probe()
1021 (!hcd->ops->hw_params && !hcd->ops->prepare) || in hdmi_codec_probe()
1022 !hcd->ops->audio_shutdown) { in hdmi_codec_probe()
1024 return -EINVAL; in hdmi_codec_probe()
1029 return -ENOMEM; in hdmi_codec_probe()
1031 hcp->hcd = *hcd; in hdmi_codec_probe()
1032 mutex_init(&hcp->lock); in hdmi_codec_probe()
1034 ret = snd_pcm_create_iec958_consumer_default(hcp->iec_status, in hdmi_codec_probe()
1035 sizeof(hcp->iec_status)); in hdmi_codec_probe()
1041 return -ENOMEM; in hdmi_codec_probe()
1043 if (hcd->i2s) { in hdmi_codec_probe()
1045 daidrv[i].playback.channels_max = hcd->max_i2s_channels; in hdmi_codec_probe()
1046 if (hcd->no_i2s_playback) in hdmi_codec_probe()
1049 if (hcd->no_i2s_capture) in hdmi_codec_probe()
1055 if (hcd->spdif) { in hdmi_codec_probe()
1057 if (hcd->no_spdif_playback) in hdmi_codec_probe()
1060 if (hcd->no_spdif_capture) in hdmi_codec_probe()