ASoC: rockchip: multicodecs: Fix the jack assignment

Set jack for the first successful one to fix the disorder
codec assignment.

And of course, we suggest user to place the one which use
the jack in the first place in Device Tree.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I8dc5d95ba73c053a599d95c0448042fd04765c05
This commit is contained in:
Sugar Zhang 2023-02-15 17:33:44 +08:00 committed by Tao Huang
parent b7494b0ea9
commit 1b6481bb65
1 changed files with 9 additions and 2 deletions

View File

@ -432,9 +432,16 @@ static int rk_dailink_init(struct snd_soc_pcm_runtime *rtd)
mc_data->jack_headset = jack_headset;
if (mc_data->codec_hp_det) {
struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
struct snd_soc_dai *codec_dai;
int i;
snd_soc_component_set_jack(component, jack_headset, NULL);
/* set jack for the first successful one */
for_each_rtd_codec_dais(rtd, i, codec_dai) {
ret = snd_soc_component_set_jack(codec_dai->component,
jack_headset, NULL);
if (ret >= 0)
break;
}
} else {
irq = gpiod_to_irq(mc_data->hp_det_gpio);
if (irq >= 0) {