← Back to team overview

touch-packages team mailing list archive

[Bug 1357928] [PATCH] ALSA: hda - Add TLV_DB_SCALE_MUTE bit for relevant controls

 

The DACs on Sigmatel/IDT codecs do mute at the lowest volume level,
and in the earlier drivers, we passed TLV_DB_SCALE_MUTE bit for each
volume control element like Speaker and Headphone as well as Master.
Along with the translation to the generic parser, however, the TLV bit
was lost for the slave controls (e.g. Speaker) but set only to
Master.  In theory this should have sufficed, but apps, particularly
PA, do care the slave volume bits, so we seem to see a regression in
the volume controls.

This patch adds a flag to hda_gen_spec to specify the DAC mute
feature, and adds the TLV bit properly for all relevant volume
controls.  Also, the TLV bit for vmaster is set in hda_generic.c, so
that we can get rid of all tricks from the codec driver side.

As the similar hack is applied to Conexant 5051 stuff, we can get rid
of it as well.

BugLink: https://bugs.launchpad.net/bugs/1357928
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 sound/pci/hda/hda_generic.c    | 9 ++++++++-
 sound/pci/hda/hda_generic.h    | 1 +
 sound/pci/hda/patch_conexant.c | 8 ++------
 sound/pci/hda/patch_sigmatel.c | 5 +----
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b956449ddada..95121e818b4d 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/jack.h>
+#include <sound/tlv.h>
 #include "hda_codec.h"
 #include "hda_local.h"
 #include "hda_auto_parser.h"
