Lines Matching refs:codec
57 struct snd_soc_codec *codec; member
120 static int wm5100_alloc_sr(struct snd_soc_codec *codec, int rate) in wm5100_alloc_sr() argument
122 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_alloc_sr()
129 dev_err(codec->dev, "Unsupported sample rate: %dHz\n", rate); in wm5100_alloc_sr()
142 if ((snd_soc_read(codec, wm5100_sr_regs[i]) & in wm5100_alloc_sr()
149 dev_dbg(codec->dev, "SR %dHz, slot %d, ref %d\n", in wm5100_alloc_sr()
155 dev_err(codec->dev, "All SR slots already in use\n"); in wm5100_alloc_sr()
159 dev_dbg(codec->dev, "Allocating SR slot %d for %dHz\n", in wm5100_alloc_sr()
162 snd_soc_update_bits(codec, wm5100_sr_regs[sr_free], in wm5100_alloc_sr()
169 dev_err(codec->dev, in wm5100_alloc_sr()
176 static void wm5100_free_sr(struct snd_soc_codec *codec, int rate) in wm5100_free_sr() argument
178 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_free_sr()
185 dev_err(codec->dev, "Unsupported sample rate: %dHz\n", rate); in wm5100_free_sr()
194 if ((snd_soc_read(codec, wm5100_sr_regs[i]) & in wm5100_free_sr()
200 dev_dbg(codec->dev, "Dereference SR %dHz, count now %d\n", in wm5100_free_sr()
203 dev_warn(codec->dev, "Freeing unreferenced sample rate %dHz\n", in wm5100_free_sr()
738 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); in wm5100_seq_notifier() local
739 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_seq_notifier()
744 expect = snd_soc_read(codec, WM5100_CHANNEL_ENABLES_1); in wm5100_seq_notifier()
746 val = snd_soc_read(codec, WM5100_OUTPUT_STATUS_1); in wm5100_seq_notifier()
753 dev_err(codec->dev, "Timeout waiting for OUTPUT1 %x\n", in wm5100_seq_notifier()
759 expect = snd_soc_read(codec, WM5100_OUTPUT_ENABLES_2); in wm5100_seq_notifier()
761 val = snd_soc_read(codec, WM5100_OUTPUT_STATUS_2); in wm5100_seq_notifier()
768 dev_err(codec->dev, "Timeout waiting for OUTPUT2 %x\n", in wm5100_seq_notifier()
778 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in wm5100_out_ev() local
779 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_out_ev()
843 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in wm5100_post_ev() local
844 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_post_ev()
847 ret = snd_soc_read(codec, WM5100_INTERRUPT_RAW_STATUS_3); in wm5100_post_ev()
853 ret = snd_soc_read(codec, WM5100_INTERRUPT_RAW_STATUS_4); in wm5100_post_ev()
1284 struct snd_soc_codec *codec = dai->codec; in wm5100_set_fmt() local
1300 dev_err(codec->dev, "Unsupported DAI format %d\n", in wm5100_set_fmt()
1319 dev_err(codec->dev, "Unsupported master mode %d\n", in wm5100_set_fmt()
1341 snd_soc_update_bits(codec, base + 1, WM5100_AIF1_BCLK_MSTR | in wm5100_set_fmt()
1343 snd_soc_update_bits(codec, base + 2, WM5100_AIF1TX_LRCLK_MSTR | in wm5100_set_fmt()
1345 snd_soc_update_bits(codec, base + 3, WM5100_AIF1TX_LRCLK_MSTR | in wm5100_set_fmt()
1347 snd_soc_update_bits(codec, base + 5, WM5100_AIF1_FMT_MASK, mask); in wm5100_set_fmt()
1402 struct snd_soc_codec *codec = dai->codec; in wm5100_hw_params() local
1403 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_hw_params()
1418 dev_dbg(codec->dev, "Word length %d bits, frame length %d bits\n", in wm5100_hw_params()
1429 sr = wm5100_alloc_sr(codec, params_rate(params)); in wm5100_hw_params()
1441 dev_err(codec->dev, "Invalid rate %dHzn", in wm5100_hw_params()
1447 snd_soc_update_bits(codec, WM5100_CLOCKING_8, in wm5100_hw_params()
1452 dev_err(codec->dev, "%s has no rate set\n", in wm5100_hw_params()
1457 dev_dbg(codec->dev, "Target BCLK is %dHz, using %dHz %s\n", in wm5100_hw_params()
1469 dev_err(codec->dev, in wm5100_hw_params()
1476 dev_dbg(codec->dev, "Setting %dHz BCLK\n", bclk_rates[bclk]); in wm5100_hw_params()
1477 snd_soc_update_bits(codec, base + 1, WM5100_AIF1_BCLK_FREQ_MASK, bclk); in wm5100_hw_params()
1480 dev_dbg(codec->dev, "Setting %dHz LRCLK\n", bclk_rates[bclk] / lrclk); in wm5100_hw_params()
1483 snd_soc_update_bits(codec, base + 7, in wm5100_hw_params()
1486 snd_soc_update_bits(codec, base + 6, in wm5100_hw_params()
1491 snd_soc_update_bits(codec, base + 9, in wm5100_hw_params()
1495 snd_soc_update_bits(codec, base + 8, in wm5100_hw_params()
1499 snd_soc_update_bits(codec, base + 4, WM5100_AIF1_RATE_MASK, sr); in wm5100_hw_params()
1509 static int wm5100_set_sysclk(struct snd_soc_codec *codec, int clk_id, in wm5100_set_sysclk() argument
1512 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_set_sysclk()
1531 snd_soc_update_bits(codec, WM5100_CLOCKING_1, in wm5100_set_sysclk()
1552 dev_err(codec->dev, "Invalid source %d\n", source); in wm5100_set_sysclk()
1561 snd_soc_update_bits(codec, WM5100_MISC_GPIO_1, in wm5100_set_sysclk()
1566 snd_soc_update_bits(codec, WM5100_MISC_GPIO_1, in wm5100_set_sysclk()
1571 snd_soc_update_bits(codec, WM5100_MISC_GPIO_1, in wm5100_set_sysclk()
1575 dev_err(codec->dev, "Unsupported OPCLK %dHz\n", in wm5100_set_sysclk()
1582 dev_err(codec->dev, "Unknown clock %d\n", clk_id); in wm5100_set_sysclk()
1589 dev_err(codec->dev, "Invalid source %d\n", source); in wm5100_set_sysclk()
1607 dev_err(codec->dev, "Invalid clock rate: %d\n", freq); in wm5100_set_sysclk()
1634 snd_soc_update_bits(codec, reg, WM5100_SYSCLK_FREQ_MASK | in wm5100_set_sysclk()
1643 dev_dbg(codec->dev, "Setting primary audio rate to %dHz", in wm5100_set_sysclk()
1646 wm5100_free_sr(codec, audio_rate); in wm5100_set_sysclk()
1647 ret = wm5100_alloc_sr(codec, audio_rate); in wm5100_set_sysclk()
1649 dev_warn(codec->dev, "Primary audio slot is %d\n", in wm5100_set_sysclk()
1757 static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source, in wm5100_set_fll() argument
1760 struct i2c_client *i2c = to_i2c_client(codec->dev); in wm5100_set_fll()
1761 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_set_fll()
1779 dev_err(codec->dev, "Unknown FLL %d\n",fll_id); in wm5100_set_fll()
1784 dev_dbg(codec->dev, "FLL%d disabled", fll_id); in wm5100_set_fll()
1786 pm_runtime_put(codec->dev); in wm5100_set_fll()
1788 snd_soc_update_bits(codec, base + 1, WM5100_FLL1_ENA, 0); in wm5100_set_fll()
1802 dev_err(codec->dev, "Invalid FLL source %d\n", source); in wm5100_set_fll()
1811 snd_soc_update_bits(codec, base + 1, WM5100_FLL1_ENA, 0); in wm5100_set_fll()
1813 snd_soc_update_bits(codec, base + 2, in wm5100_set_fll()
1817 snd_soc_update_bits(codec, base + 3, WM5100_FLL1_THETA_MASK, in wm5100_set_fll()
1819 snd_soc_update_bits(codec, base + 5, WM5100_FLL1_N_MASK, factors.n); in wm5100_set_fll()
1820 snd_soc_update_bits(codec, base + 6, in wm5100_set_fll()
1825 snd_soc_update_bits(codec, base + 7, WM5100_FLL1_LAMBDA_MASK, in wm5100_set_fll()
1831 pm_runtime_get_sync(codec->dev); in wm5100_set_fll()
1833 snd_soc_update_bits(codec, base + 1, WM5100_FLL1_ENA, WM5100_FLL1_ENA); in wm5100_set_fll()
1840 snd_soc_update_bits(codec, WM5100_CLOCKING_3, WM5100_SYSCLK_ENA, in wm5100_set_fll()
1854 ret = snd_soc_read(codec, in wm5100_set_fll()
1857 dev_err(codec->dev, in wm5100_set_fll()
1866 dev_err(codec->dev, "FLL%d lock timed out\n", fll_id); in wm5100_set_fll()
1867 pm_runtime_put(codec->dev); in wm5100_set_fll()
1875 dev_dbg(codec->dev, "FLL%d running %dHz->%dHz\n", fll_id, in wm5100_set_fll()
2101 int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) in wm5100_detect() argument
2103 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_detect()
2104 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm5100_detect()
2115 snd_soc_update_bits(codec, WM5100_MIC_DETECT_1, in wm5100_detect()
2134 snd_soc_update_bits(codec, WM5100_MIC_DETECT_1, in wm5100_detect()
2137 snd_soc_update_bits(codec, WM5100_INTERRUPT_STATUS_3_MASK, in wm5100_detect()
2140 snd_soc_update_bits(codec, WM5100_INTERRUPT_STATUS_3_MASK, in wm5100_detect()
2145 snd_soc_update_bits(codec, WM5100_MIC_DETECT_1, in wm5100_detect()
2337 static int wm5100_probe(struct snd_soc_codec *codec) in wm5100_probe() argument
2339 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm5100_probe()
2340 struct i2c_client *i2c = to_i2c_client(codec->dev); in wm5100_probe()
2341 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_probe()
2344 wm5100->codec = codec; in wm5100_probe()
2347 snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU, in wm5100_probe()
2351 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_1, 0); in wm5100_probe()
2352 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_2, 0); in wm5100_probe()
2377 static int wm5100_remove(struct snd_soc_codec *codec) in wm5100_remove() argument
2379 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); in wm5100_remove()