Lines Matching +full:codec +full:- +full:aif1 +full:- +full:bclk

1 // SPDX-License-Identifier: GPL-2.0+
13 #include <linux/input-event-codes.h>
18 #include <sound/soc-dapm.h>
27 #define ACP5X_NAU8821_COMP_NAME "i2c-NVTN2020:00"
28 #define ACP5X_NAU8821_DAI_NAME "nau8821-hifi"
29 #define ACP5X_CS35L41_COMP_LNAME "spi-VLV1776:00"
30 #define ACP5X_CS35L41_COMP_RNAME "spi-VLV1776:01"
31 #define ACP5X_CS35L41_DAI_NAME "cs35l41-pcm"
32 #define ACP5X_MAX98388_COMP_LNAME "i2c-ADS8388:00"
33 #define ACP5X_MAX98388_COMP_RNAME "i2c-ADS8388:01"
34 #define ACP5X_MAX98388_DAI_NAME "max98388-aif1"
64 struct snd_soc_dapm_context *dapm = w->dapm; in platform_clock_control()
65 struct snd_soc_card *card = dapm->card; in platform_clock_control()
71 dev_err(card->dev, "Codec dai not found\n"); in platform_clock_control()
72 return -EIO; in platform_clock_control()
78 dev_err(card->dev, "set sysclk err = %d\n", ret); in platform_clock_control()
79 return -EIO; in platform_clock_control()
84 dev_err(dai->dev, "can't set BLK clock %d\n", ret); in platform_clock_control()
87 dev_err(dai->dev, "can't set FLL: %d\n", ret); in platform_clock_control()
95 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in acp5x_8821_init()
102 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", in acp5x_8821_init()
107 dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret); in acp5x_8821_init()
146 struct snd_pcm_runtime *runtime = substream->runtime; in acp5x_8821_startup()
148 struct acp5x_platform_info *machine = snd_soc_card_get_drvdata(rtd->card); in acp5x_8821_startup()
150 machine->play_i2s_instance = I2S_SP_INSTANCE; in acp5x_8821_startup()
151 machine->cap_i2s_instance = I2S_SP_INSTANCE; in acp5x_8821_startup()
153 runtime->hw.channels_max = DUAL_CHANNEL; in acp5x_8821_startup()
158 snd_pcm_hw_constraint_list(substream->runtime, 0, in acp5x_8821_startup()
169 struct snd_soc_card *card = rtd->card; in acp5x_nau8821_hw_params()
171 int ret, bclk; in acp5x_nau8821_hw_params() local
174 return -EINVAL; in acp5x_nau8821_hw_params()
178 dev_err(card->dev, "can't set FS clock %d\n", ret); in acp5x_nau8821_hw_params()
180 bclk = snd_soc_params_to_bclk(params); in acp5x_nau8821_hw_params()
181 if (bclk < 0) { in acp5x_nau8821_hw_params()
182 dev_err(dai->dev, "Fail to get BCLK rate: %d\n", bclk); in acp5x_nau8821_hw_params()
183 return bclk; in acp5x_nau8821_hw_params()
186 ret = snd_soc_dai_set_pll(dai, 0, 0, bclk, params_rate(params) * 256); in acp5x_nau8821_hw_params()
188 dev_err(card->dev, "can't set FLL: %d\n", ret); in acp5x_nau8821_hw_params()
201 struct acp5x_platform_info *machine = snd_soc_card_get_drvdata(rtd->card); in acp5x_cs35l41_startup()
202 struct snd_pcm_runtime *runtime = substream->runtime; in acp5x_cs35l41_startup()
204 machine->play_i2s_instance = I2S_HS_INSTANCE; in acp5x_cs35l41_startup()
206 runtime->hw.channels_max = DUAL_CHANNEL; in acp5x_cs35l41_startup()
219 unsigned int bclk, rate = params_rate(params); in acp5x_cs35l41_hw_params() local
225 bclk = 1536000; in acp5x_cs35l41_hw_params()
228 bclk = 0; in acp5x_cs35l41_hw_params()
233 if (!(strcmp(comp->name, ACP5X_CS35L41_COMP_LNAME)) || in acp5x_cs35l41_hw_params()
234 !(strcmp(comp->name, ACP5X_CS35L41_COMP_RNAME))) { in acp5x_cs35l41_hw_params()
235 if (!bclk) { in acp5x_cs35l41_hw_params()
236 dev_err(comp->dev, "Invalid sample rate: 0x%x\n", rate); in acp5x_cs35l41_hw_params()
237 return -EINVAL; in acp5x_cs35l41_hw_params()
240 ret = snd_soc_component_set_sysclk(comp, 0, 0, bclk, SND_SOC_CLOCK_IN); in acp5x_cs35l41_hw_params()
242 dev_err(comp->dev, "failed to set SYSCLK: %d\n", ret); in acp5x_cs35l41_hw_params()
274 .name = "acp5x-8821-play",
284 .name = "acp5x-CS35L41-Stereo",
305 /* HP jack connectors - unknown if we have jack detection */
335 struct acp5x_platform_info *machine = snd_soc_card_get_drvdata(rtd->card); in acp5x_max98388_startup()
336 struct snd_pcm_runtime *runtime = substream->runtime; in acp5x_max98388_startup()
338 machine->play_i2s_instance = I2S_HS_INSTANCE; in acp5x_max98388_startup()
340 runtime->hw.channels_max = DUAL_CHANNEL; in acp5x_max98388_startup()
370 .name = "acp5x-8821-play",
380 .name = "acp5x-max98388-play",
417 .name = "acp5x-max98388",
453 struct device *dev = &pdev->dev; in acp5x_probe()
458 if (!dmi_id || !dmi_id->driver_data) in acp5x_probe()
459 return -ENODEV; in acp5x_probe()
463 return -ENOMEM; in acp5x_probe()
465 card = dmi_id->driver_data; in acp5x_probe()
466 card->dev = dev; in acp5x_probe()
472 return dev_err_probe(dev, ret, "Register card (%s) failed\n", card->name); in acp5x_probe()