Skip to content

Commit

Permalink
Merge branch 'test/hda-gen-parser' into test/hda-migrate
Browse files Browse the repository at this point in the history
* test/hda-gen-parser:
  ALSA: hda - Add capture_switch_hook to generic parser
  • Loading branch information
Takashi Iwai committed Jan 14, 2013
2 parents b3f6008 + ae177c3 commit ac06e22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 15 additions & 1 deletion sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2517,9 +2517,23 @@ static const struct snd_kcontrol_new cap_vol_temp = {
static int cap_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return cap_put_caller(kcontrol, ucontrol,
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct hda_gen_spec *spec = codec->spec;
int ret;

ret = cap_put_caller(kcontrol, ucontrol,
snd_hda_mixer_amp_switch_put,
NID_PATH_MUTE_CTL);
if (ret < 0)
return ret;

if (spec->capture_switch_hook) {
bool enable = (ucontrol->value.integer.value[0] ||
ucontrol->value.integer.value[1]);
spec->capture_switch_hook(codec, enable);
}

return ret;
}

static const struct snd_kcontrol_new cap_sw_temp = {
Expand Down
3 changes: 3 additions & 0 deletions sound/pci/hda/hda_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ struct hda_gen_spec {
struct hda_jack_tbl *tbl);
void (*mic_autoswitch_hook)(struct hda_codec *codec,
struct hda_jack_tbl *tbl);

/* capture switch hook (for mic-mute LED) */
void (*capture_switch_hook)(struct hda_codec *codec, bool enable);
};

int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
Expand Down

0 comments on commit ac06e22

Please sign in to comment.