aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-20 09:27:24 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:34:16 -0500
commitdb23fd193d20e222449bdca71c4cc95dfadd6eaf (patch)
treebcc71ae438b6ee791a84ea5b65d1ed1d3e7dcfb3
parent973e4972f9f0fe8f854451f7559c847a8cdc8bc7 (diff)
ALSA: hda - Refactor init_extra_out() in hda_generic.c
Just a small clean up by splitting a function. No functional changes at all. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_generic.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b7b8d7eee7c6..96c779b6ca25 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3389,45 +3389,44 @@ static void init_multi_out(struct hda_codec *codec)
3389 } 3389 }
3390} 3390}
3391 3391
3392/* initialize hp and speaker paths */ 3392
3393static void init_extra_out(struct hda_codec *codec) 3393static void __init_extra_out(struct hda_codec *codec, int num_outs,
3394 hda_nid_t *pins, hda_nid_t *dacs, int type)
3394{ 3395{
3395 struct hda_gen_spec *spec = codec->spec; 3396 struct hda_gen_spec *spec = codec->spec;
3396 int i; 3397 int i;
3397 hda_nid_t pin, dac; 3398 hda_nid_t pin, dac;
3398 3399
3399 for (i = 0; i < spec->autocfg.hp_outs; i++) { 3400 for (i = 0; i < num_outs; i++) {
3400 if (spec->autocfg.line_out_type == AUTO_PIN_HP_OUT) 3401 pin = pins[i];
3401 break;
3402 pin = spec->autocfg.hp_pins[i];
3403 if (!pin)
3404 break;
3405 dac = spec->multiout.hp_out_nid[i];
3406 if (!dac) {
3407 if (i > 0 && spec->multiout.hp_out_nid[0])
3408 dac = spec->multiout.hp_out_nid[0];
3409 else
3410 dac = spec->multiout.dac_nids[0];
3411 }
3412 set_output_and_unmute(codec, pin, PIN_HP, dac);
3413 }
3414 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
3415 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
3416 break;
3417 pin = spec->autocfg.speaker_pins[i];
3418 if (!pin) 3402 if (!pin)
3419 break; 3403 break;
3420 dac = spec->multiout.extra_out_nid[i]; 3404 dac = dacs[i];
3421 if (!dac) { 3405 if (!dac) {
3422 if (i > 0 && spec->multiout.extra_out_nid[0]) 3406 if (i > 0 && dacs[0])
3423 dac = spec->multiout.extra_out_nid[0]; 3407 dac = dacs[0];
3424 else 3408 else
3425 dac = spec->multiout.dac_nids[0]; 3409 dac = spec->multiout.dac_nids[0];
3426 } 3410 }
3427 set_output_and_unmute(codec, pin, PIN_OUT, dac); 3411 set_output_and_unmute(codec, pin, type, dac);
3428 } 3412 }
3429} 3413}
3430 3414
3415/* initialize hp and speaker paths */
3416static void init_extra_out(struct hda_codec *codec)
3417{
3418 struct hda_gen_spec *spec = codec->spec;
3419
3420 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT)
3421 __init_extra_out(codec, spec->autocfg.hp_outs,
3422 spec->autocfg.hp_pins,
3423 spec->multiout.hp_out_nid, PIN_HP);
3424 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT)
3425 __init_extra_out(codec, spec->autocfg.speaker_outs,
3426 spec->autocfg.speaker_pins,
3427 spec->multiout.extra_out_nid, PIN_OUT);
3428}
3429
3431/* initialize multi-io paths */ 3430/* initialize multi-io paths */
3432static void init_multi_io(struct hda_codec *codec) 3431static void init_multi_io(struct hda_codec *codec)
3433{ 3432{