[alsa-devel] HDA Intel IDT 92HD71B7X - HP Pavilion DV7-1299EF - Only the left speaker is working

Takashi Iwai tiwai at suse.de
Mon Nov 16 18:36:55 CET 2009


At Mon, 16 Nov 2009 18:22:56 +0100,
Wael Nasreddine (a.k.a eMxyzptlk) wrote:
> 
> On Mon, Nov 16, 2009 at 18:15, Takashi Iwai <tiwai at suse.de> wrote:
> >
> > At Mon, 16 Nov 2009 18:07:40 +0100,
> > Wael Nasreddine (a.k.a eMxyzptlk) wrote:
> > >
> > > Thank you that actually worked, I have now both Front Left and LFE working,
> > > but it's very hard to tell coz the LFE is louder than both front speakers I
> > > even put my ear directly on the speaker and it still can't be 100% sure, but
> > > I think that for now what is working is 'Front Left + LFE', I can't hear
> > > anything from the right speaker.. but it's already an improvement to what I
> > > had.
> >
> > Hm, if it's *so* loud, we should have a mixer control for this, I
> > guess.
> >
> It's not *so* loud, but yea I appreciate a mixer for it yes! at least
> I can tell which speaker is working and also I can listen to Music
> without bothering someone else because with LFE the base is loud..

OK, how about the patch below?

> > > Do you have any suggestion on how to enable the right speaker?
> >
> > No, already out of idea...  I wonder whether any other people
> > suffering from the same problem?
> >
> Julien has the same PC, same OS, same Kernel, same BIOS Version, but
> the weird thing is that he is not suffering from this problem, which
> obviously led me to beleive a hardware defect, but it's working on
> Windows!

This is really weird...


Takashi

---
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7f76a97..cd3be33 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1063,6 +1063,16 @@ static const char *slave_sws[] = {
 static void stac92xx_free_kctls(struct hda_codec *codec);
 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
 
+static void stac_add_mixer(struct sigmatel_spec *spec,
+			   struct snd_kcontrol_new *knew)
+{
+	if (!knew)
+		return;
+	if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
+		return;
+	spec->mixers[spec->num_mixers++] = knew;
+}
+
 static int stac92xx_build_controls(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec = codec->spec;
@@ -3825,8 +3835,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 	if (dig_in && spec->autocfg.dig_in_pin)
 		spec->dig_in_nid = dig_in;
 
-	if (spec->kctls.list)
-		spec->mixers[spec->num_mixers++] = spec->kctls.list;
+	stac_add_mixer(spec, spec->kctls.list);
 
 	spec->input_mux = &spec->private_imux;
 	if (!spec->dinput_mux)
@@ -3935,8 +3944,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
 	if (spec->autocfg.dig_in_pin)
 		spec->dig_in_nid = 0x04;
 
-	if (spec->kctls.list)
-		spec->mixers[spec->num_mixers++] = spec->kctls.list;
+	stac_add_mixer(spec, spec->kctls.list);
 
 	spec->input_mux = &spec->private_imux;
 	spec->dinput_mux = &spec->private_dimux;
@@ -5280,6 +5288,54 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
 		return 0;
 }
 
+/* HP dv7 bass volume - GPIO5 */
+#define stac_hp_bass_gpio_info	snd_ctl_boolean_mono_info
+static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
+				 struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct sigmatel_spec *spec = codec->spec;
+	ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
+	return 0;
+}
+
+static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
+				 struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct sigmatel_spec *spec = codec->spec;
+	unsigned int gpio_data;
+
+	gpio_data = (spec->gpio_data & ~0x20) |
+		(ucontrol->value.integer.value[0] ? 0x20 : 0);
+	if (gpio_data == spec->gpio_data)
+		return 0;
+	spec->gpio_data = gpio_data;
+	stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
+	return 1;
+}
+
+static struct snd_kcontrol_new stac_hp_bass_volume_ctrl[] = {
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Bass Speaker Playback Volume",
+		.info = stac_hp_bass_gpio_info,
+		.get = stac_hp_bass_gpio_get,
+		.put = stac_hp_bass_gpio_put,
+	},
+	{} /* terminator */
+};
+
+static void stac_add_hp_bass_volume(struct hda_codec *codec)
+{
+	struct sigmatel_spec *spec = codec->spec;
+
+	spec->gpio_mask |= 0x20;
+	spec->gpio_dir |= 0x20;
+	spec->gpio_data |= 0x20;
+	stac_add_mixer(spec, stac_hp_bass_volume_ctrl);
+}
+
 static int patch_stac92hd71bxx(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec;
@@ -5536,6 +5592,15 @@ again:
 		return err;
 	}
 
+	/* enable LFE on HP dv7 if available */
+	if (spec->board_config == STAC_HP_DV5) {
+		unsigned int cap;
+		cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
+		cap &= AC_GPIO_IO_COUNT;
+		if (cap >= 6)
+			stac_add_hp_bass_volume(codec);
+	}
+
 	codec->proc_widget_hook = stac92hd7x_proc_hook;
 
 	return 0;


More information about the Alsa-devel mailing list