Lines Matching refs:component

408 static void pll_factors(struct snd_soc_component *component,  in pll_factors()  argument
424 dev_warn(component->dev, in pll_factors()
471 static int wm8978_configure_pll(struct snd_soc_component *component) in wm8978_configure_pll() argument
473 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_configure_pll()
505 dev_dbg(component->dev, "%s: OPCLKDIV=%d\n", __func__, opclk_div); in wm8978_configure_pll()
507 snd_soc_component_update_bits(component, WM8978_GPIO_CONTROL, 0x30, in wm8978_configure_pll()
533 dev_dbg(component->dev, "%s: f_MCLK=%uHz, f_PLLOUT=%uHz\n", __func__, in wm8978_configure_pll()
536 pll_factors(component, &pll_div, f2, wm8978->f_mclk); in wm8978_configure_pll()
538 dev_dbg(component->dev, "%s: calculated PLL N=0x%x, K=0x%x, div2=%d\n", in wm8978_configure_pll()
542 snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, 0x20, 0); in wm8978_configure_pll()
544 snd_soc_component_write(component, WM8978_PLL_N, (pll_div.div2 << 4) | pll_div.n); in wm8978_configure_pll()
545 snd_soc_component_write(component, WM8978_PLL_K1, pll_div.k >> 18); in wm8978_configure_pll()
546 snd_soc_component_write(component, WM8978_PLL_K2, (pll_div.k >> 9) & 0x1ff); in wm8978_configure_pll()
547 snd_soc_component_write(component, WM8978_PLL_K3, pll_div.k & 0x1ff); in wm8978_configure_pll()
550 snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, 0x20, 0x20); in wm8978_configure_pll()
554 snd_soc_component_update_bits(component, WM8978_GPIO_CONTROL, 7, 4); in wm8978_configure_pll()
565 struct snd_soc_component *component = codec_dai->component; in wm8978_set_dai_clkdiv() local
566 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_set_dai_clkdiv()
588 ret = wm8978_configure_pll(component); in wm8978_set_dai_clkdiv()
593 snd_soc_component_update_bits(component, WM8978_CLOCKING, 0x1c, div); in wm8978_set_dai_clkdiv()
599 dev_dbg(component->dev, "%s: ID %d, value %u\n", __func__, div_id, div); in wm8978_set_dai_clkdiv()
610 struct snd_soc_component *component = codec_dai->component; in wm8978_set_dai_sysclk() local
611 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_set_dai_sysclk()
614 dev_dbg(component->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq); in wm8978_set_dai_sysclk()
621 ret = wm8978_configure_pll(component); in wm8978_set_dai_sysclk()
631 snd_soc_component_update_bits(component, WM8978_CLOCKING, 0x100, 0); in wm8978_set_dai_sysclk()
634 snd_soc_component_update_bits(component, WM8978_GPIO_CONTROL, 7, 0); in wm8978_set_dai_sysclk()
637 snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, 0x20, 0); in wm8978_set_dai_sysclk()
651 struct snd_soc_component *component = codec_dai->component; in wm8978_set_dai_fmt() local
656 u16 iface = snd_soc_component_read(component, WM8978_AUDIO_INTERFACE) & ~0x198; in wm8978_set_dai_fmt()
657 u16 clk = snd_soc_component_read(component, WM8978_CLOCKING); in wm8978_set_dai_fmt()
659 dev_dbg(component->dev, "%s\n", __func__); in wm8978_set_dai_fmt()
707 snd_soc_component_write(component, WM8978_AUDIO_INTERFACE, iface); in wm8978_set_dai_fmt()
708 snd_soc_component_write(component, WM8978_CLOCKING, clk); in wm8978_set_dai_fmt()
720 struct snd_soc_component *component = dai->component; in wm8978_hw_params() local
721 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_hw_params()
723 u16 iface_ctl = snd_soc_component_read(component, WM8978_AUDIO_INTERFACE) & ~0x60; in wm8978_hw_params()
725 u16 add_ctl = snd_soc_component_read(component, WM8978_ADDITIONAL_CONTROL) & ~0xe; in wm8978_hw_params()
726 u16 clking = snd_soc_component_read(component, WM8978_CLOCKING); in wm8978_hw_params()
781 int ret = wm8978_configure_pll(component); in wm8978_hw_params()
812 dev_warn(component->dev, "Imprecise sampling rate: %uHz%s\n", in wm8978_hw_params()
817 dev_dbg(component->dev, "%s: width %d, rate %u, MCLK divisor #%d\n", __func__, in wm8978_hw_params()
821 snd_soc_component_update_bits(component, WM8978_CLOCKING, 0xe0, best << 5); in wm8978_hw_params()
823 snd_soc_component_write(component, WM8978_AUDIO_INTERFACE, iface_ctl); in wm8978_hw_params()
824 snd_soc_component_write(component, WM8978_ADDITIONAL_CONTROL, add_ctl); in wm8978_hw_params()
829 snd_soc_component_update_bits(component, WM8978_CLOCKING, in wm8978_hw_params()
833 snd_soc_component_update_bits(component, WM8978_CLOCKING, 0x100, 0); in wm8978_hw_params()
841 struct snd_soc_component *component = dai->component; in wm8978_mute() local
843 dev_dbg(component->dev, "%s: %d\n", __func__, mute); in wm8978_mute()
846 snd_soc_component_update_bits(component, WM8978_DAC_CONTROL, 0x40, 0x40); in wm8978_mute()
848 snd_soc_component_update_bits(component, WM8978_DAC_CONTROL, 0x40, 0); in wm8978_mute()
853 static int wm8978_set_bias_level(struct snd_soc_component *component, in wm8978_set_bias_level() argument
856 u16 power1 = snd_soc_component_read(component, WM8978_POWER_MANAGEMENT_1) & ~3; in wm8978_set_bias_level()
862 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_1, power1); in wm8978_set_bias_level()
868 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { in wm8978_set_bias_level()
870 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_1, in wm8978_set_bias_level()
876 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_1, power1); in wm8978_set_bias_level()
880 snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, ~0x20, 0); in wm8978_set_bias_level()
881 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_2, 0); in wm8978_set_bias_level()
882 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_3, 0); in wm8978_set_bias_level()
886 dev_dbg(component->dev, "%s: %d, %x\n", __func__, level, power1); in wm8978_set_bias_level()
924 static int wm8978_suspend(struct snd_soc_component *component) in wm8978_suspend() argument
926 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_suspend()
928 snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); in wm8978_suspend()
930 snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_1, 0); in wm8978_suspend()
937 static int wm8978_resume(struct snd_soc_component *component) in wm8978_resume() argument
939 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_resume()
944 snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); in wm8978_resume()
948 snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, 0x20, 0x20); in wm8978_resume()
972 static int wm8978_probe(struct snd_soc_component *component) in wm8978_probe() argument
974 struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component); in wm8978_probe()
989 snd_soc_component_update_bits(component, update_reg[i], 0x100, 0x100); in wm8978_probe()