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()
813 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in clk_sys_event() local
817 return configure_clock(codec); in clk_sys_event()
976 static int wm8993_set_bias_level(struct snd_soc_codec *codec, in wm8993_set_bias_level() argument
979 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_bias_level()
982 wm_hubs_set_bias_level(codec, level); in wm8993_set_bias_level()
988 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
990 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_2, in wm8993_set_bias_level()
995 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { in wm8993_set_bias_level()
1004 wm_hubs_vmid_ena(codec); in wm8993_set_bias_level()
1007 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1021 snd_soc_update_bits(codec, WM8993_ANTIPOP1, in wm8993_set_bias_level()
1026 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1033 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1039 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1042 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_2, in wm8993_set_bias_level()
1047 snd_soc_update_bits(codec, WM8993_ANTIPOP1, in wm8993_set_bias_level()
1050 snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, in wm8993_set_bias_level()
1054 snd_soc_update_bits(codec, WM8993_ANTIPOP2, in wm8993_set_bias_level()
1068 codec->dapm.bias_level = level; in wm8993_set_bias_level()
1076 struct snd_soc_codec *codec = codec_dai->codec; in wm8993_set_sysclk() local
1077 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_sysclk()
1096 struct snd_soc_codec *codec = dai->codec; in wm8993_set_dai_fmt() local
1097 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_dai_fmt()
1098 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); in wm8993_set_dai_fmt()
1099 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); in wm8993_set_dai_fmt()
1182 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_1, aif1); in wm8993_set_dai_fmt()
1183 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_4, aif4); in wm8993_set_dai_fmt()
1192 struct snd_soc_codec *codec = dai->codec; in wm8993_hw_params() local
1193 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_hw_params()
1197 clocking1 = snd_soc_read(codec, WM8993_CLOCKING_1); in wm8993_hw_params()
1200 clocking3 = snd_soc_read(codec, WM8993_CLOCKING_3); in wm8993_hw_params()
1203 aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); in wm8993_hw_params()
1206 aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); in wm8993_hw_params()
1213 dev_dbg(codec->dev, "Configuring for %d %d bit TDM slots\n", in wm8993_hw_params()
1238 dev_dbg(codec->dev, "Target BCLK is %dHz\n", wm8993->bclk); in wm8993_hw_params()
1240 ret = configure_clock(codec); in wm8993_hw_params()
1256 dev_dbg(codec->dev, "Selected CLK_SYS_RATIO of %d\n", in wm8993_hw_params()
1272 dev_dbg(codec->dev, "Selected SAMPLE_RATE of %dHz\n", in wm8993_hw_params()
1291 dev_dbg(codec->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", in wm8993_hw_params()
1296 dev_dbg(codec->dev, "LRCLK_RATE is %d\n", wm8993->bclk / wm8993->fs); in wm8993_hw_params()
1299 snd_soc_write(codec, WM8993_CLOCKING_1, clocking1); in wm8993_hw_params()
1300 snd_soc_write(codec, WM8993_CLOCKING_3, clocking3); in wm8993_hw_params()
1301 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_1, aif1); in wm8993_hw_params()
1302 snd_soc_write(codec, WM8993_AUDIO_INTERFACE_4, aif4); in wm8993_hw_params()
1306 u16 eq1 = snd_soc_read(codec, WM8993_EQ1); in wm8993_hw_params()
1322 dev_dbg(codec->dev, "ReTune Mobile %s tuned for %dHz\n", in wm8993_hw_params()
1326 snd_soc_update_bits(codec, WM8993_EQ1, WM8993_EQ_ENA, 0); in wm8993_hw_params()
1329 snd_soc_write(codec, WM8993_EQ1 + i, s->config[i]); in wm8993_hw_params()
1331 snd_soc_update_bits(codec, WM8993_EQ1, WM8993_EQ_ENA, eq1); in wm8993_hw_params()
1339 struct snd_soc_codec *codec = codec_dai->codec; in wm8993_digital_mute() local
1342 reg = snd_soc_read(codec, WM8993_DAC_CTRL); in wm8993_digital_mute()
1349 snd_soc_write(codec, WM8993_DAC_CTRL, reg); in wm8993_digital_mute()
1357 struct snd_soc_codec *codec = dai->codec; in wm8993_set_tdm_slot() local
1358 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_set_tdm_slot()
1400 snd_soc_update_bits(codec, WM8993_AUDIO_INTERFACE_1, in wm8993_set_tdm_slot()
1402 snd_soc_update_bits(codec, WM8993_AUDIO_INTERFACE_2, in wm8993_set_tdm_slot()
1485 static int wm8993_probe(struct snd_soc_codec *codec) in wm8993_probe() argument
1487 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_probe()
1488 struct snd_soc_dapm_context *dapm = &codec->dapm; in wm8993_probe()
1496 snd_soc_update_bits(codec, WM8993_RIGHT_DAC_DIGITAL_VOLUME, in wm8993_probe()
1498 snd_soc_update_bits(codec, WM8993_RIGHT_ADC_DIGITAL_VOLUME, in wm8993_probe()
1503 snd_soc_update_bits(codec, WM8993_ANALOGUE_HP_0, in wm8993_probe()
1507 snd_soc_update_bits(codec, WM8993_CLOCKING_4, WM8993_SR_MODE, 0); in wm8993_probe()
1509 wm_hubs_handle_analogue_pdata(codec, wm8993->pdata.lineout1_diff, in wm8993_probe()
1520 snd_soc_add_codec_controls(codec, wm8993_snd_controls, in wm8993_probe()
1523 dev_dbg(codec->dev, "Using ReTune Mobile\n"); in wm8993_probe()
1525 dev_dbg(codec->dev, "No ReTune Mobile, using normal EQ\n"); in wm8993_probe()
1526 snd_soc_add_codec_controls(codec, wm8993_eq_controls, in wm8993_probe()
1532 wm_hubs_add_analogue_controls(codec); in wm8993_probe()
1535 wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff, in wm8993_probe()
1542 codec->dapm.idle_bias_off = 1; in wm8993_probe()
1549 static int wm8993_suspend(struct snd_soc_codec *codec) in wm8993_suspend() argument
1551 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_suspend()
1557 ret = _wm8993_set_fll(codec, 0, 0, 0, 0); in wm8993_suspend()
1559 dev_err(codec->dev, "Failed to stop FLL\n"); in wm8993_suspend()
1566 wm8993_set_bias_level(codec, SND_SOC_BIAS_OFF); in wm8993_suspend()
1571 static int wm8993_resume(struct snd_soc_codec *codec) in wm8993_resume() argument
1573 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); in wm8993_resume()
1576 wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY); in wm8993_resume()
1586 ret = _wm8993_set_fll(codec, 0, wm8993->fll_src, in wm8993_resume()
1589 dev_err(codec->dev, "Failed to restart FLL\n"); in wm8993_resume()