• Home
  • Raw
  • Download

Lines Matching refs:rt5670

435 	struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);  in rt5670_headset_detect()  local
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()
481 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_jack_suspend() local
483 rt5670->jack_type_saved = rt5670->jack_type; in rt5670_jack_suspend()
490 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_jack_resume() local
492 if (rt5670->jack_type_saved) in rt5670_jack_resume()
515 struct rt5670_priv *rt5670 = (struct rt5670_priv *)data; in rt5670_irq_detection() local
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()
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()
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()
580 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_jack_detect() local
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()
700 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in set_dmic_clk() local
703 rate = rt5670->sysclk / rl6231_get_pre_div(rt5670->regmap, in set_dmic_clk()
718 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in is_sys_clk_from_pll() local
720 if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1) in is_sys_clk_from_pll()
782 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in can_use_asrc() local
784 if (rt5670->sysclk > rt5670->lrck[RT5670_AIF1] * 384) in can_use_asrc()
1368 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hp_power_event() local
1372 regmap_update_bits(rt5670->regmap, RT5670_CHARGE_PUMP, in rt5670_hp_power_event()
1374 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_power_event()
1377 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_hp_power_event()
1382 regmap_write(rt5670->regmap, RT5670_DEPOP_M2, 0x3100); in rt5670_hp_power_event()
1383 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8009); in rt5670_hp_power_event()
1384 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_power_event()
1387 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_power_event()
1390 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x0004); in rt5670_hp_power_event()
1404 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hp_event() local
1409 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1411 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1412 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x805d); in rt5670_hp_event()
1413 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1414 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_event()
1416 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1419 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1424 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1426 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1427 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x803d); in rt5670_hp_event()
1429 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1431 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1435 regmap_update_bits(rt5670->regmap, in rt5670_hp_event()
1437 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1438 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0707); in rt5670_hp_event()
1439 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1454 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_spk_event() local
1456 if (!rt5670->gpio1_is_ext_spk_en) in rt5670_spk_event()
1461 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_spk_event()
1466 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_spk_event()
2298 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_hw_params() local
2302 rt5670->lrck[dai->id] = params_rate(params); in rt5670_hw_params()
2303 pre_div = rl6231_get_clk_info(rt5670->sysclk, rt5670->lrck[dai->id]); in rt5670_hw_params()
2306 rt5670->lrck[dai->id], dai->id); in rt5670_hw_params()
2315 rt5670->bclk[dai->id] = rt5670->lrck[dai->id] * (32 << bclk_ms); in rt5670_hw_params()
2318 rt5670->bclk[dai->id], rt5670->lrck[dai->id]); in rt5670_hw_params()
2366 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_dai_fmt() local
2371 rt5670->master[dai->id] = 1; in rt5670_set_dai_fmt()
2375 rt5670->master[dai->id] = 0; in rt5670_set_dai_fmt()
2428 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_codec_sysclk() local
2447 rt5670->sysclk = freq; in rt5670_set_codec_sysclk()
2449 rt5670->sysclk_src = clk_id; in rt5670_set_codec_sysclk()
2460 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_dai_pll() local
2464 if (source == rt5670->pll_src && freq_in == rt5670->pll_in && in rt5670_set_dai_pll()
2465 freq_out == rt5670->pll_out) in rt5670_set_dai_pll()
2471 rt5670->pll_in = 0; in rt5670_set_dai_pll()
2472 rt5670->pll_out = 0; in rt5670_set_dai_pll()
2522 rt5670->pll_in = freq_in; in rt5670_set_dai_pll()
2523 rt5670->pll_out = freq_out; in rt5670_set_dai_pll()
2524 rt5670->pll_src = source; in rt5670_set_dai_pll()
2596 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_set_bias_level() local
2626 if (rt5670->jd_mode) in rt5670_set_bias_level()
2651 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_probe() local
2676 rt5670->component = component; in rt5670_probe()
2683 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_remove() local
2685 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_remove()
2686 snd_soc_jack_free_gpios(rt5670->jack, 1, &rt5670->hp_gpio); in rt5670_remove()
2692 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_suspend() local
2694 regcache_cache_only(rt5670->regmap, true); in rt5670_suspend()
2695 regcache_mark_dirty(rt5670->regmap); in rt5670_suspend()
2701 struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); in rt5670_resume() local
2703 regcache_cache_only(rt5670->regmap, false); in rt5670_resume()
2704 regcache_sync(rt5670->regmap); in rt5670_resume()
2941 struct rt5670_priv *rt5670; in rt5670_i2c_probe() local
2945 rt5670 = devm_kzalloc(&i2c->dev, in rt5670_i2c_probe()
2948 if (NULL == rt5670) in rt5670_i2c_probe()
2951 i2c_set_clientdata(i2c, rt5670); in rt5670_i2c_probe()
2961 rt5670->gpio1_is_irq = true; in rt5670_i2c_probe()
2965 rt5670->gpio1_is_ext_spk_en = true; in rt5670_i2c_probe()
2969 rt5670->in2_diff = true; in rt5670_i2c_probe()
2973 rt5670->dmic_en = true; in rt5670_i2c_probe()
2977 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_IN2P; in rt5670_i2c_probe()
2981 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO6; in rt5670_i2c_probe()
2985 rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO7; in rt5670_i2c_probe()
2989 rt5670->dmic2_data_pin = RT5670_DMIC_DATA_IN3N; in rt5670_i2c_probe()
2993 rt5670->dmic2_data_pin = RT5670_DMIC_DATA_GPIO8; in rt5670_i2c_probe()
2997 rt5670->dmic3_data_pin = RT5670_DMIC_DATA_GPIO5; in rt5670_i2c_probe()
3002 rt5670->jd_mode = 1; in rt5670_i2c_probe()
3006 rt5670->jd_mode = 2; in rt5670_i2c_probe()
3010 rt5670->jd_mode = 3; in rt5670_i2c_probe()
3014 rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); in rt5670_i2c_probe()
3015 if (IS_ERR(rt5670->regmap)) { in rt5670_i2c_probe()
3016 ret = PTR_ERR(rt5670->regmap); in rt5670_i2c_probe()
3022 regmap_read(rt5670->regmap, RT5670_VENDOR_ID2, &val); in rt5670_i2c_probe()
3029 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3030 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
3035 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3037 regmap_read(rt5670->regmap, RT5670_VENDOR_ID, &val); in rt5670_i2c_probe()
3039 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0980); in rt5670_i2c_probe()
3041 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0d00); in rt5670_i2c_probe()
3043 ret = regmap_register_patch(rt5670->regmap, init_list, in rt5670_i2c_probe()
3048 regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC, in rt5670_i2c_probe()
3051 if (rt5670->in2_diff) in rt5670_i2c_probe()
3052 regmap_update_bits(rt5670->regmap, RT5670_IN2, in rt5670_i2c_probe()
3055 if (rt5670->gpio1_is_irq) { in rt5670_i2c_probe()
3057 regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000); in rt5670_i2c_probe()
3058 regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010); in rt5670_i2c_probe()
3059 regmap_write(rt5670->regmap, RT5670_IL_CMD3, 0x0014); in rt5670_i2c_probe()
3061 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3063 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_i2c_probe()
3067 if (rt5670->gpio1_is_ext_spk_en) { in rt5670_i2c_probe()
3068 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3070 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_i2c_probe()
3074 if (rt5670->jd_mode) { in rt5670_i2c_probe()
3075 regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK, in rt5670_i2c_probe()
3077 rt5670->sysclk = 0; in rt5670_i2c_probe()
3078 rt5670->sysclk_src = RT5670_SCLK_S_RCCLK; in rt5670_i2c_probe()
3079 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
3081 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2, in rt5670_i2c_probe()
3083 regmap_update_bits(rt5670->regmap, RT5670_IRQ_CTRL1, in rt5670_i2c_probe()
3085 regmap_update_bits(rt5670->regmap, RT5670_JD_CTRL3, in rt5670_i2c_probe()
3089 switch (rt5670->jd_mode) { in rt5670_i2c_probe()
3091 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3096 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3101 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
3110 if (rt5670->dmic_en) { in rt5670_i2c_probe()
3111 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3115 switch (rt5670->dmic1_data_pin) { in rt5670_i2c_probe()
3117 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3123 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3126 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3132 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3135 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3144 switch (rt5670->dmic2_data_pin) { in rt5670_i2c_probe()
3146 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3152 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
3155 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
3164 switch (rt5670->dmic3_data_pin) { in rt5670_i2c_probe()
3166 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL2, in rt5670_i2c_probe()
3169 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()