]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'fix/hda' into topic/hda
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Dec 2011 16:33:09 +0000 (17:33 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 7 Dec 2011 16:33:09 +0000 (17:33 +0100)
Conflicts:
sound/pci/hda/patch_realtek.c

1  2 
sound/pci/hda/patch_realtek.c

index 63186d7d18a9b5896cfad9b3a307af1a6cb4ad19,1d07e8fa243360d25236a4942ab5e363d69d1558..8a74c1e8eedb00da49aec145722185d61b2f8bc7
@@@ -3039,9 -2955,7 +3044,9 @@@ static int alc_auto_fill_multi_ios(stru
  static int alc_auto_fill_dac_nids(struct hda_codec *codec)
  {
        struct alc_spec *spec = codec->spec;
-       const struct auto_pin_cfg *cfg = &spec->autocfg;
+       struct auto_pin_cfg *cfg = &spec->autocfg;
 +      unsigned int location, defcfg;
 +      int num_pins;
        bool redone = false;
        int i;
  
        if (cfg->line_out_type != AUTO_PIN_HP_OUT)
                alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins,
                                 spec->multiout.hp_out_nid);
-       if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
-               alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins,
-                                spec->multiout.extra_out_nid);
+       if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
+               int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs,
+                                       cfg->speaker_pins,
+                                       spec->multiout.extra_out_nid);
+               /* if no speaker volume is assigned, try again as the primary
+                * output
+                */
+               if (!err && cfg->speaker_outs > 0 &&
+                   cfg->line_out_type == AUTO_PIN_HP_OUT) {
+                       cfg->hp_outs = cfg->line_outs;
+                       memcpy(cfg->hp_pins, cfg->line_out_pins,
+                              sizeof(cfg->hp_pins));
+                       cfg->line_outs = cfg->speaker_outs;
+                       memcpy(cfg->line_out_pins, cfg->speaker_pins,
+                              sizeof(cfg->speaker_pins));
+                       cfg->speaker_outs = 0;
+                       memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins));
+                       cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
+                       redone = false;
+                       goto again;
+               }
+       }
  
 +      if (!spec->multi_ios &&
 +          cfg->line_out_type == AUTO_PIN_SPEAKER_OUT &&
 +          cfg->hp_outs) {
 +              /* try multi-ios with HP + inputs */
 +              defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
 +              location = get_defcfg_location(defcfg);
 +
 +              num_pins = alc_auto_fill_multi_ios(codec, location, 1);
 +              if (num_pins > 0) {
 +                      spec->multi_ios = num_pins;
 +                      spec->ext_channel_count = 2;
 +                      spec->multiout.num_dacs = num_pins + 1;
 +              }
 +      }
 +
        return 0;
  }