Commit 1f578250 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add chained_before flag to the fixup entry

Sometimes we want to call a fixup after applying other existing
fixups, but currently the fixup chain mechanism allows only the call
the others after the target fixup.  This patch adds a new flag,
chained_before, to struct hda_fixup, for allowing the chained call
before the current execution.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3e367f15
...@@ -696,20 +696,18 @@ static void set_pin_targets(struct hda_codec *codec, ...@@ -696,20 +696,18 @@ static void set_pin_targets(struct hda_codec *codec,
snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val); snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val);
} }
void snd_hda_apply_fixup(struct hda_codec *codec, int action) static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
{ {
int id = codec->fixup_id;
#ifdef CONFIG_SND_DEBUG_VERBOSE #ifdef CONFIG_SND_DEBUG_VERBOSE
const char *modelname = codec->fixup_name; const char *modelname = codec->fixup_name;
#endif #endif
int depth = 0;
if (!codec->fixup_list)
return;
while (id >= 0) { while (id >= 0) {
const struct hda_fixup *fix = codec->fixup_list + id; const struct hda_fixup *fix = codec->fixup_list + id;
if (fix->chained_before)
apply_fixup(codec, fix->chain_id, action, depth + 1);
switch (fix->type) { switch (fix->type) {
case HDA_FIXUP_PINS: case HDA_FIXUP_PINS:
if (action != HDA_FIXUP_ACT_PRE_PROBE || !fix->v.pins) if (action != HDA_FIXUP_ACT_PRE_PROBE || !fix->v.pins)
...@@ -749,13 +747,19 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action) ...@@ -749,13 +747,19 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action)
codec->chip_name, fix->type); codec->chip_name, fix->type);
break; break;
} }
if (!fix->chained) if (!fix->chained || fix->chained_before)
break; break;
if (++depth > 10) if (++depth > 10)
break; break;
id = fix->chain_id; id = fix->chain_id;
} }
} }
void snd_hda_apply_fixup(struct hda_codec *codec, int action)
{
if (codec->fixup_list)
apply_fixup(codec, codec->fixup_id, action, 0);
}
EXPORT_SYMBOL_HDA(snd_hda_apply_fixup); EXPORT_SYMBOL_HDA(snd_hda_apply_fixup);
void snd_hda_pick_fixup(struct hda_codec *codec, void snd_hda_pick_fixup(struct hda_codec *codec,
......
...@@ -401,7 +401,8 @@ struct hda_model_fixup { ...@@ -401,7 +401,8 @@ struct hda_model_fixup {
struct hda_fixup { struct hda_fixup {
int type; int type;
bool chained; bool chained:1; /* call the chained fixup(s) after this */
bool chained_before:1; /* call the chained fixup(s) before this */
int chain_id; int chain_id;
union { union {
const struct hda_pintbl *pins; const struct hda_pintbl *pins;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment