Lines Matching +full:pdm +full:- +full:clk +full:- +full:map

1 // SPDX-License-Identifier: GPL-2.0
3 // Analog Devices ADAU7118 8 channel PDM-to-I2S/TDM Converter driver
36 struct regmap *map; member
65 /* PDM Clocks */
130 snd_soc_component_get_drvdata(dai->component); in adau7118_set_channel_map()
133 dev_dbg(st->dev, "Set channel map, %d", tx_num); in adau7118_set_channel_map()
136 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_channel_map()
150 snd_soc_component_get_drvdata(dai->component); in adau7118_set_fmt()
154 dev_dbg(st->dev, "Set format, fmt:%d\n", fmt); in adau7118_set_fmt()
158 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
164 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
170 st->right_j = true; in adau7118_set_fmt()
173 dev_err(st->dev, "Invalid format %d", in adau7118_set_fmt()
175 return -EINVAL; in adau7118_set_fmt()
195 dev_err(st->dev, "Invalid Inv mask %d", in adau7118_set_fmt()
197 return -EINVAL; in adau7118_set_fmt()
200 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_fmt()
213 snd_soc_component_get_drvdata(dai->component); in adau7118_set_tristate()
216 dev_dbg(st->dev, "Set tristate, %d\n", tristate); in adau7118_set_tristate()
218 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_tristate()
233 snd_soc_component_get_drvdata(dai->component); in adau7118_set_tdm_slot()
237 dev_dbg(st->dev, "Set tdm, slots:%d width:%d\n", slots, slot_width); in adau7118_set_tdm_slot()
250 dev_err(st->dev, "Invalid slot width:%d\n", slot_width); in adau7118_set_tdm_slot()
251 return -EINVAL; in adau7118_set_tdm_slot()
254 ret = snd_soc_component_update_bits(dai->component, in adau7118_set_tdm_slot()
260 st->slot_width = slot_width; in adau7118_set_tdm_slot()
261 st->slots = slots; in adau7118_set_tdm_slot()
271 snd_soc_component_get_drvdata(dai->component); in adau7118_hw_params()
276 if (!st->slots) { in adau7118_hw_params()
278 ret = snd_soc_component_update_bits(dai->component, in adau7118_hw_params()
287 slots_width = st->slot_width; in adau7118_hw_params()
291 dev_err(st->dev, "Invalid data_width:%d, slots_width:%d", in adau7118_hw_params()
293 return -EINVAL; in adau7118_hw_params()
296 if (st->right_j) { in adau7118_hw_params()
297 switch (slots_width - data_width) { in adau7118_hw_params()
311 dev_err(st->dev, in adau7118_hw_params()
314 return -EINVAL; in adau7118_hw_params()
317 ret = snd_soc_component_update_bits(dai->component, in adau7118_hw_params()
334 dev_dbg(st->dev, "Set bias level %d\n", level); in adau7118_set_bias_level()
345 ret = regulator_enable(st->iovdd); in adau7118_set_bias_level()
350 ret = regulator_enable(st->dvdd); in adau7118_set_bias_level()
352 regulator_disable(st->iovdd); in adau7118_set_bias_level()
356 if (st->hw_mode) in adau7118_set_bias_level()
359 regcache_cache_only(st->map, false); in adau7118_set_bias_level()
366 ret = regulator_disable(st->dvdd); in adau7118_set_bias_level()
370 ret = regulator_disable(st->iovdd); in adau7118_set_bias_level()
374 if (st->hw_mode) in adau7118_set_bias_level()
378 regcache_mark_dirty(st->map); in adau7118_set_bias_level()
379 regcache_cache_only(st->map, true); in adau7118_set_bias_level()
394 if (st->hw_mode) { in adau7118_component_probe()
403 snd_soc_component_init_regmap(component, st->map); in adau7118_component_probe()
425 .name = "adau7118-hifi-capture",
451 st->iovdd = devm_regulator_get(st->dev, "iovdd"); in adau7118_regulator_setup()
452 if (IS_ERR(st->iovdd)) { in adau7118_regulator_setup()
453 dev_err(st->dev, "Could not get iovdd: %ld\n", in adau7118_regulator_setup()
454 PTR_ERR(st->iovdd)); in adau7118_regulator_setup()
455 return PTR_ERR(st->iovdd); in adau7118_regulator_setup()
458 st->dvdd = devm_regulator_get(st->dev, "dvdd"); in adau7118_regulator_setup()
459 if (IS_ERR(st->dvdd)) { in adau7118_regulator_setup()
460 dev_err(st->dev, "Could not get dvdd: %ld\n", in adau7118_regulator_setup()
461 PTR_ERR(st->dvdd)); in adau7118_regulator_setup()
462 return PTR_ERR(st->dvdd); in adau7118_regulator_setup()
465 if (!st->hw_mode) { in adau7118_regulator_setup()
466 regcache_mark_dirty(st->map); in adau7118_regulator_setup()
467 regcache_cache_only(st->map, true); in adau7118_regulator_setup()
480 if (st->hw_mode) in adau7118_parset_dt()
483 ret = device_property_read_u32(st->dev, "adi,decimation-ratio", in adau7118_parset_dt()
497 dev_err(st->dev, "Invalid dec ratio: %u", dec_ratio); in adau7118_parset_dt()
498 return -EINVAL; in adau7118_parset_dt()
501 ret = regmap_update_bits(st->map, in adau7118_parset_dt()
508 ret = device_property_read_u32_array(st->dev, "adi,pdm-clk-map", in adau7118_parset_dt()
511 int pdm; in adau7118_parset_dt() local
514 for (pdm = 0; pdm < ARRAY_SIZE(clk_map); pdm++) in adau7118_parset_dt()
515 _clk_map |= (clk_map[pdm] << (pdm + 4)); in adau7118_parset_dt()
517 ret = regmap_update_bits(st->map, in adau7118_parset_dt()
527 int adau7118_probe(struct device *dev, struct regmap *map, bool hw_mode) in adau7118_probe() argument
534 return -ENOMEM; in adau7118_probe()
536 st->dev = dev; in adau7118_probe()
537 st->hw_mode = hw_mode; in adau7118_probe()
541 st->map = map; in adau7118_probe()
547 ret = regmap_update_bits(map, ADAU7118_REG_RESET, in adau7118_probe()
569 MODULE_DESCRIPTION("ADAU7118 8 channel PDM-to-I2S/TDM Converter driver");