提交 8b8d654b 编写于 作者: T Takashi Iwai

ALSA: hda - Move one-time init codes from generic_hdmi_init()

The codes to initialize work struct or create a proc interface should
be called only once and never although it's called many times through
the init callback.  Move that stuff into patch_generic_hdmi() so that
it's called only once.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 1ade8191
...@@ -1277,23 +1277,34 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) ...@@ -1277,23 +1277,34 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
return 0; return 0;
} }
static int generic_hdmi_init(struct hda_codec *codec) static int generic_hdmi_init_per_pins(struct hda_codec *codec)
{ {
struct hdmi_spec *spec = codec->spec; struct hdmi_spec *spec = codec->spec;
int pin_idx; int pin_idx;
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
hda_nid_t pin_nid = per_pin->pin_nid;
struct hdmi_eld *eld = &per_pin->sink_eld; struct hdmi_eld *eld = &per_pin->sink_eld;
hdmi_init_pin(codec, pin_nid);
snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
per_pin->codec = codec; per_pin->codec = codec;
INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld);
snd_hda_eld_proc_new(codec, eld, pin_idx); snd_hda_eld_proc_new(codec, eld, pin_idx);
} }
return 0;
}
static int generic_hdmi_init(struct hda_codec *codec)
{
struct hdmi_spec *spec = codec->spec;
int pin_idx;
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
hda_nid_t pin_nid = per_pin->pin_nid;
hdmi_init_pin(codec, pin_nid);
snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
}
snd_hda_jack_report_sync(codec); snd_hda_jack_report_sync(codec);
return 0; return 0;
} }
...@@ -1338,6 +1349,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) ...@@ -1338,6 +1349,7 @@ static int patch_generic_hdmi(struct hda_codec *codec)
return -EINVAL; return -EINVAL;
} }
codec->patch_ops = generic_hdmi_patch_ops; codec->patch_ops = generic_hdmi_patch_ops;
generic_hdmi_init_per_pins(codec);
init_channel_allocations(); init_channel_allocations();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册