Lines Matching +full:- +full:31000
1 // SPDX-License-Identifier: GPL-2.0
74 struct snd_soc_component *component = codec_dai->component; in max98520_dai_set_fmt()
80 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98520_dai_set_fmt()
89 dev_err(component->dev, "DAI invert mode unsupported\n"); in max98520_dai_set_fmt()
90 return -EINVAL; in max98520_dai_set_fmt()
93 regmap_update_bits(max98520->regmap, in max98520_dai_set_fmt()
113 return -EINVAL; in max98520_dai_set_fmt()
116 regmap_update_bits(max98520->regmap, in max98520_dai_set_fmt()
146 int blr_clk_ratio = params_channels(params) * max98520->ch_size; in max98520_set_clock()
149 if (!max98520->tdm_mode) { in max98520_set_clock()
153 dev_err(component->dev, "format unsupported %d\n", in max98520_set_clock()
155 return -EINVAL; in max98520_set_clock()
158 regmap_update_bits(max98520->regmap, in max98520_set_clock()
163 dev_dbg(component->dev, "%s tdm_mode:%d out\n", __func__, max98520->tdm_mode); in max98520_set_clock()
171 struct snd_soc_component *component = dai->component; in max98520_dai_hw_params()
189 dev_err(component->dev, "format unsupported %d\n", in max98520_dai_hw_params()
194 max98520->ch_size = snd_pcm_format_width(params_format(params)); in max98520_dai_hw_params()
196 regmap_update_bits(max98520->regmap, in max98520_dai_hw_params()
200 dev_dbg(component->dev, "format supported %d", in max98520_dai_hw_params()
245 dev_err(component->dev, "rate %d not supported\n", in max98520_dai_hw_params()
250 dev_dbg(component->dev, " %s ch_size: %d, sampling rate : %d out\n", __func__, in max98520_dai_hw_params()
253 regmap_update_bits(max98520->regmap, in max98520_dai_hw_params()
260 dev_dbg(component->dev, "%s out error", __func__); in max98520_dai_hw_params()
261 return -EINVAL; in max98520_dai_hw_params()
268 struct snd_soc_component *component = dai->component; in max98520_dai_tdm_slot()
275 max98520->tdm_mode = false; in max98520_dai_tdm_slot()
277 max98520->tdm_mode = true; in max98520_dai_tdm_slot()
282 dev_err(component->dev, "BCLK %d not supported\n", in max98520_dai_tdm_slot()
284 return -EINVAL; in max98520_dai_tdm_slot()
287 regmap_update_bits(max98520->regmap, in max98520_dai_tdm_slot()
304 dev_err(component->dev, "format unsupported %d\n", in max98520_dai_tdm_slot()
306 return -EINVAL; in max98520_dai_tdm_slot()
309 regmap_update_bits(max98520->regmap, in max98520_dai_tdm_slot()
314 regmap_update_bits(max98520->regmap, in max98520_dai_tdm_slot()
318 regmap_update_bits(max98520->regmap, in max98520_dai_tdm_slot()
341 snd_soc_dapm_to_component(w->dapm); in max98520_dac_event()
347 dev_dbg(component->dev, " AMP ON\n"); in max98520_dac_event()
349 regmap_write(max98520->regmap, MAX98520_R209F_AMP_EN, 1); in max98520_dac_event()
350 regmap_write(max98520->regmap, MAX98520_R210F_GLOBAL_EN, 1); in max98520_dac_event()
351 usleep_range(30000, 31000); in max98520_dac_event()
354 dev_dbg(component->dev, " AMP OFF\n"); in max98520_dac_event()
356 regmap_write(max98520->regmap, MAX98520_R210F_GLOBAL_EN, 0); in max98520_dac_event()
357 regmap_write(max98520->regmap, MAX98520_R209F_AMP_EN, 0); in max98520_dac_event()
358 usleep_range(30000, 31000); in max98520_dac_event()
430 static const DECLARE_TLV_DB_SCALE(max98520_digital_tlv, -6300, 50, 1);
431 static const DECLARE_TLV_DB_SCALE(max98520_spk_tlv, -600, 300, 0);
434 0, 15, TLV_DB_SCALE_ITEM(-1500, 100, 0),
443 0, 1, TLV_DB_SCALE_ITEM(-1500, 300, 0),
444 2, 4, TLV_DB_SCALE_ITEM(-1000, 200, 0),
445 5, 10, TLV_DB_SCALE_ITEM(-500, 100, 0),
449 0, 16, TLV_DB_SCALE_ITEM(-2000, 250, 0),
453 1, 20, TLV_DB_SCALE_ITEM(-2000, 100, 0),
584 .name = "max98520-aif1",
603 regmap_write(max98520->regmap, MAX98520_R2000_SW_RESET, 1); in max98520_probe()
606 regmap_write(max98520->regmap, MAX98520_R2043_PCM_RX_SRC1, 0x2); in max98520_probe()
610 regmap_write(max98520->regmap, MAX98520_R2044_PCM_RX_SRC2, 0x10); in max98520_probe()
613 regmap_update_bits(max98520->regmap, MAX98520_R2092_AMP_DSP_CFG, 1, 1); in max98520_probe()
614 /* Enable Clock Monitor Auto-restart */ in max98520_probe()
615 regmap_write(max98520->regmap, MAX98520_R2030_CLK_MON_CTRL, 0x1); in max98520_probe()
618 regmap_update_bits(max98520->regmap, in max98520_probe()
630 regcache_cache_only(max98520->regmap, true); in max98520_suspend()
631 regcache_mark_dirty(max98520->regmap); in max98520_suspend()
639 regcache_cache_only(max98520->regmap, false); in max98520_resume()
640 regmap_write(max98520->regmap, MAX98520_R2000_SW_RESET, 1); in max98520_resume()
641 regcache_sync(max98520->regmap); in max98520_resume()
675 if (max98520->reset_gpio) in max98520_power_on()
676 gpiod_set_value_cansleep(max98520->reset_gpio, !poweron); in max98520_power_on()
684 struct i2c_adapter *adapter = to_i2c_adapter(i2c->dev.parent); in max98520_i2c_probe()
688 dev_err(&i2c->dev, "I2C check functionality failed\n"); in max98520_i2c_probe()
689 return -ENXIO; in max98520_i2c_probe()
692 max98520 = devm_kzalloc(&i2c->dev, sizeof(*max98520), GFP_KERNEL); in max98520_i2c_probe()
695 return -ENOMEM; in max98520_i2c_probe()
700 max98520->regmap = devm_regmap_init_i2c(i2c, &max98520_regmap); in max98520_i2c_probe()
701 if (IS_ERR(max98520->regmap)) { in max98520_i2c_probe()
702 ret = PTR_ERR(max98520->regmap); in max98520_i2c_probe()
703 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); in max98520_i2c_probe()
708 max98520->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); in max98520_i2c_probe()
709 if (max98520->reset_gpio) { in max98520_i2c_probe()
710 if (IS_ERR(max98520->reset_gpio)) { in max98520_i2c_probe()
711 ret = PTR_ERR(max98520->reset_gpio); in max98520_i2c_probe()
712 dev_err(&i2c->dev, "Unable to request GPIO pin: %d.\n", ret); in max98520_i2c_probe()
720 ret = regmap_read(max98520->regmap, MAX98520_R21FF_REVISION_ID, ®); in max98520_i2c_probe()
722 dev_err(&i2c->dev, in max98520_i2c_probe()
726 dev_info(&i2c->dev, "MAX98520 revisionID: 0x%02X\n", reg); in max98520_i2c_probe()
729 ret = devm_snd_soc_register_component(&i2c->dev, in max98520_i2c_probe()
733 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); in max98520_i2c_probe()