Lines Matching full:rt5659

3  * rt5659.c  --  RT5659/RT5658 ALSA SoC audio codec driver
28 #include <sound/rt5659.h>
31 #include "rt5659.h"
1264 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_headset_detect() local
1296 rt5659->jack_type = SND_JACK_HEADSET; in rt5659_headset_detect()
1301 rt5659->jack_type = SND_JACK_HEADPHONE; in rt5659_headset_detect()
1309 if (rt5659->jack_type == SND_JACK_HEADSET) in rt5659_headset_detect()
1311 rt5659->jack_type = 0; in rt5659_headset_detect()
1314 dev_dbg(component->dev, "jack_type = %d\n", rt5659->jack_type); in rt5659_headset_detect()
1315 return rt5659->jack_type; in rt5659_headset_detect()
1331 struct rt5659_priv *rt5659 = data; in rt5659_irq() local
1334 &rt5659->jack_detect_work, msecs_to_jiffies(250)); in rt5659_irq()
1342 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_jack_detect() local
1344 rt5659->hs_jack = hs_jack; in rt5659_set_jack_detect()
1346 rt5659_irq(0, rt5659); in rt5659_set_jack_detect()
1354 struct rt5659_priv *rt5659 = in rt5659_jack_detect_work() local
1358 if (!rt5659->component) in rt5659_jack_detect_work()
1361 val = snd_soc_component_read(rt5659->component, RT5659_INT_ST_1) & 0x0080; in rt5659_jack_detect_work()
1364 if (rt5659->jack_type == 0) { in rt5659_jack_detect_work()
1366 report = rt5659_headset_detect(rt5659->component, 1); in rt5659_jack_detect_work()
1370 btn_type = rt5659_button_detect(rt5659->component); in rt5659_jack_detect_work()
1372 * rt5659 can report three kinds of button behavior, in rt5659_jack_detect_work()
1403 dev_err(rt5659->component->dev, in rt5659_jack_detect_work()
1411 report = rt5659->jack_type; in rt5659_jack_detect_work()
1415 report = rt5659_headset_detect(rt5659->component, 0); in rt5659_jack_detect_work()
1418 snd_soc_jack_report(rt5659->hs_jack, report, SND_JACK_HEADSET | in rt5659_jack_detect_work()
1425 struct rt5659_priv *rt5659 = in rt5659_jack_detect_intel_hd_header() local
1430 if (!rt5659->hs_jack) in rt5659_jack_detect_intel_hd_header()
1434 regmap_read(rt5659->regmap, RT5659_GPIO_STA, &value); in rt5659_jack_detect_intel_hd_header()
1437 if (hp_flag != rt5659->hda_hp_plugged) { in rt5659_jack_detect_intel_hd_header()
1438 rt5659->hda_hp_plugged = hp_flag; in rt5659_jack_detect_intel_hd_header()
1441 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_1, in rt5659_jack_detect_intel_hd_header()
1443 rt5659->jack_type |= SND_JACK_HEADPHONE; in rt5659_jack_detect_intel_hd_header()
1445 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_1, in rt5659_jack_detect_intel_hd_header()
1447 rt5659->jack_type = rt5659->jack_type & in rt5659_jack_detect_intel_hd_header()
1451 snd_soc_jack_report(rt5659->hs_jack, rt5659->jack_type, in rt5659_jack_detect_intel_hd_header()
1456 regmap_read(rt5659->regmap, RT5659_4BTN_IL_CMD_1, &value); in rt5659_jack_detect_intel_hd_header()
1457 regmap_write(rt5659->regmap, RT5659_4BTN_IL_CMD_1, value); in rt5659_jack_detect_intel_hd_header()
1460 if (mic_flag != rt5659->hda_mic_plugged) { in rt5659_jack_detect_intel_hd_header()
1461 rt5659->hda_mic_plugged = mic_flag; in rt5659_jack_detect_intel_hd_header()
1463 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_2, in rt5659_jack_detect_intel_hd_header()
1465 rt5659->jack_type |= SND_JACK_MICROPHONE; in rt5659_jack_detect_intel_hd_header()
1467 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_2, in rt5659_jack_detect_intel_hd_header()
1469 rt5659->jack_type = rt5659->jack_type in rt5659_jack_detect_intel_hd_header()
1473 snd_soc_jack_report(rt5659->hs_jack, rt5659->jack_type, in rt5659_jack_detect_intel_hd_header()
1568 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in set_dmic_clk() local
1571 pd = rl6231_get_pre_div(rt5659->regmap, in set_dmic_clk()
1573 idx = rl6231_calc_dmic_clk(rt5659->sysclk / pd); in set_dmic_clk()
3279 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_hw_params() local
3283 rt5659->lrck[dai->id] = params_rate(params); in rt5659_hw_params()
3284 pre_div = rl6231_get_clk_info(rt5659->sysclk, rt5659->lrck[dai->id]); in rt5659_hw_params()
3287 rt5659->lrck[dai->id], dai->id); in rt5659_hw_params()
3297 rt5659->lrck[dai->id], pre_div, dai->id); in rt5659_hw_params()
3341 switch (rt5659->lrck[dai->id]) { in rt5659_hw_params()
3362 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_dai_fmt() local
3367 rt5659->master[dai->id] = 1; in rt5659_set_dai_fmt()
3371 rt5659->master[dai->id] = 0; in rt5659_set_dai_fmt()
3429 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_component_sysclk() local
3433 if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src) in rt5659_set_component_sysclk()
3438 ret = clk_set_rate(rt5659->mclk, freq); in rt5659_set_component_sysclk()
3456 rt5659->sysclk = freq; in rt5659_set_component_sysclk()
3457 rt5659->sysclk_src = clk_id; in rt5659_set_component_sysclk()
3469 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_component_pll() local
3473 if (source == rt5659->pll_src && freq_in == rt5659->pll_in && in rt5659_set_component_pll()
3474 freq_out == rt5659->pll_out) in rt5659_set_component_pll()
3480 rt5659->pll_in = 0; in rt5659_set_component_pll()
3481 rt5659->pll_out = 0; in rt5659_set_component_pll()
3525 rt5659->pll_in = freq_in; in rt5659_set_component_pll()
3526 rt5659->pll_out = freq_out; in rt5659_set_component_pll()
3527 rt5659->pll_src = source; in rt5659_set_component_pll()
3587 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_bclk_ratio() local
3591 rt5659->bclk[dai->id] = ratio; in rt5659_set_bclk_ratio()
3615 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_set_bias_level() local
3620 regmap_update_bits(rt5659->regmap, RT5659_DIG_MISC, in rt5659_set_bias_level()
3622 regmap_update_bits(rt5659->regmap, RT5659_PWR_DIG_1, in rt5659_set_bias_level()
3624 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_set_bias_level()
3628 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_set_bias_level()
3635 ret = clk_prepare_enable(rt5659->mclk); in rt5659_set_bias_level()
3645 regmap_update_bits(rt5659->regmap, RT5659_PWR_DIG_1, in rt5659_set_bias_level()
3647 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_set_bias_level()
3651 regmap_update_bits(rt5659->regmap, RT5659_DIG_MISC, in rt5659_set_bias_level()
3653 clk_disable_unprepare(rt5659->mclk); in rt5659_set_bias_level()
3667 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_probe() local
3669 rt5659->component = component; in rt5659_probe()
3671 switch (rt5659->pdata.jd_src) { in rt5659_probe()
3687 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_remove() local
3689 regmap_write(rt5659->regmap, RT5659_RESET, 0); in rt5659_remove()
3695 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_suspend() local
3697 regcache_cache_only(rt5659->regmap, true); in rt5659_suspend()
3698 regcache_mark_dirty(rt5659->regmap); in rt5659_suspend()
3704 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); in rt5659_resume() local
3706 regcache_cache_only(rt5659->regmap, false); in rt5659_resume()
3707 regcache_sync(rt5659->regmap); in rt5659_resume()
3729 .name = "rt5659-aif1",
3748 .name = "rt5659-aif2",
3767 .name = "rt5659-aif3",
3819 { "rt5659" },
3824 static int rt5659_parse_dt(struct rt5659_priv *rt5659, struct device *dev) in rt5659_parse_dt() argument
3826 rt5659->pdata.in1_diff = device_property_read_bool(dev, in rt5659_parse_dt()
3828 rt5659->pdata.in3_diff = device_property_read_bool(dev, in rt5659_parse_dt()
3830 rt5659->pdata.in4_diff = device_property_read_bool(dev, in rt5659_parse_dt()
3835 &rt5659->pdata.dmic1_data_pin); in rt5659_parse_dt()
3837 &rt5659->pdata.dmic2_data_pin); in rt5659_parse_dt()
3839 &rt5659->pdata.jd_src); in rt5659_parse_dt()
3844 static void rt5659_calibrate(struct rt5659_priv *rt5659) in rt5659_calibrate() argument
3850 regmap_write(rt5659->regmap, RT5659_BIAS_CUR_CTRL_8, 0xa502); in rt5659_calibrate()
3851 regmap_write(rt5659->regmap, RT5659_CHOP_DAC, 0x3030); in rt5659_calibrate()
3853 regmap_write(rt5659->regmap, RT5659_PRE_DIV_1, 0xef00); in rt5659_calibrate()
3854 regmap_write(rt5659->regmap, RT5659_PRE_DIV_2, 0xeffc); in rt5659_calibrate()
3855 regmap_write(rt5659->regmap, RT5659_MICBIAS_2, 0x0280); in rt5659_calibrate()
3856 regmap_write(rt5659->regmap, RT5659_DIG_MISC, 0x0001); in rt5659_calibrate()
3857 regmap_write(rt5659->regmap, RT5659_GLB_CLK, 0x8000); in rt5659_calibrate()
3859 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_1, 0xaa7e); in rt5659_calibrate()
3861 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_1, 0xfe7e); in rt5659_calibrate()
3863 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_3, 0x0004); in rt5659_calibrate()
3864 regmap_write(rt5659->regmap, RT5659_PWR_DIG_2, 0x0400); in rt5659_calibrate()
3866 regmap_write(rt5659->regmap, RT5659_PWR_DIG_1, 0x0080); in rt5659_calibrate()
3868 regmap_write(rt5659->regmap, RT5659_DEPOP_1, 0x0009); in rt5659_calibrate()
3870 regmap_write(rt5659->regmap, RT5659_PWR_DIG_1, 0x0f80); in rt5659_calibrate()
3872 regmap_write(rt5659->regmap, RT5659_HP_CHARGE_PUMP_1, 0x0e16); in rt5659_calibrate()
3876 regmap_write(rt5659->regmap, RT5659_CAL_REC, 0x0505); in rt5659_calibrate()
3878 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_3, 0x0184); in rt5659_calibrate()
3879 regmap_write(rt5659->regmap, RT5659_CALIB_ADC_CTRL, 0x3c05); in rt5659_calibrate()
3880 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x20c1); in rt5659_calibrate()
3883 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x2cc1); in rt5659_calibrate()
3884 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, 0x5100); in rt5659_calibrate()
3885 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_7, 0x0014); in rt5659_calibrate()
3886 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, 0xd100); in rt5659_calibrate()
3890 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x2cc1); in rt5659_calibrate()
3891 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, 0x4900); in rt5659_calibrate()
3892 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_7, 0x0016); in rt5659_calibrate()
3893 regmap_update_bits(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, in rt5659_calibrate()
3898 regmap_read(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, &value); in rt5659_calibrate()
3905 dev_err(rt5659->component->dev, in rt5659_calibrate()
3914 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x2cc1); in rt5659_calibrate()
3915 regmap_write(rt5659->regmap, RT5659_HP_VOL, 0x0000); in rt5659_calibrate()
3916 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, 0x4500); in rt5659_calibrate()
3917 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_7, 0x001f); in rt5659_calibrate()
3918 regmap_update_bits(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, in rt5659_calibrate()
3923 regmap_read(rt5659->regmap, RT5659_HP_CALIB_CTRL_1, &value); in rt5659_calibrate()
3930 dev_err(rt5659->component->dev, in rt5659_calibrate()
3938 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_7, 0x0000); in rt5659_calibrate()
3939 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x20c0); in rt5659_calibrate()
3943 regmap_write(rt5659->regmap, RT5659_CLASSD_0, 0x2021); in rt5659_calibrate()
3944 regmap_write(rt5659->regmap, RT5659_CLASSD_CTRL_1, 0x0260); in rt5659_calibrate()
3945 regmap_write(rt5659->regmap, RT5659_PWR_MIXER, 0x3000); in rt5659_calibrate()
3946 regmap_write(rt5659->regmap, RT5659_PWR_VOL, 0xc000); in rt5659_calibrate()
3947 regmap_write(rt5659->regmap, RT5659_A_DAC_MUX, 0x000c); in rt5659_calibrate()
3948 regmap_write(rt5659->regmap, RT5659_DIG_MISC, 0x8000); in rt5659_calibrate()
3949 regmap_write(rt5659->regmap, RT5659_SPO_VOL, 0x0808); in rt5659_calibrate()
3950 regmap_write(rt5659->regmap, RT5659_SPK_L_MIXER, 0x001e); in rt5659_calibrate()
3951 regmap_write(rt5659->regmap, RT5659_SPK_R_MIXER, 0x001e); in rt5659_calibrate()
3952 regmap_write(rt5659->regmap, RT5659_CLASSD_1, 0x0803); in rt5659_calibrate()
3953 regmap_write(rt5659->regmap, RT5659_CLASSD_2, 0x0554); in rt5659_calibrate()
3954 regmap_write(rt5659->regmap, RT5659_SPO_AMP_GAIN, 0x1103); in rt5659_calibrate()
3957 regmap_write(rt5659->regmap, RT5659_CAL_REC, 0x0909); in rt5659_calibrate()
3958 regmap_update_bits(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x0001, in rt5659_calibrate()
3962 regmap_write(rt5659->regmap, RT5659_SPK_DC_CAILB_CTRL_3, 0x0000); in rt5659_calibrate()
3963 regmap_write(rt5659->regmap, RT5659_CLASSD_0, 0x0021); in rt5659_calibrate()
3964 regmap_write(rt5659->regmap, RT5659_SPK_DC_CAILB_CTRL_1, 0x3e80); in rt5659_calibrate()
3965 regmap_update_bits(rt5659->regmap, RT5659_SPK_DC_CAILB_CTRL_1, in rt5659_calibrate()
3970 regmap_read(rt5659->regmap, in rt5659_calibrate()
3978 dev_err(rt5659->component->dev, in rt5659_calibrate()
3988 regmap_write(rt5659->regmap, RT5659_DIG_MISC, 0x0000); in rt5659_calibrate()
3989 regmap_write(rt5659->regmap, RT5659_MONOMIX_IN_GAIN, 0x021f); in rt5659_calibrate()
3990 regmap_write(rt5659->regmap, RT5659_MONO_OUT, 0x480a); in rt5659_calibrate()
3992 regmap_write(rt5659->regmap, RT5659_MONO_GAIN, 0x0003); in rt5659_calibrate()
3993 regmap_write(rt5659->regmap, RT5659_MONO_NG2_CTRL_5, 0x0009); in rt5659_calibrate()
3996 regmap_write(rt5659->regmap, RT5659_SPK_DC_CAILB_CTRL_3, 0x000f); in rt5659_calibrate()
3997 regmap_write(rt5659->regmap, RT5659_MONO_AMP_CALIB_CTRL_1, 0x1e00); in rt5659_calibrate()
3998 regmap_update_bits(rt5659->regmap, RT5659_MONO_AMP_CALIB_CTRL_1, in rt5659_calibrate()
4003 regmap_read(rt5659->regmap, RT5659_MONO_AMP_CALIB_CTRL_1, in rt5659_calibrate()
4011 dev_err(rt5659->component->dev, in rt5659_calibrate()
4019 regmap_write(rt5659->regmap, RT5659_SPK_DC_CAILB_CTRL_3, 0x0003); in rt5659_calibrate()
4023 regmap_write(rt5659->regmap, RT5659_CAL_REC, 0x0808); in rt5659_calibrate()
4024 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_3, 0x0000); in rt5659_calibrate()
4025 regmap_write(rt5659->regmap, RT5659_CALIB_ADC_CTRL, 0x2005); in rt5659_calibrate()
4026 regmap_write(rt5659->regmap, RT5659_HP_CALIB_CTRL_2, 0x20c0); in rt5659_calibrate()
4027 regmap_write(rt5659->regmap, RT5659_DEPOP_1, 0x0000); in rt5659_calibrate()
4028 regmap_write(rt5659->regmap, RT5659_CLASSD_1, 0x0011); in rt5659_calibrate()
4029 regmap_write(rt5659->regmap, RT5659_CLASSD_2, 0x0150); in rt5659_calibrate()
4030 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_1, 0xfe3e); in rt5659_calibrate()
4031 regmap_write(rt5659->regmap, RT5659_MONO_OUT, 0xc80a); in rt5659_calibrate()
4032 regmap_write(rt5659->regmap, RT5659_MONO_AMP_CALIB_CTRL_1, 0x1e04); in rt5659_calibrate()
4033 regmap_write(rt5659->regmap, RT5659_PWR_MIXER, 0x0000); in rt5659_calibrate()
4034 regmap_write(rt5659->regmap, RT5659_PWR_VOL, 0x0000); in rt5659_calibrate()
4035 regmap_write(rt5659->regmap, RT5659_PWR_DIG_1, 0x0000); in rt5659_calibrate()
4036 regmap_write(rt5659->regmap, RT5659_PWR_DIG_2, 0x0000); in rt5659_calibrate()
4037 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_1, 0x003e); in rt5659_calibrate()
4038 regmap_write(rt5659->regmap, RT5659_CLASSD_CTRL_1, 0x0060); in rt5659_calibrate()
4039 regmap_write(rt5659->regmap, RT5659_CLASSD_0, 0x2021); in rt5659_calibrate()
4040 regmap_write(rt5659->regmap, RT5659_GLB_CLK, 0x0000); in rt5659_calibrate()
4041 regmap_write(rt5659->regmap, RT5659_MICBIAS_2, 0x0080); in rt5659_calibrate()
4042 regmap_write(rt5659->regmap, RT5659_HP_VOL, 0x8080); in rt5659_calibrate()
4043 regmap_write(rt5659->regmap, RT5659_HP_CHARGE_PUMP_1, 0x0c16); in rt5659_calibrate()
4046 static void rt5659_intel_hd_header_probe_setup(struct rt5659_priv *rt5659) in rt5659_intel_hd_header_probe_setup() argument
4050 regmap_read(rt5659->regmap, RT5659_GPIO_STA, &value); in rt5659_intel_hd_header_probe_setup()
4052 rt5659->hda_hp_plugged = true; in rt5659_intel_hd_header_probe_setup()
4053 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_1, in rt5659_intel_hd_header_probe_setup()
4056 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_1, in rt5659_intel_hd_header_probe_setup()
4060 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_intel_hd_header_probe_setup()
4064 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_intel_hd_header_probe_setup()
4067 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_3, RT5659_PWR_LDO2, in rt5659_intel_hd_header_probe_setup()
4069 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_2, RT5659_PWR_MB1, in rt5659_intel_hd_header_probe_setup()
4071 regmap_update_bits(rt5659->regmap, RT5659_PWR_VOL, RT5659_PWR_MIC_DET, in rt5659_intel_hd_header_probe_setup()
4075 regmap_update_bits(rt5659->regmap, RT5659_4BTN_IL_CMD_2, in rt5659_intel_hd_header_probe_setup()
4077 regmap_read(rt5659->regmap, RT5659_4BTN_IL_CMD_1, &value); in rt5659_intel_hd_header_probe_setup()
4078 regmap_write(rt5659->regmap, RT5659_4BTN_IL_CMD_1, value); in rt5659_intel_hd_header_probe_setup()
4079 regmap_read(rt5659->regmap, RT5659_4BTN_IL_CMD_1, &value); in rt5659_intel_hd_header_probe_setup()
4082 rt5659->hda_mic_plugged = true; in rt5659_intel_hd_header_probe_setup()
4083 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_2, in rt5659_intel_hd_header_probe_setup()
4086 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_2, in rt5659_intel_hd_header_probe_setup()
4090 regmap_update_bits(rt5659->regmap, RT5659_IRQ_CTRL_2, in rt5659_intel_hd_header_probe_setup()
4097 struct rt5659_priv *rt5659; in rt5659_i2c_probe() local
4101 rt5659 = devm_kzalloc(&i2c->dev, sizeof(struct rt5659_priv), in rt5659_i2c_probe()
4104 if (rt5659 == NULL) in rt5659_i2c_probe()
4107 i2c_set_clientdata(i2c, rt5659); in rt5659_i2c_probe()
4110 rt5659->pdata = *pdata; in rt5659_i2c_probe()
4112 rt5659_parse_dt(rt5659, &i2c->dev); in rt5659_i2c_probe()
4114 rt5659->gpiod_ldo1_en = devm_gpiod_get_optional(&i2c->dev, "ldo1-en", in rt5659_i2c_probe()
4116 if (IS_ERR(rt5659->gpiod_ldo1_en)) in rt5659_i2c_probe()
4119 rt5659->gpiod_reset = devm_gpiod_get_optional(&i2c->dev, "reset", in rt5659_i2c_probe()
4125 rt5659->regmap = devm_regmap_init_i2c(i2c, &rt5659_regmap); in rt5659_i2c_probe()
4126 if (IS_ERR(rt5659->regmap)) { in rt5659_i2c_probe()
4127 ret = PTR_ERR(rt5659->regmap); in rt5659_i2c_probe()
4133 regmap_read(rt5659->regmap, RT5659_DEVICE_ID, &val); in rt5659_i2c_probe()
4136 "Device with ID register %x is not rt5659\n", val); in rt5659_i2c_probe()
4140 regmap_write(rt5659->regmap, RT5659_RESET, 0); in rt5659_i2c_probe()
4143 rt5659->mclk = devm_clk_get_optional(&i2c->dev, "mclk"); in rt5659_i2c_probe()
4144 if (IS_ERR(rt5659->mclk)) in rt5659_i2c_probe()
4145 return PTR_ERR(rt5659->mclk); in rt5659_i2c_probe()
4147 rt5659_calibrate(rt5659); in rt5659_i2c_probe()
4150 if (rt5659->pdata.in1_diff) in rt5659_i2c_probe()
4151 regmap_update_bits(rt5659->regmap, RT5659_IN1_IN2, in rt5659_i2c_probe()
4153 if (rt5659->pdata.in3_diff) in rt5659_i2c_probe()
4154 regmap_update_bits(rt5659->regmap, RT5659_IN3_IN4, in rt5659_i2c_probe()
4156 if (rt5659->pdata.in4_diff) in rt5659_i2c_probe()
4157 regmap_update_bits(rt5659->regmap, RT5659_IN3_IN4, in rt5659_i2c_probe()
4161 if (rt5659->pdata.dmic1_data_pin != RT5659_DMIC1_NULL || in rt5659_i2c_probe()
4162 rt5659->pdata.dmic2_data_pin != RT5659_DMIC2_NULL) { in rt5659_i2c_probe()
4163 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4166 switch (rt5659->pdata.dmic1_data_pin) { in rt5659_i2c_probe()
4168 regmap_update_bits(rt5659->regmap, RT5659_DMIC_CTRL_1, in rt5659_i2c_probe()
4173 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4177 regmap_update_bits(rt5659->regmap, RT5659_DMIC_CTRL_1, in rt5659_i2c_probe()
4179 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4184 regmap_update_bits(rt5659->regmap, RT5659_DMIC_CTRL_1, in rt5659_i2c_probe()
4186 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4191 regmap_update_bits(rt5659->regmap, RT5659_DMIC_CTRL_1, in rt5659_i2c_probe()
4193 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4203 switch (rt5659->pdata.dmic2_data_pin) { in rt5659_i2c_probe()
4205 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4212 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4216 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4223 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4227 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4234 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4238 regmap_update_bits(rt5659->regmap, in rt5659_i2c_probe()
4250 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4259 regmap_update_bits(rt5659->regmap, RT5659_DMIC_CTRL_1, in rt5659_i2c_probe()
4264 switch (rt5659->pdata.jd_src) { in rt5659_i2c_probe()
4266 regmap_write(rt5659->regmap, RT5659_EJD_CTRL_1, 0xa880); in rt5659_i2c_probe()
4267 regmap_write(rt5659->regmap, RT5659_RC_CLK_CTRL, 0x9000); in rt5659_i2c_probe()
4268 regmap_write(rt5659->regmap, RT5659_GPIO_CTRL_1, 0xc800); in rt5659_i2c_probe()
4269 regmap_update_bits(rt5659->regmap, RT5659_PWR_ANLG_1, in rt5659_i2c_probe()
4271 regmap_write(rt5659->regmap, RT5659_PWR_ANLG_2, 0x0001); in rt5659_i2c_probe()
4272 regmap_write(rt5659->regmap, RT5659_IRQ_CTRL_2, 0x0040); in rt5659_i2c_probe()
4273 INIT_DELAYED_WORK(&rt5659->jack_detect_work, in rt5659_i2c_probe()
4277 regmap_write(rt5659->regmap, RT5659_GPIO_CTRL_3, 0x8000); in rt5659_i2c_probe()
4278 regmap_write(rt5659->regmap, RT5659_RC_CLK_CTRL, 0x0900); in rt5659_i2c_probe()
4279 regmap_write(rt5659->regmap, RT5659_EJD_CTRL_1, 0x70c0); in rt5659_i2c_probe()
4280 regmap_write(rt5659->regmap, RT5659_JD_CTRL_1, 0x2000); in rt5659_i2c_probe()
4281 regmap_write(rt5659->regmap, RT5659_IRQ_CTRL_1, 0x0040); in rt5659_i2c_probe()
4282 INIT_DELAYED_WORK(&rt5659->jack_detect_work, in rt5659_i2c_probe()
4284 rt5659_intel_hd_header_probe_setup(rt5659); in rt5659_i2c_probe()
4293 | IRQF_ONESHOT, "rt5659", rt5659); in rt5659_i2c_probe()
4298 regmap_update_bits(rt5659->regmap, RT5659_GPIO_CTRL_1, in rt5659_i2c_probe()
4309 struct rt5659_priv *rt5659 = i2c_get_clientdata(client); in rt5659_i2c_shutdown() local
4311 regmap_write(rt5659->regmap, RT5659_RESET, 0); in rt5659_i2c_shutdown()
4317 { .compatible = "realtek,rt5659", },
4334 .name = "rt5659",
4344 MODULE_DESCRIPTION("ASoC RT5659 driver");