Lines Matching full:wm8978
3 * wm8978.c -- WM8978 ALSA SoC Audio Codec driver
28 #include "wm8978.h"
425 "WM8978 N value exceeds recommended range! N = %u\n", in pll_factors()
469 * "PLL and Clock Select Circuit" in WM8978 datasheet Rev. 2.6
473 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_configure_pll() local
475 unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk, in wm8978_configure_pll()
476 f_256fs = wm8978->f_256fs; in wm8978_configure_pll()
485 wm8978->mclk_idx = -1; in wm8978_configure_pll()
510 wm8978->f_pllout = f_opclk * opclk_div; in wm8978_configure_pll()
522 int idx = wm8978_enum_mclk(f_256fs, f_mclk, &wm8978->f_pllout); in wm8978_configure_pll()
526 wm8978->mclk_idx = idx; in wm8978_configure_pll()
531 f2 = wm8978->f_pllout * 4; in wm8978_configure_pll()
534 wm8978->f_mclk, wm8978->f_pllout); in wm8978_configure_pll()
536 pll_factors(component, &pll_div, f2, wm8978->f_mclk); in wm8978_configure_pll()
560 * Configure WM8978 clock dividers.
566 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_set_dai_clkdiv() local
571 wm8978->f_opclk = div; in wm8978_set_dai_clkdiv()
573 if (wm8978->f_mclk) in wm8978_set_dai_clkdiv()
611 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_set_dai_sysclk() local
617 wm8978->f_mclk = freq; in wm8978_set_dai_sysclk()
620 if (wm8978->f_opclk) in wm8978_set_dai_sysclk()
626 wm8978->sysclk = clk_id; in wm8978_set_dai_sysclk()
629 if (wm8978->sysclk == WM8978_PLL && (!freq || clk_id == WM8978_MCLK)) { in wm8978_set_dai_sysclk()
638 wm8978->sysclk = WM8978_MCLK; in wm8978_set_dai_sysclk()
639 wm8978->f_pllout = 0; in wm8978_set_dai_sysclk()
640 wm8978->f_opclk = 0; in wm8978_set_dai_sysclk()
721 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_hw_params() local
732 if (!wm8978->f_mclk) in wm8978_hw_params()
773 wm8978->f_256fs = params_rate(params) * 256; in wm8978_hw_params()
775 if (wm8978->sysclk == WM8978_MCLK) { in wm8978_hw_params()
776 wm8978->mclk_idx = -1; in wm8978_hw_params()
777 f_sel = wm8978->f_mclk; in wm8978_hw_params()
779 if (!wm8978->f_opclk) { in wm8978_hw_params()
785 f_sel = wm8978->f_pllout; in wm8978_hw_params()
788 if (wm8978->mclk_idx < 0) { in wm8978_hw_params()
790 if (f_sel < wm8978->f_256fs || f_sel > 12 * wm8978->f_256fs) in wm8978_hw_params()
794 diff = abs(wm8978->f_256fs * 3 - in wm8978_hw_params()
807 best = wm8978->mclk_idx; in wm8978_hw_params()
814 wm8978->sysclk == WM8978_MCLK ? in wm8978_hw_params()
826 if (wm8978->sysclk != current_clk_id) { in wm8978_hw_params()
827 if (wm8978->sysclk == WM8978_PLL) in wm8978_hw_params()
905 .name = "wm8978-hifi",
926 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_suspend() local
932 regcache_mark_dirty(wm8978->regmap); in wm8978_suspend()
939 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_resume() local
942 regcache_sync(wm8978->regmap); in wm8978_resume()
946 if (wm8978->f_pllout) in wm8978_resume()
974 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_probe() local
981 wm8978->sysclk = WM8978_PLL; in wm8978_probe()
1024 struct wm8978_priv *wm8978; in wm8978_i2c_probe() local
1027 wm8978 = devm_kzalloc(&i2c->dev, sizeof(struct wm8978_priv), in wm8978_i2c_probe()
1029 if (wm8978 == NULL) in wm8978_i2c_probe()
1032 wm8978->regmap = devm_regmap_init_i2c(i2c, &wm8978_regmap_config); in wm8978_i2c_probe()
1033 if (IS_ERR(wm8978->regmap)) { in wm8978_i2c_probe()
1034 ret = PTR_ERR(wm8978->regmap); in wm8978_i2c_probe()
1039 i2c_set_clientdata(i2c, wm8978); in wm8978_i2c_probe()
1042 ret = regmap_write(wm8978->regmap, WM8978_RESET, 0); in wm8978_i2c_probe()
1059 { "wm8978" },
1065 { .compatible = "wlf,wm8978", },
1072 .name = "wm8978",
1081 MODULE_DESCRIPTION("ASoC WM8978 codec driver");