Lines Matching refs:rt5645
704 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_hweq_get() local
710 eq_param[i].reg = cpu_to_be16(rt5645->eq_param[i].reg); in rt5645_hweq_get()
711 eq_param[i].val = cpu_to_be16(rt5645->eq_param[i].val); in rt5645_hweq_get()
730 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_hweq_put() local
736 rt5645->eq_param[i].reg = be16_to_cpu(eq_param[i].reg); in rt5645_hweq_put()
737 rt5645->eq_param[i].val = be16_to_cpu(eq_param[i].val); in rt5645_hweq_put()
742 if (rt5645->eq_param[i].reg == 0) in rt5645_hweq_put()
744 else if (rt5645->eq_param[i].reg != RT5645_EQ_CTRL2) in rt5645_hweq_put()
751 if (!rt5645_validate_hweq(rt5645->eq_param[i].reg) && in rt5645_hweq_put()
752 rt5645->eq_param[i].reg != 0) in rt5645_hweq_put()
754 else if (rt5645->eq_param[i].reg == 0) in rt5645_hweq_put()
772 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_spk_put_volsw() local
775 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, in rt5645_spk_put_volsw()
780 mod_delayed_work(system_power_efficient_wq, &rt5645->rcclock_work, in rt5645_spk_put_volsw()
877 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in set_dmic_clk() local
880 rate = rt5645->sysclk / rl6231_get_pre_div(rt5645->regmap, in set_dmic_clk()
955 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_enable_hweq() local
959 if (rt5645_validate_hweq(rt5645->eq_param[i].reg)) in rt5645_enable_hweq()
960 regmap_write(rt5645->regmap, rt5645->eq_param[i].reg, in rt5645_enable_hweq()
961 rt5645->eq_param[i].val); in rt5645_enable_hweq()
1675 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in hp_amp_power() local
1680 if (rt5645->codec_type == CODEC_TYPE_RT5650) { in hp_amp_power()
1685 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1689 regmap_read(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1696 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1699 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1711 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1733 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1735 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1743 if (rt5645->codec_type == CODEC_TYPE_RT5650) { in hp_amp_power()
1744 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1747 regmap_write(rt5645->regmap, RT5645_PR_BASE + in hp_amp_power()
1778 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_hp_event() local
1784 if (rt5645->codec_type == CODEC_TYPE_RT5645) { in rt5645_hp_event()
1791 regmap_write(rt5645->regmap, RT5645_PR_BASE + in rt5645_hp_event()
1811 if (rt5645->codec_type == CODEC_TYPE_RT5645) { in rt5645_hp_event()
1818 regmap_write(rt5645->regmap, RT5645_PR_BASE + in rt5645_hp_event()
2751 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_hw_params() local
2755 rt5645->lrck[dai->id] = params_rate(params); in rt5645_hw_params()
2756 pre_div = rl6231_get_clk_info(rt5645->sysclk, rt5645->lrck[dai->id]); in rt5645_hw_params()
2767 switch (rt5645->codec_type) { in rt5645_hw_params()
2777 rt5645->bclk[dai->id] = rt5645->lrck[dai->id] * (32 << bclk_ms); in rt5645_hw_params()
2780 rt5645->bclk[dai->id], rt5645->lrck[dai->id]); in rt5645_hw_params()
2827 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_dai_fmt() local
2830 switch (rt5645->codec_type) { in rt5645_set_dai_fmt()
2841 rt5645->master[dai->id] = 1; in rt5645_set_dai_fmt()
2845 rt5645->master[dai->id] = 0; in rt5645_set_dai_fmt()
2898 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_dai_sysclk() local
2901 if (freq == rt5645->sysclk && clk_id == rt5645->sysclk_src) in rt5645_set_dai_sysclk()
2920 rt5645->sysclk = freq; in rt5645_set_dai_sysclk()
2921 rt5645->sysclk_src = clk_id; in rt5645_set_dai_sysclk()
2932 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_dai_pll() local
2936 if (source == rt5645->pll_src && freq_in == rt5645->pll_in && in rt5645_set_dai_pll()
2937 freq_out == rt5645->pll_out) in rt5645_set_dai_pll()
2943 rt5645->pll_in = 0; in rt5645_set_dai_pll()
2944 rt5645->pll_out = 0; in rt5645_set_dai_pll()
2992 rt5645->pll_in = freq_in; in rt5645_set_dai_pll()
2993 rt5645->pll_out = freq_out; in rt5645_set_dai_pll()
2994 rt5645->pll_src = source; in rt5645_set_dai_pll()
3003 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_tdm_slot() local
3007 switch (rt5645->codec_type) { in rt5645_set_tdm_slot()
3025 if (rt5645->codec_type == CODEC_TYPE_RT5645) in rt5645_set_tdm_slot()
3068 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_bias_level() local
3100 if (rt5645->en_button_func) in rt5645_set_bias_level()
3102 &rt5645->jack_detect_work, in rt5645_set_bias_level()
3109 if (!rt5645->en_button_func) in rt5645_set_bias_level()
3156 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_jack_detect() local
3160 regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0206); in rt5645_jack_detect()
3169 regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1, in rt5645_jack_detect()
3172 regmap_update_bits(rt5645->regmap, RT5645_PWR_MIXER, in rt5645_jack_detect()
3174 regmap_update_bits(rt5645->regmap, RT5645_PWR_VOL, in rt5645_jack_detect()
3178 regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0); in rt5645_jack_detect()
3179 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, in rt5645_jack_detect()
3181 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, in rt5645_jack_detect()
3184 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, in rt5645_jack_detect()
3187 if (rt5645->gpiod_cbj_sleeve) in rt5645_jack_detect()
3188 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 1); in rt5645_jack_detect()
3191 regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); in rt5645_jack_detect()
3195 if ((val == 1 || val == 2) && !rt5645->pdata.no_headset_mic) { in rt5645_jack_detect()
3196 rt5645->jack_type = SND_JACK_HEADSET; in rt5645_jack_detect()
3197 if (rt5645->en_button_func) { in rt5645_jack_detect()
3201 if (rt5645->en_button_func) in rt5645_jack_detect()
3205 rt5645->jack_type = SND_JACK_HEADPHONE; in rt5645_jack_detect()
3206 if (rt5645->gpiod_cbj_sleeve) in rt5645_jack_detect()
3207 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); in rt5645_jack_detect()
3209 if (rt5645->pdata.level_trigger_irq) in rt5645_jack_detect()
3210 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, in rt5645_jack_detect()
3213 regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06); in rt5645_jack_detect()
3215 rt5645->jack_type = 0; in rt5645_jack_detect()
3217 regmap_update_bits(rt5645->regmap, RT5645_HP_VOL, in rt5645_jack_detect()
3220 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, in rt5645_jack_detect()
3222 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, in rt5645_jack_detect()
3225 if (rt5645->en_button_func) in rt5645_jack_detect()
3228 if (rt5645->pdata.jd_mode == 0) in rt5645_jack_detect()
3232 if (rt5645->pdata.level_trigger_irq) in rt5645_jack_detect()
3233 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, in rt5645_jack_detect()
3236 if (rt5645->gpiod_cbj_sleeve) in rt5645_jack_detect()
3237 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); in rt5645_jack_detect()
3240 return rt5645->jack_type; in rt5645_jack_detect()
3261 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_set_jack_detect() local
3263 rt5645->hp_jack = hp_jack; in rt5645_set_jack_detect()
3264 rt5645->mic_jack = mic_jack; in rt5645_set_jack_detect()
3265 rt5645->btn_jack = btn_jack; in rt5645_set_jack_detect()
3266 if (rt5645->btn_jack && rt5645->codec_type == CODEC_TYPE_RT5650) { in rt5645_set_jack_detect()
3267 rt5645->en_button_func = true; in rt5645_set_jack_detect()
3268 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_set_jack_detect()
3270 regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL1, in rt5645_set_jack_detect()
3272 regmap_update_bits(rt5645->regmap, RT5645_DEPOP_M1, in rt5645_set_jack_detect()
3275 rt5645_irq(0, rt5645); in rt5645_set_jack_detect()
3303 struct rt5645_priv *rt5645 = in rt5645_jack_detect_work() local
3307 if (!rt5645->component) in rt5645_jack_detect_work()
3310 mutex_lock(&rt5645->jd_mutex); in rt5645_jack_detect_work()
3312 switch (rt5645->pdata.jd_mode) { in rt5645_jack_detect_work()
3314 if (rt5645->gpiod_hp_det) { in rt5645_jack_detect_work()
3315 gpio_state = gpiod_get_value(rt5645->gpiod_hp_det); in rt5645_jack_detect_work()
3316 if (rt5645->pdata.inv_hp_pol) in rt5645_jack_detect_work()
3318 dev_dbg(rt5645->component->dev, "gpio_state = %d\n", in rt5645_jack_detect_work()
3320 report = rt5645_jack_detect(rt5645->component, gpio_state); in rt5645_jack_detect_work()
3322 snd_soc_jack_report(rt5645->hp_jack, in rt5645_jack_detect_work()
3324 snd_soc_jack_report(rt5645->mic_jack, in rt5645_jack_detect_work()
3326 mutex_unlock(&rt5645->jd_mutex); in rt5645_jack_detect_work()
3329 val = snd_soc_component_read(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020; in rt5645_jack_detect_work()
3332 val = snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x1000; in rt5645_jack_detect_work()
3337 if (!val && (rt5645->jack_type == 0)) { /* jack in */ in rt5645_jack_detect_work()
3338 report = rt5645_jack_detect(rt5645->component, 1); in rt5645_jack_detect_work()
3339 } else if (!val && rt5645->jack_type == SND_JACK_HEADSET) { in rt5645_jack_detect_work()
3342 if (snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x4) { in rt5645_jack_detect_work()
3345 btn_type = rt5645_button_detect(rt5645->component); in rt5645_jack_detect_work()
3375 dev_err(rt5645->component->dev, in rt5645_jack_detect_work()
3382 report = rt5645->jack_type; in rt5645_jack_detect_work()
3384 mod_timer(&rt5645->btn_check_timer, in rt5645_jack_detect_work()
3390 snd_soc_component_update_bits(rt5645->component, in rt5645_jack_detect_work()
3392 rt5645_jack_detect(rt5645->component, 0); in rt5645_jack_detect_work()
3395 mutex_unlock(&rt5645->jd_mutex); in rt5645_jack_detect_work()
3397 snd_soc_jack_report(rt5645->hp_jack, report, SND_JACK_HEADPHONE); in rt5645_jack_detect_work()
3398 snd_soc_jack_report(rt5645->mic_jack, report, SND_JACK_MICROPHONE); in rt5645_jack_detect_work()
3399 if (rt5645->en_button_func) in rt5645_jack_detect_work()
3400 snd_soc_jack_report(rt5645->btn_jack, in rt5645_jack_detect_work()
3407 struct rt5645_priv *rt5645 = in rt5645_rcclock_work() local
3410 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, in rt5645_rcclock_work()
3416 struct rt5645_priv *rt5645 = data; in rt5645_irq() local
3419 &rt5645->jack_detect_work, msecs_to_jiffies(250)); in rt5645_irq()
3426 struct rt5645_priv *rt5645 = from_timer(rt5645, t, btn_check_timer); in rt5645_btn_check_callback() local
3429 &rt5645->jack_detect_work, msecs_to_jiffies(5)); in rt5645_btn_check_callback()
3435 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_probe() local
3437 rt5645->component = component; in rt5645_probe()
3439 switch (rt5645->codec_type) { in rt5645_probe()
3447 if (rt5645->v_id < 3) { in rt5645_probe()
3466 if (rt5645->pdata.jd_mode) { in rt5645_probe()
3472 if (rt5645->pdata.long_name) in rt5645_probe()
3473 component->card->long_name = rt5645->pdata.long_name; in rt5645_probe()
3475 rt5645->eq_param = devm_kcalloc(component->dev, in rt5645_probe()
3479 if (!rt5645->eq_param) in rt5645_probe()
3493 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_suspend() local
3495 regcache_cache_only(rt5645->regmap, true); in rt5645_suspend()
3496 regcache_mark_dirty(rt5645->regmap); in rt5645_suspend()
3503 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); in rt5645_resume() local
3505 regcache_cache_only(rt5645->regmap, false); in rt5645_resume()
3506 regcache_sync(rt5645->regmap); in rt5645_resume()
3891 static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev) in rt5645_parse_dt() argument
3893 rt5645->pdata.in2_diff = device_property_read_bool(dev, in rt5645_parse_dt()
3896 "realtek,dmic1-data-pin", &rt5645->pdata.dmic1_data_pin); in rt5645_parse_dt()
3898 "realtek,dmic2-data-pin", &rt5645->pdata.dmic2_data_pin); in rt5645_parse_dt()
3900 "realtek,jd-mode", &rt5645->pdata.jd_mode); in rt5645_parse_dt()
3909 struct rt5645_priv *rt5645; in rt5645_i2c_probe() local
3914 rt5645 = devm_kzalloc(&i2c->dev, sizeof(struct rt5645_priv), in rt5645_i2c_probe()
3916 if (rt5645 == NULL) in rt5645_i2c_probe()
3919 rt5645->i2c = i2c; in rt5645_i2c_probe()
3920 i2c_set_clientdata(i2c, rt5645); in rt5645_i2c_probe()
3929 rt5645->pdata = *pdata; in rt5645_i2c_probe()
3931 rt5645_parse_dt(rt5645, &i2c->dev); in rt5645_i2c_probe()
3933 rt5645->pdata = jd_mode3_platform_data; in rt5645_i2c_probe()
3936 rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk); in rt5645_i2c_probe()
3937 rt5645->pdata.level_trigger_irq = QUIRK_LEVEL_IRQ(quirk); in rt5645_i2c_probe()
3938 rt5645->pdata.inv_jd1_1 = QUIRK_INV_JD1_1(quirk); in rt5645_i2c_probe()
3939 rt5645->pdata.inv_hp_pol = QUIRK_INV_HP_POL(quirk); in rt5645_i2c_probe()
3940 rt5645->pdata.jd_mode = QUIRK_JD_MODE(quirk); in rt5645_i2c_probe()
3941 rt5645->pdata.dmic1_data_pin = QUIRK_DMIC1_DATA_PIN(quirk); in rt5645_i2c_probe()
3942 rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk); in rt5645_i2c_probe()
3953 rt5645->pdata.no_headset_mic = true; in rt5645_i2c_probe()
3956 rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", in rt5645_i2c_probe()
3959 if (IS_ERR(rt5645->gpiod_hp_det)) { in rt5645_i2c_probe()
3961 ret = PTR_ERR(rt5645->gpiod_hp_det); in rt5645_i2c_probe()
3970 rt5645->gpiod_cbj_sleeve = devm_gpiod_get_optional(&i2c->dev, "cbj-sleeve", in rt5645_i2c_probe()
3973 if (IS_ERR(rt5645->gpiod_cbj_sleeve)) { in rt5645_i2c_probe()
3974 ret = PTR_ERR(rt5645->gpiod_cbj_sleeve); in rt5645_i2c_probe()
3980 for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) in rt5645_i2c_probe()
3981 rt5645->supplies[i].supply = rt5645_supply_names[i]; in rt5645_i2c_probe()
3984 ARRAY_SIZE(rt5645->supplies), in rt5645_i2c_probe()
3985 rt5645->supplies); in rt5645_i2c_probe()
3991 ret = regulator_bulk_enable(ARRAY_SIZE(rt5645->supplies), in rt5645_i2c_probe()
3992 rt5645->supplies); in rt5645_i2c_probe()
4019 rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap); in rt5645_i2c_probe()
4020 rt5645->codec_type = CODEC_TYPE_RT5645; in rt5645_i2c_probe()
4023 rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5650_regmap); in rt5645_i2c_probe()
4024 rt5645->codec_type = CODEC_TYPE_RT5650; in rt5645_i2c_probe()
4034 if (IS_ERR(rt5645->regmap)) { in rt5645_i2c_probe()
4035 ret = PTR_ERR(rt5645->regmap); in rt5645_i2c_probe()
4041 regmap_write(rt5645->regmap, RT5645_RESET, 0); in rt5645_i2c_probe()
4044 rt5645->v_id = val & 0xff; in rt5645_i2c_probe()
4046 regmap_write(rt5645->regmap, RT5645_AD_DA_MIXER, 0x8080); in rt5645_i2c_probe()
4048 ret = regmap_multi_reg_write(rt5645->regmap, init_list, in rt5645_i2c_probe()
4053 if (rt5645->codec_type == CODEC_TYPE_RT5650) { in rt5645_i2c_probe()
4054 ret = regmap_multi_reg_write(rt5645->regmap, rt5650_init_list, in rt5645_i2c_probe()
4061 regmap_update_bits(rt5645->regmap, RT5645_CLSD_OUT_CTRL, 0xc0, 0xc0); in rt5645_i2c_probe()
4063 if (rt5645->pdata.in2_diff) in rt5645_i2c_probe()
4064 regmap_update_bits(rt5645->regmap, RT5645_IN2_CTRL, in rt5645_i2c_probe()
4067 if (rt5645->pdata.dmic1_data_pin || rt5645->pdata.dmic2_data_pin) { in rt5645_i2c_probe()
4068 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4071 switch (rt5645->pdata.dmic1_data_pin) { in rt5645_i2c_probe()
4073 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4078 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4080 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4082 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4087 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4089 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4098 switch (rt5645->pdata.dmic2_data_pin) { in rt5645_i2c_probe()
4100 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4105 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4107 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4112 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4114 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4120 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, in rt5645_i2c_probe()
4122 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4131 if (rt5645->pdata.jd_mode) { in rt5645_i2c_probe()
4132 regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, in rt5645_i2c_probe()
4135 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, in rt5645_i2c_probe()
4137 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, in rt5645_i2c_probe()
4139 regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, in rt5645_i2c_probe()
4141 regmap_update_bits(rt5645->regmap, RT5645_HPO_MIXER, in rt5645_i2c_probe()
4143 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS, in rt5645_i2c_probe()
4145 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, in rt5645_i2c_probe()
4147 switch (rt5645->pdata.jd_mode) { in rt5645_i2c_probe()
4149 regmap_update_bits(rt5645->regmap, RT5645_A_JD_CTRL1, in rt5645_i2c_probe()
4154 regmap_update_bits(rt5645->regmap, RT5645_A_JD_CTRL1, in rt5645_i2c_probe()
4160 regmap_update_bits(rt5645->regmap, RT5645_A_JD_CTRL1, in rt5645_i2c_probe()
4167 if (rt5645->pdata.inv_jd1_1) { in rt5645_i2c_probe()
4168 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, in rt5645_i2c_probe()
4173 regmap_update_bits(rt5645->regmap, RT5645_ADDA_CLK1, in rt5645_i2c_probe()
4176 if (rt5645->pdata.level_trigger_irq) { in rt5645_i2c_probe()
4177 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, in rt5645_i2c_probe()
4180 timer_setup(&rt5645->btn_check_timer, rt5645_btn_check_callback, 0); in rt5645_i2c_probe()
4182 mutex_init(&rt5645->jd_mutex); in rt5645_i2c_probe()
4183 INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); in rt5645_i2c_probe()
4184 INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work); in rt5645_i2c_probe()
4186 if (rt5645->i2c->irq) { in rt5645_i2c_probe()
4187 ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq, in rt5645_i2c_probe()
4189 | IRQF_ONESHOT, "rt5645", rt5645); in rt5645_i2c_probe()
4204 if (rt5645->i2c->irq) in rt5645_i2c_probe()
4205 free_irq(rt5645->i2c->irq, rt5645); in rt5645_i2c_probe()
4207 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); in rt5645_i2c_probe()
4213 struct rt5645_priv *rt5645 = i2c_get_clientdata(i2c); in rt5645_i2c_remove() local
4216 free_irq(i2c->irq, rt5645); in rt5645_i2c_remove()
4222 del_timer_sync(&rt5645->btn_check_timer); in rt5645_i2c_remove()
4224 cancel_delayed_work_sync(&rt5645->jack_detect_work); in rt5645_i2c_remove()
4225 cancel_delayed_work_sync(&rt5645->rcclock_work); in rt5645_i2c_remove()
4227 if (rt5645->gpiod_cbj_sleeve) in rt5645_i2c_remove()
4228 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); in rt5645_i2c_remove()
4230 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); in rt5645_i2c_remove()
4235 struct rt5645_priv *rt5645 = i2c_get_clientdata(i2c); in rt5645_i2c_shutdown() local
4237 regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, in rt5645_i2c_shutdown()
4239 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, RT5645_CBJ_MN_JD, in rt5645_i2c_shutdown()
4241 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, RT5645_CBJ_BST1_EN, in rt5645_i2c_shutdown()
4244 regmap_write(rt5645->regmap, RT5645_RESET, 0); in rt5645_i2c_shutdown()
4246 if (rt5645->gpiod_cbj_sleeve) in rt5645_i2c_shutdown()
4247 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); in rt5645_i2c_shutdown()
4252 struct rt5645_priv *rt5645 = dev_get_drvdata(dev); in rt5645_sys_suspend() local
4254 del_timer_sync(&rt5645->btn_check_timer); in rt5645_sys_suspend()
4255 cancel_delayed_work_sync(&rt5645->jack_detect_work); in rt5645_sys_suspend()
4256 cancel_delayed_work_sync(&rt5645->rcclock_work); in rt5645_sys_suspend()
4258 regcache_cache_only(rt5645->regmap, true); in rt5645_sys_suspend()
4259 regcache_mark_dirty(rt5645->regmap); in rt5645_sys_suspend()
4265 struct rt5645_priv *rt5645 = dev_get_drvdata(dev); in rt5645_sys_resume() local
4267 regcache_cache_only(rt5645->regmap, false); in rt5645_sys_resume()
4268 regcache_sync(rt5645->regmap); in rt5645_sys_resume()
4270 if (rt5645->hp_jack) { in rt5645_sys_resume()
4271 rt5645->jack_type = 0; in rt5645_sys_resume()
4272 rt5645_jack_detect_work(&rt5645->jack_detect_work.work); in rt5645_sys_resume()