Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tobin Davis <tdavis@dsl-only.net>
To: Shaw Terwilliger <sterwill@sourcegear.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Intel HDA on Mac Pro
Date: Mon, 11 Dec 2006 08:33:53 -0800	[thread overview]
Message-ID: <1165854833.7530.205.camel@razman> (raw)
In-Reply-To: <457D6E99.2000207@sourcegear.com>


[-- Attachment #1.1: Type: text/plain, Size: 2360 bytes --]

Ok, based on that information, I think I have a working patch.  Give
this a try.  

I'll let the next guy work on the S/PDIF if there is an issue with it.

Tobin

On Mon, 2006-12-11 at 08:43 -0600, Shaw Terwilliger wrote:

> Tobin Davis wrote:
> > modprobe -r snd-hda-intel
> > dmesg -c >/dev/null
> > modprobe snd-hda-intel model=auto
> > dmesg >dmesg.out  # send me this output
> > 
> > This should (hopefully) detect which port the headphones are on.  It
> > won't enable sound, but it is useful for detecting pins from the bios
> > settings.
> 
> File is attached.
> 
> > Also, when you said sound was coming from the surround channels, do you
> > know if the front output was coming from that?  To test this, reload the
> > driver with "model=macpro" and type:
> > speaker-test -c 6 -t wav -Dplug:surround51
> 
> I get:
> 
> Unable to set nperiods 4 for playback: Invalid argument
> Setting of hwparams failed: Invalid argument
> 
> If I change "-c 6" to "-c 8", I can run with the rest of the args (also
> works with 4).  The "rear right" channel in the speaker test comes from
> the actual front right speaker (and "rear left" from the actual front
> left).  Speakers are plugged in the to Mac's rear line-out.  And it's
> the "Surround" mixer strip (alsamixer) that controls these volumes.
> 
> 
> plain text document attachment (hda-model-auto.dmesg.txt)
> 
> [593939.343584] ACPI: PCI Interrupt 0000:00:1b.0[A] -> GSI 23 (level, low) -> IRQ 225
> [593939.344458] PCI: Setting latency timer of device 0000:00:1b.0 to 64
> [593939.378547] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/../../alsa-kernel/pci/hda/hda_intel.c:696: codec_mask = 0x1
> [593939.556328] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/hda_codec.c:1743: hda_codec: model 'auto' is selected
> [593939.604812] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/hda_codec.c:2175: autoconfig: line_outs=1 (0x15/0x0/0x0/0x0/0x0)
> [593939.604817] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/hda_codec.c:2179:    speaker_outs=1 (0x1a/0x0/0x0/0x0/0x0)
> [593939.604821] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/hda_codec.c:2183:    hp_outs=1 (0x18/0x0/0x0/0x0/0x0)
> [593939.604824] ALSA /data/downloads/alsa-driver-1.0.14rc1/pci/hda/hda_codec.c:2191:    inputs: mic=0x0, fmic=0x0, line=0x19, fline=0x0, cd=0x0, aux=0x0

-- 
Tobin Davis <tdavis@dsl-only.net>

[-- Attachment #1.2: Type: text/html, Size: 3839 bytes --]

[-- Attachment #2: macpro.patch.2 --]
[-- Type: text/x-patch, Size: 5472 bytes --]

diff -r 1ede4dc9b6ea pci/hda/patch_realtek.c
--- a/pci/hda/patch_realtek.c	Sun Dec 10 00:00:38 2006 +0000
+++ b/pci/hda/patch_realtek.c	Mon Dec 11 08:29:20 2006 -0800
@@ -112,6 +112,7 @@ enum {
 	ALC882_6ST_DIG,
 	ALC882_ARIMA,
 	ALC882_AUTO,
+	ALC885_MACPRO,
 	ALC882_MODEL_LAST,
 };
 
@@ -4507,6 +4508,103 @@ static struct hda_verb alc882_eapd_verbs
 	{ } 
 };
 
+/* Mac Pro test */
+static struct snd_kcontrol_new alc882_macpro_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0d, 2, HDA_INPUT),
+	HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
+	{ } /* end */
+};
+
+static struct hda_verb alc882_macpro_init_verbs[] = {
+	/* Front mixer: unmute input/output amp left and right (volume = 0) */
+	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
+	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
+	/* Front Pin: output 0 (0x0c) */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	/* Mic (rear) pin: input vref at 80% */
+	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
+	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
+	/* Front Mic pin: input vref at 80% */
+	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
+	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
+	/* Speaker:  output */
+	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
+	/* Headphone output (output 0 - 0x0c) */
+	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
+
+	/* FIXME: use matrix-type input source selection */
+	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
+	/* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
+	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
+	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
+	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
+	/* Input mixer2 */
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
+	/* Input mixer3 */
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
+	/* ADC1: mute amp left and right */
+	{0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+	{0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
+	/* ADC2: mute amp left and right */
+	{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+	{0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
+	/* ADC3: mute amp left and right */
+	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
+
+	{ }
+};
+static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
+{
+	unsigned int gpiostate, gpiomask, gpiodir;
+
+	gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
+				       AC_VERB_GET_GPIO_DATA, 0);
+
+	if (!muted)
+		gpiostate |= (1 << pin);
+	else
+		gpiostate &= ~(1 << pin);
+
+	gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
+				      AC_VERB_GET_GPIO_MASK, 0);
+	gpiomask |= (1 << pin);
+
+	gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
+				     AC_VERB_GET_GPIO_DIRECTION, 0);
+	gpiodir |= (1 << pin);
+
+
+	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);
+
+	msleep(1);
+
+	snd_hda_codec_write(codec, codec->afg, 0,
+			    AC_VERB_SET_GPIO_DATA, gpiostate);
+}
+
 /*
  * generic initialization of ADC, input mixers and output mixers
  */
@@ -4633,6 +4731,7 @@ static const char *alc882_models[ALC882_
 	[ALC882_3ST_DIG]	= "3stack-dig",
 	[ALC882_6ST_DIG]	= "6stack-dig",
 	[ALC882_ARIMA]		= "arima",
+	[ALC885_MACPRO]		= "macpro",
 	[ALC882_AUTO]		= "auto",
 };
 
@@ -4675,6 +4774,17 @@ static struct alc_config_preset alc882_p
 		.dac_nids = alc882_dac_nids,
 		.num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
 		.channel_mode = alc882_sixstack_modes,
+		.input_mux = &alc882_capture_source,
+	},
+	[ALC885_MACPRO] = {
+		.mixers = { alc882_macpro_mixer },
+		.init_verbs = { alc882_macpro_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc882_dac_nids),
+		.dac_nids = alc882_dac_nids,
+		.dig_out_nid = ALC882_DIGOUT_NID,
+		.dig_in_nid = ALC882_DIGIN_NID,
+		.num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
+		.channel_mode = alc882_ch_modes,
 		.input_mux = &alc882_capture_source,
 	},
 };
@@ -4803,6 +4913,11 @@ static int patch_alc882(struct hda_codec
 
 	if (board_config != ALC882_AUTO)
 		setup_preset(spec, &alc882_presets[board_config]);
+
+	if (board_config == ALC885_MACPRO) {
+		alc882_gpio_mute(codec, 0, 0);
+		alc882_gpio_mute(codec, 1, 0);
+	}
 
 	spec->stream_name_analog = "ALC882 Analog";
 	spec->stream_analog_playback = &alc882_pcm_analog_playback;

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

  reply	other threads:[~2006-12-11 16:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-04 20:34 Intel HDA on Mac Pro Shaw Terwilliger
2006-12-04 20:51 ` Tobin Davis
2006-12-04 21:02   ` Shaw Terwilliger
2006-12-04 23:45     ` Tobin Davis
2006-12-05  0:19       ` Shaw Terwilliger
2006-12-05  0:30         ` Tobin Davis
2006-12-05  4:02           ` Shaw Terwilliger
     [not found]             ` <457828D7.4020908@teamprise.com>
2006-12-07 14:51               ` Tobin Davis
2006-12-07 23:46               ` Tobin Davis
2006-12-08 19:39                 ` Shaw Terwilliger
2006-12-10 16:16                   ` Tobin Davis
2006-12-11 14:43                     ` Shaw Terwilliger
2006-12-11 16:33                       ` Tobin Davis [this message]
2006-12-11 16:52                         ` Shaw Terwilliger
2006-12-11 17:05                           ` Tobin Davis
2006-12-11 17:13                             ` Shaw Terwilliger
2006-12-11 17:43                               ` Tobin Davis
2006-12-11 19:09                                 ` Shaw Terwilliger
2006-12-11 22:10                 ` Richard
2006-12-11 22:55                   ` Tobin Davis
     [not found]                     ` <f0d712d60612111704x14717093p6e038641fc6e94e6@mail.gmail.com>
2006-12-13 15:22                       ` Tobin Davis
2006-12-13 16:36                         ` Shaw Terwilliger
2006-12-13 17:11                           ` Tobin Davis
2006-12-14  7:01                           ` Tobin Davis
2006-12-14 15:10                             ` Shaw Terwilliger
2006-12-14 16:51                               ` Tobin Davis
2006-12-14 21:24                                 ` Shaw Terwilliger
2006-12-15  2:28                                   ` Tobin Davis

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=1165854833.7530.205.camel@razman \
    --to=tdavis@dsl-only.net \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=sterwill@sourcegear.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox