Lines Matching +full:codec +full:- +full:aif1 +full:- +full:bclk

1 // SPDX-License-Identifier: GPL-2.0
123 struct snd_soc_component *component = codec_dai->component; in max98373_dai_set_fmt()
128 dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); in max98373_dai_set_fmt()
137 dev_err(component->dev, "DAI invert mode unsupported\n"); in max98373_dai_set_fmt()
138 return -EINVAL; in max98373_dai_set_fmt()
141 regmap_update_bits(max98373->regmap, in max98373_dai_set_fmt()
161 return -EINVAL; in max98373_dai_set_fmt()
164 regmap_update_bits(max98373->regmap, in max98373_dai_set_fmt()
177 static int max98373_get_bclk_sel(int bclk) in max98373_get_bclk_sel() argument
182 if (bclk_sel_table[i] == bclk) in max98373_get_bclk_sel()
192 /* BCLK/LRCLK ratio calculation */ in max98373_set_clock()
193 int blr_clk_ratio = params_channels(params) * max98373->ch_size; in max98373_set_clock()
196 if (!max98373->tdm_mode) { in max98373_set_clock()
197 /* BCLK configuration */ in max98373_set_clock()
200 dev_err(component->dev, "format unsupported %d\n", in max98373_set_clock()
202 return -EINVAL; in max98373_set_clock()
205 regmap_update_bits(max98373->regmap, in max98373_set_clock()
217 struct snd_soc_component *component = dai->component; in max98373_dai_hw_params()
234 dev_err(component->dev, "format unsupported %d\n", in max98373_dai_hw_params()
239 max98373->ch_size = snd_pcm_format_width(params_format(params)); in max98373_dai_hw_params()
241 regmap_update_bits(max98373->regmap, in max98373_dai_hw_params()
245 dev_dbg(component->dev, "format supported %d", in max98373_dai_hw_params()
284 dev_err(component->dev, "rate %d not supported\n", in max98373_dai_hw_params()
290 regmap_update_bits(max98373->regmap, in max98373_dai_hw_params()
294 regmap_update_bits(max98373->regmap, in max98373_dai_hw_params()
300 if (max98373->interleave_mode && in max98373_dai_hw_params()
302 regmap_update_bits(max98373->regmap, in max98373_dai_hw_params()
305 sampling_rate - 3); in max98373_dai_hw_params()
307 regmap_update_bits(max98373->regmap, in max98373_dai_hw_params()
314 return -EINVAL; in max98373_dai_hw_params()
321 struct snd_soc_component *component = dai->component; in max98373_dai_tdm_slot()
329 max98373->tdm_mode = false; in max98373_dai_tdm_slot()
331 max98373->tdm_mode = true; in max98373_dai_tdm_slot()
333 /* BCLK configuration */ in max98373_dai_tdm_slot()
336 dev_err(component->dev, "BCLK %d not supported\n", in max98373_dai_tdm_slot()
338 return -EINVAL; in max98373_dai_tdm_slot()
341 regmap_update_bits(max98373->regmap, in max98373_dai_tdm_slot()
358 dev_err(component->dev, "format unsupported %d\n", in max98373_dai_tdm_slot()
360 return -EINVAL; in max98373_dai_tdm_slot()
363 regmap_update_bits(max98373->regmap, in max98373_dai_tdm_slot()
373 regmap_update_bits(max98373->regmap, in max98373_dai_tdm_slot()
377 regmap_write(max98373->regmap, in max98373_dai_tdm_slot()
386 /* Tx slot Hi-Z configuration */ in max98373_dai_tdm_slot()
387 regmap_write(max98373->regmap, in max98373_dai_tdm_slot()
390 regmap_write(max98373->regmap, in max98373_dai_tdm_slot()
456 .name = "max98373-aif1",
482 for (i = 0; i < max98373->cache_num; i++) in max98373_suspend()
483 regmap_read(max98373->regmap, max98373->cache[i].reg, &max98373->cache[i].val); in max98373_suspend()
485 regcache_cache_only(max98373->regmap, true); in max98373_suspend()
486 regcache_mark_dirty(max98373->regmap); in max98373_suspend()
494 regcache_cache_only(max98373->regmap, false); in max98373_resume()
496 regcache_sync(max98373->regmap); in max98373_resume()
523 max98373 = devm_kzalloc(&i2c->dev, sizeof(*max98373), GFP_KERNEL); in max98373_i2c_probe()
526 ret = -ENOMEM; in max98373_i2c_probe()
532 if (device_property_read_bool(&i2c->dev, "maxim,interleave_mode")) in max98373_i2c_probe()
533 max98373->interleave_mode = true; in max98373_i2c_probe()
535 max98373->interleave_mode = false; in max98373_i2c_probe()
538 max98373->regmap = devm_regmap_init_i2c(i2c, &max98373_regmap); in max98373_i2c_probe()
539 if (IS_ERR(max98373->regmap)) { in max98373_i2c_probe()
540 ret = PTR_ERR(max98373->regmap); in max98373_i2c_probe()
541 dev_err(&i2c->dev, in max98373_i2c_probe()
546 max98373->cache_num = ARRAY_SIZE(max98373_i2c_cache_reg); in max98373_i2c_probe()
547 max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num, in max98373_i2c_probe()
548 sizeof(*max98373->cache), in max98373_i2c_probe()
550 if (!max98373->cache) { in max98373_i2c_probe()
551 ret = -ENOMEM; in max98373_i2c_probe()
555 for (i = 0; i < max98373->cache_num; i++) in max98373_i2c_probe()
556 max98373->cache[i].reg = max98373_i2c_cache_reg[i]; in max98373_i2c_probe()
559 max98373_slot_config(&i2c->dev, max98373); in max98373_i2c_probe()
562 ret = regmap_read(max98373->regmap, in max98373_i2c_probe()
565 dev_err(&i2c->dev, in max98373_i2c_probe()
569 dev_info(&i2c->dev, "MAX98373 revisionID: 0x%02X\n", reg); in max98373_i2c_probe()
571 /* codec registration */ in max98373_i2c_probe()
572 ret = devm_snd_soc_register_component(&i2c->dev, &soc_codec_dev_max98373, in max98373_i2c_probe()
575 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); in max98373_i2c_probe()