@@ -1105,6 +1106,7 @@ enum {
  */
 static int assign_out_path_ctls(struct hda_codec *codec, struct nid_path *path)
 {
+	struct hda_gen_spec *spec = codec->spec;
 	hda_nid_t nid;
 	unsigned int val;
 	int badness = 0;
@@ -1119,6 +1121,8 @@ static int assign_out_path_ctls(struct hda_codec *codec, struct nid_path *path)
 	nid = look_for_out_vol_nid(codec, path);
 	if (nid) {
 		val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
+		if (spec->dac_min_mute)
+			val |= HDA_AMP_VAL_MIN_MUTE;
 		if (is_ctl_used(codec, val, NID_PATH_VOL_CTL))
 			badness += BAD_SHARED_VOL;
 		else
@@ -1880,9 +1884,12 @@ static int parse_output_paths(struct hda_codec *codec)
 		path = snd_hda_get_path_from_idx(codec, spec->out_paths[0]);
 		if (path)
 			spec->vmaster_nid = look_for_out_vol_nid(codec, path);
-		if (spec->vmaster_nid)
+		if (spec->vmaster_nid) {
 			snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
 						HDA_OUTPUT, spec->vmaster_tlv);
+			if (spec->dac_min_mute)
+				spec->vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
+		}
 	}
 
 	/* set initial pinctl targets */
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index bb2dea743986..3f95f1d3f1f8 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -231,6 +231,7 @@ struct hda_gen_spec {
 	unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */
 	unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
 	unsigned int power_down_unused:1; /* power down unused widgets */
+	unsigned int dac_min_mute:1; /* minimal = mute for DACs */
 
 	/* other internal flags */
 	unsigned int no_analog:1; /* digital I/O only */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 6f2fa838b635..c0b03c112187 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -26,7 +26,6 @@
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/jack.h>
-#include <sound/tlv.h>
 
 #include "hda_codec.h"
 #include "hda_local.h"
@@ -779,6 +778,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
  */
 static void add_cx5051_fake_mutes(struct hda_codec *codec)
 {
+	struct conexant_spec *spec = codec->spec;
 	static hda_nid_t out_nids[] = {
 		0x10, 0x11, 0
 	};
@@ -788,6 +788,7 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
 		snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT,
 					  AC_AMPCAP_MIN_MUTE |
 					  query_amp_caps(codec, *p, HDA_OUTPUT));
+	spec->gen.dac_min_mute = true;
 }
 
 static int patch_conexant_auto(struct hda_codec *codec)
@@ -860,11 +861,6 @@ static int patch_conexant_auto(struct hda_codec *codec)
 	if (err < 0)
 		goto error;
 
-	if (codec->vendor_id == 0x14f15051) {
-		/* minimum value is actually mute */
-		spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
-	}
-
 	codec->patch_ops = cx_auto_patch_ops;
 
 	/* Some laptops with Conexant chips show stalls in S3 resume,
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index ea823e1100da..f26ec04a29b5 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -32,7 +32,6 @@
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/jack.h>
-#include <sound/tlv.h>
 #include "hda_codec.h"
 #include "hda_local.h"
 #include "hda_auto_parser.h"
@@ -4227,9 +4226,6 @@ static int stac_parse_auto_config(struct hda_codec *codec)
 	if (err < 0)
 		return err;
 
-	/* minimum value is actually mute */
-	spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
-
 	/* setup analog beep controls */
 	if (spec->anabeep_nid > 0) {
 		err = stac_auto_create_beep_ctls(codec,
@@ -4413,6 +4409,7 @@ static int alloc_stac_spec(struct hda_codec *codec)
 	snd_hda_gen_spec_init(&spec->gen);
 	codec->spec = spec;
 	codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
+	spec->gen.dac_min_mute = true;
 	return 0;
 }
 
-- 
2.1.0

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to alsa-driver in Ubuntu.
https://bugs.launchpad.net/bugs/1357928

Title:
  [Studio1747, IDT 92HD73C1X5,playback] volume slider problem - Slide to
  bottom and sound stays off even when slider moved up again

Status in “alsa-driver” package in Ubuntu:
  Incomplete

Bug description:
  The Audio Mixer panel widget slider (current version) has no "mute"
  checkbox. The 12.04 version had a mute checkbox in addition to the
  slider.

  When the slider is moved to the bottom, everything is muted: Master,
  Headphone, Speaker, PCM. Move the slider up and only Master is
  unmuted.

  My computer has three hardware buttons for audio. The mute/unmute
  mutes but never unmutes. Same issue.

  Known problem: http://askubuntu.com/questions/397819/ubuntu-13-10-and-
  xfce4-no-sound-at-all

  With 2012.04 I could just uncheck the mute button and things were back
  to normal. Now I need to open Audio Mixer and unmute everything.

  (It also appears I need to unmute the Headphones to hear sounds from
  the internal speakers.)

  As someone who works in an environment where I regularly need to mute
  this behavior is very annoying.

  1) The volume sliders should never mute.
  2) There should be a mute checkbox.
  3) The unmute options should unmute everything which was muted.

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: alsa-base 1.0.25+dfsg-0ubuntu4
  ProcVersionSignature: Ubuntu 3.13.0-34.60-generic 3.13.11.4
  Uname: Linux 3.13.0-34-generic x86_64
  ApportVersion: 2.14.1-0ubuntu3.3
  Architecture: amd64
  CurrentDesktop: XFCE
  Date: Sun Aug 17 06:53:47 2014
  InstallationDate: Installed on 2010-06-11 (1528 days ago)
  InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
  PackageArchitecture: all
  SourcePackage: alsa-driver
  Symptom: audio
  Symptom_Card: RV710/730 HDMI Audio [Radeon HD 4000 series] - HDA ATI HDMI
  Symptom_PulseAudioLog:
   
  Symptom_Type: Volume slider, or mixer problems
  Title: [HDA-Intel - HDA Intel MID, playback] volume slider problem
  UpgradeStatus: Upgraded to trusty on 2014-08-13 (3 days ago)
  dmi.bios.date: 03/31/2011
  dmi.bios.vendor: Dell Inc.
  dmi.bios.version: A14
  dmi.board.asset.tag: 1234567890
  dmi.board.name: 0J509P
  dmi.board.vendor: Dell Inc.
  dmi.chassis.asset.tag: 1234567890
  dmi.chassis.type: 8
  dmi.chassis.vendor: Dell Inc.
  dmi.modalias: dmi:bvnDellInc.:bvrA14:bd03/31/2011:svnDellInc.:pnStudio1747:pvr:rvnDellInc.:rn0J509P:rvr:cvnDellInc.:ct8:cvr:
  dmi.product.name: Studio 1747
  dmi.sys.vendor: Dell Inc.
  mtime.conffile..etc.modprobe.d.alsa.base.conf: 2012-09-22T06:43:48.837149

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1357928/+subscriptions


References