Lines Matching refs:codec
319 static int wm8904_configure_clocking(struct snd_soc_codec *codec) in wm8904_configure_clocking() argument
321 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_configure_clocking()
325 clock2 = snd_soc_read(codec, WM8904_CLOCK_RATES_2); in wm8904_configure_clocking()
326 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, in wm8904_configure_clocking()
332 dev_dbg(codec->dev, "Using %dHz MCLK\n", wm8904->mclk_rate); in wm8904_configure_clocking()
338 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_configure_clocking()
343 dev_dbg(codec->dev, "Using %dHz FLL clock\n", in wm8904_configure_clocking()
351 dev_err(codec->dev, "System clock not configured\n"); in wm8904_configure_clocking()
364 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_0, WM8904_MCLK_DIV, in wm8904_configure_clocking()
367 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, in wm8904_configure_clocking()
370 dev_dbg(codec->dev, "CLK_SYS is %dHz\n", wm8904->sysclk_rate); in wm8904_configure_clocking()
375 static void wm8904_set_drc(struct snd_soc_codec *codec) in wm8904_set_drc() argument
377 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_drc()
382 save = snd_soc_read(codec, WM8904_DRC_0); in wm8904_set_drc()
385 snd_soc_update_bits(codec, WM8904_DRC_0 + i, 0xffff, in wm8904_set_drc()
389 snd_soc_update_bits(codec, WM8904_DRC_0, in wm8904_set_drc()
396 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_put_drc_enum() local
397 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_put_drc_enum()
406 wm8904_set_drc(codec); in wm8904_put_drc_enum()
414 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_get_drc_enum() local
415 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_get_drc_enum()
422 static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) in wm8904_set_retune_mobile() argument
424 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_retune_mobile()
447 dev_dbg(codec->dev, "ReTune Mobile %s/%dHz for %dHz sample rate\n", in wm8904_set_retune_mobile()
455 save = snd_soc_read(codec, WM8904_EQ1); in wm8904_set_retune_mobile()
458 snd_soc_update_bits(codec, WM8904_EQ1 + i, 0xffff, in wm8904_set_retune_mobile()
461 snd_soc_update_bits(codec, WM8904_EQ1, WM8904_EQ_ENA, save); in wm8904_set_retune_mobile()
467 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_put_retune_mobile_enum() local
468 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_put_retune_mobile_enum()
477 wm8904_set_retune_mobile(codec); in wm8904_put_retune_mobile_enum()
485 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_get_retune_mobile_enum() local
486 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_get_retune_mobile_enum()
495 static int wm8904_set_deemph(struct snd_soc_codec *codec) in wm8904_set_deemph() argument
497 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_deemph()
516 dev_dbg(codec->dev, "Set deemphasis %d\n", val); in wm8904_set_deemph()
518 return snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, in wm8904_set_deemph()
525 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_get_deemph() local
526 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_get_deemph()
535 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_put_deemph() local
536 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_put_deemph()
544 return wm8904_set_deemph(codec); in wm8904_put_deemph()
575 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8904_adc_osr_put() local
588 snd_soc_update_bits(codec, WM8904_ADC_TEST_0, in wm8904_adc_osr_put()
676 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in sysclk_event() local
677 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in sysclk_event()
688 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in sysclk_event()
692 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in sysclk_event()
703 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in sysclk_event()
714 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in out_pga_event() local
715 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in out_pga_event()
754 snd_soc_update_bits(codec, pwr_reg, in out_pga_event()
759 snd_soc_update_bits(codec, reg, in out_pga_event()
765 snd_soc_update_bits(codec, reg, in out_pga_event()
770 snd_soc_update_bits(codec, WM8904_DC_SERVO_0, in out_pga_event()
777 dev_dbg(codec->dev, "Restoring DC servo state\n"); in out_pga_event()
779 snd_soc_write(codec, dcs_l_reg, in out_pga_event()
781 snd_soc_write(codec, dcs_r_reg, in out_pga_event()
784 snd_soc_write(codec, WM8904_DC_SERVO_1, dcs_mask); in out_pga_event()
788 dev_dbg(codec->dev, "Calibrating DC servo\n"); in out_pga_event()
790 snd_soc_write(codec, WM8904_DC_SERVO_1, in out_pga_event()
799 val = snd_soc_read(codec, WM8904_DC_SERVO_READBACK_0); in out_pga_event()
807 dev_warn(codec->dev, "DC servo timed out\n"); in out_pga_event()
809 dev_dbg(codec->dev, "DC servo ready\n"); in out_pga_event()
812 snd_soc_update_bits(codec, reg, in out_pga_event()
819 snd_soc_update_bits(codec, reg, in out_pga_event()
829 snd_soc_update_bits(codec, reg, in out_pga_event()
837 wm8904->dcs_state[dcs_l] = snd_soc_read(codec, dcs_l_reg); in out_pga_event()
838 wm8904->dcs_state[dcs_r] = snd_soc_read(codec, dcs_r_reg); in out_pga_event()
840 snd_soc_update_bits(codec, WM8904_DC_SERVO_0, in out_pga_event()
844 snd_soc_update_bits(codec, reg, in out_pga_event()
851 snd_soc_update_bits(codec, pwr_reg, in out_pga_event()
1168 static int wm8904_add_widgets(struct snd_soc_codec *codec) in wm8904_add_widgets() argument
1170 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_add_widgets()
1171 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8904_add_widgets()
1180 snd_soc_add_codec_controls(codec, wm8904_adc_snd_controls, in wm8904_add_widgets()
1182 snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls, in wm8904_add_widgets()
1184 snd_soc_add_codec_controls(codec, wm8904_snd_controls, in wm8904_add_widgets()
1203 snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls, in wm8904_add_widgets()
1281 struct snd_soc_codec *codec = dai->codec; in wm8904_hw_params() local
1282 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_hw_params()
1293 dev_dbg(codec->dev, "Configuring for %d %d bit TDM slots\n", in wm8904_hw_params()
1319 dev_dbg(codec->dev, "Target BCLK is %dHz\n", wm8904->bclk); in wm8904_hw_params()
1321 ret = wm8904_configure_clocking(codec); in wm8904_hw_params()
1337 dev_dbg(codec->dev, "Selected CLK_SYS_RATIO of %d\n", in wm8904_hw_params()
1353 dev_dbg(codec->dev, "Selected SAMPLE_RATE of %dHz\n", in wm8904_hw_params()
1376 dev_dbg(codec->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", in wm8904_hw_params()
1381 dev_dbg(codec->dev, "LRCLK_RATE is %d\n", wm8904->bclk / wm8904->fs); in wm8904_hw_params()
1385 snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, in wm8904_hw_params()
1387 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, in wm8904_hw_params()
1389 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_2, in wm8904_hw_params()
1391 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_3, in wm8904_hw_params()
1393 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_1, in wm8904_hw_params()
1398 wm8904_set_retune_mobile(codec); in wm8904_hw_params()
1399 wm8904_set_deemph(codec); in wm8904_hw_params()
1408 struct snd_soc_codec *codec = dai->codec; in wm8904_set_sysclk() local
1409 struct wm8904_priv *priv = snd_soc_codec_get_drvdata(codec); in wm8904_set_sysclk()
1427 wm8904_configure_clocking(codec); in wm8904_set_sysclk()
1434 struct snd_soc_codec *codec = dai->codec; in wm8904_set_fmt() local
1511 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, in wm8904_set_fmt()
1514 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_3, in wm8904_set_fmt()
1524 struct snd_soc_codec *codec = dai->codec; in wm8904_set_tdm_slot() local
1525 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_tdm_slot()
1563 snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, in wm8904_set_tdm_slot()
1681 struct snd_soc_codec *codec = dai->codec; in wm8904_set_fll() local
1682 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_fll()
1692 clock2 = snd_soc_read(codec, WM8904_CLOCK_RATES_2); in wm8904_set_fll()
1695 dev_dbg(codec->dev, "FLL disabled\n"); in wm8904_set_fll()
1701 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, in wm8904_set_fll()
1704 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_set_fll()
1721 dev_dbg(codec->dev, "Using free running FLL\n"); in wm8904_set_fll()
1731 dev_err(codec->dev, "Unknown FLL ID %d\n", fll_id); in wm8904_set_fll()
1737 fll1 = snd_soc_read(codec, WM8904_FLL_CONTROL_1); in wm8904_set_fll()
1738 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, in wm8904_set_fll()
1740 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_set_fll()
1744 snd_soc_update_bits(codec, WM8904_CONTROL_INTERFACE_TEST_1, in wm8904_set_fll()
1753 snd_soc_update_bits(codec, WM8904_FLL_NCO_TEST_1, WM8904_FLL_FRC_NCO, in wm8904_set_fll()
1755 snd_soc_update_bits(codec, WM8904_CONTROL_INTERFACE_TEST_1, in wm8904_set_fll()
1760 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, in wm8904_set_fll()
1765 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, in wm8904_set_fll()
1770 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, in wm8904_set_fll()
1779 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_set_fll()
1782 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_2, in wm8904_set_fll()
1787 snd_soc_write(codec, WM8904_FLL_CONTROL_3, fll_div.k); in wm8904_set_fll()
1789 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_4, WM8904_FLL_N_MASK, in wm8904_set_fll()
1792 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, in wm8904_set_fll()
1797 dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); in wm8904_set_fll()
1804 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_set_fll()
1806 snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, in wm8904_set_fll()
1811 snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, in wm8904_set_fll()
1819 struct snd_soc_codec *codec = codec_dai->codec; in wm8904_digital_mute() local
1827 snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, WM8904_DAC_MUTE, val); in wm8904_digital_mute()
1832 static int wm8904_set_bias_level(struct snd_soc_codec *codec, in wm8904_set_bias_level() argument
1835 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_set_bias_level()
1847 snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, in wm8904_set_bias_level()
1852 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, in wm8904_set_bias_level()
1857 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8904_set_bias_level()
1861 dev_err(codec->dev, in wm8904_set_bias_level()
1871 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, in wm8904_set_bias_level()
1875 snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, in wm8904_set_bias_level()
1886 snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, in wm8904_set_bias_level()
1891 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, in wm8904_set_bias_level()
1897 snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, in wm8904_set_bias_level()
1901 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, in wm8904_set_bias_level()
1949 static void wm8904_handle_retune_mobile_pdata(struct snd_soc_codec *codec) in wm8904_handle_retune_mobile_pdata() argument
1951 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_handle_retune_mobile_pdata()
1994 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", in wm8904_handle_retune_mobile_pdata()
2000 ret = snd_soc_add_codec_controls(codec, &control, 1); in wm8904_handle_retune_mobile_pdata()
2002 dev_err(codec->dev, in wm8904_handle_retune_mobile_pdata()
2006 static void wm8904_handle_pdata(struct snd_soc_codec *codec) in wm8904_handle_pdata() argument
2008 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_handle_pdata()
2013 snd_soc_add_codec_controls(codec, wm8904_eq_controls, in wm8904_handle_pdata()
2018 dev_dbg(codec->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); in wm8904_handle_pdata()
2037 ret = snd_soc_add_codec_controls(codec, &control, 1); in wm8904_handle_pdata()
2039 dev_err(codec->dev, in wm8904_handle_pdata()
2042 wm8904_set_drc(codec); in wm8904_handle_pdata()
2045 dev_dbg(codec->dev, "%d ReTune Mobile configurations\n", in wm8904_handle_pdata()
2049 wm8904_handle_retune_mobile_pdata(codec); in wm8904_handle_pdata()
2051 snd_soc_add_codec_controls(codec, wm8904_eq_controls, in wm8904_handle_pdata()
2056 static int wm8904_probe(struct snd_soc_codec *codec) in wm8904_probe() argument
2058 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_probe()
2067 dev_err(codec->dev, "Unknown device type %d\n", in wm8904_probe()
2072 wm8904_handle_pdata(codec); in wm8904_probe()
2074 wm8904_add_widgets(codec); in wm8904_probe()
2079 static int wm8904_remove(struct snd_soc_codec *codec) in wm8904_remove() argument
2081 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); in wm8904_remove()