Lines Matching +full:codec +full:- +full:aif3
1 // SPDX-License-Identifier: GPL-2.0-only
3 * da732x.c --- Dialog DA732X ALSA SoC Audio Driver
24 #include <sound/soc-dapm.h>
41 * da732x register cache - default settings
184 return -EINVAL; in da732x_get_input_div()
327 struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; in da732x_hpf_set()
328 unsigned int reg = enum_ctrl->reg; in da732x_hpf_set()
329 unsigned int sel = ucontrol->value.enumerated.item[0]; in da732x_hpf_set()
343 return -EINVAL; in da732x_hpf_set()
355 struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; in da732x_hpf_get()
356 unsigned int reg = enum_ctrl->reg; in da732x_hpf_get()
363 ucontrol->value.enumerated.item[0] = DA732X_HPF_VOICE; in da732x_hpf_get()
366 ucontrol->value.enumerated.item[0] = DA732X_HPF_MUSIC; in da732x_hpf_get()
369 ucontrol->value.enumerated.item[0] = DA732X_HPF_DISABLED; in da732x_hpf_get()
604 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in da732x_adc_event()
608 switch (w->reg) { in da732x_adc_event()
620 return -EINVAL; in da732x_adc_event()
623 snd_soc_component_update_bits(component, w->reg, DA732X_ADC_RST_MASK, in da732x_adc_event()
625 snd_soc_component_update_bits(component, w->reg, DA732X_ADC_PD_MASK, in da732x_adc_event()
629 snd_soc_component_update_bits(component, w->reg, DA732X_ADC_PD_MASK, in da732x_adc_event()
631 snd_soc_component_update_bits(component, w->reg, DA732X_ADC_RST_MASK, in da732x_adc_event()
634 switch (w->reg) { in da732x_adc_event()
644 return -EINVAL; in da732x_adc_event()
649 return -EINVAL; in da732x_adc_event()
658 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in da732x_out_pga_event()
662 snd_soc_component_update_bits(component, w->reg, in da732x_out_pga_event()
663 (1 << w->shift) | DA732X_OUT_HIZ_EN, in da732x_out_pga_event()
664 (1 << w->shift) | DA732X_OUT_HIZ_EN); in da732x_out_pga_event()
667 snd_soc_component_update_bits(component, w->reg, in da732x_out_pga_event()
668 (1 << w->shift) | DA732X_OUT_HIZ_EN, in da732x_out_pga_event()
669 (1 << w->shift) | DA732X_OUT_HIZ_DIS); in da732x_out_pga_event()
672 return -EINVAL; in da732x_out_pga_event()
944 struct snd_soc_component *component = dai->component; in da732x_hw_params()
949 reg_aif = dai->driver->base; in da732x_hw_params()
965 return -EINVAL; in da732x_hw_params()
1003 return -EINVAL; in da732x_hw_params()
1014 struct snd_soc_component *component = dai->component; in da732x_set_dai_fmt()
1017 u32 reg_aif3, aif3; in da732x_set_dai_fmt() local
1019 switch (dai->id) { in da732x_set_dai_fmt()
1033 return -EINVAL; in da732x_set_dai_fmt()
1046 return -EINVAL; in da732x_set_dai_fmt()
1051 aif3 = DA732X_AIF_I2S_MODE; in da732x_set_dai_fmt()
1054 aif3 = DA732X_AIF_RIGHT_J_MODE; in da732x_set_dai_fmt()
1057 aif3 = DA732X_AIF_LEFT_J_MODE; in da732x_set_dai_fmt()
1060 aif3 = DA732X_AIF_DSP_MODE; in da732x_set_dai_fmt()
1063 return -EINVAL; in da732x_set_dai_fmt()
1073 aif3 |= DA732X_AIF_BCLK_INV; in da732x_set_dai_fmt()
1076 return -EINVAL; in da732x_set_dai_fmt()
1086 aif3 |= DA732X_AIF_BCLK_INV | DA732X_AIF_WCLK_INV; in da732x_set_dai_fmt()
1089 aif3 |= DA732X_AIF_BCLK_INV; in da732x_set_dai_fmt()
1092 aif3 |= DA732X_AIF_WCLK_INV; in da732x_set_dai_fmt()
1095 return -EINVAL; in da732x_set_dai_fmt()
1099 return -EINVAL; in da732x_set_dai_fmt()
1105 DA732X_AIF_WCLK_INV | DA732X_AIF_MODE_MASK, aif3); in da732x_set_dai_fmt()
1126 da732x->pll_en = false; in da732x_set_dai_pll()
1130 if (da732x->pll_en) in da732x_set_dai_pll()
1131 return -EBUSY; in da732x_set_dai_pll()
1135 switch (da732x->sysclk) { in da732x_set_dai_pll()
1146 dev_err(component->dev, in da732x_set_dai_pll()
1148 return -EINVAL; in da732x_set_dai_pll()
1152 indiv = da732x_get_input_div(component, da732x->sysclk); in da732x_set_dai_pll()
1156 fref = da732x->sysclk / BIT(indiv); in da732x_set_dai_pll()
1170 da732x->pll_en = true; in da732x_set_dai_pll()
1178 struct snd_soc_component *component = dai->component; in da732x_set_dai_sysclk()
1181 da732x->sysclk = freq; in da732x_set_dai_sysclk()
1422 /* Init Codec */ in da732x_set_bias_level()
1471 regcache_cache_only(da732x->regmap, false); in da732x_set_bias_level()
1472 regcache_sync(da732x->regmap); in da732x_set_bias_level()
1479 da732x->pll_en = false; in da732x_set_bias_level()
1483 regcache_cache_only(da732x->regmap, true); in da732x_set_bias_level()
1487 da732x->pll_en = false; in da732x_set_bias_level()
1514 da732x = devm_kzalloc(&i2c->dev, sizeof(struct da732x_priv), in da732x_i2c_probe()
1517 return -ENOMEM; in da732x_i2c_probe()
1521 da732x->regmap = devm_regmap_init_i2c(i2c, &da732x_regmap); in da732x_i2c_probe()
1522 if (IS_ERR(da732x->regmap)) { in da732x_i2c_probe()
1523 ret = PTR_ERR(da732x->regmap); in da732x_i2c_probe()
1524 dev_err(&i2c->dev, "Failed to initialize regmap\n"); in da732x_i2c_probe()
1528 ret = regmap_read(da732x->regmap, DA732X_REG_ID, ®); in da732x_i2c_probe()
1530 dev_err(&i2c->dev, "Failed to read ID register: %d\n", ret); in da732x_i2c_probe()
1534 dev_info(&i2c->dev, "Revision: %d.%d\n", in da732x_i2c_probe()
1538 ret = devm_snd_soc_register_component(&i2c->dev, in da732x_i2c_probe()
1542 dev_err(&i2c->dev, "Failed to register component.\n"); in da732x_i2c_probe()