Lines Matching refs:codec
343 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in speaker_mode_get() local
346 reg = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_2); in speaker_mode_get()
364 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in speaker_mode_put() local
365 unsigned int reg_pwr = snd_soc_read(codec, WM9081_POWER_MANAGEMENT); in speaker_mode_put()
366 unsigned int reg2 = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_2); in speaker_mode_put()
387 snd_soc_write(codec, WM9081_ANALOGUE_SPEAKER_2, reg2); in speaker_mode_put()
550 static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id, in wm9081_set_fll() argument
553 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_set_fll()
565 dev_dbg(codec->dev, "FLL disabled\n"); in wm9081_set_fll()
576 reg5 = snd_soc_read(codec, WM9081_FLL_CONTROL_5); in wm9081_set_fll()
585 dev_err(codec->dev, "Unknown FLL ID %d\n", fll_id); in wm9081_set_fll()
590 clk_sys_reg = snd_soc_read(codec, WM9081_CLOCK_CONTROL_3); in wm9081_set_fll()
592 snd_soc_write(codec, WM9081_CLOCK_CONTROL_3, in wm9081_set_fll()
597 reg1 = snd_soc_read(codec, WM9081_FLL_CONTROL_1); in wm9081_set_fll()
599 snd_soc_write(codec, WM9081_FLL_CONTROL_1, reg1); in wm9081_set_fll()
606 snd_soc_write(codec, WM9081_FLL_CONTROL_1, reg1); in wm9081_set_fll()
608 snd_soc_write(codec, WM9081_FLL_CONTROL_2, in wm9081_set_fll()
611 snd_soc_write(codec, WM9081_FLL_CONTROL_3, fll_div.k); in wm9081_set_fll()
613 reg4 = snd_soc_read(codec, WM9081_FLL_CONTROL_4); in wm9081_set_fll()
616 snd_soc_write(codec, WM9081_FLL_CONTROL_4, reg4); in wm9081_set_fll()
620 snd_soc_write(codec, WM9081_FLL_CONTROL_5, reg5); in wm9081_set_fll()
623 snd_soc_update_bits(codec, WM9081_FLL_CONTROL_4, in wm9081_set_fll()
627 snd_soc_write(codec, WM9081_FLL_CONTROL_1, reg1 | WM9081_FLL_ENA); in wm9081_set_fll()
631 snd_soc_write(codec, WM9081_CLOCK_CONTROL_3, clk_sys_reg); in wm9081_set_fll()
633 dev_dbg(codec->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout); in wm9081_set_fll()
641 static int configure_clock(struct snd_soc_codec *codec) in configure_clock() argument
643 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in configure_clock()
658 wm9081_set_fll(codec, WM9081_SYSCLK_FLL_MCLK, 0, 0); in configure_clock()
699 ret = wm9081_set_fll(codec, WM9081_SYSCLK_FLL_MCLK, in configure_clock()
715 reg = snd_soc_read(codec, WM9081_CLOCK_CONTROL_1); in configure_clock()
720 snd_soc_write(codec, WM9081_CLOCK_CONTROL_1, reg); in configure_clock()
722 reg = snd_soc_read(codec, WM9081_CLOCK_CONTROL_3); in configure_clock()
727 snd_soc_write(codec, WM9081_CLOCK_CONTROL_3, reg); in configure_clock()
729 dev_dbg(codec->dev, "CLK_SYS is %dHz\n", wm9081->sysclk_rate); in configure_clock()
737 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in clk_sys_event() local
738 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in clk_sys_event()
743 dev_dbg(codec->dev, "Using %dHz MCLK\n", wm9081->mclk_rate); in clk_sys_event()
746 dev_dbg(codec->dev, "Using %dHz MCLK with FLL\n", in clk_sys_event()
750 dev_err(codec->dev, "System clock not configured\n"); in clk_sys_event()
756 configure_clock(codec); in clk_sys_event()
761 wm9081_set_fll(codec, 0, 0, 0); in clk_sys_event()
820 static int wm9081_set_bias_level(struct snd_soc_codec *codec, in wm9081_set_bias_level() argument
823 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_set_bias_level()
831 snd_soc_update_bits(codec, WM9081_VMID_CONTROL, in wm9081_set_bias_level()
835 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, in wm9081_set_bias_level()
841 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { in wm9081_set_bias_level()
846 snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, in wm9081_set_bias_level()
850 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, in wm9081_set_bias_level()
855 snd_soc_update_bits(codec, WM9081_VMID_CONTROL, in wm9081_set_bias_level()
863 snd_soc_update_bits(codec, WM9081_VMID_CONTROL, in wm9081_set_bias_level()
867 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, in wm9081_set_bias_level()
872 snd_soc_update_bits(codec, WM9081_VMID_CONTROL, in wm9081_set_bias_level()
876 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, in wm9081_set_bias_level()
883 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, in wm9081_set_bias_level()
888 snd_soc_update_bits(codec, WM9081_VMID_CONTROL, in wm9081_set_bias_level()
893 snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, in wm9081_set_bias_level()
901 codec->dapm.bias_level = level; in wm9081_set_bias_level()
909 struct snd_soc_codec *codec = dai->codec; in wm9081_set_dai_fmt() local
910 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_set_dai_fmt()
911 unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2); in wm9081_set_dai_fmt()
992 snd_soc_write(codec, WM9081_AUDIO_INTERFACE_2, aif2); in wm9081_set_dai_fmt()
1001 struct snd_soc_codec *codec = dai->codec; in wm9081_hw_params() local
1002 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_hw_params()
1006 clk_ctrl2 = snd_soc_read(codec, WM9081_CLOCK_CONTROL_2); in wm9081_hw_params()
1009 aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1); in wm9081_hw_params()
1011 aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2); in wm9081_hw_params()
1014 aif3 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_3); in wm9081_hw_params()
1017 aif4 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_4); in wm9081_hw_params()
1053 dev_dbg(codec->dev, "Target BCLK is %dHz\n", wm9081->bclk); in wm9081_hw_params()
1055 ret = configure_clock(codec); in wm9081_hw_params()
1071 dev_dbg(codec->dev, "Selected CLK_SYS_RATIO of %d\n", in wm9081_hw_params()
1087 dev_dbg(codec->dev, "Selected SAMPLE_RATE of %dHz\n", in wm9081_hw_params()
1106 dev_dbg(codec->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", in wm9081_hw_params()
1111 dev_dbg(codec->dev, "LRCLK_RATE is %d\n", wm9081->bclk / wm9081->fs); in wm9081_hw_params()
1132 dev_dbg(codec->dev, "ReTune Mobile %s tuned for %dHz\n", in wm9081_hw_params()
1136 eq1 = snd_soc_read(codec, WM9081_EQ_1) & WM9081_EQ_ENA; in wm9081_hw_params()
1138 snd_soc_write(codec, WM9081_EQ_1, 0); in wm9081_hw_params()
1142 snd_soc_write(codec, WM9081_EQ_1 + i, s->config[i]); in wm9081_hw_params()
1145 snd_soc_write(codec, WM9081_EQ_1, eq1); in wm9081_hw_params()
1148 snd_soc_write(codec, WM9081_CLOCK_CONTROL_2, clk_ctrl2); in wm9081_hw_params()
1149 snd_soc_write(codec, WM9081_AUDIO_INTERFACE_2, aif2); in wm9081_hw_params()
1150 snd_soc_write(codec, WM9081_AUDIO_INTERFACE_3, aif3); in wm9081_hw_params()
1151 snd_soc_write(codec, WM9081_AUDIO_INTERFACE_4, aif4); in wm9081_hw_params()
1158 struct snd_soc_codec *codec = codec_dai->codec; in wm9081_digital_mute() local
1161 reg = snd_soc_read(codec, WM9081_DAC_DIGITAL_2); in wm9081_digital_mute()
1168 snd_soc_write(codec, WM9081_DAC_DIGITAL_2, reg); in wm9081_digital_mute()
1173 static int wm9081_set_sysclk(struct snd_soc_codec *codec, int clk_id, in wm9081_set_sysclk() argument
1176 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_set_sysclk()
1195 struct snd_soc_codec *codec = dai->codec; in wm9081_set_tdm_slot() local
1196 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_set_tdm_slot()
1197 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1); in wm9081_set_tdm_slot()
1227 snd_soc_write(codec, WM9081_AUDIO_INTERFACE_1, aif1); in wm9081_set_tdm_slot()
1260 static int wm9081_probe(struct snd_soc_codec *codec) in wm9081_probe() argument
1262 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); in wm9081_probe()
1265 snd_soc_update_bits(codec, WM9081_ANALOGUE_LINEOUT, in wm9081_probe()
1267 snd_soc_update_bits(codec, WM9081_ANALOGUE_SPEAKER_PGA, in wm9081_probe()
1271 dev_dbg(codec->dev, in wm9081_probe()
1273 snd_soc_add_codec_controls(codec, wm9081_eq_controls, in wm9081_probe()