diff options
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 5ea21285ee1f..a63c54d9d767 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -61,7 +61,6 @@ struct hda_gspec { | |||
61 | struct hda_gnode *cap_vol_node; /* Node for capture volume */ | 61 | struct hda_gnode *cap_vol_node; /* Node for capture volume */ |
62 | unsigned int cur_cap_src; /* current capture source */ | 62 | unsigned int cur_cap_src; /* current capture source */ |
63 | struct hda_input_mux input_mux; | 63 | struct hda_input_mux input_mux; |
64 | char cap_labels[HDA_MAX_NUM_INPUTS][16]; | ||
65 | 64 | ||
66 | unsigned int def_amp_in_caps; | 65 | unsigned int def_amp_in_caps; |
67 | unsigned int def_amp_out_caps; | 66 | unsigned int def_amp_out_caps; |
@@ -506,11 +505,10 @@ static const char *get_input_type(struct hda_gnode *node, unsigned int *pinctl) | |||
506 | * returns 0 if not found, 1 if found, or a negative error code. | 505 | * returns 0 if not found, 1 if found, or a negative error code. |
507 | */ | 506 | */ |
508 | static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec, | 507 | static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec, |
509 | struct hda_gnode *node) | 508 | struct hda_gnode *node, int idx) |
510 | { | 509 | { |
511 | int i, err; | 510 | int i, err; |
512 | unsigned int pinctl; | 511 | unsigned int pinctl; |
513 | char *label; | ||
514 | const char *type; | 512 | const char *type; |
515 | 513 | ||
516 | if (node->checked) | 514 | if (node->checked) |
@@ -523,7 +521,7 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec, | |||
523 | child = hda_get_node(spec, node->conn_list[i]); | 521 | child = hda_get_node(spec, node->conn_list[i]); |
524 | if (! child) | 522 | if (! child) |
525 | continue; | 523 | continue; |
526 | err = parse_adc_sub_nodes(codec, spec, child); | 524 | err = parse_adc_sub_nodes(codec, spec, child, idx); |
527 | if (err < 0) | 525 | if (err < 0) |
528 | return err; | 526 | return err; |
529 | if (err > 0) { | 527 | if (err > 0) { |
@@ -564,9 +562,7 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec, | |||
564 | return 0; | 562 | return 0; |
565 | type = "Input"; | 563 | type = "Input"; |
566 | } | 564 | } |
567 | label = spec->cap_labels[spec->input_mux.num_items]; | 565 | snd_hda_add_imux_item(&spec->input_mux, type, idx, NULL); |
568 | strcpy(label, type); | ||
569 | spec->input_mux.items[spec->input_mux.num_items].label = label; | ||
570 | 566 | ||
571 | /* unmute the PIN external input */ | 567 | /* unmute the PIN external input */ |
572 | unmute_input(codec, node, 0); /* index = 0? */ | 568 | unmute_input(codec, node, 0); /* index = 0? */ |
@@ -577,29 +573,6 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec, | |||
577 | return 1; /* found */ | 573 | return 1; /* found */ |
578 | } | 574 | } |
579 | 575 | ||
580 | /* add a capture source element */ | ||
581 | static void add_cap_src(struct hda_gspec *spec, int idx) | ||
582 | { | ||
583 | struct hda_input_mux_item *csrc; | ||
584 | char *buf; | ||
585 | int num, ocap; | ||
586 | |||
587 | num = spec->input_mux.num_items; | ||
588 | csrc = &spec->input_mux.items[num]; | ||
589 | buf = spec->cap_labels[num]; | ||
590 | for (ocap = 0; ocap < num; ocap++) { | ||
591 | if (! strcmp(buf, spec->cap_labels[ocap])) { | ||
592 | /* same label already exists, | ||
593 | * put the index number to be unique | ||
594 | */ | ||
595 | sprintf(buf, "%s %d", spec->cap_labels[ocap], num); | ||
596 | break; | ||
597 | } | ||
598 | } | ||
599 | csrc->index = idx; | ||
600 | spec->input_mux.num_items++; | ||
601 | } | ||
602 | |||
603 | /* | 576 | /* |
604 | * parse input | 577 | * parse input |
605 | */ | 578 | */ |
@@ -624,22 +597,18 @@ static int parse_input_path(struct hda_codec *codec, struct hda_gnode *adc_node) | |||
624 | for (i = 0; i < adc_node->nconns; i++) { | 597 | for (i = 0; i < adc_node->nconns; i++) { |
625 | node = hda_get_node(spec, adc_node->conn_list[i]); | 598 | node = hda_get_node(spec, adc_node->conn_list[i]); |
626 | if (node && node->type == AC_WID_PIN) { | 599 | if (node && node->type == AC_WID_PIN) { |
627 | err = parse_adc_sub_nodes(codec, spec, node); | 600 | err = parse_adc_sub_nodes(codec, spec, node, i); |
628 | if (err < 0) | 601 | if (err < 0) |
629 | return err; | 602 | return err; |
630 | else if (err > 0) | ||
631 | add_cap_src(spec, i); | ||
632 | } | 603 | } |
633 | } | 604 | } |
634 | /* ... then check the rests, more complicated connections */ | 605 | /* ... then check the rests, more complicated connections */ |
635 | for (i = 0; i < adc_node->nconns; i++) { | 606 | for (i = 0; i < adc_node->nconns; i++) { |
636 | node = hda_get_node(spec, adc_node->conn_list[i]); | 607 | node = hda_get_node(spec, adc_node->conn_list[i]); |
637 | if (node && node->type != AC_WID_PIN) { | 608 | if (node && node->type != AC_WID_PIN) { |
638 | err = parse_adc_sub_nodes(codec, spec, node); | 609 | err = parse_adc_sub_nodes(codec, spec, node, i); |
639 | if (err < 0) | 610 | if (err < 0) |
640 | return err; | 611 | return err; |
641 | else if (err > 0) | ||
642 | add_cap_src(spec, i); | ||
643 | } | 612 | } |
644 | } | 613 | } |
645 | 614 | ||
@@ -793,7 +762,8 @@ static int check_existing_control(struct hda_codec *codec, const char *type, con | |||
793 | /* | 762 | /* |
794 | * build output mixer controls | 763 | * build output mixer controls |
795 | */ | 764 | */ |
796 | static int create_output_mixers(struct hda_codec *codec, const char **names) | 765 | static int create_output_mixers(struct hda_codec *codec, |
766 | const char * const *names) | ||
797 | { | 767 | { |
798 | struct hda_gspec *spec = codec->spec; | 768 | struct hda_gspec *spec = codec->spec; |
799 | int i, err; | 769 | int i, err; |
@@ -811,8 +781,8 @@ static int create_output_mixers(struct hda_codec *codec, const char **names) | |||
811 | static int build_output_controls(struct hda_codec *codec) | 781 | static int build_output_controls(struct hda_codec *codec) |
812 | { | 782 | { |
813 | struct hda_gspec *spec = codec->spec; | 783 | struct hda_gspec *spec = codec->spec; |
814 | static const char *types_speaker[] = { "Speaker", "Headphone" }; | 784 | static const char * const types_speaker[] = { "Speaker", "Headphone" }; |
815 | static const char *types_line[] = { "Front", "Headphone" }; | 785 | static const char * const types_line[] = { "Front", "Headphone" }; |
816 | 786 | ||
817 | switch (spec->pcm_vol_nodes) { | 787 | switch (spec->pcm_vol_nodes) { |
818 | case 1: | 788 | case 1: |