Lines Matching +full:brownout +full:- +full:release +full:- +full:rate +full:- +full:ms
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"
177 "320us", "640us", "1.28ms", "2.56ms", "5.12ms", "10.24ms",
178 "20.48ms", "40.96ms", "81.92ms", "163.84ms"
188 "1.28ms", "2.56ms", "5.12ms", "10.24ms", "20.48ms", "40.96ms",
189 "81.92ms", "163.84ms", "327.68ms", "655.36ms"
198 "0.01ms", "0.1ms", "1ms", "10ms", "100ms", "250ms", "500ms", "hold"
207 "0.01ms", "0.05ms", "0.1ms", "0.5ms", "1ms", "5ms", "25ms", "250ms"
216 "10ms", "25ms", "50ms", "75ms", "100ms", "200ms", "300ms", "400ms",
217 "500ms", "600ms", "700ms", "800ms", "900ms", "1000ms", "1100ms", "1200ms"
347 /* Brownout Protection Automatic Level Control */
350 SOC_ENUM("ALC Attack Rate", max98388_alc_attack_rate_enum),
351 SOC_ENUM("ALC Release Rate", max98388_alc_release_rate_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()
610 /* sampling rate configuration */ 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()
657 /* set sampling rate of IV */ 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()
836 .name = "max98388-aif1",
859 regcache_cache_only(max98388->regmap, true); in max98388_suspend()
860 regcache_mark_dirty(max98388->regmap); in max98388_suspend()
869 regcache_cache_only(max98388->regmap, false); in max98388_resume()
871 regcache_sync(max98388->regmap); in max98388_resume()
908 if (!device_property_read_u32(dev, "adi,vmon-slot-no", &value)) in max98388_read_deveice_property()
909 max98388->v_slot = value & 0xF; in max98388_read_deveice_property()
911 max98388->v_slot = 0; in max98388_read_deveice_property()
913 if (!device_property_read_u32(dev, "adi,imon-slot-no", &value)) in max98388_read_deveice_property()
914 max98388->i_slot = value & 0xF; in max98388_read_deveice_property()
916 max98388->i_slot = 1; in max98388_read_deveice_property()
918 if (device_property_read_bool(dev, "adi,interleave-mode")) in max98388_read_deveice_property()
919 max98388->interleave_mode = true; in max98388_read_deveice_property()
921 max98388->interleave_mode = false; in max98388_read_deveice_property()
931 max98388 = devm_kzalloc(&i2c->dev, sizeof(*max98388), GFP_KERNEL); in max98388_i2c_probe()
933 return -ENOMEM; in max98388_i2c_probe()
938 max98388->regmap = devm_regmap_init_i2c(i2c, &max98388_regmap); in max98388_i2c_probe()
939 if (IS_ERR(max98388->regmap)) in max98388_i2c_probe()
940 return dev_err_probe(&i2c->dev, PTR_ERR(max98388->regmap), in max98388_i2c_probe()
944 max98388_read_deveice_property(&i2c->dev, max98388); in max98388_i2c_probe()
947 max98388->reset_gpio = devm_gpiod_get_optional(&i2c->dev, in max98388_i2c_probe()
949 if (IS_ERR(max98388->reset_gpio)) in max98388_i2c_probe()
950 return dev_err_probe(&i2c->dev, PTR_ERR(max98388->reset_gpio), in max98388_i2c_probe()
953 if (max98388->reset_gpio) { in max98388_i2c_probe()
955 gpiod_set_value_cansleep(max98388->reset_gpio, 0); in max98388_i2c_probe()
961 ret = regmap_read(max98388->regmap, in max98388_i2c_probe()
964 return dev_err_probe(&i2c->dev, ret, in max98388_i2c_probe()
967 dev_info(&i2c->dev, "MAX98388 revisionID: 0x%02X\n", reg); in max98388_i2c_probe()
970 ret = devm_snd_soc_register_component(&i2c->dev, in max98388_i2c_probe()
975 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); in max98388_i2c_probe()