ALSA: hda - Call snd_hda_jack_report_sync() generically in hda_codec.c
authorTakashi Iwai <tiwai@suse.de>
Wed, 22 Aug 2012 14:40:24 +0000 (16:40 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 22 Aug 2012 14:48:17 +0000 (16:48 +0200)
Instead of calling the jack sync in the init callback of each codec,
call it generically at initialization and resume.  By calling it at
the last of resume sequence, a possible race between the jack sync and
the unsol event enablement in the current code will be closed, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c

index a6c34dc6dac18f6000d120c3bfd2dce41d42fe0b..4efd2711acd98ccf2f6cb971f7f99c52dd594f49 100644 (file)
@@ -3618,6 +3618,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
                snd_hda_codec_resume_amp(codec);
                snd_hda_codec_resume_cache(codec);
        }
+       snd_hda_jack_report_sync(codec);
        snd_hda_power_down(codec); /* flag down before returning */
 }
 #endif /* CONFIG_PM */
@@ -3663,6 +3664,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
                err = codec->patch_ops.build_controls(codec);
        if (err < 0)
                return err;
+       snd_hda_jack_report_sync(codec); /* call at the last init point */
        return 0;
 }
 
index 0c4c1a61b3789f590d62ea6a2e8348417746cd95..0bddb3ee1101c01daef748645827ca24d2430c45 100644 (file)
@@ -1193,7 +1193,6 @@ static int cs_init(struct hda_codec *codec)
        init_output(codec);
        init_input(codec);
        init_digital(codec);
-       snd_hda_jack_report_sync(codec);
 
        return 0;
 }
@@ -1643,7 +1642,6 @@ static int cs421x_init(struct hda_codec *codec)
        init_output(codec);
        init_input(codec);
        init_cs421x_digital(codec);
-       snd_hda_jack_report_sync(codec);
 
        return 0;
 }
index 5e22a8f43d2eebc288083142b355feffb61ffedb..172895a8add47921edaf372a77462b43d00e97ff 100644 (file)
@@ -4061,7 +4061,6 @@ static int cx_auto_init(struct hda_codec *codec)
        cx_auto_init_output(codec);
        cx_auto_init_input(codec);
        cx_auto_init_digital(codec);
-       snd_hda_jack_report_sync(codec);
        snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
        return 0;
 }
index 8f23374fa6427198735f91b987656986052a8773..d9439c59bb8bee3eb9e17f1a58d89b46721e6d3b 100644 (file)
@@ -1311,7 +1311,6 @@ static int generic_hdmi_init(struct hda_codec *codec)
                hdmi_init_pin(codec, pin_nid);
                snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
        }
-       snd_hda_jack_report_sync(codec);
        return 0;
 }
 
@@ -1428,7 +1427,6 @@ static int simple_playback_init(struct hda_codec *codec)
                snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE,
                                    AMP_OUT_UNMUTE);
        snd_hda_jack_detect_enable(codec, pin, pin);
-       snd_hda_jack_report_sync(codec);
        return 0;
 }
 
index 4f81dd44c837e1de6b1de327f457bcb0fcc8f16f..ce99cc95532698fb09c8b1218036148487a64e94 100644 (file)
@@ -2053,8 +2053,6 @@ static int alc_init(struct hda_codec *codec)
 
        alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
 
-       snd_hda_jack_report_sync(codec);
-
        hda_call_check_power_status(codec, 0x01);
        return 0;
 }
index ea5775a1a7db292e25dd7956b8ac502d1a9db33e..435295402efa4b69524463008ae7ce05525c95b1 100644 (file)
@@ -4418,8 +4418,6 @@ static int stac92xx_init(struct hda_codec *codec)
                stac_toggle_power_map(codec, nid, 0);
        }
 
-       snd_hda_jack_report_sync(codec);
-
        /* sync mute LED */
        if (spec->gpio_led) {
                if (spec->vmaster_mute.hook)
index 43077177691588ab03590cd0576369c54b55d266..4b0796b30f785f6951f9263914d1070aea49c04f 100644 (file)
@@ -2815,7 +2815,6 @@ static int via_init(struct hda_codec *codec)
 
        via_hp_automute(codec);
        vt1708_update_hp_work(spec);
-       snd_hda_jack_report_sync(codec);
 
        return 0;
 }