Lines Matching +full:de +full:- +full:noise
1 // SPDX-License-Identifier: GPL-2.0-only
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
141 static const DECLARE_TLV_DB_MINMAX_MUTE(ssm2518_vol_tlv, -7125, 2400);
142 static const DECLARE_TLV_DB_SCALE(ssm2518_compressor_tlv, -3400, 200, 0);
143 static const DECLARE_TLV_DB_SCALE(ssm2518_expander_tlv, -8100, 300, 0);
144 static const DECLARE_TLV_DB_SCALE(ssm2518_noise_gate_tlv, -9600, 300, 0);
145 static const DECLARE_TLV_DB_SCALE(ssm2518_post_drc_tlv, -2400, 300, 0);
148 0, 7, TLV_DB_SCALE_ITEM(-2200, 200, 0),
149 7, 15, TLV_DB_SCALE_ITEM(-800, 100, 0),
186 SOC_SINGLE("Playback De-emphasis Switch", SSM2518_REG_MUTE_CTRL,
198 SOC_SINGLE("DRC Noise Gate Switch", SSM2518_REG_DRC_1, 2, 1, 0),
207 SOC_SINGLE_TLV("DRC Noise Gate Threshold Volume",
223 SOC_ENUM("DRC Noise Gate Hold Time",
324 return -EINVAL; in ssm2518_lookup_mcs()
327 if (sysclks[i] == ssm2518->sysclk) in ssm2518_lookup_mcs()
331 return -EINVAL; in ssm2518_lookup_mcs()
337 struct snd_soc_component *component = dai->component; in ssm2518_hw_params()
359 return -EINVAL; in ssm2518_hw_params()
361 if (ssm2518->right_j) { in ssm2518_hw_params()
370 return -EINVAL; in ssm2518_hw_params()
376 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_CLOCK, in ssm2518_hw_params()
381 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_SAI_CTRL1, in ssm2518_hw_params()
386 return regmap_update_bits(ssm2518->regmap, SSM2518_REG_POWER1, in ssm2518_hw_params()
392 struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component); in ssm2518_mute()
400 return regmap_update_bits(ssm2518->regmap, SSM2518_REG_MUTE_CTRL, in ssm2518_mute()
406 struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component); in ssm2518_set_dai_fmt()
415 return -EINVAL; in ssm2518_set_dai_fmt()
434 return -EINVAL; in ssm2518_set_dai_fmt()
437 ssm2518->right_j = false; in ssm2518_set_dai_fmt()
448 ssm2518->right_j = true; in ssm2518_set_dai_fmt()
462 return -EINVAL; in ssm2518_set_dai_fmt()
468 ret = regmap_write(ssm2518->regmap, SSM2518_REG_SAI_CTRL1, ctrl1); in ssm2518_set_dai_fmt()
472 return regmap_write(ssm2518->regmap, SSM2518_REG_SAI_CTRL2, ctrl2); in ssm2518_set_dai_fmt()
480 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_POWER1, in ssm2518_set_power()
482 regcache_mark_dirty(ssm2518->regmap); in ssm2518_set_power()
485 if (ssm2518->enable_gpio) in ssm2518_set_power()
486 gpiod_set_value_cansleep(ssm2518->enable_gpio, enable); in ssm2518_set_power()
488 regcache_cache_only(ssm2518->regmap, !enable); in ssm2518_set_power()
491 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_POWER1, in ssm2518_set_power()
493 regcache_sync(ssm2518->regmap); in ssm2518_set_power()
525 struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component); in ssm2518_set_tdm_slot()
531 return regmap_update_bits(ssm2518->regmap, in ssm2518_set_tdm_slot()
536 return -EINVAL; in ssm2518_set_tdm_slot()
540 return -EINVAL; in ssm2518_set_tdm_slot()
556 return -EINVAL; in ssm2518_set_tdm_slot()
569 return -EINVAL; in ssm2518_set_tdm_slot()
589 return -EINVAL; in ssm2518_set_tdm_slot()
592 ret = regmap_write(ssm2518->regmap, SSM2518_REG_CHAN_MAP, in ssm2518_set_tdm_slot()
598 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_SAI_CTRL1, in ssm2518_set_tdm_slot()
603 return regmap_update_bits(ssm2518->regmap, SSM2518_REG_SAI_CTRL2, in ssm2518_set_tdm_slot()
610 struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component); in ssm2518_startup()
612 if (ssm2518->constraints) in ssm2518_startup()
613 snd_pcm_hw_constraint_list(substream->runtime, 0, in ssm2518_startup()
614 SNDRV_PCM_HW_PARAM_RATE, ssm2518->constraints); in ssm2518_startup()
632 .name = "ssm2518-hifi",
650 return -EINVAL; in ssm2518_set_sysclk()
663 return -EINVAL; in ssm2518_set_sysclk()
668 ssm2518->constraints = NULL; in ssm2518_set_sysclk()
676 ssm2518->constraints = &ssm2518_constraints_2048000; in ssm2518_set_sysclk()
687 ssm2518->constraints = &ssm2518_constraints_2822000; in ssm2518_set_sysclk()
695 ssm2518->constraints = &ssm2518_constraints_3072000; in ssm2518_set_sysclk()
700 ssm2518->constraints = &ssm2518_constraints_12288000; in ssm2518_set_sysclk()
703 return -EINVAL; in ssm2518_set_sysclk()
706 ssm2518->sysclk = freq; in ssm2518_set_sysclk()
708 return regmap_update_bits(ssm2518->regmap, SSM2518_REG_POWER1, in ssm2518_set_sysclk()
741 ssm2518 = devm_kzalloc(&i2c->dev, sizeof(*ssm2518), GFP_KERNEL); in ssm2518_i2c_probe()
743 return -ENOMEM; in ssm2518_i2c_probe()
746 ssm2518->enable_gpio = devm_gpiod_get_optional(&i2c->dev, NULL, in ssm2518_i2c_probe()
748 ret = PTR_ERR_OR_ZERO(ssm2518->enable_gpio); in ssm2518_i2c_probe()
752 gpiod_set_consumer_name(ssm2518->enable_gpio, "SSM2518 nSD"); in ssm2518_i2c_probe()
756 ssm2518->regmap = devm_regmap_init_i2c(i2c, &ssm2518_regmap_config); in ssm2518_i2c_probe()
757 if (IS_ERR(ssm2518->regmap)) in ssm2518_i2c_probe()
758 return PTR_ERR(ssm2518->regmap); in ssm2518_i2c_probe()
766 regcache_cache_bypass(ssm2518->regmap, true); in ssm2518_i2c_probe()
767 ret = regmap_write(ssm2518->regmap, SSM2518_REG_POWER1, in ssm2518_i2c_probe()
769 regcache_cache_bypass(ssm2518->regmap, false); in ssm2518_i2c_probe()
773 ret = regmap_update_bits(ssm2518->regmap, SSM2518_REG_POWER2, in ssm2518_i2c_probe()
782 return devm_snd_soc_register_component(&i2c->dev, in ssm2518_i2c_probe()
812 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");