ALSA: hda - Allow multiple callbacks for jack
So far, hda_jack infrastructure allows only one callback per jack, and this makes things slightly complicated when a driver wants to assign multiple tasks to a jack, e.g. the standard auto-mute with a power up/down sequence. This can be simplified if the hda_jack accepts multiple callbacks. This patch is such an extension: the callback-specific part (the function and private_data) is split to another struct from hda_jack_tbl, and multiple such objects can be assigned to a single hda_jack_tbl entry. The new struct hda_jack_callback is passed to each callback function now, thus the patch became bigger than expected. But these changes are mostly trivial. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -264,7 +264,8 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
|
||||
}
|
||||
|
||||
/* update the master volume per volume-knob's unsol event */
|
||||
static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack)
|
||||
static void alc_update_knob_master(struct hda_codec *codec,
|
||||
struct hda_jack_callback *jack)
|
||||
{
|
||||
unsigned int val;
|
||||
struct snd_kcontrol *kctl;
|
||||
@@ -276,7 +277,7 @@ static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl
|
||||
uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
|
||||
if (!uctl)
|
||||
return;
|
||||
val = snd_hda_codec_read(codec, jack->nid, 0,
|
||||
val = snd_hda_codec_read(codec, jack->tbl->nid, 0,
|
||||
AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
|
||||
val &= HDA_AMP_VOLMASK;
|
||||
uctl->value.integer.value[0] = val;
|
||||
@@ -3272,7 +3273,7 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
|
||||
}
|
||||
|
||||
static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
|
||||
struct hda_jack_tbl *jack)
|
||||
struct hda_jack_callback *jack)
|
||||
{
|
||||
struct alc_spec *spec = codec->spec;
|
||||
int vref;
|
||||
@@ -3926,7 +3927,8 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
|
||||
alc_update_headset_mode(codec);
|
||||
}
|
||||
|
||||
static void alc_update_headset_jack_cb(struct hda_codec *codec, struct hda_jack_tbl *jack)
|
||||
static void alc_update_headset_jack_cb(struct hda_codec *codec,
|
||||
struct hda_jack_callback *jack)
|
||||
{
|
||||
struct alc_spec *spec = codec->spec;
|
||||
spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
|
||||
@@ -4166,7 +4168,7 @@ static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
|
||||
}
|
||||
|
||||
static void alc283_hp_automute_hook(struct hda_codec *codec,
|
||||
struct hda_jack_tbl *jack)
|
||||
struct hda_jack_callback *jack)
|
||||
{
|
||||
struct alc_spec *spec = codec->spec;
|
||||
int vref;
|
||||
|
Reference in New Issue
Block a user