if (!st->slots) { /* set stereo mode */
ret = snd_soc_component_update_bits(dai->component,
ADAU7118_REG_SPT_CTRL1,
ADAU7118_SAI_MODE_MASK,
ADAU7118_SAI_MODE(0)); if (ret < 0) return ret;
ret = snd_soc_component_update_bits(dai->component,
ADAU7118_REG_SPT_CTRL1,
ADAU7118_DATA_FMT_MASK,
regval); if (ret < 0) return ret;
}
return0;
}
staticint adau7118_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level)
{ struct adau7118_data *st = snd_soc_component_get_drvdata(component); int ret = 0;
dev_dbg(st->dev, "Set bias level %d\n", level);
switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: break;
case SND_SOC_BIAS_STANDBY: if (snd_soc_component_get_bias_level(component) ==
SND_SOC_BIAS_OFF) { /* power on */
ret = regulator_enable(st->iovdd); if (ret) return ret;
/* there's no timing constraints before enabling dvdd */
ret = regulator_enable(st->dvdd); if (ret) {
regulator_disable(st->iovdd); return ret;
}
if (st->hw_mode) return0;
regcache_cache_only(st->map, false); /* sync cache */
ret = snd_soc_component_cache_sync(component);
} break; case SND_SOC_BIAS_OFF: /* power off */
ret = regulator_disable(st->dvdd); if (ret) return ret;
ret = regulator_disable(st->iovdd); if (ret) return ret;
if (st->hw_mode) return0;
/* cache only */
regcache_mark_dirty(st->map);
regcache_cache_only(st->map, true);
break;
}
return ret;
}
staticint adau7118_component_probe(struct snd_soc_component *component)
{ struct adau7118_data *st = snd_soc_component_get_drvdata(component); struct snd_soc_dapm_context *dapm =
snd_soc_component_get_dapm(component); int ret = 0;
if (st->hw_mode) {
ret = snd_soc_dapm_new_controls(dapm, adau7118_widgets_hw,
ARRAY_SIZE(adau7118_widgets_hw)); if (ret) return ret;
ret = snd_soc_dapm_add_routes(dapm, adau7118_routes_hw,
ARRAY_SIZE(adau7118_routes_hw));
} else {
snd_soc_component_init_regmap(component, st->map);
ret = snd_soc_dapm_new_controls(dapm, adau7118_widgets_sw,
ARRAY_SIZE(adau7118_widgets_sw)); if (ret) return ret;
ret = snd_soc_dapm_add_routes(dapm, adau7118_routes_sw,
ARRAY_SIZE(adau7118_routes_sw));
}
staticint adau7118_regulator_setup(struct adau7118_data *st)
{
st->iovdd = devm_regulator_get(st->dev, "iovdd"); if (IS_ERR(st->iovdd)) {
dev_err(st->dev, "Could not get iovdd: %ld\n",
PTR_ERR(st->iovdd)); return PTR_ERR(st->iovdd);
}
st->dvdd = devm_regulator_get(st->dev, "dvdd"); if (IS_ERR(st->dvdd)) {
dev_err(st->dev, "Could not get dvdd: %ld\n",
PTR_ERR(st->dvdd)); return PTR_ERR(st->dvdd);
} /* just assume the device is in reset */ if (!st->hw_mode) {
regcache_mark_dirty(st->map);
regcache_cache_only(st->map, true);
}
if (!hw_mode) {
st->map = map;
adau7118_dai.ops = &adau7118_ops; /* * Perform a full soft reset. This will set all register's * with their reset values.
*/
ret = regmap_update_bits(map, ADAU7118_REG_RESET,
ADAU7118_FULL_SOFT_R_MASK,
ADAU7118_FULL_SOFT_R(1)); if (ret) return ret;
}
ret = adau7118_parset_dt(st); if (ret) return ret;
ret = adau7118_regulator_setup(st); if (ret) return ret;
MODULE_AUTHOR("Nuno Sa <nuno.sa@analog.com>");
MODULE_DESCRIPTION("ADAU7118 8 channel PDM-to-I2S/TDM Converter driver");
MODULE_LICENSE("GPL");
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet am 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.