Lines Matching +full:rates +full:- +full:ru
1 // SPDX-License-Identifier: GPL-2.0-only
3 * ak4641.c -- AK4641 ALSA Soc Audio driver
6 * Copyright (C) 2011 Dmitry Artamonow <mad_soft@inbox.ru>
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"};
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);
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()
476 .hw_params = NULL, /* rates are controlled by BT chip */
485 .name = "ak4641-hifi",
491 .rates = AK4641_RATES,
498 .rates = AK4641_RATES,
505 .name = "ak4641-voice",
511 .rates = AK4641_RATES_BT,
518 .rates = AK4641_RATES_BT,
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()