Skip to content

Commit

Permalink
ALSA: hda - Always call standard unsolicited event for Realtek codecs
Browse files Browse the repository at this point in the history
With the model parsers out of the way, we have no custom unsol
events to worry about, we can therefore simplify the code.

In addition, this fixes a bug on the ASUS TC710, which has only
a headphone jack and a mic jack, but no internal mic or speakers.
Therefore the unsol_event pointer was not set, and as a result,
the jack kcontrols were not correctly updated.

BugLink: https://bugs.launchpad.net/bugs/1021192
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
David Henningsson authored and Takashi Iwai committed Jul 5, 2012
1 parent f68d891 commit a7a0a64
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ struct alc_spec {

/* hooks */
void (*init_hook)(struct hda_codec *codec);
void (*unsol_event)(struct hda_codec *codec, unsigned int res);
#ifdef CONFIG_SND_HDA_POWER_SAVE
void (*power_hook)(struct hda_codec *codec);
#endif
Expand Down Expand Up @@ -688,7 +687,7 @@ static void alc_update_knob_master(struct hda_codec *codec, hda_nid_t nid)
}

/* unsolicited event for HP jack sensing */
static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
{
int action;

Expand Down Expand Up @@ -1024,11 +1023,9 @@ static void alc_init_automute(struct hda_codec *codec)
spec->automute_lo = spec->automute_lo_possible;
spec->automute_speaker = spec->automute_speaker_possible;

if (spec->automute_speaker_possible || spec->automute_lo_possible) {
if (spec->automute_speaker_possible || spec->automute_lo_possible)
/* create a control for automute mode */
alc_add_automute_mode_enum(codec);
spec->unsol_event = alc_sku_unsol_event;
}
}

/* return the position of NID in the list, or -1 if not found */
Expand Down Expand Up @@ -1191,7 +1188,6 @@ static void alc_init_auto_mic(struct hda_codec *codec)

snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
ext, fixed, dock);
spec->unsol_event = alc_sku_unsol_event;
}

/* check the availabilities of auto-mute and auto-mic switches */
Expand Down Expand Up @@ -2062,14 +2058,6 @@ static int alc_init(struct hda_codec *codec)
return 0;
}

static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
{
struct alc_spec *spec = codec->spec;

if (spec->unsol_event)
spec->unsol_event(codec, res);
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
{
Expand Down Expand Up @@ -4271,14 +4259,12 @@ static void set_capture_mixer(struct hda_codec *codec)
*/
static void alc_auto_init_std(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
alc_auto_init_multi_out(codec);
alc_auto_init_extra_out(codec);
alc_auto_init_analog_input(codec);
alc_auto_init_input_src(codec);
alc_auto_init_digital(codec);
if (spec->unsol_event)
alc_inithook(codec);
alc_inithook(codec);
}

/*
Expand Down Expand Up @@ -4879,7 +4865,6 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
spec->automute_speaker = 1;
spec->autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
snd_hda_jack_detect_enable(codec, 0x0f, ALC_HP_EVENT);
spec->unsol_event = alc_sku_unsol_event;
snd_hda_gen_add_verbs(&spec->gen, alc_gpio1_init_verbs);
}
}
Expand Down

0 comments on commit a7a0a64

Please sign in to comment.