Lines Matching +full:tdm +full:- +full:data +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0
3 // Analog Devices ADAU7118 8 channel PDM-to-I2S/TDM Converter driver
128 snd_soc_component_get_drvdata(dai->component); in adau7118_set_channel_map()
131 dev_dbg(st->dev, "Set channel map, %d", tx_num); in adau7118_set_channel_map()
134 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_channel_map()
148 snd_soc_component_get_drvdata(dai->component); in adau7118_set_fmt()
152 dev_dbg(st->dev, "Set format, fmt:%d\n", fmt); in adau7118_set_fmt()
156 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
162 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
168 st->right_j = true; in adau7118_set_fmt()
171 dev_err(st->dev, "Invalid format %d", in adau7118_set_fmt()
173 return -EINVAL; in adau7118_set_fmt()
193 dev_err(st->dev, "Invalid Inv mask %d", in adau7118_set_fmt()
195 return -EINVAL; in adau7118_set_fmt()
198 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
211 snd_soc_component_get_drvdata(dai->component); in adau7118_set_tristate()
214 dev_dbg(st->dev, "Set tristate, %d\n", tristate); in adau7118_set_tristate()
216 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_tristate()
231 snd_soc_component_get_drvdata(dai->component); in adau7118_set_tdm_slot()
235 dev_dbg(st->dev, "Set tdm, slots:%d width:%d\n", slots, slot_width); in adau7118_set_tdm_slot()
248 dev_err(st->dev, "Invalid slot width:%d\n", slot_width); in adau7118_set_tdm_slot()
249 return -EINVAL; in adau7118_set_tdm_slot()
252 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_tdm_slot()
258 st->slot_width = slot_width; in adau7118_set_tdm_slot()
259 st->slots = slots; in adau7118_set_tdm_slot()
269 snd_soc_component_get_drvdata(dai->component); in adau7118_hw_params()
274 if (!st->slots) { in adau7118_hw_params()
276 ret = snd_soc_component_update_bits(dai->component, in adau7118_hw_params()
285 slots_width = st->slot_width; in adau7118_hw_params()
289 dev_err(st->dev, "Invalid data_width:%d, slots_width:%d", in adau7118_hw_params()
291 return -EINVAL; in adau7118_hw_params()
294 if (st->right_j) { in adau7118_hw_params()
295 switch (slots_width - data_width) { in adau7118_hw_params()
297 /* delay bclck by 8 */ in adau7118_hw_params()
301 /* delay bclck by 12 */ in adau7118_hw_params()
305 /* delay bclck by 16 */ in adau7118_hw_params()
309 dev_err(st->dev, in adau7118_hw_params()
312 return -EINVAL; in adau7118_hw_params()
315 ret = snd_soc_component_update_bits(dai->component, in adau7118_hw_params()
332 dev_dbg(st->dev, "Set bias level %d\n", level); in adau7118_set_bias_level()
343 ret = regulator_enable(st->iovdd); in adau7118_set_bias_level()
348 ret = regulator_enable(st->dvdd); in adau7118_set_bias_level()
350 regulator_disable(st->iovdd); in adau7118_set_bias_level()
354 if (st->hw_mode) in adau7118_set_bias_level()
357 regcache_cache_only(st->map, false); in adau7118_set_bias_level()
364 ret = regulator_disable(st->dvdd); in adau7118_set_bias_level()
368 ret = regulator_disable(st->iovdd); in adau7118_set_bias_level()
372 if (st->hw_mode) in adau7118_set_bias_level()
376 regcache_mark_dirty(st->map); in adau7118_set_bias_level()
377 regcache_cache_only(st->map, true); in adau7118_set_bias_level()
392 if (st->hw_mode) { in adau7118_component_probe()
401 snd_soc_component_init_regmap(component, st->map); in adau7118_component_probe()
423 .name = "adau7118-hifi-capture",
447 static void adau7118_regulator_disable(void *data) in adau7118_regulator_disable() argument
449 struct adau7118_data *st = data; in adau7118_regulator_disable()
456 ret = regulator_disable(st->dvdd); in adau7118_regulator_disable()
460 regulator_disable(st->iovdd); in adau7118_regulator_disable()
465 st->iovdd = devm_regulator_get(st->dev, "iovdd"); in adau7118_regulator_setup()
466 if (IS_ERR(st->iovdd)) { in adau7118_regulator_setup()
467 dev_err(st->dev, "Could not get iovdd: %ld\n", in adau7118_regulator_setup()
468 PTR_ERR(st->iovdd)); in adau7118_regulator_setup()
469 return PTR_ERR(st->iovdd); in adau7118_regulator_setup()
472 st->dvdd = devm_regulator_get(st->dev, "dvdd"); in adau7118_regulator_setup()
473 if (IS_ERR(st->dvdd)) { in adau7118_regulator_setup()
474 dev_err(st->dev, "Could not get dvdd: %ld\n", in adau7118_regulator_setup()
475 PTR_ERR(st->dvdd)); in adau7118_regulator_setup()
476 return PTR_ERR(st->dvdd); in adau7118_regulator_setup()
479 if (!st->hw_mode) { in adau7118_regulator_setup()
480 regcache_mark_dirty(st->map); in adau7118_regulator_setup()
481 regcache_cache_only(st->map, true); in adau7118_regulator_setup()
484 return devm_add_action_or_reset(st->dev, adau7118_regulator_disable, in adau7118_regulator_setup()
495 if (st->hw_mode) in adau7118_parset_dt()
498 ret = device_property_read_u32(st->dev, "adi,decimation-ratio", in adau7118_parset_dt()
512 dev_err(st->dev, "Invalid dec ratio: %u", dec_ratio); in adau7118_parset_dt()
513 return -EINVAL; in adau7118_parset_dt()
516 ret = regmap_update_bits(st->map, in adau7118_parset_dt()
523 ret = device_property_read_u32_array(st->dev, "adi,pdm-clk-map", in adau7118_parset_dt()
532 ret = regmap_update_bits(st->map, in adau7118_parset_dt()
549 return -ENOMEM; in adau7118_probe()
551 st->dev = dev; in adau7118_probe()
552 st->hw_mode = hw_mode; in adau7118_probe()
556 st->map = map; in adau7118_probe()
584 MODULE_DESCRIPTION("ADAU7118 8 channel PDM-to-I2S/TDM Converter driver");