Lines Matching refs:codec

52 static int wm8960_set_pll(struct snd_soc_codec *codec,
162 static int wm8960_set_deemph(struct snd_soc_codec *codec) in wm8960_set_deemph() argument
164 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_deemph()
183 dev_dbg(codec->dev, "Set deemphasis %d\n", val); in wm8960_set_deemph()
185 return snd_soc_update_bits(codec, WM8960_DACCTL1, in wm8960_set_deemph()
192 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8960_get_deemph() local
193 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_get_deemph()
202 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8960_put_deemph() local
203 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_put_deemph()
211 return wm8960_set_deemph(codec); in wm8960_put_deemph()
462 static int wm8960_add_widgets(struct snd_soc_codec *codec) in wm8960_add_widgets() argument
464 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_add_widgets()
466 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8960_add_widgets()
496 list_for_each_entry(w, &codec->component.card->widgets, list) { in wm8960_add_widgets()
513 struct snd_soc_codec *codec = codec_dai->codec; in wm8960_set_dai_fmt() local
565 snd_soc_write(codec, WM8960_IFACE1, iface); in wm8960_set_dai_fmt()
596 static int wm8960_configure_clocking(struct snd_soc_codec *codec) in wm8960_configure_clocking() argument
598 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_configure_clocking()
600 u16 iface1 = snd_soc_read(codec, WM8960_IFACE1); in wm8960_configure_clocking()
604 dev_dbg(codec->dev, in wm8960_configure_clocking()
610 dev_err(codec->dev, "No MCLK configured\n"); in wm8960_configure_clocking()
625 wm8960_set_pll(codec, 0, 0); in wm8960_configure_clocking()
630 dev_err(codec->dev, "No SYSCLK configured\n"); in wm8960_configure_clocking()
655 dev_err(codec->dev, "failed to configure clock\n"); in wm8960_configure_clocking()
669 wm8960_set_pll(codec, in wm8960_configure_clocking()
684 dev_err(codec->dev, "failed to configure clock\n"); in wm8960_configure_clocking()
690 snd_soc_update_bits(codec, WM8960_CLOCK1, 3 << 1, i << 1); in wm8960_configure_clocking()
693 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x7 << 3, j << 3); in wm8960_configure_clocking()
694 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x7 << 6, j << 6); in wm8960_configure_clocking()
697 snd_soc_update_bits(codec, WM8960_CLOCK2, 0xf, k); in wm8960_configure_clocking()
706 struct snd_soc_codec *codec = dai->codec; in wm8960_hw_params() local
707 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_hw_params()
708 u16 iface = snd_soc_read(codec, WM8960_IFACE1) & 0xfff3; in wm8960_hw_params()
733 dev_err(codec->dev, "unsupported width %d\n", in wm8960_hw_params()
741 wm8960_set_deemph(codec); in wm8960_hw_params()
745 snd_soc_update_bits(codec, in wm8960_hw_params()
751 snd_soc_write(codec, WM8960_IFACE1, iface); in wm8960_hw_params()
755 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON && in wm8960_hw_params()
757 return wm8960_configure_clocking(codec); in wm8960_hw_params()
765 struct snd_soc_codec *codec = dai->codec; in wm8960_hw_free() local
766 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_hw_free()
776 struct snd_soc_codec *codec = dai->codec; in wm8960_mute() local
779 snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0x8); in wm8960_mute()
781 snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0); in wm8960_mute()
785 static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, in wm8960_set_bias_level_out3() argument
788 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_bias_level_out3()
789 u16 pm2 = snd_soc_read(codec, WM8960_POWER2); in wm8960_set_bias_level_out3()
797 switch (snd_soc_codec_get_bias_level(codec)) { in wm8960_set_bias_level_out3()
802 dev_err(codec->dev, in wm8960_set_bias_level_out3()
809 ret = wm8960_configure_clocking(codec); in wm8960_set_bias_level_out3()
814 snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x80); in wm8960_set_bias_level_out3()
823 wm8960_set_pll(codec, 0, 0); in wm8960_set_bias_level_out3()
836 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8960_set_bias_level_out3()
840 snd_soc_write(codec, WM8960_APOP1, in wm8960_set_bias_level_out3()
845 snd_soc_update_bits(codec, WM8960_POWER1, 0x80, 0x80); in wm8960_set_bias_level_out3()
849 snd_soc_update_bits(codec, WM8960_POWER1, WM8960_VREF, in wm8960_set_bias_level_out3()
853 snd_soc_write(codec, WM8960_APOP1, WM8960_BUFIOEN); in wm8960_set_bias_level_out3()
857 snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x100); in wm8960_set_bias_level_out3()
862 snd_soc_write(codec, WM8960_APOP1, in wm8960_set_bias_level_out3()
867 snd_soc_write(codec, WM8960_POWER1, 0); in wm8960_set_bias_level_out3()
875 static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec, in wm8960_set_bias_level_capless() argument
878 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_bias_level_capless()
879 u16 pm2 = snd_soc_read(codec, WM8960_POWER2); in wm8960_set_bias_level_capless()
887 switch (snd_soc_codec_get_bias_level(codec)) { in wm8960_set_bias_level_capless()
890 snd_soc_update_bits(codec, WM8960_APOP1, in wm8960_set_bias_level_capless()
904 snd_soc_update_bits(codec, WM8960_POWER2, in wm8960_set_bias_level_capless()
910 snd_soc_update_bits(codec, WM8960_POWER1, in wm8960_set_bias_level_capless()
917 snd_soc_update_bits(codec, WM8960_POWER1, in wm8960_set_bias_level_capless()
925 dev_err(codec->dev, in wm8960_set_bias_level_capless()
932 ret = wm8960_configure_clocking(codec); in wm8960_set_bias_level_capless()
944 wm8960_set_pll(codec, 0, 0); in wm8960_set_bias_level_capless()
950 snd_soc_update_bits(codec, WM8960_APOP1, in wm8960_set_bias_level_capless()
957 snd_soc_update_bits(codec, WM8960_POWER1, in wm8960_set_bias_level_capless()
970 switch (snd_soc_codec_get_bias_level(codec)) { in wm8960_set_bias_level_capless()
973 snd_soc_update_bits(codec, WM8960_APOP2, in wm8960_set_bias_level_capless()
978 snd_soc_update_bits(codec, WM8960_APOP1, in wm8960_set_bias_level_capless()
1077 static int wm8960_set_pll(struct snd_soc_codec *codec, in wm8960_set_pll() argument
1092 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0); in wm8960_set_pll()
1093 snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0); in wm8960_set_pll()
1098 reg = snd_soc_read(codec, WM8960_PLL1) & ~0x3f; in wm8960_set_pll()
1105 snd_soc_write(codec, WM8960_PLL2, (pll_div.k >> 16) & 0xff); in wm8960_set_pll()
1106 snd_soc_write(codec, WM8960_PLL3, (pll_div.k >> 8) & 0xff); in wm8960_set_pll()
1107 snd_soc_write(codec, WM8960_PLL4, pll_div.k & 0xff); in wm8960_set_pll()
1109 snd_soc_write(codec, WM8960_PLL1, reg); in wm8960_set_pll()
1112 snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0x1); in wm8960_set_pll()
1114 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0x1); in wm8960_set_pll()
1122 struct snd_soc_codec *codec = codec_dai->codec; in wm8960_set_dai_pll() local
1123 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_dai_pll()
1130 return wm8960_set_pll(codec, freq_in, freq_out); in wm8960_set_dai_pll()
1136 struct snd_soc_codec *codec = codec_dai->codec; in wm8960_set_dai_clkdiv() local
1141 reg = snd_soc_read(codec, WM8960_CLOCK1) & 0x1f9; in wm8960_set_dai_clkdiv()
1142 snd_soc_write(codec, WM8960_CLOCK1, reg | div); in wm8960_set_dai_clkdiv()
1145 reg = snd_soc_read(codec, WM8960_CLOCK1) & 0x1c7; in wm8960_set_dai_clkdiv()
1146 snd_soc_write(codec, WM8960_CLOCK1, reg | div); in wm8960_set_dai_clkdiv()
1149 reg = snd_soc_read(codec, WM8960_PLL1) & 0x03f; in wm8960_set_dai_clkdiv()
1150 snd_soc_write(codec, WM8960_PLL1, reg | div); in wm8960_set_dai_clkdiv()
1153 reg = snd_soc_read(codec, WM8960_CLOCK2) & 0x03f; in wm8960_set_dai_clkdiv()
1154 snd_soc_write(codec, WM8960_CLOCK2, reg | div); in wm8960_set_dai_clkdiv()
1157 reg = snd_soc_read(codec, WM8960_ADDCTL1) & 0x1fd; in wm8960_set_dai_clkdiv()
1158 snd_soc_write(codec, WM8960_ADDCTL1, reg | div); in wm8960_set_dai_clkdiv()
1167 static int wm8960_set_bias_level(struct snd_soc_codec *codec, in wm8960_set_bias_level() argument
1170 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_bias_level()
1172 return wm8960->set_bias_level(codec, level); in wm8960_set_bias_level()
1178 struct snd_soc_codec *codec = dai->codec; in wm8960_set_dai_sysclk() local
1179 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_set_dai_sysclk()
1183 snd_soc_update_bits(codec, WM8960_CLOCK1, in wm8960_set_dai_sysclk()
1187 snd_soc_update_bits(codec, WM8960_CLOCK1, in wm8960_set_dai_sysclk()
1236 static int wm8960_probe(struct snd_soc_codec *codec) in wm8960_probe() argument
1238 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); in wm8960_probe()
1246 snd_soc_add_codec_controls(codec, wm8960_snd_controls, in wm8960_probe()
1248 wm8960_add_widgets(codec); in wm8960_probe()