Lines Matching +full:slew +full:- +full:delay +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/delay.h>
75 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in max98388_dac_event()
80 regmap_write(max98388->regmap, in max98388_dac_event()
85 regmap_write(max98388->regmap, in max98388_dac_event()
88 max98388->tdm_mode = false; in max98388_dac_event()
131 static DECLARE_TLV_DB_SCALE(max98388_digital_tlv, -6350, 50, 1);
132 static DECLARE_TLV_DB_SCALE(max98388_amp_gain_tlv, -300, 300, 0);
135 "0dBFS", "-1dBFS", "-2dBFS", "-3dBFS", "-4dBFS", "-5dBFS",
136 "-6dBFS", "-7dBFS", "-8dBFS", "-9dBFS", "-10dBFS", "-11dBFS",
137 "-12dBFS", "-13dBFS", "-14dBFS", "-15dBFS"
175 "0", "10us", "20us", "40us", "80us", "160us",
176 "320us", "640us", "1.28ms", "2.56ms", "5.12ms", "10.24ms",
186 "20us", "40us", "80us", "160us", "320us", "640us",
359 SOC_ENUM("ALC Mute Delay", max98388_alc_mute_delay_enum),
367 SOC_ENUM("Fall Slew Rate", max98388_edge_rate_falling_enum),
368 SOC_ENUM("Rise Slew Rate", max98388_edge_rate_rising_enum),
394 ret = regmap_update_bits(max98388->regmap, in max98388_reset()
405 ret = regmap_read(max98388->regmap, in max98388_reset()
421 max98388_reset(max98388, component->dev); in max98388_probe()
424 regmap_write(max98388->regmap, in max98388_probe()
429 regmap_write(max98388->regmap, in max98388_probe()
433 regmap_write(max98388->regmap, in max98388_probe()
437 regmap_write(max98388->regmap, in max98388_probe()
439 max98388->v_slot); in max98388_probe()
441 regmap_write(max98388->regmap, in max98388_probe()
443 max98388->i_slot); in max98388_probe()
444 /* Enable Auto-restart behavior by default */ in max98388_probe()
445 regmap_write(max98388->regmap, in max98388_probe()
448 if (max98388->interleave_mode) in max98388_probe()
449 regmap_update_bits(max98388->regmap, in max98388_probe()
455 regmap_update_bits(max98388->regmap, in max98388_probe()
465 struct snd_soc_component *component = codec_dai->component; in max98388_dai_set_fmt()
470 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98388_dai_set_fmt()
479 dev_err(component->dev, "DAI invert mode unsupported\n"); in max98388_dai_set_fmt()
480 return -EINVAL; in max98388_dai_set_fmt()
483 regmap_update_bits(max98388->regmap, in max98388_dai_set_fmt()
503 return -EINVAL; in max98388_dai_set_fmt()
506 regmap_update_bits(max98388->regmap, in max98388_dai_set_fmt()
535 int blr_clk_ratio = params_channels(params) * max98388->ch_size; in max98388_set_clock()
538 if (!max98388->tdm_mode) { in max98388_set_clock()
542 dev_err(component->dev, "format unsupported %d\n", in max98388_set_clock()
544 return -EINVAL; in max98388_set_clock()
547 regmap_update_bits(max98388->regmap, in max98388_set_clock()
559 struct snd_soc_component *component = dai->component; in max98388_dai_hw_params()
578 dev_err(component->dev, "format unsupported %d\n", in max98388_dai_hw_params()
583 max98388->ch_size = snd_pcm_format_width(params_format(params)); in max98388_dai_hw_params()
585 ret = regmap_read(max98388->regmap, in max98388_dai_hw_params()
590 /* GLOBAL_EN OFF prior to the channel size re-configure */ in max98388_dai_hw_params()
592 ret = regmap_read(max98388->regmap, in max98388_dai_hw_params()
598 regmap_write(max98388->regmap, in max98388_dai_hw_params()
602 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
606 dev_dbg(component->dev, "format supported %d", in max98388_dai_hw_params()
645 dev_err(component->dev, "rate %d not supported\n", in max98388_dai_hw_params()
651 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
657 if (max98388->interleave_mode && in max98388_dai_hw_params()
659 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
662 (sampling_rate - 3) << MAX98388_PCM_SR_IV_SHIFT); in max98388_dai_hw_params()
664 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
672 regmap_write(max98388->regmap, in max98388_dai_hw_params()
680 return -EINVAL; in max98388_dai_hw_params()
690 struct snd_soc_component *component = dai->component; in max98388_dai_tdm_slot()
699 max98388->tdm_mode = false; in max98388_dai_tdm_slot()
701 max98388->tdm_mode = true; in max98388_dai_tdm_slot()
706 dev_err(component->dev, "BCLK %d not supported\n", in max98388_dai_tdm_slot()
708 return -EINVAL; in max98388_dai_tdm_slot()
711 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
728 dev_err(component->dev, "format unsupported %d\n", in max98388_dai_tdm_slot()
730 return -EINVAL; in max98388_dai_tdm_slot()
733 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
743 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
748 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
765 regmap_update_bits(max98388->regmap, addr, bits, bits); in max98388_dai_tdm_slot()
835 .name = "max98388-aif1",
858 regcache_cache_only(max98388->regmap, true); in max98388_suspend()
859 regcache_mark_dirty(max98388->regmap); in max98388_suspend()
868 regcache_cache_only(max98388->regmap, false); in max98388_resume()
870 regcache_sync(max98388->regmap); in max98388_resume()
907 if (!device_property_read_u32(dev, "adi,vmon-slot-no", &value)) in max98388_read_deveice_property()
908 max98388->v_slot = value & 0xF; in max98388_read_deveice_property()
910 max98388->v_slot = 0; in max98388_read_deveice_property()
912 if (!device_property_read_u32(dev, "adi,imon-slot-no", &value)) in max98388_read_deveice_property()
913 max98388->i_slot = value & 0xF; in max98388_read_deveice_property()
915 max98388->i_slot = 1; in max98388_read_deveice_property()
917 if (device_property_read_bool(dev, "adi,interleave-mode")) in max98388_read_deveice_property()
918 max98388->interleave_mode = true; in max98388_read_deveice_property()
920 max98388->interleave_mode = false; in max98388_read_deveice_property()
930 max98388 = devm_kzalloc(&i2c->dev, sizeof(*max98388), GFP_KERNEL); in max98388_i2c_probe()
932 return -ENOMEM; in max98388_i2c_probe()
937 max98388->regmap = devm_regmap_init_i2c(i2c, &max98388_regmap); in max98388_i2c_probe()
938 if (IS_ERR(max98388->regmap)) in max98388_i2c_probe()
939 return dev_err_probe(&i2c->dev, PTR_ERR(max98388->regmap), in max98388_i2c_probe()
943 max98388_read_deveice_property(&i2c->dev, max98388); in max98388_i2c_probe()
946 max98388->reset_gpio = devm_gpiod_get_optional(&i2c->dev, in max98388_i2c_probe()
948 if (IS_ERR(max98388->reset_gpio)) in max98388_i2c_probe()
949 return dev_err_probe(&i2c->dev, PTR_ERR(max98388->reset_gpio), in max98388_i2c_probe()
952 if (max98388->reset_gpio) { in max98388_i2c_probe()
954 gpiod_set_value_cansleep(max98388->reset_gpio, 0); in max98388_i2c_probe()
960 ret = regmap_read(max98388->regmap, in max98388_i2c_probe()
963 return dev_err_probe(&i2c->dev, ret, in max98388_i2c_probe()
966 dev_info(&i2c->dev, "MAX98388 revisionID: 0x%02X\n", reg); in max98388_i2c_probe()
969 ret = devm_snd_soc_register_component(&i2c->dev, in max98388_i2c_probe()
974 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); in max98388_i2c_probe()