• Home
  • Raw
  • Download

Lines Matching refs:rt5670

419 	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);  in rt5670_headset_detect()  local
441 rt5670->jack_type = SND_JACK_HEADSET; in rt5670_headset_detect()
448 rt5670->jack_type = SND_JACK_HEADPHONE; in rt5670_headset_detect()
455 rt5670->jack_type = 0; in rt5670_headset_detect()
460 return rt5670->jack_type; in rt5670_headset_detect()
465 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_jack_suspend() local
467 rt5670->jack_type_saved = rt5670->jack_type; in rt5670_jack_suspend()
474 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_jack_resume() local
476 if (rt5670->jack_type_saved) in rt5670_jack_resume()
499 struct rt5670_priv *rt5670 = (struct rt5670_priv *)data; in rt5670_irq_detection() local
500 struct snd_soc_jack_gpio *gpio = &rt5670->hp_gpio; in rt5670_irq_detection()
501 struct snd_soc_jack *jack = rt5670->jack; in rt5670_irq_detection()
504 if (rt5670->pdata.jd_mode == 1) /* 2 port */ in rt5670_irq_detection()
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()
513 if (rt5670->jack_type == 0) { 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()
542 report = rt5670->jack_type; 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()
564 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_jack_detect() local
567 rt5670->jack = jack; in rt5670_set_jack_detect()
568 rt5670->hp_gpio.gpiod_dev = codec->dev; in rt5670_set_jack_detect()
569 rt5670->hp_gpio.name = "headphone detect"; in rt5670_set_jack_detect()
570 rt5670->hp_gpio.report = SND_JACK_HEADSET | in rt5670_set_jack_detect()
572 rt5670->hp_gpio.debounce_time = 150; in rt5670_set_jack_detect()
573 rt5670->hp_gpio.wake = true; in rt5670_set_jack_detect()
574 rt5670->hp_gpio.data = (struct rt5670_priv *)rt5670; in rt5670_set_jack_detect()
575 rt5670->hp_gpio.jack_status_check = rt5670_irq_detection; in rt5670_set_jack_detect()
577 ret = snd_soc_jack_add_gpios(rt5670->jack, 1, in rt5670_set_jack_detect()
578 &rt5670->hp_gpio); in rt5670_set_jack_detect()
684 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in set_dmic_clk() local
687 rate = rt5670->sysclk / rl6231_get_pre_div(rt5670->regmap, in set_dmic_clk()
702 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in is_sys_clk_from_pll() local
704 if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1) in is_sys_clk_from_pll()
766 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in can_use_asrc() local
768 if (rt5670->sysclk > rt5670->lrck[RT5670_AIF1] * 384) in can_use_asrc()
1416 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hp_power_event() local
1420 regmap_update_bits(rt5670->regmap, RT5670_CHARGE_PUMP, in rt5670_hp_power_event()
1422 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_power_event()
1425 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_hp_power_event()
1430 regmap_write(rt5670->regmap, RT5670_DEPOP_M2, 0x3100); in rt5670_hp_power_event()
1431 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8009); in rt5670_hp_power_event()
1432 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_power_event()
1435 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_power_event()
1438 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x0004); in rt5670_hp_power_event()
1452 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hp_event() local
1457 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1459 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1460 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x805d); in rt5670_hp_event()
1461 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1462 regmap_update_bits(rt5670->regmap, RT5670_GEN_CTRL2, in rt5670_hp_event()
1464 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1467 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1472 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
1474 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1475 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x803d); in rt5670_hp_event()
1477 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1479 regmap_update_bits(rt5670->regmap, RT5670_HP_VOL, in rt5670_hp_event()
1483 regmap_update_bits(rt5670->regmap, in rt5670_hp_event()
1485 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1486 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0707); in rt5670_hp_event()
1487 regmap_write(rt5670->regmap, RT5670_PR_BASE + in rt5670_hp_event()
2320 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_hw_params() local
2324 rt5670->lrck[dai->id] = params_rate(params); in rt5670_hw_params()
2325 pre_div = rl6231_get_clk_info(rt5670->sysclk, rt5670->lrck[dai->id]); in rt5670_hw_params()
2328 rt5670->lrck[dai->id], dai->id); in rt5670_hw_params()
2337 rt5670->bclk[dai->id] = rt5670->lrck[dai->id] * (32 << bclk_ms); in rt5670_hw_params()
2340 rt5670->bclk[dai->id], rt5670->lrck[dai->id]); in rt5670_hw_params()
2388 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_fmt() local
2393 rt5670->master[dai->id] = 1; in rt5670_set_dai_fmt()
2397 rt5670->master[dai->id] = 0; in rt5670_set_dai_fmt()
2451 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_sysclk() local
2470 rt5670->sysclk = freq; in rt5670_set_dai_sysclk()
2472 rt5670->sysclk_src = clk_id; in rt5670_set_dai_sysclk()
2483 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_dai_pll() local
2487 if (source == rt5670->pll_src && freq_in == rt5670->pll_in && in rt5670_set_dai_pll()
2488 freq_out == rt5670->pll_out) in rt5670_set_dai_pll()
2494 rt5670->pll_in = 0; in rt5670_set_dai_pll()
2495 rt5670->pll_out = 0; in rt5670_set_dai_pll()
2545 rt5670->pll_in = freq_in; in rt5670_set_dai_pll()
2546 rt5670->pll_out = freq_out; in rt5670_set_dai_pll()
2547 rt5670->pll_src = source; in rt5670_set_dai_pll()
2601 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_set_bias_level() local
2631 if (rt5670->pdata.jd_mode) in rt5670_set_bias_level()
2656 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_probe() local
2681 rt5670->codec = codec; in rt5670_probe()
2688 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_remove() local
2690 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_remove()
2691 snd_soc_jack_free_gpios(rt5670->jack, 1, &rt5670->hp_gpio); in rt5670_remove()
2698 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_suspend() local
2700 regcache_cache_only(rt5670->regmap, true); in rt5670_suspend()
2701 regcache_mark_dirty(rt5670->regmap); in rt5670_suspend()
2707 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); in rt5670_resume() local
2709 regcache_cache_only(rt5670->regmap, false); in rt5670_resume()
2710 regcache_sync(rt5670->regmap); in rt5670_resume()
2833 struct rt5670_priv *rt5670; in rt5670_i2c_probe() local
2837 rt5670 = devm_kzalloc(&i2c->dev, in rt5670_i2c_probe()
2840 if (NULL == rt5670) in rt5670_i2c_probe()
2843 i2c_set_clientdata(i2c, rt5670); in rt5670_i2c_probe()
2846 rt5670->pdata = *pdata; in rt5670_i2c_probe()
2849 rt5670->pdata.dmic_en = true; in rt5670_i2c_probe()
2850 rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P; in rt5670_i2c_probe()
2851 rt5670->pdata.dev_gpio = true; in rt5670_i2c_probe()
2852 rt5670->pdata.jd_mode = 1; in rt5670_i2c_probe()
2855 rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); in rt5670_i2c_probe()
2856 if (IS_ERR(rt5670->regmap)) { in rt5670_i2c_probe()
2857 ret = PTR_ERR(rt5670->regmap); in rt5670_i2c_probe()
2863 regmap_read(rt5670->regmap, RT5670_VENDOR_ID2, &val); in rt5670_i2c_probe()
2870 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
2871 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
2876 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
2878 regmap_read(rt5670->regmap, RT5670_VENDOR_ID, &val); in rt5670_i2c_probe()
2880 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0980); in rt5670_i2c_probe()
2882 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0d00); in rt5670_i2c_probe()
2884 ret = regmap_register_patch(rt5670->regmap, init_list, in rt5670_i2c_probe()
2889 if (rt5670->pdata.in2_diff) in rt5670_i2c_probe()
2890 regmap_update_bits(rt5670->regmap, RT5670_IN2, in rt5670_i2c_probe()
2893 if (rt5670->pdata.dev_gpio) { in rt5670_i2c_probe()
2895 regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000); in rt5670_i2c_probe()
2896 regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010); in rt5670_i2c_probe()
2897 regmap_write(rt5670->regmap, RT5670_IL_CMD3, 0x0014); in rt5670_i2c_probe()
2899 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
2901 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, in rt5670_i2c_probe()
2903 regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC, 0x8, 0x8); in rt5670_i2c_probe()
2906 if (rt5670->pdata.jd_mode) { in rt5670_i2c_probe()
2907 regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK, in rt5670_i2c_probe()
2909 rt5670->sysclk = 0; in rt5670_i2c_probe()
2910 rt5670->sysclk_src = RT5670_SCLK_S_RCCLK; in rt5670_i2c_probe()
2911 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, in rt5670_i2c_probe()
2913 regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2, in rt5670_i2c_probe()
2915 regmap_update_bits(rt5670->regmap, RT5670_IRQ_CTRL1, in rt5670_i2c_probe()
2917 regmap_update_bits(rt5670->regmap, RT5670_JD_CTRL3, in rt5670_i2c_probe()
2921 switch (rt5670->pdata.jd_mode) { in rt5670_i2c_probe()
2923 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
2928 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
2933 regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1, in rt5670_i2c_probe()
2942 if (rt5670->pdata.dmic_en) { in rt5670_i2c_probe()
2943 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
2947 switch (rt5670->pdata.dmic1_data_pin) { in rt5670_i2c_probe()
2949 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
2955 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
2958 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
2964 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
2967 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
2976 switch (rt5670->pdata.dmic2_data_pin) { in rt5670_i2c_probe()
2978 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
2984 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1, in rt5670_i2c_probe()
2987 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()
2996 switch (rt5670->pdata.dmic3_data_pin) { in rt5670_i2c_probe()
2998 regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL2, in rt5670_i2c_probe()
3001 regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, in rt5670_i2c_probe()