Lines Matching refs:codec
158 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in mic_bias_event() local
159 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in mic_bias_event()
164 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, in mic_bias_event()
170 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, in mic_bias_event()
185 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in power_vag_event() local
190 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in power_vag_event()
200 if ((snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER) & in power_vag_event()
202 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in power_vag_event()
328 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in dac_get_volsw() local
333 reg = snd_soc_read(codec, SGTL5000_CHIP_DAC_VOL); in dac_get_volsw()
381 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in dac_put_volsw() local
401 snd_soc_write(codec, SGTL5000_CHIP_DAC_VOL, reg); in dac_put_volsw()
451 struct snd_soc_codec *codec = codec_dai->codec; in sgtl5000_digital_mute() local
454 snd_soc_update_bits(codec, SGTL5000_CHIP_ADCDAC_CTRL, in sgtl5000_digital_mute()
463 struct snd_soc_codec *codec = codec_dai->codec; in sgtl5000_set_dai_fmt() local
464 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_set_dai_fmt()
522 snd_soc_write(codec, SGTL5000_CHIP_I2S_CTRL, i2sctl); in sgtl5000_set_dai_fmt()
531 struct snd_soc_codec *codec = codec_dai->codec; in sgtl5000_set_dai_sysclk() local
532 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_set_dai_sysclk()
558 static int sgtl5000_set_clock(struct snd_soc_codec *codec, int frame_rate) in sgtl5000_set_clock() argument
560 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_set_clock()
613 dev_err(codec->dev, "frame rate %d not supported\n", in sgtl5000_set_clock()
642 dev_err(codec->dev, in sgtl5000_set_clock()
644 dev_err(codec->dev, "%d ratio is not supported. " in sgtl5000_set_clock()
677 snd_soc_write(codec, SGTL5000_CHIP_PLL_CTRL, pll_ctl); in sgtl5000_set_clock()
679 snd_soc_update_bits(codec, in sgtl5000_set_clock()
684 snd_soc_update_bits(codec, in sgtl5000_set_clock()
690 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in sgtl5000_set_clock()
695 snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL, clk_ctl); in sgtl5000_set_clock()
698 snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL, clk_ctl); in sgtl5000_set_clock()
701 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in sgtl5000_set_clock()
717 struct snd_soc_codec *codec = dai->codec; in sgtl5000_pcm_hw_params() local
718 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_pcm_hw_params()
726 dev_err(codec->dev, "%s: set sysclk first!\n", __func__); in sgtl5000_pcm_hw_params()
736 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, stereo, in sgtl5000_pcm_hw_params()
740 ret = sgtl5000_set_clock(codec, params_rate(params)); in sgtl5000_pcm_hw_params()
774 snd_soc_update_bits(codec, SGTL5000_CHIP_I2S_CTRL, in sgtl5000_pcm_hw_params()
792 struct snd_soc_codec *codec = (struct snd_soc_codec *)ldo->codec_data; in ldo_regulator_enable() local
806 snd_soc_update_bits(codec, SGTL5000_CHIP_LINREG_CTRL, in ldo_regulator_enable()
809 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in ldo_regulator_enable()
814 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in ldo_regulator_enable()
825 struct snd_soc_codec *codec = (struct snd_soc_codec *)ldo->codec_data; in ldo_regulator_disable() local
827 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in ldo_regulator_disable()
832 snd_soc_update_bits(codec, SGTL5000_CHIP_LINREG_CTRL, in ldo_regulator_disable()
854 static int ldo_regulator_register(struct snd_soc_codec *codec, in ldo_regulator_register() argument
859 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in ldo_regulator_register()
867 ldo->desc.name = kstrdup(dev_name(codec->dev), GFP_KERNEL); in ldo_regulator_register()
870 dev_err(codec->dev, "failed to allocate decs name memory\n"); in ldo_regulator_register()
879 ldo->codec_data = codec; in ldo_regulator_register()
882 config.dev = codec->dev; in ldo_regulator_register()
890 dev_err(codec->dev, "failed to register regulator\n"); in ldo_regulator_register()
901 static int ldo_regulator_remove(struct snd_soc_codec *codec) in ldo_regulator_remove() argument
903 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in ldo_regulator_remove()
916 static int ldo_regulator_register(struct snd_soc_codec *codec, in ldo_regulator_register() argument
920 dev_err(codec->dev, "this setup needs regulator support in the kernel\n"); in ldo_regulator_register()
924 static int ldo_regulator_remove(struct snd_soc_codec *codec) in ldo_regulator_remove() argument
940 static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, in sgtl5000_set_bias_level() argument
944 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_set_bias_level()
951 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { in sgtl5000_set_bias_level()
963 dev_err(codec->dev, in sgtl5000_set_bias_level()
982 codec->dapm.bias_level = level; in sgtl5000_set_bias_level()
1106 static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) in sgtl5000_set_power_regs() argument
1114 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_set_power_regs()
1125 dev_err(codec->dev, "regulator voltage not set correctly\n"); in sgtl5000_set_power_regs()
1132 dev_err(codec->dev, in sgtl5000_set_power_regs()
1140 ana_pwr = snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER); in sgtl5000_set_power_regs()
1144 lreg_ctrl = snd_soc_read(codec, SGTL5000_CHIP_LINREG_CTRL); in sgtl5000_set_power_regs()
1148 snd_soc_update_bits(codec, SGTL5000_CHIP_CLK_TOP_CTRL, in sgtl5000_set_power_regs()
1161 snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, lreg_ctrl); in sgtl5000_set_power_regs()
1163 snd_soc_write(codec, SGTL5000_CHIP_ANA_POWER, ana_pwr); in sgtl5000_set_power_regs()
1166 snd_soc_update_bits(codec, SGTL5000_CHIP_LINREG_CTRL, in sgtl5000_set_power_regs()
1175 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in sgtl5000_set_power_regs()
1179 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, in sgtl5000_set_power_regs()
1197 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, in sgtl5000_set_power_regs()
1211 snd_soc_update_bits(codec, SGTL5000_CHIP_LINE_OUT_CTRL, in sgtl5000_set_power_regs()
1221 static int sgtl5000_replace_vddd_with_ldo(struct snd_soc_codec *codec) in sgtl5000_replace_vddd_with_ldo() argument
1223 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_replace_vddd_with_ldo()
1227 ret = ldo_regulator_register(codec, &ldo_init_data, LDO_VOLTAGE); in sgtl5000_replace_vddd_with_ldo()
1229 dev_err(codec->dev, in sgtl5000_replace_vddd_with_ldo()
1236 dev_info(codec->dev, "Using internal LDO instead of VDDD\n"); in sgtl5000_replace_vddd_with_ldo()
1240 static int sgtl5000_enable_regulators(struct snd_soc_codec *codec) in sgtl5000_enable_regulators() argument
1245 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_enable_regulators()
1253 vddd = regulator_get_optional(codec->dev, "VDDD"); in sgtl5000_enable_regulators()
1265 ret = sgtl5000_replace_vddd_with_ldo(codec); in sgtl5000_enable_regulators()
1270 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(sgtl5000->supplies), in sgtl5000_enable_regulators()
1290 ldo_regulator_remove(codec); in sgtl5000_enable_regulators()
1295 static int sgtl5000_probe(struct snd_soc_codec *codec) in sgtl5000_probe() argument
1298 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_probe()
1300 ret = sgtl5000_enable_regulators(codec); in sgtl5000_probe()
1305 ret = sgtl5000_set_power_regs(codec); in sgtl5000_probe()
1310 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, in sgtl5000_probe()
1314 snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); in sgtl5000_probe()
1320 snd_soc_write(codec, SGTL5000_CHIP_SSS_CTRL, in sgtl5000_probe()
1322 snd_soc_write(codec, SGTL5000_CHIP_DIG_POWER, in sgtl5000_probe()
1326 snd_soc_write(codec, SGTL5000_CHIP_ADCDAC_CTRL, in sgtl5000_probe()
1331 snd_soc_write(codec, SGTL5000_CHIP_PAD_STRENGTH, 0x015f); in sgtl5000_probe()
1333 snd_soc_write(codec, SGTL5000_CHIP_ANA_CTRL, in sgtl5000_probe()
1337 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, in sgtl5000_probe()
1341 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, in sgtl5000_probe()
1349 snd_soc_write(codec, SGTL5000_DAP_CTRL, 0); in sgtl5000_probe()
1358 ldo_regulator_remove(codec); in sgtl5000_probe()
1363 static int sgtl5000_remove(struct snd_soc_codec *codec) in sgtl5000_remove() argument
1365 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); in sgtl5000_remove()
1371 ldo_regulator_remove(codec); in sgtl5000_remove()