Lines Matching +full:out +full:- +full:mono
1 // SPDX-License-Identifier: GPL-2.0-only
3 * ak4641.c -- AK4641 ALSA Soc Audio driver
77 if (ak4641->deemph && deemph_settings[i] != 0 && in ak4641_set_deemph()
78 abs(deemph_settings[i] - ak4641->playback_fs) < in ak4641_set_deemph()
79 abs(deemph_settings[best] - ak4641->playback_fs)) in ak4641_set_deemph()
82 if (!ak4641->deemph && deemph_settings[i] == 0) in ak4641_set_deemph()
86 dev_dbg(component->dev, "Set deemphasis %d\n", best); in ak4641_set_deemph()
96 int deemph = ucontrol->value.integer.value[0]; in ak4641_put_deemph()
99 return -EINVAL; in ak4641_put_deemph()
101 ak4641->deemph = deemph; in ak4641_put_deemph()
112 ucontrol->value.integer.value[0] = ak4641->deemph; in ak4641_get_deemph()
116 static const char *ak4641_mono_out[] = {"(L + R)/2", "Hi-Z"};
117 static const char *ak4641_hp_out[] = {"Stereo", "Mono"};
122 static const DECLARE_TLV_DB_SCALE(mono_gain_tlv, -1700, 2300, 0);
124 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1050, 150, 0);
125 static const DECLARE_TLV_DB_SCALE(master_tlv, -12750, 50, 0);
126 static const DECLARE_TLV_DB_SCALE(mic_stereo_sidetone_tlv, -2700, 300, 0);
127 static const DECLARE_TLV_DB_SCALE(mic_mono_sidetone_tlv, -400, 400, 0);
128 static const DECLARE_TLV_DB_SCALE(capture_tlv, -800, 50, 0);
129 static const DECLARE_TLV_DB_SCALE(alc_tlv, -800, 50, 0);
130 static const DECLARE_TLV_DB_SCALE(aux_in_tlv, -2100, 300, 0);
143 SOC_ENUM("Mono 1 Output", ak4641_mono_out_enum),
144 SOC_SINGLE_TLV("Mono 1 Gain Volume", AK4641_SIG1, 7, 1, 1,
159 SOC_SINGLE("Left Out Enable Switch", AK4641_SIG2, 1, 1, 0),
160 SOC_SINGLE("Right Out Enable Switch", AK4641_SIG2, 0, 1, 0),
177 /* Mono 1 Mixer */
179 SOC_DAPM_SINGLE_TLV("Mic Mono Sidetone Volume", AK4641_VOL, 7, 1, 0,
181 SOC_DAPM_SINGLE("Mic Mono Sidetone Switch", AK4641_SIG1, 4, 1, 0),
182 SOC_DAPM_SINGLE("Mono Playback Switch", AK4641_SIG1, 5, 1, 0),
208 /* mono 2 switch */
227 SND_SOC_DAPM_SWITCH("Mono 2 Enable", SND_SOC_NOPM, 0, 0,
239 SND_SOC_DAPM_PGA("Mono Out", AK4641_PM1, 3, 0, NULL, 0),
240 SND_SOC_DAPM_PGA("Line Out", AK4641_PM1, 4, 0, NULL, 0),
243 SND_SOC_DAPM_PGA("Mono Out 2", AK4641_PM2, 3, 0, NULL, 0),
263 /* Mono 1 Mixer */
264 {"Mono1 Mixer", "Mic Mono Sidetone Switch", "Input Mux"},
265 {"Mono1 Mixer", "Mono Playback Switch", "DAC"},
279 /* Line Out */
280 {"LOUT", NULL, "Line Out"},
281 {"ROUT", NULL, "Line Out"},
282 {"Line Out", NULL, "Stereo Mixer"},
284 /* Mono 1 Out */
285 {"MOUT1", NULL, "Mono Out"},
286 {"Mono Out", NULL, "Mono1 Mixer"},
288 /* Mono 2 Out */
289 {"MOUT2", NULL, "Mono 2 Enable"},
290 {"Mono 2 Enable", "Switch", "Mono Out 2"},
291 {"Mono Out 2", NULL, "Stereo Mixer"},
293 {"Voice ADC", NULL, "Mono 2 Enable"},
307 struct snd_soc_component *component = codec_dai->component; in ak4641_set_dai_sysclk()
310 ak4641->sysclk = freq; in ak4641_set_dai_sysclk()
318 struct snd_soc_component *component = dai->component; in ak4641_i2s_hw_params()
324 fs = ak4641->sysclk / rate; in ak4641_i2s_hw_params()
326 return -EINVAL; in ak4641_i2s_hw_params()
340 dev_err(component->dev, "Error: unsupported fs=%d\n", fs); in ak4641_i2s_hw_params()
341 return -EINVAL; in ak4641_i2s_hw_params()
346 /* Update de-emphasis filter for the new rate */ in ak4641_i2s_hw_params()
347 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in ak4641_i2s_hw_params()
348 ak4641->playback_fs = rate; in ak4641_i2s_hw_params()
358 struct snd_soc_component *component = codec_dai->component; in ak4641_pcm_set_dai_fmt()
377 return -EINVAL; in ak4641_pcm_set_dai_fmt()
390 struct snd_soc_component *component = codec_dai->component; in ak4641_i2s_set_dai_fmt()
402 return -EINVAL; in ak4641_i2s_set_dai_fmt()
410 struct snd_soc_component *component = dai->component; in ak4641_mute()
419 struct ak4641_platform_data *pdata = component->dev->platform_data; in ak4641_set_bias_level()
433 if (pdata && gpio_is_valid(pdata->gpio_power)) in ak4641_set_bias_level()
434 gpio_set_value(pdata->gpio_power, 1); in ak4641_set_bias_level()
436 if (pdata && gpio_is_valid(pdata->gpio_npdn)) in ak4641_set_bias_level()
437 gpio_set_value(pdata->gpio_npdn, 1); in ak4641_set_bias_level()
440 ret = regcache_sync(ak4641->regmap); in ak4641_set_bias_level()
442 dev_err(component->dev, in ak4641_set_bias_level()
452 if (pdata && gpio_is_valid(pdata->gpio_npdn)) in ak4641_set_bias_level()
453 gpio_set_value(pdata->gpio_npdn, 0); in ak4641_set_bias_level()
454 if (pdata && gpio_is_valid(pdata->gpio_power)) in ak4641_set_bias_level()
455 gpio_set_value(pdata->gpio_power, 0); in ak4641_set_bias_level()
456 regcache_mark_dirty(ak4641->regmap); in ak4641_set_bias_level()
485 .name = "ak4641-hifi",
505 .name = "ak4641-voice",
552 struct ak4641_platform_data *pdata = i2c->dev.platform_data; in ak4641_i2c_probe()
556 ak4641 = devm_kzalloc(&i2c->dev, sizeof(struct ak4641_priv), in ak4641_i2c_probe()
559 return -ENOMEM; in ak4641_i2c_probe()
561 ak4641->regmap = devm_regmap_init_i2c(i2c, &ak4641_regmap); in ak4641_i2c_probe()
562 if (IS_ERR(ak4641->regmap)) in ak4641_i2c_probe()
563 return PTR_ERR(ak4641->regmap); in ak4641_i2c_probe()
566 if (gpio_is_valid(pdata->gpio_power)) { in ak4641_i2c_probe()
567 ret = gpio_request_one(pdata->gpio_power, in ak4641_i2c_probe()
572 if (gpio_is_valid(pdata->gpio_npdn)) { in ak4641_i2c_probe()
573 ret = gpio_request_one(pdata->gpio_npdn, in ak4641_i2c_probe()
579 gpio_set_value(pdata->gpio_npdn, 1); in ak4641_i2c_probe()
585 ret = devm_snd_soc_register_component(&i2c->dev, in ak4641_i2c_probe()
595 if (gpio_is_valid(pdata->gpio_power)) in ak4641_i2c_probe()
596 gpio_set_value(pdata->gpio_power, 0); in ak4641_i2c_probe()
597 if (gpio_is_valid(pdata->gpio_npdn)) in ak4641_i2c_probe()
598 gpio_free(pdata->gpio_npdn); in ak4641_i2c_probe()
601 if (pdata && gpio_is_valid(pdata->gpio_power)) in ak4641_i2c_probe()
602 gpio_free(pdata->gpio_power); in ak4641_i2c_probe()
609 struct ak4641_platform_data *pdata = i2c->dev.platform_data; in ak4641_i2c_remove()
612 if (gpio_is_valid(pdata->gpio_power)) { in ak4641_i2c_remove()
613 gpio_set_value(pdata->gpio_power, 0); in ak4641_i2c_remove()
614 gpio_free(pdata->gpio_power); in ak4641_i2c_remove()
616 if (gpio_is_valid(pdata->gpio_npdn)) in ak4641_i2c_remove()
617 gpio_free(pdata->gpio_npdn); in ak4641_i2c_remove()