Lines Matching refs:codec
469 static int _wm8993_set_fll(struct snd_soc_codec *codec, int fll_id, int source, in _wm8993_set_fll() argument
472 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in _wm8993_set_fll()
473 struct i2c_client *i2c = to_i2c_client(codec->dev); in _wm8993_set_fll()
485 dev_dbg(codec->dev, "FLL disabled\n"); in _wm8993_set_fll()
489 reg1 = snd_soc_read(codec, WM8993_FLL_CONTROL_1); in _wm8993_set_fll()
491 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1); in _wm8993_set_fll()
500 reg5 = snd_soc_read(codec, WM8993_FLL_CONTROL_5); in _wm8993_set_fll()
516 dev_err(codec->dev, "Unknown FLL ID %d\n", fll_id); in _wm8993_set_fll()
522 reg1 = snd_soc_read(codec, WM8993_FLL_CONTROL_1); in _wm8993_set_fll()
524 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1); in _wm8993_set_fll()
531 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1); in _wm8993_set_fll()
533 snd_soc_write(codec, WM8993_FLL_CONTROL_2, in _wm8993_set_fll()
536 snd_soc_write(codec, WM8993_FLL_CONTROL_3, fll_div.k); in _wm8993_set_fll()
538 reg4 = snd_soc_read(codec, WM8993_FLL_CONTROL_4); in _wm8993_set_fll()
541 snd_soc_write(codec, WM8993_FLL_CONTROL_4, reg4); in _wm8993_set_fll()
545 snd_soc_write(codec, WM8993_FLL_CONTROL_5, reg5); in _wm8993_set_fll()
558 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1 | WM8993_FLL_ENA); in _wm8993_set_fll()
562 dev_warn(codec->dev, "Timed out waiting for FLL\n"); in _wm8993_set_fll()
564 dev_dbg(codec->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout); in _wm8993_set_fll()
576 return _wm8993_set_fll(dai->codec, fll_id, source, Fref, Fout); in wm8993_set_fll()
579 static int configure_clock(struct snd_soc_codec *codec) in configure_clock() argument
581 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in configure_clock()
587 dev_dbg(codec->dev, "Using %dHz MCLK\n", wm8993->mclk_rate); in configure_clock()
589 reg = snd_soc_read(codec, WM8993_CLOCKING_2); in configure_clock()
598 snd_soc_write(codec, WM8993_CLOCKING_2, reg); in configure_clock()
602 dev_dbg(codec->dev, "Using %dHz FLL clock\n", in configure_clock()
605 reg = snd_soc_read(codec, WM8993_CLOCKING_2); in configure_clock()
614 snd_soc_write(codec, WM8993_CLOCKING_2, reg); in configure_clock()
618 dev_err(codec->dev, "System clock not configured\n"); in configure_clock()
622 dev_dbg(codec->dev, "CLK_SYS is %dHz\n", wm8993->sysclk_rate); in configure_clock()
812 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in clk_sys_event() local
816 return configure_clock(codec); in clk_sys_event()
975 static int wm8993_set_bias_level(struct snd_soc_codec *codec, in wm8993_set_bias_level() argument
978 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_bias_level()
981 wm_hubs_set_bias_level(codec, level); in wm8993_set_bias_level()
987 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
989 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_2, in wm8993_set_bias_level()
994 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8993_set_bias_level()
1003 wm_hubs_vmid_ena(codec); in wm8993_set_bias_level()
1006 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1020 snd_soc_update_bits(codec, WM8993_ANTIPOP1, in wm8993_set_bias_level()
1025 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1032 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1038 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1041 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_2, in wm8993_set_bias_level()
1046 snd_soc_update_bits(codec, WM8993_ANTIPOP1, in wm8993_set_bias_level()
1049 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1053 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1073 struct snd_soc_codec *codec = codec_dai->codec; in wm8993_set_sysclk() local
1074 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_sysclk()
1093 struct snd_soc_codec *codec = dai->codec; in wm8993_set_dai_fmt() local
1094 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_dai_fmt()
1095 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); in wm8993_set_dai_fmt()
1096 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); in wm8993_set_dai_fmt()
1179 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_1, aif1); in wm8993_set_dai_fmt()
1180 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_4, aif4); in wm8993_set_dai_fmt()
1189 struct snd_soc_codec *codec = dai->codec; in wm8993_hw_params() local
1190 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_hw_params()
1194 clocking1 = snd_soc_read(codec, WM8993_CLOCKING_1); in wm8993_hw_params()
1197 clocking3 = snd_soc_read(codec, WM8993_CLOCKING_3); in wm8993_hw_params()
1200 aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); in wm8993_hw_params()
1203 aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); in wm8993_hw_params()
1210 dev_dbg(codec->dev, "Configuring for %d %d bit TDM slots\n", in wm8993_hw_params()
1235 dev_dbg(codec->dev, "Target BCLK is %dHz\n", wm8993->bclk); in wm8993_hw_params()
1237 ret = configure_clock(codec); in wm8993_hw_params()
1253 dev_dbg(codec->dev, "Selected CLK_SYS_RATIO of %d\n", in wm8993_hw_params()
1269 dev_dbg(codec->dev, "Selected SAMPLE_RATE of %dHz\n", in wm8993_hw_params()
1288 dev_dbg(codec->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", in wm8993_hw_params()
1293 dev_dbg(codec->dev, "LRCLK_RATE is %d\n", wm8993->bclk / wm8993->fs); in wm8993_hw_params()
1296 snd_soc_write(codec, WM8993_CLOCKING_1, clocking1); in wm8993_hw_params()
1297 snd_soc_write(codec, WM8993_CLOCKING_3, clocking3); in wm8993_hw_params()
1298 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_1, aif1); in wm8993_hw_params()
1299 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_4, aif4); in wm8993_hw_params()
1303 u16 eq1 = snd_soc_read(codec, WM8993_EQ1); in wm8993_hw_params()
1319 dev_dbg(codec->dev, "ReTune Mobile %s tuned for %dHz\n", in wm8993_hw_params()
1323 snd_soc_update_bits(codec, WM8993_EQ1, WM8993_EQ_ENA, 0); in wm8993_hw_params()
1326 snd_soc_write(codec, WM8993_EQ1 + i, s->config[i]); in wm8993_hw_params()
1328 snd_soc_update_bits(codec, WM8993_EQ1, WM8993_EQ_ENA, eq1); in wm8993_hw_params()
1336 struct snd_soc_codec *codec = codec_dai->codec; in wm8993_digital_mute() local
1339 reg = snd_soc_read(codec, WM8993_DAC_CTRL); in wm8993_digital_mute()
1346 snd_soc_write(codec, WM8993_DAC_CTRL, reg); in wm8993_digital_mute()
1354 struct snd_soc_codec *codec = dai->codec; in wm8993_set_tdm_slot() local
1355 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_tdm_slot()
1397 snd_soc_update_bits(codec, WM8993_AUDIO_INTERFACE_1, in wm8993_set_tdm_slot()
1399 snd_soc_update_bits(codec, WM8993_AUDIO_INTERFACE_2, in wm8993_set_tdm_slot()
1482 static int wm8993_probe(struct snd_soc_codec *codec) in wm8993_probe() argument
1484 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_probe()
1485 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8993_probe()
1493 snd_soc_update_bits(codec, WM8993_RIGHT_DAC_DIGITAL_VOLUME, in wm8993_probe()
1495 snd_soc_update_bits(codec, WM8993_RIGHT_ADC_DIGITAL_VOLUME, in wm8993_probe()
1500 snd_soc_update_bits(codec, WM8993_ANALOGUE_HP_0, in wm8993_probe()
1504 snd_soc_update_bits(codec, WM8993_CLOCKING_4, WM8993_SR_MODE, 0); in wm8993_probe()
1506 wm_hubs_handle_analogue_pdata(codec, wm8993->pdata.lineout1_diff, in wm8993_probe()
1517 snd_soc_add_codec_controls(codec, wm8993_snd_controls, in wm8993_probe()
1520 dev_dbg(codec->dev, "Using ReTune Mobile\n"); in wm8993_probe()
1522 dev_dbg(codec->dev, "No ReTune Mobile, using normal EQ\n"); in wm8993_probe()
1523 snd_soc_add_codec_controls(codec, wm8993_eq_controls, in wm8993_probe()
1529 wm_hubs_add_analogue_controls(codec); in wm8993_probe()
1532 wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff, in wm8993_probe()
1546 static int wm8993_suspend(struct snd_soc_codec *codec) in wm8993_suspend() argument
1548 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_suspend()
1554 ret = _wm8993_set_fll(codec, 0, 0, 0, 0); in wm8993_suspend()
1556 dev_err(codec->dev, "Failed to stop FLL\n"); in wm8993_suspend()
1563 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); in wm8993_suspend()
1568 static int wm8993_resume(struct snd_soc_codec *codec) in wm8993_resume() argument
1570 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_resume()
1573 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); in wm8993_resume()
1583 ret = _wm8993_set_fll(codec, 0, wm8993->fll_src, in wm8993_resume()
1586 dev_err(codec->dev, "Failed to restart FLL\n"); in wm8993_resume()