[alsa-devel] patch for Dell 1210 which using stac9221 codec

zhejiang zhe.jiang at intel.com
Wed Oct 31 09:49:44 CET 2007


On Tue, 2007-10-30 at 14:53 +0100, Takashi Iwai wrote:
> At Tue, 30 Oct 2007 17:05:55 +0800,
> zhejiang wrote:
> > 
> > The stac92xx_auto_create_multi_out_ctls() create controls according to
> > cfg->line_outs. This patch seems to leave the cfg->line_outs unchanged.
> > It will be 1 . So I think that we need to modify
> > stac92xx_auto_create_multi_out_ctls(),let it to use the right line_outs.
> 
> Right, then it might be actually easier to swap line_outs and hp_outs
> before and after as you suggested...
> 
> 
> Takashi

So,we should patch the patch_sigmatel.c like that?

Thanks!

diff -Nur a/alsa-driver-hg20071031/alsa-kernel/pci/hda/patch_sigmatel.c
b/alsa-driver-hg20071031/alsa-kernel/pci/hda/patch_sigmatel.c
--- a/alsa-driver-hg20071031/alsa-kernel/pci/hda/patch_sigmatel.c
2007-10-23 08:00:10.000000000 +0800
+++ b/alsa-driver-hg20071031/alsa-kernel/pci/hda/patch_sigmatel.c
2007-10-31 16:15:38.000000000 +0800
@@ -884,8 +884,8 @@
     102801D7 (Dell XPS M1210)
 */
 static unsigned int dell_922x_m82_pin_configs[10] = {
-	0x0221121f, 0x408103ff, 0x02111212, 0x90100310, 
-	0x408003f1, 0x02111211, 0x03451340, 0x40c003f2, 
+	0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, 
+	0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, 
 	0x508003f3, 0x405003f4, 
 };
 
@@ -2088,6 +2088,7 @@
 {
 	struct sigmatel_spec *spec = codec->spec;
 	int err;
+	int hp_speaker_swap = 0;
 
 	if ((err = snd_hda_parse_pin_def_config(codec,
 						&spec->autocfg,
@@ -2096,6 +2097,18 @@
 	if (! spec->autocfg.line_outs)
 		return 0; /* can't find valid pin config */
 
+	if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
+	   spec->autocfg.hp_outs > 1) {
+		/*Copy hp_outs to line_outs, backup line_outs in speaker_outs*/
+		memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins,
+			       sizeof(spec->autocfg.line_out_pins));
+		spec->autocfg.speaker_outs = spec->autocfg.line_outs;
+		memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins,
+			       sizeof(spec->autocfg.hp_pins));
+		spec->autocfg.line_outs = spec->autocfg.hp_outs;
+		hp_speaker_swap = 1;
+	}
+
 	if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
 		return err;
 	if (spec->multiout.num_dacs == 0)
@@ -2107,6 +2120,18 @@
 	if (err < 0)
 		return err;
 
+	if (hp_speaker_swap == 1) {
+		/*Restore the hp_outs and line_outs*/
+		memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,
+			       sizeof(spec->autocfg.line_out_pins));
+		spec->autocfg.hp_outs = spec->autocfg.line_outs;
+		memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,
+			       sizeof(spec->autocfg.speaker_pins));
+		spec->autocfg.line_outs = spec->autocfg.speaker_outs;
+		memset(spec->autocfg.speaker_pins, 0,
sizeof(spec->autocfg.speaker_pins));
+		spec->autocfg.speaker_outs = 0;
+	}
+
 	err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg);
 
 	if (err < 0)


More information about the Alsa-devel mailing list