Lines Matching +full:dsp +full:- +full:aif2 +full:- +full:bclk
1 // SPDX-License-Identifier: GPL-2.0-only
3 * rt5670.c -- RT5670 ALSA SoC audio codec driver
25 #include <sound/soc-dapm.h>
31 #include "rt5670-dsp.h"
50 MODULE_PARM_DESC(quirk, "Board-specific quirk override");
422 * rt5670_headset_detect - Detect headset.
457 rt5670->jack_type = SND_JACK_HEADSET; in rt5670_headset_detect()
464 rt5670->jack_type = SND_JACK_HEADPHONE; in rt5670_headset_detect()
471 rt5670->jack_type = 0; in rt5670_headset_detect()
476 return rt5670->jack_type; in rt5670_headset_detect()
483 rt5670->jack_type_saved = rt5670->jack_type; in rt5670_jack_suspend()
492 if (rt5670->jack_type_saved) in rt5670_jack_resume()
516 struct snd_soc_jack_gpio *gpio = &rt5670->hp_gpio; in rt5670_irq_detection()
517 struct snd_soc_jack *jack = rt5670->jack; in rt5670_irq_detection()
518 int val, btn_type, report = jack->status; in rt5670_irq_detection()
520 if (rt5670->jd_mode == 1) /* 2 port */ in rt5670_irq_detection()
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()
529 if (rt5670->jack_type == 0) { in rt5670_irq_detection()
530 report = rt5670_headset_detect(rt5670->component, 1); in rt5670_irq_detection()
532 gpio->debounce_time = 25; 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()
558 report = rt5670->jack_type; 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()
568 gpio->debounce_time = 150; /* for jack in */ in rt5670_irq_detection()
583 rt5670->jack = jack; in rt5670_set_jack_detect()
584 rt5670->hp_gpio.gpiod_dev = component->dev; in rt5670_set_jack_detect()
585 rt5670->hp_gpio.name = "headset"; in rt5670_set_jack_detect()
586 rt5670->hp_gpio.report = SND_JACK_HEADSET | in rt5670_set_jack_detect()
588 rt5670->hp_gpio.debounce_time = 150; in rt5670_set_jack_detect()
589 rt5670->hp_gpio.wake = true; in rt5670_set_jack_detect()
590 rt5670->hp_gpio.data = (struct rt5670_priv *)rt5670; in rt5670_set_jack_detect()
591 rt5670->hp_gpio.jack_status_check = rt5670_irq_detection; in rt5670_set_jack_detect()
593 ret = snd_soc_jack_add_gpios(rt5670->jack, 1, in rt5670_set_jack_detect()
594 &rt5670->hp_gpio); in rt5670_set_jack_detect()
596 dev_err(component->dev, "Adding jack GPIO failed\n"); in rt5670_set_jack_detect()
604 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
605 static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0);
606 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
607 static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000);
633 * For reliable output-mute LED control we need a "DAC1 Playback Switch" control.
636 * DAPM-mixer DAC1 input are enabled.
642 if (rt5670->dac1_mixl_dac1_switch && rt5670->dac1_playback_switch_l) in rt5670_update_ad_da_mixer_dac1_m_bits()
645 if (rt5670->dac1_mixr_dac1_switch && rt5670->dac1_playback_switch_r) in rt5670_update_ad_da_mixer_dac1_m_bits()
648 regmap_update_bits(rt5670->regmap, RT5670_AD_DA_MIXER, in rt5670_update_ad_da_mixer_dac1_m_bits()
658 ucontrol->value.integer.value[0] = rt5670->dac1_playback_switch_l; in rt5670_dac1_playback_switch_get()
659 ucontrol->value.integer.value[1] = rt5670->dac1_playback_switch_r; in rt5670_dac1_playback_switch_get()
670 if (rt5670->dac1_playback_switch_l == ucontrol->value.integer.value[0] && in rt5670_dac1_playback_switch_put()
671 rt5670->dac1_playback_switch_r == ucontrol->value.integer.value[1]) in rt5670_dac1_playback_switch_put()
674 rt5670->dac1_playback_switch_l = ucontrol->value.integer.value[0]; in rt5670_dac1_playback_switch_put()
675 rt5670->dac1_playback_switch_r = ucontrol->value.integer.value[1]; in rt5670_dac1_playback_switch_put()
735 * set_dmic_clk - Set parameter of dmic.
747 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in set_dmic_clk()
751 rate = rt5670->sysclk / rl6231_get_pre_div(rt5670->regmap, in set_dmic_clk()
755 dev_err(component->dev, "Failed to set DMIC clock\n"); in set_dmic_clk()
765 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in is_sys_clk_from_pll()
768 if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1) in is_sys_clk_from_pll()
777 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in is_using_asrc()
780 switch (source->shift) { in is_using_asrc()
829 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in can_use_asrc()
832 if (rt5670->sysclk > rt5670->lrck[RT5670_AIF1] * 384) in can_use_asrc()
840 * rt5670_sel_asrc_clk_src - select ASRC clock source for a set of filters
860 return -EINVAL; in rt5670_sel_asrc_clk_src()
968 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; in rt5670_put_dac1_mix_dac1_switch()
973 if (mc->shift == 0) in rt5670_put_dac1_mix_dac1_switch()
974 rt5670->dac1_mixl_dac1_switch = ucontrol->value.integer.value[0]; in rt5670_put_dac1_mix_dac1_switch()
976 rt5670->dac1_mixr_dac1_switch = ucontrol->value.integer.value[0]; in rt5670_put_dac1_mix_dac1_switch()
1139 /* DAC1 L/R source */ /* MX-29 [9:8] [11:10] */
1156 /*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */
1179 /*RxDP source*/ /* MX-2D [15:13] */
1191 /* MX-2D [1] [0] */
1193 "DSP", "Bypass"
1200 SOC_DAPM_ENUM("DSP UL source", rt5670_dsp_ul_enum);
1206 SOC_DAPM_ENUM("DSP DL source", rt5670_dsp_dl_enum);
1209 /* MX-26 [15] */
1221 /* MX-27 MX-26 [12] */
1239 /* MX-27 MX-26 [11] */
1256 /* MX-27 MX-26 [9:8] */
1274 /* MX-28 [12] */
1284 /* MX-28 [11] */
1295 /* MX-28 [9:8] */
1305 /* MX-28 [1:0] */
1311 /* MX-28 [4] */
1321 /* MX-28 [3] */
1332 /* MX-2D [3:2] */
1334 "Slot 0-1", "Slot 2-3", "Slot 4-5", "Slot 6-7"
1343 /* MX-2F [15] */
1354 /* MX-2F [14:12] */
1365 /* MX-31 [15] [13] [11] [9] */
1394 /* MX-FA [12] */
1405 /* MX-FA [11] */
1416 /* MX-FA [10] */
1427 /* MX-9D [9:8] */
1441 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_hp_power_event()
1446 regmap_update_bits(rt5670->regmap, RT5670_CHARGE_PUMP, in rt5670_hp_power_event()
1448 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_power_event()
1451 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_hp_power_event()
1456 regmap_write(rt5670->regmap, RT5670_DEPOP_M2, 0x3100); in rt5670_hp_power_event()
1457 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8009); in rt5670_hp_power_event()
1458 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_power_event()
1461 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_power_event()
1464 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x0004); in rt5670_hp_power_event()
1477 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_hp_event()
1483 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1485 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1486 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x805d); in rt5670_hp_event()
1487 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1488 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_event()
1490 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1493 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1498 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1500 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1501 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x803d); in rt5670_hp_event()
1503 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1505 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1509 regmap_update_bits(rt5670->regmap, in rt5670_hp_event()
1511 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1512 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0707); in rt5670_hp_event()
1513 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1527 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_spk_event()
1530 if (!rt5670->gpio1_is_ext_spk_en) in rt5670_spk_event()
1535 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_spk_event()
1540 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_spk_event()
1554 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_bst1_event()
1577 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rt5670_bst2_event()
1600 SND_SOC_DAPM_SUPPLY("I2S DSP", RT5670_PWR_DIG2,
1771 /* DSP */
1780 SND_SOC_DAPM_MUX("DSP UL Mux", SND_SOC_NOPM, 0, 0,
1782 SND_SOC_DAPM_MUX("DSP DL Mux", SND_SOC_NOPM, 0, 0,
1828 SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0),
1829 SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0,
1832 /* Audio DSP */
1833 SND_SOC_DAPM_PGA("Audio DSP", SND_SOC_NOPM, 0, 0, NULL, 0),
2164 { "TDM Data Mux", "Slot 0-1", "Stereo1 ADC MIX" },
2165 { "TDM Data Mux", "Slot 2-3", "Mono ADC MIX" },
2166 { "TDM Data Mux", "Slot 4-5", "Stereo2 ADC MIX" },
2167 { "TDM Data Mux", "Slot 6-7", "IF2 DAC" },
2169 { "DSP UL Mux", "Bypass", "TDM Data Mux" },
2170 { "DSP UL Mux", NULL, "I2S DSP" },
2171 { "DSP DL Mux", "Bypass", "RxDP Mux" },
2172 { "DSP DL Mux", NULL, "I2S DSP" },
2174 { "TxDP_ADC_L", NULL, "DSP UL Mux" },
2175 { "TxDP_ADC_R", NULL, "DSP UL Mux" },
2176 { "TxDC_DAC", NULL, "DSP DL Mux" },
2239 { "Audio DSP", NULL, "DAC1 MIXL" },
2240 { "Audio DSP", NULL, "DAC1 MIXR" },
2369 struct snd_soc_component *component = dai->component; in rt5670_hw_params()
2374 rt5670->lrck[dai->id] = params_rate(params); in rt5670_hw_params()
2375 pre_div = rl6231_get_clk_info(rt5670->sysclk, rt5670->lrck[dai->id]); in rt5670_hw_params()
2377 dev_err(component->dev, "Unsupported clock setting %d for DAI %d\n", in rt5670_hw_params()
2378 rt5670->lrck[dai->id], dai->id); in rt5670_hw_params()
2379 return -EINVAL; in rt5670_hw_params()
2383 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); in rt5670_hw_params()
2384 return -EINVAL; in rt5670_hw_params()
2387 rt5670->bclk[dai->id] = rt5670->lrck[dai->id] * (32 << bclk_ms); in rt5670_hw_params()
2389 dev_dbg(dai->dev, "bclk is %dHz and lrck is %dHz\n", in rt5670_hw_params()
2390 rt5670->bclk[dai->id], rt5670->lrck[dai->id]); in rt5670_hw_params()
2391 dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n", in rt5670_hw_params()
2392 bclk_ms, pre_div, dai->id); in rt5670_hw_params()
2407 return -EINVAL; in rt5670_hw_params()
2410 switch (dai->id) { in rt5670_hw_params()
2428 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_hw_params()
2429 return -EINVAL; in rt5670_hw_params()
2437 struct snd_soc_component *component = dai->component; in rt5670_set_dai_fmt()
2443 rt5670->master[dai->id] = 1; in rt5670_set_dai_fmt()
2447 rt5670->master[dai->id] = 0; in rt5670_set_dai_fmt()
2450 return -EINVAL; in rt5670_set_dai_fmt()
2460 return -EINVAL; in rt5670_set_dai_fmt()
2476 return -EINVAL; in rt5670_set_dai_fmt()
2479 switch (dai->id) { in rt5670_set_dai_fmt()
2491 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_fmt()
2492 return -EINVAL; in rt5670_set_dai_fmt()
2514 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); in rt5670_set_codec_sysclk()
2515 return -EINVAL; in rt5670_set_codec_sysclk()
2519 rt5670->sysclk = freq; in rt5670_set_codec_sysclk()
2521 rt5670->sysclk_src = clk_id; 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()
2536 if (source == rt5670->pll_src && freq_in == rt5670->pll_in && in rt5670_set_dai_pll()
2537 freq_out == rt5670->pll_out) in rt5670_set_dai_pll()
2541 dev_dbg(component->dev, "PLL disabled\n"); in rt5670_set_dai_pll()
2543 rt5670->pll_in = 0; in rt5670_set_dai_pll()
2544 rt5670->pll_out = 0; in rt5670_set_dai_pll()
2559 switch (dai->id) { in rt5670_set_dai_pll()
2569 dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); in rt5670_set_dai_pll()
2570 return -EINVAL; in rt5670_set_dai_pll()
2574 dev_err(component->dev, "Unknown PLL source %d\n", source); in rt5670_set_dai_pll()
2575 return -EINVAL; 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()
2594 rt5670->pll_in = freq_in; in rt5670_set_dai_pll()
2595 rt5670->pll_out = freq_out; in rt5670_set_dai_pll()
2596 rt5670->pll_src = source; in rt5670_set_dai_pll()
2604 struct snd_soc_component *component = dai->component; in rt5670_set_tdm_slot()
2623 return -EINVAL; in rt5670_set_tdm_slot()
2639 return -EINVAL; in rt5670_set_tdm_slot()
2649 struct snd_soc_component *component = dai->component; in rt5670_set_bclk_ratio()
2651 dev_dbg(component->dev, "%s ratio=%d\n", __func__, ratio); in rt5670_set_bclk_ratio()
2652 if (dai->id != RT5670_AIF1) in rt5670_set_bclk_ratio()
2698 if (rt5670->jd_mode) in rt5670_set_bias_level()
2744 dev_err(component->dev, in rt5670_probe()
2746 return -ENODEV; in rt5670_probe()
2748 rt5670->component = component; in rt5670_probe()
2757 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_remove()
2758 snd_soc_jack_free_gpios(rt5670->jack, 1, &rt5670->hp_gpio); in rt5670_remove()
2766 regcache_cache_only(rt5670->regmap, true); in rt5670_suspend()
2767 regcache_mark_dirty(rt5670->regmap); in rt5670_suspend()
2775 regcache_cache_only(rt5670->regmap, false); in rt5670_resume()
2776 regcache_sync(rt5670->regmap); in rt5670_resume()
2799 .name = "rt5670-aif1",
2819 .name = "rt5670-aif2",
2822 .stream_name = "AIF2 Playback",
2829 .stream_name = "AIF2 Capture",
2893 rt5670_quirk = (unsigned long)id->driver_data; in rt5670_quirk_cb()
3036 return "cfg-spk:2 cfg-mic:dmics12"; in rt5670_components()
3038 return "cfg-spk:2 cfg-mic:dmic1"; in rt5670_components()
3040 return "cfg-spk:2 cfg-mic:dmic2"; in rt5670_components()
3042 return "cfg-spk:2 cfg-mic:dmic3"; in rt5670_components()
3054 rt5670 = devm_kzalloc(&i2c->dev, in rt5670_i2c_probe()
3058 return -ENOMEM; in rt5670_i2c_probe()
3064 dev_info(&i2c->dev, "Overriding quirk 0x%x => 0x%x\n", in rt5670_i2c_probe()
3070 rt5670->gpio1_is_irq = true; in rt5670_i2c_probe()
3071 dev_info(&i2c->dev, "quirk GPIO1 is IRQ\n"); in rt5670_i2c_probe()
3074 rt5670->gpio1_is_ext_spk_en = true; in rt5670_i2c_probe()
3075 dev_info(&i2c->dev, "quirk GPIO1 is external speaker enable\n"); in rt5670_i2c_probe()
3078 rt5670->in2_diff = true; in rt5670_i2c_probe()
3079 dev_info(&i2c->dev, "quirk IN2_DIFF\n"); in rt5670_i2c_probe()
3082 rt5670->dmic_en = true; in rt5670_i2c_probe()
3083 dev_info(&i2c->dev, "quirk DMIC enabled\n"); in rt5670_i2c_probe()
3086 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_IN2P; in rt5670_i2c_probe()
3087 dev_info(&i2c->dev, "quirk DMIC1 on IN2P pin\n"); in rt5670_i2c_probe()
3090 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO6; in rt5670_i2c_probe()
3091 dev_info(&i2c->dev, "quirk DMIC1 on GPIO6 pin\n"); in rt5670_i2c_probe()
3094 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO7; in rt5670_i2c_probe()
3095 dev_info(&i2c->dev, "quirk DMIC1 on GPIO7 pin\n"); in rt5670_i2c_probe()
3098 rt5670->dmic2_data_pin = RT5670_DMIC_DATA_IN3N; in rt5670_i2c_probe()
3099 dev_info(&i2c->dev, "quirk DMIC2 on INR pin\n"); in rt5670_i2c_probe()
3102 rt5670->dmic2_data_pin = RT5670_DMIC_DATA_GPIO8; in rt5670_i2c_probe()
3103 dev_info(&i2c->dev, "quirk DMIC2 on GPIO8 pin\n"); in rt5670_i2c_probe()
3106 rt5670->dmic3_data_pin = RT5670_DMIC_DATA_GPIO5; in rt5670_i2c_probe()
3107 dev_info(&i2c->dev, "quirk DMIC3 on GPIO5 pin\n"); in rt5670_i2c_probe()
3111 rt5670->jd_mode = 1; in rt5670_i2c_probe()
3112 dev_info(&i2c->dev, "quirk JD mode 1\n"); in rt5670_i2c_probe()
3115 rt5670->jd_mode = 2; in rt5670_i2c_probe()
3116 dev_info(&i2c->dev, "quirk JD mode 2\n"); in rt5670_i2c_probe()
3119 rt5670->jd_mode = 3; in rt5670_i2c_probe()
3120 dev_info(&i2c->dev, "quirk JD mode 3\n"); in rt5670_i2c_probe()
3127 rt5670->dac1_playback_switch_l = true; in rt5670_i2c_probe()
3128 rt5670->dac1_playback_switch_r = true; in rt5670_i2c_probe()
3129 /* The Power-On-Reset values for the DAC1 mixer have the DAC1 input enabled. */ in rt5670_i2c_probe()
3130 rt5670->dac1_mixl_dac1_switch = true; in rt5670_i2c_probe()
3131 rt5670->dac1_mixr_dac1_switch = true; in rt5670_i2c_probe()
3133 rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); in rt5670_i2c_probe()
3134 if (IS_ERR(rt5670->regmap)) { in rt5670_i2c_probe()
3135 ret = PTR_ERR(rt5670->regmap); in rt5670_i2c_probe()
3136 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", in rt5670_i2c_probe()
3141 regmap_read(rt5670->regmap, RT5670_VENDOR_ID2, &val); in rt5670_i2c_probe()
3143 dev_err(&i2c->dev, in rt5670_i2c_probe()
3145 return -ENODEV; in rt5670_i2c_probe()
3148 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3149 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
3154 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3156 regmap_read(rt5670->regmap, RT5670_VENDOR_ID, &val); in rt5670_i2c_probe()
3158 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0980); in rt5670_i2c_probe()
3160 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0d00); in rt5670_i2c_probe()
3162 ret = regmap_register_patch(rt5670->regmap, init_list, in rt5670_i2c_probe()
3165 dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); in rt5670_i2c_probe()
3167 regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC, in rt5670_i2c_probe()
3170 if (rt5670->in2_diff) in rt5670_i2c_probe()
3171 regmap_update_bits(rt5670->regmap, RT5670_IN2, in rt5670_i2c_probe()
3174 if (rt5670->gpio1_is_irq) { in rt5670_i2c_probe()
3176 regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000); in rt5670_i2c_probe()
3177 regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010); in rt5670_i2c_probe()
3178 regmap_write(rt5670->regmap, RT5670_IL_CMD3, 0x0014); in rt5670_i2c_probe()
3180 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3182 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_i2c_probe()
3186 if (rt5670->gpio1_is_ext_spk_en) { in rt5670_i2c_probe()
3187 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3189 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_i2c_probe()
3193 if (rt5670->jd_mode) { in rt5670_i2c_probe()
3194 regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK, in rt5670_i2c_probe()
3196 rt5670->sysclk = 0; in rt5670_i2c_probe()
3197 rt5670->sysclk_src = RT5670_SCLK_S_RCCLK; in rt5670_i2c_probe()
3198 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
3200 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2, in rt5670_i2c_probe()
3202 regmap_update_bits(rt5670->regmap, RT5670_IRQ_CTRL1, in rt5670_i2c_probe()
3204 regmap_update_bits(rt5670->regmap, RT5670_JD_CTRL3, in rt5670_i2c_probe()
3208 switch (rt5670->jd_mode) { in rt5670_i2c_probe()
3210 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3215 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3220 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3229 if (rt5670->dmic_en) { in rt5670_i2c_probe()
3230 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3234 switch (rt5670->dmic1_data_pin) { in rt5670_i2c_probe()
3236 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3242 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3245 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3251 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3254 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3263 switch (rt5670->dmic2_data_pin) { in rt5670_i2c_probe()
3265 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3271 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3274 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3283 switch (rt5670->dmic3_data_pin) { in rt5670_i2c_probe()
3285 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL2, in rt5670_i2c_probe()
3288 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3295 dev_err(&i2c->dev, in rt5670_i2c_probe()
3305 pm_runtime_enable(&i2c->dev); in rt5670_i2c_probe()
3306 pm_request_idle(&i2c->dev); in rt5670_i2c_probe()
3308 ret = devm_snd_soc_register_component(&i2c->dev, in rt5670_i2c_probe()
3316 pm_runtime_disable(&i2c->dev); in rt5670_i2c_probe()
3323 pm_runtime_disable(&i2c->dev); in rt5670_i2c_remove()