diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-06-20 10:32:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-06-20 10:32:22 -0400 |
commit | 8b8d654b55648561287bd8baca0f75f964a17038 (patch) | |
tree | 42e48385c076b8e797042f3c1e5ef99b05d05e86 /sound/pci/hda | |
parent | 1ade819181e9b4ab4de1ab0ac0b865d946fefc17 (diff) |
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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index db8f6928f839..64f1fedfd535 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -1277,23 +1277,34 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
1277 | return 0; | 1277 | return 0; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | static int generic_hdmi_init(struct hda_codec *codec) | 1280 | static int generic_hdmi_init_per_pins(struct hda_codec *codec) |
1281 | { | 1281 | { |
1282 | struct hdmi_spec *spec = codec->spec; | 1282 | struct hdmi_spec *spec = codec->spec; |
1283 | int pin_idx; | 1283 | int pin_idx; |
1284 | 1284 | ||
1285 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { | 1285 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { |
1286 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | 1286 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; |
1287 | hda_nid_t pin_nid = per_pin->pin_nid; | ||
1288 | struct hdmi_eld *eld = &per_pin->sink_eld; | 1287 | struct hdmi_eld *eld = &per_pin->sink_eld; |
1289 | 1288 | ||
1290 | hdmi_init_pin(codec, pin_nid); | ||
1291 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); | ||
1292 | |||
1293 | per_pin->codec = codec; | 1289 | per_pin->codec = codec; |
1294 | INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); | 1290 | INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); |
1295 | snd_hda_eld_proc_new(codec, eld, pin_idx); | 1291 | snd_hda_eld_proc_new(codec, eld, pin_idx); |
1296 | } | 1292 | } |
1293 | return 0; | ||
1294 | } | ||
1295 | |||
1296 | static int generic_hdmi_init(struct hda_codec *codec) | ||
1297 | { | ||
1298 | struct hdmi_spec *spec = codec->spec; | ||
1299 | int pin_idx; | ||
1300 | |||
1301 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { | ||
1302 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | ||
1303 | hda_nid_t pin_nid = per_pin->pin_nid; | ||
1304 | |||
1305 | hdmi_init_pin(codec, pin_nid); | ||
1306 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); | ||
1307 | } | ||
1297 | snd_hda_jack_report_sync(codec); | 1308 | snd_hda_jack_report_sync(codec); |
1298 | return 0; | 1309 | return 0; |
1299 | } | 1310 | } |
@@ -1338,6 +1349,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
1338 | return -EINVAL; | 1349 | return -EINVAL; |
1339 | } | 1350 | } |
1340 | codec->patch_ops = generic_hdmi_patch_ops; | 1351 | codec->patch_ops = generic_hdmi_patch_ops; |
1352 | generic_hdmi_init_per_pins(codec); | ||
1341 | 1353 | ||
1342 | init_channel_allocations(); | 1354 | init_channel_allocations(); |
1343 | 1355 | ||