Lines Matching refs:codec
415 static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert) in rt5670_headset_detect() argument
418 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in rt5670_headset_detect()
419 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_headset_detect()
424 snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x0); in rt5670_headset_detect()
425 snd_soc_update_bits(codec, RT5670_CJ_CTRL2, in rt5670_headset_detect()
428 snd_soc_write(codec, RT5670_GPIO_CTRL2, 0x0004); in rt5670_headset_detect()
429 snd_soc_update_bits(codec, RT5670_GPIO_CTRL1, in rt5670_headset_detect()
431 snd_soc_update_bits(codec, RT5670_CJ_CTRL1, in rt5670_headset_detect()
433 snd_soc_write(codec, RT5670_JD_CTRL3, 0x00f0); in rt5670_headset_detect()
434 snd_soc_update_bits(codec, RT5670_CJ_CTRL2, in rt5670_headset_detect()
436 snd_soc_update_bits(codec, RT5670_CJ_CTRL2, in rt5670_headset_detect()
439 val = snd_soc_read(codec, RT5670_CJ_CTRL3) & 0x7; in rt5670_headset_detect()
443 snd_soc_update_bits(codec, RT5670_INT_IRQ_ST, 0x8, 0x8); in rt5670_headset_detect()
444 snd_soc_update_bits(codec, RT5670_IL_CMD, 0x40, 0x40); in rt5670_headset_detect()
445 snd_soc_read(codec, RT5670_IL_CMD); in rt5670_headset_detect()
447 snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
453 snd_soc_update_bits(codec, RT5670_INT_IRQ_ST, 0x8, 0x0); in rt5670_headset_detect()
454 snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
463 void rt5670_jack_suspend(struct snd_soc_codec *codec) in rt5670_jack_suspend() argument
465 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_jack_suspend()
468 rt5670_headset_detect(codec, 0); in rt5670_jack_suspend()
472 void rt5670_jack_resume(struct snd_soc_codec *codec) in rt5670_jack_resume() argument
474 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_jack_resume()
477 rt5670_headset_detect(codec, 1); in rt5670_jack_resume()
481 static int rt5670_button_detect(struct snd_soc_codec *codec) in rt5670_button_detect() argument
485 val = snd_soc_read(codec, RT5670_IL_CMD); in rt5670_button_detect()
487 snd_soc_write(codec, RT5670_IL_CMD, val); in rt5670_button_detect()
490 val = snd_soc_read(codec, RT5670_IL_CMD); in rt5670_button_detect()
491 snd_soc_write(codec, RT5670_IL_CMD, val); in rt5670_button_detect()
505 val = snd_soc_read(rt5670->codec, RT5670_A_JD_CTRL1) & 0x0070; in rt5670_irq_detection()
507 val = snd_soc_read(rt5670->codec, RT5670_A_JD_CTRL1) & 0x0020; in rt5670_irq_detection()
514 report = rt5670_headset_detect(rt5670->codec, 1); in rt5670_irq_detection()
520 if (snd_soc_read(rt5670->codec, RT5670_INT_IRQ_ST) & 0x4) { in rt5670_irq_detection()
523 btn_type = rt5670_button_detect(rt5670->codec); in rt5670_irq_detection()
535 dev_err(rt5670->codec->dev, in rt5670_irq_detection()
550 snd_soc_update_bits(rt5670->codec, RT5670_INT_IRQ_ST, 0x1, 0x0); in rt5670_irq_detection()
551 rt5670_headset_detect(rt5670->codec, 0); in rt5670_irq_detection()
561 int rt5670_set_jack_detect(struct snd_soc_codec *codec, in rt5670_set_jack_detect() argument
564 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_jack_detect()
568 rt5670->hp_gpio.gpiod_dev = codec->dev; in rt5670_set_jack_detect()
580 dev_err(codec->dev, "Adding jack GPIO failed\n"); in rt5670_set_jack_detect()
683 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in set_dmic_clk() local
684 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in set_dmic_clk()
691 dev_err(codec->dev, "Failed to set DMIC clock\n"); in set_dmic_clk()
693 snd_soc_update_bits(codec, RT5670_DMIC_CTRL1, in set_dmic_clk()
701 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); in is_sys_clk_from_pll() local
702 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in is_sys_clk_from_pll()
713 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); in is_using_asrc() local
749 val = (snd_soc_read(codec, reg) >> shift) & 0xf; in is_using_asrc()
765 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); in can_use_asrc() local
766 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in can_use_asrc()
789 int rt5670_sel_asrc_clk_src(struct snd_soc_codec *codec, in rt5670_sel_asrc_clk_src() argument
847 snd_soc_update_bits(codec, RT5670_ASRC_2, in rt5670_sel_asrc_clk_src()
851 snd_soc_update_bits(codec, RT5670_ASRC_3, in rt5670_sel_asrc_clk_src()
1415 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in rt5670_hp_power_event() local
1416 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hp_power_event()
1451 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in rt5670_hp_event() local
1452 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hp_event()
1501 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in rt5670_bst1_event() local
1505 snd_soc_update_bits(codec, RT5670_PWR_ANLG2, in rt5670_bst1_event()
1510 snd_soc_update_bits(codec, RT5670_PWR_ANLG2, in rt5670_bst1_event()
1524 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in rt5670_bst2_event() local
1528 snd_soc_update_bits(codec, RT5670_PWR_ANLG2, in rt5670_bst2_event()
1533 snd_soc_update_bits(codec, RT5670_PWR_ANLG2, in rt5670_bst2_event()
2319 struct snd_soc_codec *codec = dai->codec; in rt5670_hw_params() local
2320 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hw_params()
2327 dev_err(codec->dev, "Unsupported clock setting %d for DAI %d\n", in rt5670_hw_params()
2333 dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); in rt5670_hw_params()
2365 snd_soc_update_bits(codec, RT5670_I2S1_SDP, in rt5670_hw_params()
2367 snd_soc_update_bits(codec, RT5670_ADDA_CLK1, mask_clk, val_clk); in rt5670_hw_params()
2373 snd_soc_update_bits(codec, RT5670_I2S2_SDP, in rt5670_hw_params()
2375 snd_soc_update_bits(codec, RT5670_ADDA_CLK1, mask_clk, val_clk); in rt5670_hw_params()
2378 dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_hw_params()
2387 struct snd_soc_codec *codec = dai->codec; in rt5670_set_dai_fmt() local
2388 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_fmt()
2431 snd_soc_update_bits(codec, RT5670_I2S1_SDP, in rt5670_set_dai_fmt()
2436 snd_soc_update_bits(codec, RT5670_I2S2_SDP, in rt5670_set_dai_fmt()
2441 dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_fmt()
2450 struct snd_soc_codec *codec = dai->codec; in rt5670_set_dai_sysclk() local
2451 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_sysclk()
2465 dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); in rt5670_set_dai_sysclk()
2468 snd_soc_update_bits(codec, RT5670_GLB_CLK, in rt5670_set_dai_sysclk()
2482 struct snd_soc_codec *codec = dai->codec; in rt5670_set_dai_pll() local
2483 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_pll()
2492 dev_dbg(codec->dev, "PLL disabled\n"); in rt5670_set_dai_pll()
2496 snd_soc_update_bits(codec, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2503 snd_soc_update_bits(codec, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2512 snd_soc_update_bits(codec, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2516 snd_soc_update_bits(codec, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2520 dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_pll()
2525 dev_err(codec->dev, "Unknown PLL source %d\n", source); in rt5670_set_dai_pll()
2531 dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); in rt5670_set_dai_pll()
2535 dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=%d\n", in rt5670_set_dai_pll()
2539 snd_soc_write(codec, RT5670_PLL_CTRL1, in rt5670_set_dai_pll()
2541 snd_soc_write(codec, RT5670_PLL_CTRL2, in rt5670_set_dai_pll()
2555 struct snd_soc_codec *codec = dai->codec; in rt5670_set_tdm_slot() local
2593 snd_soc_update_bits(codec, RT5670_TDM_CTRL_1, 0x7c00, val); in rt5670_set_tdm_slot()
2598 static int rt5670_set_bias_level(struct snd_soc_codec *codec, in rt5670_set_bias_level() argument
2601 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_bias_level()
2605 if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { in rt5670_set_bias_level()
2606 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2612 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2615 snd_soc_update_bits(codec, RT5670_CHARGE_PUMP, in rt5670_set_bias_level()
2618 snd_soc_update_bits(codec, RT5670_DIG_MISC, 0x1, 0x1); in rt5670_set_bias_level()
2619 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2624 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2627 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2632 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2638 snd_soc_update_bits(codec, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2643 snd_soc_update_bits(codec, RT5670_DIG_MISC, 0x1, 0x0); in rt5670_set_bias_level()
2653 static int rt5670_probe(struct snd_soc_codec *codec) in rt5670_probe() argument
2655 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in rt5670_probe()
2656 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_probe()
2658 switch (snd_soc_read(codec, RT5670_RESET) & RT5670_ID_MASK) { in rt5670_probe()
2677 dev_err(codec->dev, in rt5670_probe()
2681 rt5670->codec = codec; in rt5670_probe()
2686 static int rt5670_remove(struct snd_soc_codec *codec) in rt5670_remove() argument
2688 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_remove()
2696 static int rt5670_suspend(struct snd_soc_codec *codec) in rt5670_suspend() argument
2698 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_suspend()
2705 static int rt5670_resume(struct snd_soc_codec *codec) in rt5670_resume() argument
2707 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_resume()