Commit e8b827b4 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: hda - Fix redundant jack creations for cx5051

[Note that since the patch isn't applicable (and unnecessary) to
3.3-rc, there is no corresponding upstream fix.]

The cx5051 parser calls snd_hda_input_jack_add() in the init callback
to create and initialize the jack detection instances.  Since the init
callback is called at each time when the device gets woken up after
suspend or power-saving mode, the duplicated instances are accumulated
at each call.  This ends up with the kernel warnings with the too
large array size.

The fix is simply to move the calls of snd_hda_input_jack_add() into
the parser section instead of the init callback.

The fix is needed only up to 3.2 kernel, since the HD-audio jack layer
was redesigned in the 3.3 kernel.
Reported-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Tested-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d870401f
...@@ -1917,6 +1917,10 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid, ...@@ -1917,6 +1917,10 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid,
snd_hda_codec_write(codec, nid, 0, snd_hda_codec_write(codec, nid, 0,
AC_VERB_SET_UNSOLICITED_ENABLE, AC_VERB_SET_UNSOLICITED_ENABLE,
AC_USRSP_EN | event); AC_USRSP_EN | event);
}
static void cxt5051_init_mic_jack(struct hda_codec *codec, hda_nid_t nid)
{
snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL); snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL);
snd_hda_input_jack_report(codec, nid); snd_hda_input_jack_report(codec, nid);
} }
...@@ -1934,7 +1938,6 @@ static int cxt5051_init(struct hda_codec *codec) ...@@ -1934,7 +1938,6 @@ static int cxt5051_init(struct hda_codec *codec)
struct conexant_spec *spec = codec->spec; struct conexant_spec *spec = codec->spec;
conexant_init(codec); conexant_init(codec);
conexant_init_jacks(codec);
if (spec->auto_mic & AUTO_MIC_PORTB) if (spec->auto_mic & AUTO_MIC_PORTB)
cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT);
...@@ -2067,6 +2070,12 @@ static int patch_cxt5051(struct hda_codec *codec) ...@@ -2067,6 +2070,12 @@ static int patch_cxt5051(struct hda_codec *codec)
if (spec->beep_amp) if (spec->beep_amp)
snd_hda_attach_beep_device(codec, spec->beep_amp); snd_hda_attach_beep_device(codec, spec->beep_amp);
conexant_init_jacks(codec);
if (spec->auto_mic & AUTO_MIC_PORTB)
cxt5051_init_mic_jack(codec, 0x17);
if (spec->auto_mic & AUTO_MIC_PORTC)
cxt5051_init_mic_jack(codec, 0x18);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment