LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Harald Dunkel <harald.dunkel@t-online.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.24-rc7, intel audio: alsa doesn't say a beep
Date: Thu, 10 Jan 2008 14:30:30 +0100	[thread overview]
Message-ID: <s5hr6gpajux.wl%tiwai@suse.de> (raw)
In-Reply-To: <47852A41.9020903@t-online.de>

At Wed, 09 Jan 2008 21:10:41 +0100,
Harald Dunkel wrote:
> 
> Takashi Iwai wrote:
> > 
> > Thanks.  Then the possible reason might be the registers that don't
> > appear in this proc output, such as GPIO.
> > Could you try the patch below with the latency patch (you reverted) in
> > rc7?
> > 
> 
> Using rc7:
> 
> hda_intel.c(rc6) + patch for sigmatel.c:     sound works
> hda_intel.c(rc7) + patch for sigmatel.c:     sound does not work
> 
> Sorry to say, but AFAICS the patch for sigmatel.c doesn't fix
> the problem.

Hm...  Just to be sure, try the patch below.  It's a clean up patch
that I'd like to apply later.

The perex/alsa.git mm branch on kernel.org has many fixes.  Could you
give it a try, too?


thanks,

Takashi

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 0401223..9048d43 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -110,7 +110,6 @@ struct sigmatel_spec {
 	unsigned int mic_switch: 1;
 	unsigned int alt_switch: 1;
 	unsigned int hp_detect: 1;
-	unsigned int gpio_mute: 1;
 
 	unsigned int gpio_mask, gpio_data;
 
@@ -1245,22 +1244,6 @@ static void stac92xx_set_config_regs(struct hda_codec *codec)
 					spec->pin_configs[i]);
 }
 
-static void stac92xx_enable_gpio_mask(struct hda_codec *codec)
-{
-	struct sigmatel_spec *spec = codec->spec;
-	/* Configure GPIOx as output */
-	snd_hda_codec_write_cache(codec, codec->afg, 0,
-				  AC_VERB_SET_GPIO_DIRECTION, spec->gpio_mask);
-	/* Configure GPIOx as CMOS */
-	snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7e7, 0x00000000);
-	/* Assert GPIOx */
-	snd_hda_codec_write_cache(codec, codec->afg, 0,
-				  AC_VERB_SET_GPIO_DATA, spec->gpio_data);
-	/* Enable GPIOx */
-	snd_hda_codec_write_cache(codec, codec->afg, 0,
-				  AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
-}
-
 /*
  * Analog playback callbacks
  */
@@ -2183,38 +2166,38 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
  * funky external mute control using GPIO pins.
  */
 
-static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted)
+static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
+			  unsigned int data)
 {
 	unsigned int gpiostate, gpiomask, gpiodir;
 
+	if (!mask)
+		return;
+
 	gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
 				       AC_VERB_GET_GPIO_DATA, 0);
-
-	if (!muted)
-		gpiostate |= (1 << pin);
-	else
-		gpiostate &= ~(1 << pin);
+	gpiostate = (gpiostate & ~mask) | (data & mask);
 
 	gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
 				      AC_VERB_GET_GPIO_MASK, 0);
-	gpiomask |= (1 << pin);
+	gpiomask |= mask;
 
 	gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
 				     AC_VERB_GET_GPIO_DIRECTION, 0);
-	gpiodir |= (1 << pin);
+	gpiodir |= mask;
 
-	/* AppleHDA seems to do this -- WTF is this verb?? */
+	/* Configure GPIOx as CMOS */
 	snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
 
 	snd_hda_codec_write(codec, codec->afg, 0,
 			    AC_VERB_SET_GPIO_MASK, gpiomask);
-	snd_hda_codec_write(codec, codec->afg, 0,
-			    AC_VERB_SET_GPIO_DIRECTION, gpiodir);
+	snd_hda_codec_read(codec, codec->afg, 0,
+			   AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
 
 	msleep(1);
 
-	snd_hda_codec_write(codec, codec->afg, 0,
-			    AC_VERB_SET_GPIO_DATA, gpiostate);
+	snd_hda_codec_read(codec, codec->afg, 0,
+			   AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
 }
 
 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
@@ -2273,10 +2256,7 @@ static int stac92xx_init(struct hda_codec *codec)
 		stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
 					 AC_PINCTL_IN_EN);
 
-	if (spec->gpio_mute) {
-		stac922x_gpio_mute(codec, 0, 0);
-		stac922x_gpio_mute(codec, 1, 0);
-	}
+	stac_gpio_set(codec, spec->gpio_mask, spec->gpio_data);
 
 	return 0;
 }
@@ -2400,10 +2380,7 @@ static int stac92xx_resume(struct hda_codec *codec)
 
 	stac92xx_set_config_regs(codec);
 	snd_hda_sequence_write(codec, spec->init);
-	if (spec->gpio_mute) {
-		stac922x_gpio_mute(codec, 0, 0);
-		stac922x_gpio_mute(codec, 1, 0);
-	}
+	stac_gpio_set(codec, spec->gpio_mask, spec->gpio_data);
 	snd_hda_codec_resume_amp(codec);
 	snd_hda_codec_resume_cache(codec);
 	/* invoke unsolicited event to reset the HP state */
@@ -2567,7 +2544,7 @@ static int patch_stac922x(struct hda_codec *codec)
 							stac922x_models,
 							stac922x_cfg_tbl);
 	if (spec->board_config == STAC_INTEL_MAC_V3) {
-		spec->gpio_mute = 1;
+		spec->gpio_mask = spec->gpio_data = 0x03;
 		/* Intel Macs have all same PCI SSID, so we need to check
 		 * codec SSID to distinguish the exact models
 		 */
@@ -2714,7 +2691,6 @@ static int patch_stac927x(struct hda_codec *codec)
 	spec->multiout.dac_nids = spec->dac_nids;
 	/* GPIO0 High = Enable EAPD */
 	spec->gpio_mask = spec->gpio_data = 0x00000001;
-	stac92xx_enable_gpio_mask(codec); 
 	
 	err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
 	if (!err) {
@@ -2796,7 +2772,6 @@ static int patch_stac9205(struct hda_codec *codec)
 		break;
 	}
 
-	stac92xx_enable_gpio_mask(codec);
 	err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
 	if (!err) {
 		if (spec->board_config < 0) {

  reply	other threads:[~2008-01-10 13:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 19:53 Harald Dunkel
2008-01-08  7:24 ` Takashi Iwai
2008-01-08 10:10   ` Ingo Molnar
2008-01-08 17:01   ` Harald Dunkel
2008-01-08 17:43     ` Takashi Iwai
2008-01-09  6:03       ` Harald Dunkel
2008-01-09  7:31         ` Takashi Iwai
2008-01-09 20:10           ` Harald Dunkel
2008-01-10 13:30             ` Takashi Iwai [this message]
2008-01-10 22:02               ` Harald Dunkel
2008-01-11  6:49                 ` Takashi Iwai
2008-01-11 21:55                   ` Harald Dunkel
2008-01-13 11:17                     ` Takashi Iwai
2008-01-14 20:46                       ` Harald Dunkel
2008-01-15 10:07                         ` Takashi Iwai
2008-01-12  9:41                   ` Harald Dunkel
2008-01-12 17:11                     ` Daniel Hazelton
2008-01-14 11:04                       ` Takashi Iwai
2008-01-14 21:03                         ` Daniel Hazelton
2008-01-15 10:08                           ` Takashi Iwai
2008-01-15 19:00                             ` Daniel Hazelton
2008-01-13 11:26                     ` Takashi Iwai
2008-01-16  6:53       ` Harald Dunkel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hr6gpajux.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=harald.dunkel@t-online.de \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: 2.6.24-rc7, intel audio: alsa doesn'\''t say a beep' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).