Lines Matching +full:mic +full:- +full:int

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"
50 .pin = "Headset Mic",
57 SOC_DAPM_PIN_SWITCH("Headset Mic"),
58 SOC_DAPM_PIN_SWITCH("Int Mic"),
61 static int platform_clock_control(struct snd_soc_dapm_widget *w, in platform_clock_control()
62 struct snd_kcontrol *k, int event) in platform_clock_control()
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()
67 int ret = 0; 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()
93 static int acp5x_8821_init(struct snd_soc_pcm_runtime *rtd) in acp5x_8821_init()
95 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in acp5x_8821_init()
96 int ret; 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()
117 static const unsigned int rates[] = {
127 static const unsigned int channels[] = {
137 static const unsigned int acp5x_nau8821_format[] = {32};
144 static int acp5x_8821_startup(struct snd_pcm_substream *substream) in acp5x_8821_startup()
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()
165 static int acp5x_nau8821_hw_params(struct snd_pcm_substream *substream, in acp5x_nau8821_hw_params()
169 struct snd_soc_card *card = rtd->card; in acp5x_nau8821_hw_params()
171 int ret, bclk; in acp5x_nau8821_hw_params()
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()
182 dev_err(dai->dev, "Fail to get BCLK rate: %d\n", bclk); in acp5x_nau8821_hw_params()
188 dev_err(card->dev, "can't set FLL: %d\n", ret); in acp5x_nau8821_hw_params()
198 static int acp5x_cs35l41_startup(struct snd_pcm_substream *substream) in acp5x_cs35l41_startup()
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()
215 static int acp5x_cs35l41_hw_params(struct snd_pcm_substream *substream, in acp5x_cs35l41_hw_params()
219 unsigned int bclk, rate = params_rate(params); in acp5x_cs35l41_hw_params()
221 int ret, i; 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()
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()
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",
297 SND_SOC_DAPM_MIC("Headset Mic", NULL),
298 SND_SOC_DAPM_MIC("Int Mic", NULL),
305 /* HP jack connectors - unknown if we have jack detection */
308 { "MICL", NULL, "Headset Mic" },
309 { "MICR", NULL, "Headset Mic" },
310 { "DMIC", NULL, "Int Mic" },
313 { "Headset Mic", NULL, "Platform Clock" },
314 { "Int Mic", NULL, "Platform Clock" },
332 static int acp5x_max98388_startup(struct snd_pcm_substream *substream) in acp5x_max98388_startup()
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",
393 SND_SOC_DAPM_MIC("Headset Mic", NULL),
394 SND_SOC_DAPM_MIC("Int Mic", NULL),
404 { "MICL", NULL, "Headset Mic" },
405 { "MICR", NULL, "Headset Mic" },
406 { "DMIC", NULL, "Int Mic" },
409 { "Headset Mic", NULL, "Platform Clock" },
410 { "Int Mic", NULL, "Platform Clock" },
417 .name = "acp5x-max98388",
449 static int acp5x_probe(struct platform_device *pdev) in acp5x_probe()
453 struct device *dev = &pdev->dev; in acp5x_probe()
455 int ret; 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()