Lines Matching +full:spk +full:- +full:fmt
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Intel Broxton-P I2S Machine Driver
19 #include <sound/soc-acpi.h>
22 #include "../../codecs/da7219-aad.h"
23 #include "../common/soc-intel-quirks.h"
26 #define BXT_DIALOG_CODEC_DAI "da7219-hifi"
28 #define MAX98390_DEV0_NAME "i2c-MX98390:00"
29 #define MAX98390_DEV1_NAME "i2c-MX98390:01"
66 struct snd_soc_dapm_context *dapm = w->dapm; in platform_clock_control()
67 struct snd_soc_card *card = dapm->card; in platform_clock_control()
72 dev_err(card->dev, "Codec dai not found; Unable to set/unset codec pll\n"); in platform_clock_control()
73 return -EIO; in platform_clock_control()
80 dev_err(card->dev, "failed to stop PLL: %d\n", ret); in platform_clock_control()
85 dev_err(card->dev, "failed to start PLL: %d\n", ret); in platform_clock_control()
97 SOC_DAPM_PIN_SWITCH("Spk"),
101 SOC_DAPM_PIN_SWITCH("Left Spk"),
102 SOC_DAPM_PIN_SWITCH("Right Spk"),
117 SND_SOC_DAPM_SPK("Spk", NULL),
121 SND_SOC_DAPM_SPK("Left Spk", NULL),
122 SND_SOC_DAPM_SPK("Right Spk", NULL),
126 /* HP jack connectors - unknown if we have jack detection */
137 {"HDMI1", NULL, "hif5-0 Output"},
138 {"HDMI2", NULL, "hif6-0 Output"},
139 {"HDMI2", NULL, "hif7-0 Output"},
158 {"Spk", NULL, "Speaker"},
163 {"Left Spk", NULL, "Left BE_OUT"},
164 {"Right Spk", NULL, "Right BE_OUT"},
207 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); in broxton_ssp_fixup() local
210 rate->min = rate->max = 48000; in broxton_ssp_fixup()
211 chan->min = chan->max = DUAL_CHANNEL; in broxton_ssp_fixup()
214 snd_mask_none(fmt); in broxton_ssp_fixup()
215 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE); in broxton_ssp_fixup()
224 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in broxton_da7219_codec_init()
237 dev_err(rtd->dev, "can't set codec sysclk configuration\n"); in broxton_da7219_codec_init()
245 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", in broxton_da7219_codec_init()
252 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); in broxton_da7219_codec_init()
264 snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); in broxton_da7219_codec_init()
271 struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); in broxton_hdmi_init()
275 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); in broxton_hdmi_init()
277 return -ENOMEM; in broxton_hdmi_init()
279 pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id; in broxton_hdmi_init()
280 pcm->codec_dai = dai; in broxton_hdmi_init()
282 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); in broxton_hdmi_init()
290 struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component; in broxton_da7219_fe_init()
330 struct snd_pcm_runtime *runtime = substream->runtime; in bxt_fe_startup()
339 runtime->hw.channels_max = DUAL_CHANNEL; in bxt_fe_startup()
343 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; in bxt_fe_startup()
362 chan->min = chan->max = 2; in broxton_dmic_fixup()
364 chan->min = chan->max = 4; in broxton_dmic_fixup()
371 struct snd_pcm_runtime *runtime = substream->runtime; in broxton_dmic_startup()
373 runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL; in broxton_dmic_startup()
377 return snd_pcm_hw_constraint_list(substream->runtime, 0, in broxton_dmic_startup()
405 substream->runtime->hw.channels_max = 1; in broxton_refcap_startup()
406 snd_pcm_hw_constraint_list(substream->runtime, 0, in broxton_refcap_startup()
410 return snd_pcm_hw_constraint_list(substream->runtime, 0, in broxton_refcap_startup()
419 /* broxton digital audio interface glue - connects codec <--> CPU */
452 /* Left */ COMP_CODEC(MAX98390_DEV0_NAME, "max98390-aif1"),
453 /* Right */ COMP_CODEC(MAX98390_DEV1_NAME, "max98390-aif1")));
458 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-DLGS7219:00",
468 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
473 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
479 "intel-hdmi-hifi2")));
485 "intel-hdmi-hifi3")));
582 /* SSP5 - Codec */
583 .name = "SSP5-Codec",
595 /* SSP1 - Codec */
596 .name = "SSP1-Codec",
674 switch (ctx->spkamp) { in bxt_card_late_probe()
692 dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp); in bxt_card_late_probe()
693 return -EINVAL; in bxt_card_late_probe()
696 err = snd_soc_dapm_new_controls(&card->dapm, widgets, num_widgets); in bxt_card_late_probe()
698 dev_err(card->dev, "Fail to new widgets\n"); in bxt_card_late_probe()
704 dev_err(card->dev, "Fail to add controls\n"); in bxt_card_late_probe()
708 err = snd_soc_dapm_add_routes(&card->dapm, routes, num_routes); in bxt_card_late_probe()
710 dev_err(card->dev, "Fail to add routes\n"); in bxt_card_late_probe()
715 snd_soc_dapm_add_routes(&card->dapm, gemini_map, in bxt_card_late_probe()
718 snd_soc_dapm_add_routes(&card->dapm, broxton_map, in bxt_card_late_probe()
721 if (list_empty(&ctx->hdmi_pcm_list)) in bxt_card_late_probe()
722 return -EINVAL; in bxt_card_late_probe()
724 if (ctx->common_hdmi_codec_drv) { in bxt_card_late_probe()
725 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, in bxt_card_late_probe()
727 component = pcm->codec_dai->component; in bxt_card_late_probe()
731 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { in bxt_card_late_probe()
732 component = pcm->codec_dai->component; in bxt_card_late_probe()
734 "HDMI/DP, pcm=%d Jack", pcm->device); in bxt_card_late_probe()
741 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, in bxt_card_late_probe()
749 return hdac_hdmi_jack_port_init(component, &card->dapm); in bxt_card_late_probe()
775 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); in broxton_audio_probe()
777 return -ENOMEM; in broxton_audio_probe()
779 INIT_LIST_HEAD(&ctx->hdmi_pcm_list); in broxton_audio_probe()
781 if (acpi_dev_present("MX98390", NULL, -1)) in broxton_audio_probe()
782 ctx->spkamp = SPKAMP_MAX98390; in broxton_audio_probe()
784 ctx->spkamp = SPKAMP_MAX98357A; in broxton_audio_probe()
786 broxton_audio_card.dev = &pdev->dev; in broxton_audio_probe()
795 if (!strcmp(broxton_dais[i].codecs->dai_name, in broxton_audio_probe()
797 broxton_dais[i].name = "SSP1-Codec"; in broxton_audio_probe()
798 broxton_dais[i].cpus->dai_name = "SSP1 Pin"; in broxton_audio_probe()
801 else if (!strcmp(broxton_dais[i].codecs->dai_name, in broxton_audio_probe()
803 broxton_dais[i].name = "SSP2-Codec"; in broxton_audio_probe()
804 broxton_dais[i].cpus->dai_name = "SSP2 Pin"; in broxton_audio_probe()
810 if (ctx->spkamp == SPKAMP_MAX98390) { in broxton_audio_probe()
820 if (!strcmp(broxton_dais[i].codecs->dai_name, in broxton_audio_probe()
822 broxton_dais[i].name = "SSP1-Codec"; in broxton_audio_probe()
823 broxton_dais[i].cpus->dai_name = "SSP1 Pin"; in broxton_audio_probe()
825 if (ctx->spkamp == SPKAMP_MAX98390) { in broxton_audio_probe()
832 else if (!strcmp(broxton_dais[i].codecs->dai_name, in broxton_audio_probe()
834 broxton_dais[i].name = "SSP0-Codec"; in broxton_audio_probe()
835 broxton_dais[i].cpus->dai_name = "SSP0 Pin"; in broxton_audio_probe()
841 mach = pdev->dev.platform_data; in broxton_audio_probe()
842 platform_name = mach->mach_params.platform; in broxton_audio_probe()
849 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; in broxton_audio_probe()
851 return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card); in broxton_audio_probe()
873 MODULE_DESCRIPTION("Audio Machine driver-DA7219 & MAX98357A in I2S mode");