Lines Matching +full:slew +full:- +full:time +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0
76 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in max98388_dac_event()
81 regmap_write(max98388->regmap, in max98388_dac_event()
86 regmap_write(max98388->regmap, in max98388_dac_event()
89 max98388->tdm_mode = false; in max98388_dac_event()
132 static DECLARE_TLV_DB_SCALE(max98388_digital_tlv, -6350, 50, 1);
133 static DECLARE_TLV_DB_SCALE(max98388_amp_gain_tlv, -300, 300, 0);
136 "0dBFS", "-1dBFS", "-2dBFS", "-3dBFS", "-4dBFS", "-5dBFS",
137 "-6dBFS", "-7dBFS", "-8dBFS", "-9dBFS", "-10dBFS", "-11dBFS",
138 "-12dBFS", "-13dBFS", "-14dBFS", "-15dBFS"
176 "0", "10us", "20us", "40us", "80us", "160us",
177 "320us", "640us", "1.28ms", "2.56ms", "5.12ms", "10.24ms",
187 "20us", "40us", "80us", "160us", "320us", "640us",
353 SOC_ENUM("ALC Debounce Time", max98388_alc_debouce_enum),
368 SOC_ENUM("Fall Slew Rate", max98388_edge_rate_falling_enum),
369 SOC_ENUM("Rise Slew Rate", max98388_edge_rate_rising_enum),
395 ret = regmap_update_bits(max98388->regmap, in max98388_reset()
406 ret = regmap_read(max98388->regmap, in max98388_reset()
422 max98388_reset(max98388, component->dev); in max98388_probe()
425 regmap_write(max98388->regmap, in max98388_probe()
430 regmap_write(max98388->regmap, in max98388_probe()
434 regmap_write(max98388->regmap, in max98388_probe()
438 regmap_write(max98388->regmap, in max98388_probe()
440 max98388->v_slot); in max98388_probe()
442 regmap_write(max98388->regmap, in max98388_probe()
444 max98388->i_slot); in max98388_probe()
445 /* Enable Auto-restart behavior by default */ in max98388_probe()
446 regmap_write(max98388->regmap, in max98388_probe()
449 if (max98388->interleave_mode) in max98388_probe()
450 regmap_update_bits(max98388->regmap, in max98388_probe()
456 regmap_update_bits(max98388->regmap, in max98388_probe()
466 struct snd_soc_component *component = codec_dai->component; in max98388_dai_set_fmt()
471 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98388_dai_set_fmt()
480 dev_err(component->dev, "DAI invert mode unsupported\n"); in max98388_dai_set_fmt()
481 return -EINVAL; in max98388_dai_set_fmt()
484 regmap_update_bits(max98388->regmap, in max98388_dai_set_fmt()
504 return -EINVAL; in max98388_dai_set_fmt()
507 regmap_update_bits(max98388->regmap, in max98388_dai_set_fmt()
536 int blr_clk_ratio = params_channels(params) * max98388->ch_size; in max98388_set_clock()
539 if (!max98388->tdm_mode) { in max98388_set_clock()
543 dev_err(component->dev, "format unsupported %d\n", in max98388_set_clock()
545 return -EINVAL; in max98388_set_clock()
548 regmap_update_bits(max98388->regmap, in max98388_set_clock()
560 struct snd_soc_component *component = dai->component; in max98388_dai_hw_params()
579 dev_err(component->dev, "format unsupported %d\n", in max98388_dai_hw_params()
584 max98388->ch_size = snd_pcm_format_width(params_format(params)); in max98388_dai_hw_params()
586 ret = regmap_read(max98388->regmap, in max98388_dai_hw_params()
591 /* GLOBAL_EN OFF prior to the channel size re-configure */ in max98388_dai_hw_params()
593 ret = regmap_read(max98388->regmap, in max98388_dai_hw_params()
599 regmap_write(max98388->regmap, in max98388_dai_hw_params()
603 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
607 dev_dbg(component->dev, "format supported %d", in max98388_dai_hw_params()
646 dev_err(component->dev, "rate %d not supported\n", in max98388_dai_hw_params()
652 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
658 if (max98388->interleave_mode && in max98388_dai_hw_params()
660 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
663 (sampling_rate - 3) << MAX98388_PCM_SR_IV_SHIFT); in max98388_dai_hw_params()
665 regmap_update_bits(max98388->regmap, in max98388_dai_hw_params()
673 regmap_write(max98388->regmap, in max98388_dai_hw_params()
681 return -EINVAL; in max98388_dai_hw_params()
691 struct snd_soc_component *component = dai->component; in max98388_dai_tdm_slot()
700 max98388->tdm_mode = false; in max98388_dai_tdm_slot()
702 max98388->tdm_mode = true; in max98388_dai_tdm_slot()
707 dev_err(component->dev, "BCLK %d not supported\n", in max98388_dai_tdm_slot()
709 return -EINVAL; in max98388_dai_tdm_slot()
712 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
729 dev_err(component->dev, "format unsupported %d\n", in max98388_dai_tdm_slot()
731 return -EINVAL; in max98388_dai_tdm_slot()
734 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
744 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
749 regmap_update_bits(max98388->regmap, in max98388_dai_tdm_slot()
766 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()