Lines Matching refs:component
431 static int rt5670_headset_detect(struct snd_soc_component *component, int jack_insert) in rt5670_headset_detect() argument
434 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); in rt5670_headset_detect()
435 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_headset_detect()
440 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x0); in rt5670_headset_detect()
441 snd_soc_component_update_bits(component, RT5670_CJ_CTRL2, in rt5670_headset_detect()
444 snd_soc_component_write(component, RT5670_GPIO_CTRL2, 0x0004); in rt5670_headset_detect()
445 snd_soc_component_update_bits(component, RT5670_GPIO_CTRL1, in rt5670_headset_detect()
447 snd_soc_component_update_bits(component, RT5670_CJ_CTRL1, in rt5670_headset_detect()
449 snd_soc_component_write(component, RT5670_JD_CTRL3, 0x00f0); in rt5670_headset_detect()
450 snd_soc_component_update_bits(component, RT5670_CJ_CTRL2, in rt5670_headset_detect()
452 snd_soc_component_update_bits(component, RT5670_CJ_CTRL2, in rt5670_headset_detect()
455 val = snd_soc_component_read(component, RT5670_CJ_CTRL3) & 0x7; in rt5670_headset_detect()
459 snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x8); in rt5670_headset_detect()
460 snd_soc_component_update_bits(component, RT5670_IL_CMD, 0x40, 0x40); in rt5670_headset_detect()
461 snd_soc_component_read(component, RT5670_IL_CMD); in rt5670_headset_detect()
463 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
469 snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x0); in rt5670_headset_detect()
470 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
479 void rt5670_jack_suspend(struct snd_soc_component *component) in rt5670_jack_suspend() argument
481 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_jack_suspend()
484 rt5670_headset_detect(component, 0); in rt5670_jack_suspend()
488 void rt5670_jack_resume(struct snd_soc_component *component) in rt5670_jack_resume() argument
490 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_jack_resume()
493 rt5670_headset_detect(component, 1); in rt5670_jack_resume()
497 static int rt5670_button_detect(struct snd_soc_component *component) in rt5670_button_detect() argument
501 val = snd_soc_component_read(component, RT5670_IL_CMD); in rt5670_button_detect()
503 snd_soc_component_write(component, RT5670_IL_CMD, val); in rt5670_button_detect()
506 val = snd_soc_component_read(component, RT5670_IL_CMD); in rt5670_button_detect()
507 snd_soc_component_write(component, RT5670_IL_CMD, val); in rt5670_button_detect()
521 val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0070; in rt5670_irq_detection()
523 val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0020; in rt5670_irq_detection()
530 report = rt5670_headset_detect(rt5670->component, 1); in rt5670_irq_detection()
536 if (snd_soc_component_read(rt5670->component, RT5670_INT_IRQ_ST) & 0x4) { in rt5670_irq_detection()
539 btn_type = rt5670_button_detect(rt5670->component); in rt5670_irq_detection()
551 dev_err(rt5670->component->dev, in rt5670_irq_detection()
566 snd_soc_component_update_bits(rt5670->component, RT5670_INT_IRQ_ST, 0x1, 0x0); in rt5670_irq_detection()
567 rt5670_headset_detect(rt5670->component, 0); in rt5670_irq_detection()
577 int rt5670_set_jack_detect(struct snd_soc_component *component, in rt5670_set_jack_detect() argument
580 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_jack_detect()
584 rt5670->hp_gpio.gpiod_dev = component->dev; in rt5670_set_jack_detect()
596 dev_err(component->dev, "Adding jack GPIO failed\n"); in rt5670_set_jack_detect()
655 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in rt5670_dac1_playback_switch_get() local
656 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_dac1_playback_switch_get()
667 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in rt5670_dac1_playback_switch_put() local
668 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_dac1_playback_switch_put()
747 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in set_dmic_clk() local
748 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in set_dmic_clk()
755 dev_err(component->dev, "Failed to set DMIC clock\n"); in set_dmic_clk()
757 snd_soc_component_update_bits(component, RT5670_DMIC_CTRL1, in set_dmic_clk()
765 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in is_sys_clk_from_pll() local
766 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in is_sys_clk_from_pll()
777 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in is_using_asrc() local
813 val = (snd_soc_component_read(component, reg) >> shift) & 0xf; in is_using_asrc()
829 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in can_use_asrc() local
830 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in can_use_asrc()
853 int rt5670_sel_asrc_clk_src(struct snd_soc_component *component, in rt5670_sel_asrc_clk_src() argument
911 snd_soc_component_update_bits(component, RT5670_ASRC_2, in rt5670_sel_asrc_clk_src()
915 snd_soc_component_update_bits(component, RT5670_ASRC_3, in rt5670_sel_asrc_clk_src()
969 struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); in rt5670_put_dac1_mix_dac1_switch() local
970 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_put_dac1_mix_dac1_switch()
1441 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_hp_power_event() local
1442 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hp_power_event()
1477 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_hp_event() local
1478 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hp_event()
1527 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_spk_event() local
1528 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_spk_event()
1554 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_bst1_event() local
1558 snd_soc_component_update_bits(component, RT5670_PWR_ANLG2, in rt5670_bst1_event()
1563 snd_soc_component_update_bits(component, RT5670_PWR_ANLG2, in rt5670_bst1_event()
1577 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_bst2_event() local
1581 snd_soc_component_update_bits(component, RT5670_PWR_ANLG2, in rt5670_bst2_event()
1586 snd_soc_component_update_bits(component, RT5670_PWR_ANLG2, in rt5670_bst2_event()
2369 struct snd_soc_component *component = dai->component; in rt5670_hw_params() local
2370 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hw_params()
2377 dev_err(component->dev, "Unsupported clock setting %d for DAI %d\n", in rt5670_hw_params()
2383 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); in rt5670_hw_params()
2415 snd_soc_component_update_bits(component, RT5670_I2S1_SDP, in rt5670_hw_params()
2417 snd_soc_component_update_bits(component, RT5670_ADDA_CLK1, mask_clk, val_clk); in rt5670_hw_params()
2423 snd_soc_component_update_bits(component, RT5670_I2S2_SDP, in rt5670_hw_params()
2425 snd_soc_component_update_bits(component, RT5670_ADDA_CLK1, mask_clk, val_clk); in rt5670_hw_params()
2428 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_hw_params()
2437 struct snd_soc_component *component = dai->component; in rt5670_set_dai_fmt() local
2438 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_dai_fmt()
2481 snd_soc_component_update_bits(component, RT5670_I2S1_SDP, in rt5670_set_dai_fmt()
2486 snd_soc_component_update_bits(component, RT5670_I2S2_SDP, in rt5670_set_dai_fmt()
2491 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_fmt()
2497 static int rt5670_set_codec_sysclk(struct snd_soc_component *component, int clk_id, in rt5670_set_codec_sysclk() argument
2500 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_codec_sysclk()
2514 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); in rt5670_set_codec_sysclk()
2517 snd_soc_component_update_bits(component, RT5670_GLB_CLK, in rt5670_set_codec_sysclk()
2523 dev_dbg(component->dev, "Sysclk : %dHz clock id : %d\n", freq, clk_id); in rt5670_set_codec_sysclk()
2531 struct snd_soc_component *component = dai->component; in rt5670_set_dai_pll() local
2532 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_dai_pll()
2541 dev_dbg(component->dev, "PLL disabled\n"); in rt5670_set_dai_pll()
2545 snd_soc_component_update_bits(component, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2552 snd_soc_component_update_bits(component, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2561 snd_soc_component_update_bits(component, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2565 snd_soc_component_update_bits(component, RT5670_GLB_CLK, in rt5670_set_dai_pll()
2569 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_pll()
2574 dev_err(component->dev, "Unknown PLL source %d\n", source); in rt5670_set_dai_pll()
2580 dev_err(component->dev, "Unsupported input clock %d\n", freq_in); in rt5670_set_dai_pll()
2584 dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n", in rt5670_set_dai_pll()
2588 snd_soc_component_write(component, RT5670_PLL_CTRL1, in rt5670_set_dai_pll()
2590 snd_soc_component_write(component, RT5670_PLL_CTRL2, in rt5670_set_dai_pll()
2604 struct snd_soc_component *component = dai->component; in rt5670_set_tdm_slot() local
2642 snd_soc_component_update_bits(component, RT5670_TDM_CTRL_1, 0x7c00, val); in rt5670_set_tdm_slot()
2649 struct snd_soc_component *component = dai->component; in rt5670_set_bclk_ratio() local
2651 dev_dbg(component->dev, "%s ratio=%d\n", __func__, ratio); in rt5670_set_bclk_ratio()
2656 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, in rt5670_set_bclk_ratio()
2659 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, in rt5670_set_bclk_ratio()
2665 static int rt5670_set_bias_level(struct snd_soc_component *component, in rt5670_set_bias_level() argument
2668 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_bias_level()
2672 if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { in rt5670_set_bias_level()
2673 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2679 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2682 snd_soc_component_update_bits(component, RT5670_CHARGE_PUMP, in rt5670_set_bias_level()
2685 snd_soc_component_update_bits(component, RT5670_DIG_MISC, 0x1, 0x1); in rt5670_set_bias_level()
2686 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2691 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2694 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2699 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2705 snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, in rt5670_set_bias_level()
2710 snd_soc_component_update_bits(component, RT5670_DIG_MISC, 0x1, 0x0); in rt5670_set_bias_level()
2720 static int rt5670_probe(struct snd_soc_component *component) in rt5670_probe() argument
2722 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); in rt5670_probe()
2723 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_probe()
2725 switch (snd_soc_component_read(component, RT5670_RESET) & RT5670_ID_MASK) { in rt5670_probe()
2744 dev_err(component->dev, in rt5670_probe()
2748 rt5670->component = component; in rt5670_probe()
2753 static void rt5670_remove(struct snd_soc_component *component) in rt5670_remove() argument
2755 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_remove()
2762 static int rt5670_suspend(struct snd_soc_component *component) in rt5670_suspend() argument
2764 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_suspend()
2771 static int rt5670_resume(struct snd_soc_component *component) in rt5670_resume() argument
2773 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_resume()