Lines Matching refs:codec
411 static void pll_factors(struct snd_soc_codec *codec, in pll_factors() argument
427 dev_warn(codec->dev, in pll_factors()
474 static int wm8978_configure_pll(struct snd_soc_codec *codec) in wm8978_configure_pll() argument
476 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_configure_pll()
508 dev_dbg(codec->dev, "%s: OPCLKDIV=%d\n", __func__, opclk_div); in wm8978_configure_pll()
510 snd_soc_update_bits(codec, WM8978_GPIO_CONTROL, 0x30, in wm8978_configure_pll()
536 dev_dbg(codec->dev, "%s: f_MCLK=%uHz, f_PLLOUT=%uHz\n", __func__, in wm8978_configure_pll()
539 pll_factors(codec, &pll_div, f2, wm8978->f_mclk); in wm8978_configure_pll()
541 dev_dbg(codec->dev, "%s: calculated PLL N=0x%x, K=0x%x, div2=%d\n", in wm8978_configure_pll()
545 snd_soc_update_bits(codec, WM8978_POWER_MANAGEMENT_1, 0x20, 0); in wm8978_configure_pll()
547 snd_soc_write(codec, WM8978_PLL_N, (pll_div.div2 << 4) | pll_div.n); in wm8978_configure_pll()
548 snd_soc_write(codec, WM8978_PLL_K1, pll_div.k >> 18); in wm8978_configure_pll()
549 snd_soc_write(codec, WM8978_PLL_K2, (pll_div.k >> 9) & 0x1ff); in wm8978_configure_pll()
550 snd_soc_write(codec, WM8978_PLL_K3, pll_div.k & 0x1ff); in wm8978_configure_pll()
553 snd_soc_update_bits(codec, WM8978_POWER_MANAGEMENT_1, 0x20, 0x20); in wm8978_configure_pll()
557 snd_soc_update_bits(codec, WM8978_GPIO_CONTROL, 7, 4); in wm8978_configure_pll()
568 struct snd_soc_codec *codec = codec_dai->codec; in wm8978_set_dai_clkdiv() local
569 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_set_dai_clkdiv()
591 ret = wm8978_configure_pll(codec); in wm8978_set_dai_clkdiv()
596 snd_soc_update_bits(codec, WM8978_CLOCKING, 0x1c, div); in wm8978_set_dai_clkdiv()
602 dev_dbg(codec->dev, "%s: ID %d, value %u\n", __func__, div_id, div); in wm8978_set_dai_clkdiv()
613 struct snd_soc_codec *codec = codec_dai->codec; in wm8978_set_dai_sysclk() local
614 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_set_dai_sysclk()
617 dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq); in wm8978_set_dai_sysclk()
624 ret = wm8978_configure_pll(codec); in wm8978_set_dai_sysclk()
634 snd_soc_update_bits(codec, WM8978_CLOCKING, 0x100, 0); in wm8978_set_dai_sysclk()
637 snd_soc_update_bits(codec, WM8978_GPIO_CONTROL, 7, 0); in wm8978_set_dai_sysclk()
640 snd_soc_update_bits(codec, WM8978_POWER_MANAGEMENT_1, 0x20, 0); in wm8978_set_dai_sysclk()
654 struct snd_soc_codec *codec = codec_dai->codec; in wm8978_set_dai_fmt() local
659 u16 iface = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x198; in wm8978_set_dai_fmt()
660 u16 clk = snd_soc_read(codec, WM8978_CLOCKING); in wm8978_set_dai_fmt()
662 dev_dbg(codec->dev, "%s\n", __func__); in wm8978_set_dai_fmt()
710 snd_soc_write(codec, WM8978_AUDIO_INTERFACE, iface); in wm8978_set_dai_fmt()
711 snd_soc_write(codec, WM8978_CLOCKING, clk); in wm8978_set_dai_fmt()
723 struct snd_soc_codec *codec = dai->codec; in wm8978_hw_params() local
724 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_hw_params()
726 u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60; in wm8978_hw_params()
728 u16 add_ctl = snd_soc_read(codec, WM8978_ADDITIONAL_CONTROL) & ~0xe; in wm8978_hw_params()
729 u16 clking = snd_soc_read(codec, WM8978_CLOCKING); in wm8978_hw_params()
784 int ret = wm8978_configure_pll(codec); in wm8978_hw_params()
815 dev_warn(codec->dev, "Imprecise sampling rate: %uHz%s\n", in wm8978_hw_params()
820 dev_dbg(codec->dev, "%s: width %d, rate %u, MCLK divisor #%d\n", __func__, in wm8978_hw_params()
824 snd_soc_update_bits(codec, WM8978_CLOCKING, 0xe0, best << 5); in wm8978_hw_params()
826 snd_soc_write(codec, WM8978_AUDIO_INTERFACE, iface_ctl); in wm8978_hw_params()
827 snd_soc_write(codec, WM8978_ADDITIONAL_CONTROL, add_ctl); in wm8978_hw_params()
832 snd_soc_update_bits(codec, WM8978_CLOCKING, in wm8978_hw_params()
836 snd_soc_update_bits(codec, WM8978_CLOCKING, 0x100, 0); in wm8978_hw_params()
844 struct snd_soc_codec *codec = dai->codec; in wm8978_mute() local
846 dev_dbg(codec->dev, "%s: %d\n", __func__, mute); in wm8978_mute()
849 snd_soc_update_bits(codec, WM8978_DAC_CONTROL, 0x40, 0x40); in wm8978_mute()
851 snd_soc_update_bits(codec, WM8978_DAC_CONTROL, 0x40, 0); in wm8978_mute()
856 static int wm8978_set_bias_level(struct snd_soc_codec *codec, in wm8978_set_bias_level() argument
859 u16 power1 = snd_soc_read(codec, WM8978_POWER_MANAGEMENT_1) & ~3; in wm8978_set_bias_level()
865 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, power1); in wm8978_set_bias_level()
871 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8978_set_bias_level()
873 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, in wm8978_set_bias_level()
879 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, power1); in wm8978_set_bias_level()
883 snd_soc_update_bits(codec, WM8978_POWER_MANAGEMENT_1, ~0x20, 0); in wm8978_set_bias_level()
884 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_2, 0); in wm8978_set_bias_level()
885 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_3, 0); in wm8978_set_bias_level()
889 dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1); in wm8978_set_bias_level()
926 static int wm8978_suspend(struct snd_soc_codec *codec) in wm8978_suspend() argument
928 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_suspend()
930 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); in wm8978_suspend()
932 snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, 0); in wm8978_suspend()
939 static int wm8978_resume(struct snd_soc_codec *codec) in wm8978_resume() argument
941 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_resume()
946 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); in wm8978_resume()
950 snd_soc_update_bits(codec, WM8978_POWER_MANAGEMENT_1, 0x20, 0x20); in wm8978_resume()
974 static int wm8978_probe(struct snd_soc_codec *codec) in wm8978_probe() argument
976 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); in wm8978_probe()
991 snd_soc_update_bits(codec, update_reg[i], 0x100, 0x100); in wm8978_probe()