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>
22 #define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1
53 const int ca_id;
54 unsigned int n_ch;
55 unsigned long mask; member
61 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
65 /* Channel maps for multi-channel playbacks, up to 8 n_ch */
68 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
70 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
73 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
76 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
79 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
82 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
85 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
88 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
91 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
94 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
97 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
100 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
103 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
107 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
111 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
115 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
119 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
123 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
127 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
131 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
135 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
139 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
143 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
147 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
151 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
155 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
159 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
163 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
167 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
171 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
175 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
179 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
194 .mask = FL | FR },
196 .mask = FL | FR | LFE | FC },
198 .mask = FL | FR | FC },
200 .mask = FL | FR | LFE },
202 .mask = FL | FR | LFE | FC | RL | RR },
204 .mask = FL | FR | FC | RL | RR },
206 .mask = FL | FR | LFE | RL | RR },
208 .mask = FL | FR | RL | RR },
210 .mask = FL | FR | LFE | FC | RC },
212 .mask = FL | FR | FC | RC },
214 .mask = FL | FR | LFE | RC },
216 .mask = FL | FR | RC },
218 .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
220 .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
222 .mask = FL | FR | FC | RL | RR | RLC | RRC },
224 .mask = FL | FR | FC | RL | RR | FLC | FRC },
226 .mask = FL | FR | LFE | RL | RR | RLC | RRC },
228 .mask = FL | FR | LFE | RL | RR | FLC | FRC },
230 .mask = FL | FR | RL | RR | RLC | RRC },
232 .mask = FL | FR | RL | RR | FLC | FRC },
234 .mask = FL | FR | LFE | FC | RL | RR | RC },
236 .mask = FL | FR | LFE | RC | FC | FLC | FRC },
238 .mask = FL | FR | FC | RL | RR | RC },
240 .mask = FL | FR | RC | FC | FLC | FRC },
242 .mask = FL | FR | LFE | RL | RR | RC },
244 .mask = FL | FR | LFE | RC | FLC | FRC },
246 .mask = FL | FR | RC | RL | RR },
248 .mask = FL | FR | RC | FLC | FRC },
250 .mask = FL | FR | LFE | FC | FLC | FRC },
252 .mask = FL | FR | FC | FLC | FRC },
254 .mask = FL | FR | LFE | FLC | FRC },
256 .mask = FL | FR | FLC | FRC },
258 .mask = FL | FR | LFE | FC | RL | RR },
260 .mask = FL | FR | FC | RL | RR },
262 .mask = FL | FR | LFE | RL | RR },
264 .mask = FL | FR | RL | RR },
266 .mask = FL | FR | LFE | FC | RC },
268 .mask = FL | FR | FC | RC },
270 .mask = FL | FR | LFE | RC },
272 .mask = FL | FR | RC },
274 .mask = FL | FR | LFE | FC },
276 .mask = FL | FR | FC },
278 .mask = FL | FR | LFE },
286 unsigned int chmap_idx;
290 unsigned int jack_status;
305 static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol, in hdmi_eld_ctl_info()
308 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in hdmi_eld_ctl_info()
309 uinfo->count = sizeof_field(struct hdmi_codec_priv, eld); in hdmi_eld_ctl_info()
314 static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, in hdmi_eld_ctl_get()
320 memcpy(ucontrol->value.bytes.data, hcp->eld, sizeof(hcp->eld)); in hdmi_eld_ctl_get()
325 static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc) in hdmi_codec_spk_mask_from_alloc()
327 int i; in hdmi_codec_spk_mask_from_alloc()
347 spk_alloc = drm_eld_get_spk_alloc(hcp->eld); in hdmi_codec_eld_chmap()
351 if ((spk_mask & ~(FL | FR)) && hcp->chmap_info->max_channels > 2) in hdmi_codec_eld_chmap()
352 hcp->chmap_info->chmap = hdmi_codec_8ch_chmaps; in hdmi_codec_eld_chmap()
354 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; in hdmi_codec_eld_chmap()
357 static int hdmi_codec_get_ch_alloc_table_idx(struct hdmi_codec_priv *hcp, in hdmi_codec_get_ch_alloc_table_idx()
360 int i; in hdmi_codec_get_ch_alloc_table_idx()
365 spk_alloc = drm_eld_get_spk_alloc(hcp->eld); in hdmi_codec_get_ch_alloc_table_idx()
370 if (!spk_alloc && cap->ca_id == 0) in hdmi_codec_get_ch_alloc_table_idx()
372 if (cap->n_ch != channels) in hdmi_codec_get_ch_alloc_table_idx()
374 if (!(cap->mask == (spk_mask & cap->mask))) in hdmi_codec_get_ch_alloc_table_idx()
379 return -EINVAL; in hdmi_codec_get_ch_alloc_table_idx()
381 static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, in hdmi_codec_chmap_ctl_get()
384 unsigned const char *map; in hdmi_codec_chmap_ctl_get() local
385 unsigned int i; in hdmi_codec_chmap_ctl_get()
387 struct hdmi_codec_priv *hcp = info->private_data; in hdmi_codec_chmap_ctl_get()
389 if (hcp->chmap_idx != HDMI_CODEC_CHMAP_IDX_UNKNOWN) in hdmi_codec_chmap_ctl_get()
390 map = info->chmap[hcp->chmap_idx].map; in hdmi_codec_chmap_ctl_get()
392 for (i = 0; i < info->max_channels; i++) { in hdmi_codec_chmap_ctl_get()
393 if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) in hdmi_codec_chmap_ctl_get()
394 ucontrol->value.integer.value[i] = 0; in hdmi_codec_chmap_ctl_get()
396 ucontrol->value.integer.value[i] = map[i]; in hdmi_codec_chmap_ctl_get()
402 static int hdmi_codec_iec958_info(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_info()
405 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in hdmi_codec_iec958_info()
406 uinfo->count = 1; in hdmi_codec_iec958_info()
410 static int hdmi_codec_iec958_default_get(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_default_get()
416 memcpy(ucontrol->value.iec958.status, hcp->iec_status, in hdmi_codec_iec958_default_get()
417 sizeof(hcp->iec_status)); in hdmi_codec_iec958_default_get()
422 static int hdmi_codec_iec958_default_put(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_default_put()
428 memcpy(hcp->iec_status, ucontrol->value.iec958.status, in hdmi_codec_iec958_default_put()
429 sizeof(hcp->iec_status)); in hdmi_codec_iec958_default_put()
434 static int hdmi_codec_iec958_mask_get(struct snd_kcontrol *kcontrol, in hdmi_codec_iec958_mask_get()
437 memset(ucontrol->value.iec958.status, 0xff, in hdmi_codec_iec958_mask_get()
443 static int hdmi_codec_startup(struct snd_pcm_substream *substream, in hdmi_codec_startup()
447 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in hdmi_codec_startup()
448 bool has_capture = !hcp->hcd.no_i2s_capture; in hdmi_codec_startup()
449 bool has_playback = !hcp->hcd.no_i2s_playback; in hdmi_codec_startup()
450 int ret = 0; in hdmi_codec_startup()
455 mutex_lock(&hcp->lock); in hdmi_codec_startup()
456 if (hcp->busy) { in hdmi_codec_startup()
457 dev_err(dai->dev, "Only one simultaneous stream supported!\n"); in hdmi_codec_startup()
458 mutex_unlock(&hcp->lock); in hdmi_codec_startup()
459 return -EINVAL; in hdmi_codec_startup()
462 if (hcp->hcd.ops->audio_startup) { in hdmi_codec_startup()
463 ret = hcp->hcd.ops->audio_startup(dai->dev->parent, hcp->hcd.data); in hdmi_codec_startup()
468 if (tx && hcp->hcd.ops->get_eld) { in hdmi_codec_startup()
469 ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, in hdmi_codec_startup()
470 hcp->eld, sizeof(hcp->eld)); in hdmi_codec_startup()
474 snd_parse_eld(dai->dev, &hcp->eld_parsed, in hdmi_codec_startup()
475 hcp->eld, sizeof(hcp->eld)); in hdmi_codec_startup()
477 ret = snd_pcm_hw_constraint_eld(substream->runtime, hcp->eld); in hdmi_codec_startup()
485 hcp->busy = true; in hdmi_codec_startup()
488 mutex_unlock(&hcp->lock); in hdmi_codec_startup()
496 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in hdmi_codec_shutdown()
497 bool has_capture = !hcp->hcd.no_i2s_capture; in hdmi_codec_shutdown()
498 bool has_playback = !hcp->hcd.no_i2s_playback; in hdmi_codec_shutdown()
503 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_shutdown()
504 hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); in hdmi_codec_shutdown()
506 mutex_lock(&hcp->lock); in hdmi_codec_shutdown()
507 hcp->busy = false; in hdmi_codec_shutdown()
508 mutex_unlock(&hcp->lock); in hdmi_codec_shutdown()
511 static int hdmi_codec_fill_codec_params(struct snd_soc_dai *dai, in hdmi_codec_fill_codec_params()
512 unsigned int sample_width, in hdmi_codec_fill_codec_params()
513 unsigned int sample_rate, in hdmi_codec_fill_codec_params()
514 unsigned int channels, in hdmi_codec_fill_codec_params()
518 int idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
520 bool pcm_audio = !(hcp->iec_status[0] & IEC958_AES0_NONAUDIO); in hdmi_codec_fill_codec_params()
527 dev_err(dai->dev, "Not able to map channels to speakers (%d)\n", in hdmi_codec_fill_codec_params()
529 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
538 hdmi_audio_infoframe_init(&hp->cea); in hdmi_codec_fill_codec_params()
541 hp->cea.channels = channels; in hdmi_codec_fill_codec_params()
543 hp->cea.channels = 0; in hdmi_codec_fill_codec_params()
545 hp->cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; in hdmi_codec_fill_codec_params()
546 hp->cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; in hdmi_codec_fill_codec_params()
547 hp->cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; in hdmi_codec_fill_codec_params()
548 hp->cea.channel_allocation = ca_id; in hdmi_codec_fill_codec_params()
550 hp->sample_width = sample_width; in hdmi_codec_fill_codec_params()
551 hp->sample_rate = sample_rate; in hdmi_codec_fill_codec_params()
552 hp->channels = channels; in hdmi_codec_fill_codec_params()
555 hcp->chmap_idx = ca_id; in hdmi_codec_fill_codec_params()
557 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_fill_codec_params()
562 static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, in hdmi_codec_hw_params()
576 int ret; in hdmi_codec_hw_params()
578 if (!hcp->hcd.ops->hw_params) in hdmi_codec_hw_params()
581 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, in hdmi_codec_hw_params()
593 memcpy(hp.iec.status, hcp->iec_status, sizeof(hp.iec.status)); in hdmi_codec_hw_params()
597 dev_err(dai->dev, "Creating IEC958 channel status failed %d\n", in hdmi_codec_hw_params()
602 cf->bit_fmt = params_format(params); in hdmi_codec_hw_params()
603 return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data, in hdmi_codec_hw_params()
607 static int hdmi_codec_prepare(struct snd_pcm_substream *substream, in hdmi_codec_prepare()
612 struct snd_pcm_runtime *runtime = substream->runtime; in hdmi_codec_prepare()
613 unsigned int channels = runtime->channels; in hdmi_codec_prepare()
614 unsigned int width = snd_pcm_format_width(runtime->format); in hdmi_codec_prepare()
615 unsigned int rate = runtime->rate; in hdmi_codec_prepare()
617 int ret; in hdmi_codec_prepare()
619 if (!hcp->hcd.ops->prepare) in hdmi_codec_prepare()
622 dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, in hdmi_codec_prepare()
629 memcpy(hp.iec.status, hcp->iec_status, sizeof(hp.iec.status)); in hdmi_codec_prepare()
633 dev_err(dai->dev, "Creating IEC958 channel status failed %d\n", in hdmi_codec_prepare()
638 cf->bit_fmt = runtime->format; in hdmi_codec_prepare()
639 return hcp->hcd.ops->prepare(dai->dev->parent, hcp->hcd.data, in hdmi_codec_prepare()
643 static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai, in hdmi_codec_i2s_set_fmt()
644 unsigned int fmt) in hdmi_codec_i2s_set_fmt()
653 cf->bit_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
654 cf->frame_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
657 cf->frame_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
660 cf->bit_clk_provider = 1; in hdmi_codec_i2s_set_fmt()
665 return -EINVAL; in hdmi_codec_i2s_set_fmt()
672 cf->frame_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
675 cf->bit_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
678 cf->frame_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
679 cf->bit_clk_inv = 1; in hdmi_codec_i2s_set_fmt()
685 cf->fmt = HDMI_I2S; in hdmi_codec_i2s_set_fmt()
688 cf->fmt = HDMI_DSP_A; in hdmi_codec_i2s_set_fmt()
691 cf->fmt = HDMI_DSP_B; in hdmi_codec_i2s_set_fmt()
694 cf->fmt = HDMI_RIGHT_J; in hdmi_codec_i2s_set_fmt()
697 cf->fmt = HDMI_LEFT_J; in hdmi_codec_i2s_set_fmt()
700 cf->fmt = HDMI_AC97; in hdmi_codec_i2s_set_fmt()
703 dev_err(dai->dev, "Invalid DAI interface format\n"); in hdmi_codec_i2s_set_fmt()
704 return -EINVAL; in hdmi_codec_i2s_set_fmt()
710 static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction) in hdmi_codec_mute()
720 if (hcp->hcd.ops->mute_stream && in hdmi_codec_mute()
722 !hcp->hcd.no_capture_mute)) in hdmi_codec_mute()
723 return hcp->hcd.ops->mute_stream(dai->dev->parent, in hdmi_codec_mute()
724 hcp->hcd.data, in hdmi_codec_mute()
727 return -ENOTSUPP; in hdmi_codec_mute()
735 * ${LINUX}/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
760 * instance allowing the 32-bit formats enables 24-precision with CPU
761 * DAIs that do not support 24-bit formats. If the extra formats cause
773 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, MASK),
794 static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, in hdmi_codec_pcm_new()
797 struct snd_soc_dai_driver *drv = dai->driver; in hdmi_codec_pcm_new()
799 unsigned int i; in hdmi_codec_pcm_new()
800 int ret; in hdmi_codec_pcm_new()
802 ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, in hdmi_codec_pcm_new()
803 NULL, drv->playback.channels_max, 0, in hdmi_codec_pcm_new()
804 &hcp->chmap_info); in hdmi_codec_pcm_new()
809 hcp->chmap_info->private_data = hcp; in hdmi_codec_pcm_new()
810 hcp->chmap_info->kctl->get = hdmi_codec_chmap_ctl_get; in hdmi_codec_pcm_new()
813 hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; in hdmi_codec_pcm_new()
814 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; in hdmi_codec_pcm_new()
820 kctl = snd_ctl_new1(&hdmi_codec_controls[i], dai->component); in hdmi_codec_pcm_new()
822 return -ENOMEM; in hdmi_codec_pcm_new()
824 kctl->id.device = rtd->pcm->device; in hdmi_codec_pcm_new()
825 ret = snd_ctl_add(rtd->card->snd_card, kctl); in hdmi_codec_pcm_new()
837 struct hdmi_codec_priv *hcp = entry->private_data; in print_eld_info()
839 snd_print_eld_info(&hcp->eld_parsed, buffer); in print_eld_info()
842 static int hdmi_dai_proc_new(struct hdmi_codec_priv *hcp, in hdmi_dai_proc_new()
845 struct snd_soc_component *component = dai->component; in hdmi_dai_proc_new()
846 struct snd_soc_card *card = component->card; in hdmi_dai_proc_new()
851 int err, i, id = 0; in hdmi_dai_proc_new()
854 * To avoid duplicate proc entry, find its rtd and use rtd->id in hdmi_dai_proc_new()
855 * instead of dai->id in hdmi_dai_proc_new()
860 id = rtd->id; in hdmi_dai_proc_new()
866 err = snd_card_proc_new(card->snd_card, name, &entry); in hdmi_dai_proc_new()
871 hcp->proc_entry = entry; in hdmi_dai_proc_new()
878 snd_info_free_entry(hcp->proc_entry); in hdmi_dai_proc_free()
879 hcp->proc_entry = NULL; in hdmi_dai_proc_free()
882 static int hdmi_dai_proc_new(struct hdmi_codec_priv *hcp, in hdmi_dai_proc_new()
893 static int hdmi_dai_probe(struct snd_soc_dai *dai) in hdmi_dai_probe()
896 snd_soc_component_get_drvdata(dai->component); in hdmi_dai_probe()
902 .source = dai->driver->playback.stream_name, in hdmi_dai_probe()
905 .sink = dai->driver->capture.stream_name, in hdmi_dai_probe()
909 int ret, i; in hdmi_dai_probe()
911 dapm = snd_soc_component_get_dapm(dai->component); in hdmi_dai_probe()
923 daifmt = devm_kzalloc(dai->dev, sizeof(*daifmt), GFP_KERNEL); in hdmi_dai_probe()
925 return -ENOMEM; in hdmi_dai_probe()
932 static int hdmi_dai_remove(struct snd_soc_dai *dai) in hdmi_dai_remove()
935 snd_soc_component_get_drvdata(dai->component); in hdmi_dai_remove()
942 unsigned int jack_status) in hdmi_codec_jack_report()
944 if (jack_status != hcp->jack_status) { in hdmi_codec_jack_report()
945 if (hcp->jack) in hdmi_codec_jack_report()
946 snd_soc_jack_report(hcp->jack, jack_status, SND_JACK_LINEOUT); in hdmi_codec_jack_report()
947 hcp->jack_status = jack_status; in hdmi_codec_jack_report()
954 int ret; in plugged_cb()
957 if (hcp->hcd.ops->get_eld) { in plugged_cb()
958 hcp->hcd.ops->get_eld(dev->parent, hcp->hcd.data, in plugged_cb()
959 hcp->eld, sizeof(hcp->eld)); in plugged_cb()
960 ret = snd_parse_eld(dev, &hcp->eld_parsed, in plugged_cb()
961 hcp->eld, sizeof(hcp->eld)); in plugged_cb()
965 snd_show_eld(dev, &hcp->eld_parsed); in plugged_cb()
970 memset(hcp->eld, 0, sizeof(hcp->eld)); in plugged_cb()
974 static int hdmi_codec_set_jack(struct snd_soc_component *component, in hdmi_codec_set_jack()
980 if (hcp->hcd.ops->hook_plugged_cb) { in hdmi_codec_set_jack()
981 hcp->jack = jack; in hdmi_codec_set_jack()
987 snd_soc_jack_report(jack, hcp->jack_status, SND_JACK_LINEOUT); in hdmi_codec_set_jack()
992 return -ENOTSUPP; in hdmi_codec_set_jack()
995 static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai) in hdmi_dai_spdif_probe()
998 int ret; in hdmi_dai_spdif_probe()
1005 cf->fmt = HDMI_SPDIF; in hdmi_dai_spdif_probe()
1034 .name = "i2s-hifi",
1056 .name = "spdif-hifi",
1075 static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, in hdmi_of_xlate_dai_id()
1079 int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ in hdmi_of_xlate_dai_id()
1081 if (hcp->hcd.ops->get_dai_id) in hdmi_of_xlate_dai_id()
1082 ret = hcp->hcd.ops->get_dai_id(component, endpoint, hcp->hcd.data); in hdmi_of_xlate_dai_id()
1087 static int hdmi_probe(struct snd_soc_component *component) in hdmi_probe()
1090 int ret = 0; in hdmi_probe()
1092 if (hcp->hcd.ops->hook_plugged_cb) { in hdmi_probe()
1093 ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, in hdmi_probe()
1094 hcp->hcd.data, in hdmi_probe()
1096 component->dev); in hdmi_probe()
1106 if (hcp->hcd.ops->hook_plugged_cb) in hdmi_remove()
1107 hcp->hcd.ops->hook_plugged_cb(component->dev->parent, in hdmi_remove()
1108 hcp->hcd.data, NULL, NULL); in hdmi_remove()
1123 static int hdmi_codec_probe(struct platform_device *pdev) in hdmi_codec_probe()
1125 struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; in hdmi_codec_probe()
1127 struct device *dev = &pdev->dev; in hdmi_codec_probe()
1129 int dai_count, i = 0; in hdmi_codec_probe()
1130 int ret; in hdmi_codec_probe()
1134 return -EINVAL; in hdmi_codec_probe()
1137 dai_count = hcd->i2s + hcd->spdif; in hdmi_codec_probe()
1138 if (dai_count < 1 || !hcd->ops || in hdmi_codec_probe()
1139 (!hcd->ops->hw_params && !hcd->ops->prepare) || in hdmi_codec_probe()
1140 !hcd->ops->audio_shutdown) { in hdmi_codec_probe()
1142 return -EINVAL; in hdmi_codec_probe()
1147 return -ENOMEM; in hdmi_codec_probe()
1149 hcp->hcd = *hcd; in hdmi_codec_probe()
1150 mutex_init(&hcp->lock); in hdmi_codec_probe()
1152 ret = snd_pcm_create_iec958_consumer_default(hcp->iec_status, in hdmi_codec_probe()
1153 sizeof(hcp->iec_status)); in hdmi_codec_probe()
1159 return -ENOMEM; in hdmi_codec_probe()
1161 if (hcd->i2s) { in hdmi_codec_probe()
1163 daidrv[i].playback.channels_max = hcd->max_i2s_channels; in hdmi_codec_probe()
1164 if (hcd->i2s_formats) { in hdmi_codec_probe()
1165 daidrv[i].playback.formats = hcd->i2s_formats; in hdmi_codec_probe()
1166 daidrv[i].capture.formats = hcd->i2s_formats; in hdmi_codec_probe()
1168 if (hcd->no_i2s_playback) in hdmi_codec_probe()
1171 if (hcd->no_i2s_capture) in hdmi_codec_probe()
1177 if (hcd->spdif) { in hdmi_codec_probe()
1179 if (hcd->no_spdif_playback) in hdmi_codec_probe()
1182 if (hcd->no_spdif_capture) in hdmi_codec_probe()