Lines Matching +full:spk +full:- +full:fmt

1 // SPDX-License-Identifier: GPL-2.0-only
3 * cht-bsw-max98090.c - ASoc Machine driver for Intel Cherryview-based
24 #include <sound/soc-acpi.h>
27 #include "../atom/sst-atom-controls.h"
45 struct snd_soc_dapm_context *dapm = w->dapm; in platform_clock_control()
46 struct snd_soc_card *card = dapm->card; in platform_clock_control()
52 if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) in platform_clock_control()
57 dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n"); in platform_clock_control()
58 return -EIO; in platform_clock_control()
62 ret = clk_prepare_enable(ctx->mclk); in platform_clock_control()
64 dev_err(card->dev, in platform_clock_control()
69 clk_disable_unprepare(ctx->mclk); in platform_clock_control()
79 SND_SOC_DAPM_SPK("Ext Spk", NULL),
91 {"Ext Spk", NULL, "SPKL"},
92 {"Ext Spk", NULL, "SPKR"},
102 {"Ext Spk", NULL, "Platform Clock"},
109 SOC_DAPM_PIN_SWITCH("Ext Spk"),
122 dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret); in cht_aif1_hw_params()
133 struct snd_soc_dapm_context *dapm = &jack->card->dapm; in cht_ti_jack_event()
181 { "hp-gpios", &hp_gpios, 1 },
182 { "mic-gpios", &mic_gpios, 1 },
190 struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); in cht_codec_init()
191 struct snd_soc_jack *jack = &ctx->jack; in cht_codec_init()
193 if (ctx->ts3a227e_present) { in cht_codec_init()
204 ret = snd_soc_card_jack_new_pins(runtime->card, "Headset Jack", in cht_codec_init()
209 dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret); in cht_codec_init()
213 ret = snd_soc_jack_add_gpiods(runtime->card->dev->parent, jack, in cht_codec_init()
221 dev_err(runtime->dev, in cht_codec_init()
226 if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) in cht_codec_init()
239 ret = clk_prepare_enable(ctx->mclk); in cht_codec_init()
241 clk_disable_unprepare(ctx->mclk); in cht_codec_init()
243 ret = clk_set_rate(ctx->mclk, CHT_PLAT_CLK_3_HZ); in cht_codec_init()
246 dev_err(runtime->dev, "unable to set MCLK rate\n"); in cht_codec_init()
259 unsigned int fmt = 0; in cht_codec_fixup() local
263 dev_err(rtd->dev, "can't set cpu_dai slot fmt: %d\n", ret); in cht_codec_fixup()
267 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_BP_FP; in cht_codec_fixup()
269 ret = snd_soc_dai_set_fmt(snd_soc_rtd_to_cpu(rtd, 0), fmt); in cht_codec_fixup()
271 dev_err(rtd->dev, "can't set cpu_dai set fmt: %d\n", ret); in cht_codec_fixup()
276 rate->min = rate->max = 48000; in cht_codec_fixup()
277 channels->min = channels->max = 2; in cht_codec_fixup()
279 /* set SSP2 to 16-bit */ in cht_codec_fixup()
286 return snd_pcm_hw_constraint_single(substream->runtime, in cht_aif1_startup()
292 struct snd_soc_card *card = component->card; in cht_max98090_headset_init()
294 struct snd_soc_jack *jack = &ctx->jack; in cht_max98090_headset_init()
311 dev_err(card->dev, "Headset Jack creation failed %d\n", ret); in cht_max98090_headset_init()
327 .dlc = COMP_AUX("i2c-104C227E:00"),
335 DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));
338 DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));
341 DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
343 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-193C9890:00", "HiFi")));
346 DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));
360 .name = "Deep-Buffer Audio Port",
361 .stream_name = "Deep-Buffer Audio",
370 .name = "SSP2-Codec",
385 #define SOF_CARD_NAME "bytcht max98090" /* card name will be 'sof-bytcht max98090 */
450 /* Gnawty model Chromebook (Acer Chromebook CB3-111) */
532 struct device *dev = &pdev->dev; in snd_cht_mc_probe()
542 return -ENOMEM; in snd_cht_mc_probe()
546 drv->quirks = (unsigned long)dmi_id->driver_data; in snd_cht_mc_probe()
548 drv->ts3a227e_present = acpi_dev_found("104C227E"); in snd_cht_mc_probe()
549 if (!drv->ts3a227e_present) { in snd_cht_mc_probe()
554 ret_val = devm_acpi_dev_add_driver_gpios(dev->parent, in snd_cht_mc_probe()
562 mach = dev->platform_data; in snd_cht_mc_probe()
563 platform_name = mach->mach_params.platform; in snd_cht_mc_probe()
573 if (drv->quirks & QUIRK_PMC_PLT_CLK_0) in snd_cht_mc_probe()
578 drv->mclk = devm_clk_get(dev, mclk_name); in snd_cht_mc_probe()
579 if (IS_ERR(drv->mclk)) { in snd_cht_mc_probe()
582 mclk_name, PTR_ERR(drv->mclk)); in snd_cht_mc_probe()
583 return PTR_ERR(drv->mclk); in snd_cht_mc_probe()
589 * it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors in snd_cht_mc_probe()
593 if (drv->quirks & QUIRK_PMC_PLT_CLK_0) { in snd_cht_mc_probe()
594 ret_val = clk_prepare_enable(drv->mclk); in snd_cht_mc_probe()
614 dev->driver->pm = &snd_soc_pm_ops; in snd_cht_mc_probe()
631 if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) in snd_cht_mc_remove()
632 clk_disable_unprepare(ctx->mclk); in snd_cht_mc_remove()
637 .name = "cht-bsw-max98090",
648 MODULE_ALIAS("platform:cht-bsw-max98090");