Lines Matching +full:jd +full:- +full:invert

1 // SPDX-License-Identifier: GPL-2.0-only
3 // rt722-sdca.c -- rt722 SDCA ALSA SoC audio driver
23 #include <sound/soc-dapm.h>
26 #include "rt722-sdca.h"
31 struct regmap *regmap = rt722->mbq_regmap; in rt722_sdca_index_write()
37 dev_err(&rt722->slave->dev, in rt722_sdca_index_write()
48 struct regmap *regmap = rt722->mbq_regmap; in rt722_sdca_index_read()
53 dev_err(&rt722->slave->dev, in rt722_sdca_index_read()
99 ret = regmap_read(rt722->regmap, in rt722_sdca_button_detect()
110 ret = regmap_read(rt722->regmap, in rt722_sdca_button_detect()
117 ret = regmap_read(rt722->regmap, in rt722_sdca_button_detect()
131 regmap_write(rt722->regmap, in rt722_sdca_button_detect()
144 ret = regmap_read(rt722->regmap, in rt722_sdca_headset_detect()
152 rt722->jack_type = 0; in rt722_sdca_headset_detect()
155 rt722->jack_type = SND_JACK_HEADPHONE; in rt722_sdca_headset_detect()
158 rt722->jack_type = SND_JACK_HEADSET; in rt722_sdca_headset_detect()
164 ret = regmap_write(rt722->regmap, in rt722_sdca_headset_detect()
171 dev_dbg(&rt722->slave->dev, in rt722_sdca_headset_detect()
187 if (!rt722->hs_jack) in rt722_sdca_jack_detect_handler()
190 if (!rt722->component->card || !rt722->component->card->instantiated) in rt722_sdca_jack_detect_handler()
194 if (rt722->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) { in rt722_sdca_jack_detect_handler()
201 if (rt722->scp_sdca_stat2 & SDW_SCP_SDCA_INT_SDCA_8) in rt722_sdca_jack_detect_handler()
204 if (rt722->jack_type == 0) in rt722_sdca_jack_detect_handler()
207 dev_dbg(&rt722->slave->dev, in rt722_sdca_jack_detect_handler()
208 "in %s, jack_type=%d\n", __func__, rt722->jack_type); in rt722_sdca_jack_detect_handler()
209 dev_dbg(&rt722->slave->dev, in rt722_sdca_jack_detect_handler()
211 dev_dbg(&rt722->slave->dev, in rt722_sdca_jack_detect_handler()
213 rt722->scp_sdca_stat1, rt722->scp_sdca_stat2); in rt722_sdca_jack_detect_handler()
215 snd_soc_jack_report(rt722->hs_jack, rt722->jack_type | btn_type, in rt722_sdca_jack_detect_handler()
222 snd_soc_jack_report(rt722->hs_jack, rt722->jack_type, in rt722_sdca_jack_detect_handler()
228 &rt722->jack_btn_check_work, msecs_to_jiffies(200)); in rt722_sdca_jack_detect_handler()
240 ret = regmap_read(rt722->regmap, in rt722_sdca_btn_check_handler()
249 ret = regmap_read(rt722->regmap, in rt722_sdca_btn_check_handler()
256 ret = regmap_read(rt722->regmap, in rt722_sdca_btn_check_handler()
266 rt722->jack_type = 0; in rt722_sdca_btn_check_handler()
268 dev_dbg(&rt722->slave->dev, "%s, btn_type=0x%x\n", __func__, btn_type); in rt722_sdca_btn_check_handler()
269 snd_soc_jack_report(rt722->hs_jack, rt722->jack_type | btn_type, in rt722_sdca_btn_check_handler()
276 snd_soc_jack_report(rt722->hs_jack, rt722->jack_type, in rt722_sdca_btn_check_handler()
282 &rt722->jack_btn_check_work, msecs_to_jiffies(200)); in rt722_sdca_btn_check_handler()
293 mutex_lock(&rt722->calibrate_mutex); in rt722_sdca_jack_init()
294 if (rt722->hs_jack) { in rt722_sdca_jack_init()
296 sdw_write_no_pm(rt722->slave, SDW_SCP_SDCA_INTMASK1, in rt722_sdca_jack_init()
299 sdw_write_no_pm(rt722->slave, SDW_SCP_SDCA_INTMASK2, in rt722_sdca_jack_init()
301 dev_dbg(&rt722->slave->dev, "in %s enable\n", __func__); in rt722_sdca_jack_init()
305 regmap_write(rt722->regmap, in rt722_sdca_jack_init()
308 regmap_write(rt722->regmap, in rt722_sdca_jack_init()
315 mutex_unlock(&rt722->calibrate_mutex); in rt722_sdca_jack_init()
324 rt722->hs_jack = hs_jack; in rt722_sdca_set_jack_detect()
326 ret = pm_runtime_resume_and_get(component->dev); in rt722_sdca_set_jack_detect()
328 if (ret != -EACCES) { in rt722_sdca_set_jack_detect()
329 dev_err(component->dev, "%s: failed to resume %d\n", __func__, ret); in rt722_sdca_set_jack_detect()
333 dev_dbg(component->dev, "%s: skipping jack init for now\n", __func__); in rt722_sdca_set_jack_detect()
339 pm_runtime_mark_last_busy(component->dev); in rt722_sdca_set_jack_detect()
340 pm_runtime_put_autosuspend(component->dev); in rt722_sdca_set_jack_detect()
351 (struct soc_mixer_control *)kcontrol->private_value; in rt722_sdca_set_gain_put()
359 if (strstr(ucontrol->id.name, "FU1E Capture Volume") || in rt722_sdca_set_gain_put()
360 strstr(ucontrol->id.name, "FU0F Capture Volume")) in rt722_sdca_set_gain_put()
363 regmap_read(rt722->mbq_regmap, mc->reg, &lvalue); in rt722_sdca_set_gain_put()
364 regmap_read(rt722->mbq_regmap, mc->rreg, &rvalue); in rt722_sdca_set_gain_put()
367 gain_l_val = ucontrol->value.integer.value[0]; in rt722_sdca_set_gain_put()
368 if (gain_l_val > mc->max) in rt722_sdca_set_gain_put()
369 gain_l_val = mc->max; in rt722_sdca_set_gain_put()
371 if (mc->shift == 8) /* boost gain */ in rt722_sdca_set_gain_put()
376 gain_l_val = 0x1e00 - ((mc->max - gain_l_val) * interval_offset); in rt722_sdca_set_gain_put()
378 gain_l_val = 0 - ((mc->max - gain_l_val) * interval_offset); in rt722_sdca_set_gain_put()
383 gain_r_val = ucontrol->value.integer.value[1]; in rt722_sdca_set_gain_put()
384 if (gain_r_val > mc->max) in rt722_sdca_set_gain_put()
385 gain_r_val = mc->max; in rt722_sdca_set_gain_put()
387 if (mc->shift == 8) /* boost gain */ in rt722_sdca_set_gain_put()
392 gain_r_val = 0x1e00 - ((mc->max - gain_r_val) * interval_offset); in rt722_sdca_set_gain_put()
394 gain_r_val = 0 - ((mc->max - gain_r_val) * interval_offset); in rt722_sdca_set_gain_put()
404 regmap_write(rt722->mbq_regmap, mc->reg, gain_l_val); in rt722_sdca_set_gain_put()
407 regmap_write(rt722->mbq_regmap, mc->rreg, gain_r_val); in rt722_sdca_set_gain_put()
409 regmap_read(rt722->mbq_regmap, mc->reg, &read_l); in rt722_sdca_set_gain_put()
410 regmap_read(rt722->mbq_regmap, mc->rreg, &read_r); in rt722_sdca_set_gain_put()
414 return -EIO; in rt722_sdca_set_gain_put()
423 (struct soc_mixer_control *)kcontrol->private_value; in rt722_sdca_set_gain_get()
429 if (strstr(ucontrol->id.name, "FU1E Capture Volume") || in rt722_sdca_set_gain_get()
430 strstr(ucontrol->id.name, "FU0F Capture Volume")) in rt722_sdca_set_gain_get()
433 regmap_read(rt722->mbq_regmap, mc->reg, &read_l); in rt722_sdca_set_gain_get()
434 regmap_read(rt722->mbq_regmap, mc->rreg, &read_r); in rt722_sdca_set_gain_get()
436 if (mc->shift == 8) /* boost gain */ in rt722_sdca_set_gain_get()
440 ctl_l = mc->max - (((0x1e00 - read_l) & 0xffff) / interval_offset); in rt722_sdca_set_gain_get()
442 ctl_l = mc->max - (((0 - read_l) & 0xffff) / interval_offset); in rt722_sdca_set_gain_get()
446 if (mc->shift == 8) /* boost gain */ in rt722_sdca_set_gain_get()
450 ctl_r = mc->max - (((0x1e00 - read_r) & 0xffff) / interval_offset); in rt722_sdca_set_gain_get()
452 ctl_r = mc->max - (((0 - read_r) & 0xffff) / interval_offset); in rt722_sdca_set_gain_get()
458 ucontrol->value.integer.value[0] = ctl_l; in rt722_sdca_set_gain_get()
459 ucontrol->value.integer.value[1] = ctl_r; in rt722_sdca_set_gain_get()
469 for (i = 0; i < ARRAY_SIZE(rt722->fu1e_mixer_mute); i++) { in rt722_sdca_set_fu1e_capture_ctl()
470 ch_mute = rt722->fu1e_dapm_mute || rt722->fu1e_mixer_mute[i]; in rt722_sdca_set_fu1e_capture_ctl()
471 err = regmap_write(rt722->regmap, in rt722_sdca_set_fu1e_capture_ctl()
487 (struct rt722_sdca_dmic_kctrl_priv *)kcontrol->private_value; in rt722_sdca_fu1e_capture_get()
490 for (i = 0; i < p->count; i++) in rt722_sdca_fu1e_capture_get()
491 ucontrol->value.integer.value[i] = !rt722->fu1e_mixer_mute[i]; in rt722_sdca_fu1e_capture_get()
502 (struct rt722_sdca_dmic_kctrl_priv *)kcontrol->private_value; in rt722_sdca_fu1e_capture_put()
505 for (i = 0; i < p->count; i++) { in rt722_sdca_fu1e_capture_put()
506 if (rt722->fu1e_mixer_mute[i] != !ucontrol->value.integer.value[i]) in rt722_sdca_fu1e_capture_put()
508 rt722->fu1e_mixer_mute[i] = !ucontrol->value.integer.value[i]; in rt722_sdca_fu1e_capture_put()
523 ch_l = (rt722->fu0f_dapm_mute || rt722->fu0f_mixer_l_mute) ? 0x01 : 0x00; in rt722_sdca_set_fu0f_capture_ctl()
524 ch_r = (rt722->fu0f_dapm_mute || rt722->fu0f_mixer_r_mute) ? 0x01 : 0x00; in rt722_sdca_set_fu0f_capture_ctl()
526 err = regmap_write(rt722->regmap, in rt722_sdca_set_fu0f_capture_ctl()
532 err = regmap_write(rt722->regmap, in rt722_sdca_set_fu0f_capture_ctl()
547 ucontrol->value.integer.value[0] = !rt722->fu0f_mixer_l_mute; in rt722_sdca_fu0f_capture_get()
548 ucontrol->value.integer.value[1] = !rt722->fu0f_mixer_r_mute; in rt722_sdca_fu0f_capture_get()
559 if (rt722->fu0f_mixer_l_mute != !ucontrol->value.integer.value[0] || in rt722_sdca_fu0f_capture_put()
560 rt722->fu0f_mixer_r_mute != !ucontrol->value.integer.value[1]) in rt722_sdca_fu0f_capture_put()
563 rt722->fu0f_mixer_l_mute = !ucontrol->value.integer.value[0]; in rt722_sdca_fu0f_capture_put()
564 rt722->fu0f_mixer_r_mute = !ucontrol->value.integer.value[1]; in rt722_sdca_fu0f_capture_put()
576 (struct rt722_sdca_dmic_kctrl_priv *)kcontrol->private_value; in rt722_sdca_fu_info()
578 if (p->max == 1) in rt722_sdca_fu_info()
579 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in rt722_sdca_fu_info()
581 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in rt722_sdca_fu_info()
582 uinfo->count = p->count; in rt722_sdca_fu_info()
583 uinfo->value.integer.min = 0; in rt722_sdca_fu_info()
584 uinfo->value.integer.max = p->max; in rt722_sdca_fu_info()
594 (struct rt722_sdca_dmic_kctrl_priv *)kcontrol->private_value; in rt722_sdca_dmic_set_gain_get()
601 if (strstr(ucontrol->id.name, "FU1E Capture Volume")) in rt722_sdca_dmic_set_gain_get()
605 for (i = 0; i < p->count; i++) { in rt722_sdca_dmic_set_gain_get()
606 regmap_read(rt722->mbq_regmap, p->reg_base + i, &regvalue); in rt722_sdca_dmic_set_gain_get()
612 ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset); in rt722_sdca_dmic_set_gain_get()
614 ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset); in rt722_sdca_dmic_set_gain_get()
617 ucontrol->value.integer.value[i] = ctl; in rt722_sdca_dmic_set_gain_get()
628 (struct rt722_sdca_dmic_kctrl_priv *)kcontrol->private_value; in rt722_sdca_dmic_set_gain_put()
638 if (strstr(ucontrol->id.name, "FU1E Capture Volume")) in rt722_sdca_dmic_set_gain_put()
642 for (i = 0; i < p->count; i++) { in rt722_sdca_dmic_set_gain_put()
643 regmap_read(rt722->mbq_regmap, p->reg_base + i, &regvalue[i]); in rt722_sdca_dmic_set_gain_put()
645 gain_val[i] = ucontrol->value.integer.value[i]; in rt722_sdca_dmic_set_gain_put()
646 if (gain_val[i] > p->max) in rt722_sdca_dmic_set_gain_put()
647 gain_val[i] = p->max; in rt722_sdca_dmic_set_gain_put()
652 gain_val[i] = vol_max - ((p->max - gain_val[i]) * interval_offset); in rt722_sdca_dmic_set_gain_put()
663 for (i = 0; i < p->count; i++) { in rt722_sdca_dmic_set_gain_put()
664 err = regmap_write(rt722->mbq_regmap, p->reg_base + i, gain_val[i]); in rt722_sdca_dmic_set_gain_put()
666 dev_err(&rt722->slave->dev, "%s: %#08x can't be set\n", in rt722_sdca_dmic_set_gain_put()
667 __func__, p->reg_base + i); in rt722_sdca_dmic_set_gain_put()
676 .invert = xinvert})
695 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);
696 static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -1725, 75, 0);
753 if (strstr(ucontrol->id.name, "ADC 22 Mux")) in rt722_sdca_adc_mux_get()
755 else if (strstr(ucontrol->id.name, "ADC 24 Mux")) in rt722_sdca_adc_mux_get()
757 else if (strstr(ucontrol->id.name, "ADC 25 Mux")) in rt722_sdca_adc_mux_get()
760 return -EINVAL; in rt722_sdca_adc_mux_get()
765 ucontrol->value.enumerated.item[0] = (val >> mask_sft) & 0x7; in rt722_sdca_adc_mux_get()
778 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in rt722_sdca_adc_mux_put()
779 unsigned int *item = ucontrol->value.enumerated.item; in rt722_sdca_adc_mux_put()
782 if (item[0] >= e->items) in rt722_sdca_adc_mux_put()
783 return -EINVAL; in rt722_sdca_adc_mux_put()
785 if (strstr(ucontrol->id.name, "ADC 22 Mux")) in rt722_sdca_adc_mux_put()
787 else if (strstr(ucontrol->id.name, "ADC 24 Mux")) in rt722_sdca_adc_mux_put()
789 else if (strstr(ucontrol->id.name, "ADC 25 Mux")) in rt722_sdca_adc_mux_put()
792 return -EINVAL; in rt722_sdca_adc_mux_put()
794 val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l; in rt722_sdca_adc_mux_put()
852 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_fu42_event()
858 regmap_write(rt722->regmap, in rt722_sdca_fu42_event()
861 regmap_write(rt722->regmap, in rt722_sdca_fu42_event()
866 regmap_write(rt722->regmap, in rt722_sdca_fu42_event()
869 regmap_write(rt722->regmap, in rt722_sdca_fu42_event()
881 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_fu21_event()
887 regmap_write(rt722->regmap, in rt722_sdca_fu21_event()
890 regmap_write(rt722->regmap, in rt722_sdca_fu21_event()
895 regmap_write(rt722->regmap, in rt722_sdca_fu21_event()
898 regmap_write(rt722->regmap, in rt722_sdca_fu21_event()
910 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_fu113_event()
915 rt722->fu1e_dapm_mute = false; in rt722_sdca_fu113_event()
919 rt722->fu1e_dapm_mute = true; in rt722_sdca_fu113_event()
930 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_fu36_event()
935 rt722->fu0f_dapm_mute = false; in rt722_sdca_fu36_event()
939 rt722->fu0f_dapm_mute = true; in rt722_sdca_fu36_event()
950 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_pde47_event()
956 regmap_write(rt722->regmap, in rt722_sdca_pde47_event()
961 regmap_write(rt722->regmap, in rt722_sdca_pde47_event()
973 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_pde23_event()
979 regmap_write(rt722->regmap, in rt722_sdca_pde23_event()
984 regmap_write(rt722->regmap, in rt722_sdca_pde23_event()
996 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_pde11_event()
1002 regmap_write(rt722->regmap, in rt722_sdca_pde11_event()
1007 regmap_write(rt722->regmap, in rt722_sdca_pde11_event()
1019 snd_soc_dapm_to_component(w->dapm); in rt722_sdca_pde12_event()
1025 regmap_write(rt722->regmap, in rt722_sdca_pde12_event()
1030 regmap_write(rt722->regmap, in rt722_sdca_pde12_event()
1112 device_property_read_u32(dev, "realtek,jd-src", &rt722->jd_src); in rt722_sdca_parse_dt()
1122 rt722_sdca_parse_dt(rt722, &rt722->slave->dev); in rt722_sdca_probe()
1123 rt722->component = component; in rt722_sdca_probe()
1125 ret = pm_runtime_resume(component->dev); in rt722_sdca_probe()
1126 if (ret < 0 && ret != -EACCES) in rt722_sdca_probe()
1162 struct snd_soc_component *component = dai->component; in rt722_sdca_pcm_hw_params()
1171 dev_dbg(dai->dev, "%s %s", __func__, dai->name); in rt722_sdca_pcm_hw_params()
1175 return -EINVAL; in rt722_sdca_pcm_hw_params()
1177 if (!rt722->slave) in rt722_sdca_pcm_hw_params()
1178 return -EINVAL; in rt722_sdca_pcm_hw_params()
1182 * RT722_AIF1 with port = 2 for headset-mic capture in rt722_sdca_pcm_hw_params()
1184 * RT722_AIF3 with port = 6 for digital-mic capture in rt722_sdca_pcm_hw_params()
1186 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in rt722_sdca_pcm_hw_params()
1188 if (dai->id == RT722_AIF1) in rt722_sdca_pcm_hw_params()
1190 else if (dai->id == RT722_AIF2) in rt722_sdca_pcm_hw_params()
1193 return -EINVAL; in rt722_sdca_pcm_hw_params()
1196 if (dai->id == RT722_AIF1) in rt722_sdca_pcm_hw_params()
1198 else if (dai->id == RT722_AIF3) in rt722_sdca_pcm_hw_params()
1201 return -EINVAL; in rt722_sdca_pcm_hw_params()
1209 port_config.ch_mask = GENMASK(num_channels - 1, 0); in rt722_sdca_pcm_hw_params()
1212 retval = sdw_stream_add_slave(rt722->slave, &stream_config, in rt722_sdca_pcm_hw_params()
1215 dev_err(dai->dev, "%s: Unable to configure port\n", __func__); in rt722_sdca_pcm_hw_params()
1220 dev_err(component->dev, "%s: Unsupported channels %d\n", in rt722_sdca_pcm_hw_params()
1222 return -EINVAL; in rt722_sdca_pcm_hw_params()
1240 dev_err(component->dev, "%s: Rate %d is not supported\n", in rt722_sdca_pcm_hw_params()
1242 return -EINVAL; in rt722_sdca_pcm_hw_params()
1246 if (dai->id == RT722_AIF1) { in rt722_sdca_pcm_hw_params()
1247 regmap_write(rt722->regmap, in rt722_sdca_pcm_hw_params()
1250 regmap_write(rt722->regmap, in rt722_sdca_pcm_hw_params()
1255 if (dai->id == RT722_AIF2) in rt722_sdca_pcm_hw_params()
1256 regmap_write(rt722->regmap, in rt722_sdca_pcm_hw_params()
1260 if (dai->id == RT722_AIF3) in rt722_sdca_pcm_hw_params()
1261 regmap_write(rt722->regmap, in rt722_sdca_pcm_hw_params()
1271 struct snd_soc_component *component = dai->component; in rt722_sdca_pcm_hw_free()
1276 if (!rt722->slave) in rt722_sdca_pcm_hw_free()
1277 return -EINVAL; in rt722_sdca_pcm_hw_free()
1279 sdw_stream_remove_slave(rt722->slave, sdw_stream); in rt722_sdca_pcm_hw_free()
1297 .name = "rt722-sdca-aif1",
1316 .name = "rt722-sdca-aif2",
1328 .name = "rt722-sdca-aif3",
1348 return -ENOMEM; in rt722_sdca_init()
1351 rt722->slave = slave; in rt722_sdca_init()
1352 rt722->regmap = regmap; in rt722_sdca_init()
1353 rt722->mbq_regmap = mbq_regmap; in rt722_sdca_init()
1355 mutex_init(&rt722->calibrate_mutex); in rt722_sdca_init()
1356 mutex_init(&rt722->disable_irq_lock); in rt722_sdca_init()
1358 INIT_DELAYED_WORK(&rt722->jack_detect_work, rt722_sdca_jack_detect_handler); in rt722_sdca_init()
1359 INIT_DELAYED_WORK(&rt722->jack_btn_check_work, rt722_sdca_btn_check_handler); in rt722_sdca_init()
1365 rt722->hw_init = false; in rt722_sdca_init()
1366 rt722->first_hw_init = false; in rt722_sdca_init()
1367 rt722->fu1e_dapm_mute = true; in rt722_sdca_init()
1368 rt722->fu0f_dapm_mute = true; in rt722_sdca_init()
1369 rt722->fu0f_mixer_l_mute = rt722->fu0f_mixer_r_mute = true; in rt722_sdca_init()
1370 rt722->fu1e_mixer_mute[0] = rt722->fu1e_mixer_mute[1] = in rt722_sdca_init()
1371 rt722->fu1e_mixer_mute[2] = rt722->fu1e_mixer_mute[3] = true; in rt722_sdca_init()
1407 regmap_write(rt722->regmap, in rt722_sdca_dmic_preset()
1411 regmap_write(rt722->regmap, 0x2f5c, 0x25); in rt722_sdca_dmic_preset()
1432 regmap_write(rt722->regmap, in rt722_sdca_amp_preset()
1460 /* Set JD de-bounce clock control */ in rt722_sdca_jack_preset()
1477 dev_dbg(&rt722->slave->dev, "calibration failed!, ret=%d\n", ret); in rt722_sdca_jack_preset()
1498 regmap_write(rt722->regmap, 0x2f58, 0x07); in rt722_sdca_jack_preset()
1499 regmap_write(rt722->regmap, 0x2f03, 0x06); in rt722_sdca_jack_preset()
1505 /* Release HP-JD, EN_CBJ_TIE_GL/R open, en_osw gating auto done bit */ in rt722_sdca_jack_preset()
1514 rt722->disable_irq = false; in rt722_sdca_io_init()
1516 if (rt722->hw_init) in rt722_sdca_io_init()
1519 if (rt722->first_hw_init) { in rt722_sdca_io_init()
1520 regcache_cache_only(rt722->regmap, false); in rt722_sdca_io_init()
1521 regcache_cache_bypass(rt722->regmap, true); in rt722_sdca_io_init()
1522 regcache_cache_only(rt722->mbq_regmap, false); in rt722_sdca_io_init()
1523 regcache_cache_bypass(rt722->mbq_regmap, true); in rt722_sdca_io_init()
1530 pm_runtime_set_autosuspend_delay(&slave->dev, 3000); in rt722_sdca_io_init()
1531 pm_runtime_use_autosuspend(&slave->dev); in rt722_sdca_io_init()
1534 pm_runtime_set_active(&slave->dev); in rt722_sdca_io_init()
1537 pm_runtime_mark_last_busy(&slave->dev); in rt722_sdca_io_init()
1539 pm_runtime_enable(&slave->dev); in rt722_sdca_io_init()
1542 pm_runtime_get_noresume(&slave->dev); in rt722_sdca_io_init()
1548 if (rt722->first_hw_init) { in rt722_sdca_io_init()
1549 regcache_cache_bypass(rt722->regmap, false); in rt722_sdca_io_init()
1550 regcache_mark_dirty(rt722->regmap); in rt722_sdca_io_init()
1551 regcache_cache_bypass(rt722->mbq_regmap, false); in rt722_sdca_io_init()
1552 regcache_mark_dirty(rt722->mbq_regmap); in rt722_sdca_io_init()
1554 rt722->first_hw_init = true; in rt722_sdca_io_init()
1557 rt722->hw_init = true; in rt722_sdca_io_init()
1559 pm_runtime_mark_last_busy(&slave->dev); in rt722_sdca_io_init()
1560 pm_runtime_put_autosuspend(&slave->dev); in rt722_sdca_io_init()
1562 dev_dbg(&slave->dev, "%s hw_init complete\n", __func__); in rt722_sdca_io_init()