Skip to content

Commit

Permalink
ALSA: hda - Add hooks for HP/line/mic auto switching
Browse files Browse the repository at this point in the history
... as a preliminary work for migrating patch_sigmatel.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent ee8e765 commit 2e03e95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2780,6 +2780,8 @@ static int check_auto_mute_availability(struct hda_codec *codec)
snd_printdd("hda-codec: Enable HP auto-muting on NID 0x%x\n",
nid);
snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT,
spec->hp_automute_hook ?
spec->hp_automute_hook :
snd_hda_gen_hp_automute);
spec->detect_hp = 1;
}
Expand All @@ -2793,6 +2795,8 @@ static int check_auto_mute_availability(struct hda_codec *codec)
snd_printdd("hda-codec: Enable Line-Out auto-muting on NID 0x%x\n", nid);
snd_hda_jack_detect_enable_callback(codec, nid,
HDA_GEN_FRONT_EVENT,
spec->line_automute_hook ?
spec->line_automute_hook :
snd_hda_gen_line_automute);
spec->detect_lo = 1;
}
Expand Down Expand Up @@ -2845,6 +2849,8 @@ static bool auto_mic_check_imux(struct hda_codec *codec)
snd_hda_jack_detect_enable_callback(codec,
spec->am_entry[i].pin,
HDA_GEN_MIC_EVENT,
spec->mic_autoswitch_hook ?
spec->mic_autoswitch_hook :
snd_hda_gen_mic_autoswitch);
return true;
}
Expand Down
8 changes: 8 additions & 0 deletions sound/pci/hda/hda_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ struct hda_gen_spec {
void (*init_hook)(struct hda_codec *codec);
void (*automute_hook)(struct hda_codec *codec);
void (*cap_sync_hook)(struct hda_codec *codec);

/* automute / autoswitch hooks */
void (*hp_automute_hook)(struct hda_codec *codec,
struct hda_jack_tbl *tbl);
void (*line_automute_hook)(struct hda_codec *codec,
struct hda_jack_tbl *tbl);
void (*mic_autoswitch_hook)(struct hda_codec *codec,
struct hda_jack_tbl *tbl);
};

int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
Expand Down

0 comments on commit 2e03e95

Please sign in to comment.