public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Takashi Iwai <tiwai@suse.de>
Subject: [patch 27/33] ALSA: ac97 - Fix ASUS A9T laptop output
Date: Mon, 4 Aug 2008 13:16:16 -0700	[thread overview]
Message-ID: <20080804201616.GB1139@suse.de> (raw)
In-Reply-To: <20080804201321.GA1139@suse.de>

[-- Attachment #1: alsa-ac97-fix-asus-a9t-laptop-output.patch --]
[-- Type: text/plain, Size: 4190 bytes --]

2.6.25-stable review patch.  If anyone has any objections, please let us
know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit e48d6d97bb6bd8c008045ea0522ea8278fdccc55 upstream

ASUS A9T laptop uses line-out pin as the real front-output while
other devices use it as the surround.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/sound/ac97_codec.h  |    1 
 sound/pci/ac97/ac97_patch.c |   48 +++++++++++++++++++++++++++++++-------------
 2 files changed, 35 insertions(+), 14 deletions(-)

--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -504,6 +504,7 @@ struct snd_ac97 {
 			unsigned short pcmreg[3];	// PCM registers
 			unsigned short codec_cfg[3];	// CODEC_CFG bits
 			unsigned char swap_mic_linein;	// AD1986/AD1986A only
+			unsigned char lo_as_master;	/* LO as master */
 		} ad18xx;
 		unsigned int dev_flags;		/* device specific */
 	} spec;
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1960,6 +1960,9 @@ static int snd_ac97_ad1888_lohpsel_get(s
 
 	val = ac97->regs[AC97_AD_MISC];
 	ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL);
+	if (ac97->spec.ad18xx.lo_as_master)
+		ucontrol->value.integer.value[0] =
+			!ucontrol->value.integer.value[0];
 	return 0;
 }
 
@@ -1968,8 +1971,10 @@ static int snd_ac97_ad1888_lohpsel_put(s
 	struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
 	unsigned short val;
 
-	val = !ucontrol->value.integer.value[0]
-		? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0;
+	val = !ucontrol->value.integer.value[0];
+	if (ac97->spec.ad18xx.lo_as_master)
+		val = !val;
+	val = val ? (AC97_AD198X_LOSEL | AC97_AD198X_HPSEL) : 0;
 	return snd_ac97_update_bits(ac97, AC97_AD_MISC,
 				    AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val);
 }
@@ -2020,7 +2025,7 @@ static void ad1888_update_jacks(struct s
 {
 	unsigned short val = 0;
 	/* clear LODIS if shared jack is to be used for Surround out */
-	if (is_shared_linein(ac97))
+	if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97))
 		val |= (1 << 12);
 	/* clear CLDIS if shared jack is to be used for C/LFE out */
 	if (is_shared_micin(ac97))
@@ -2056,9 +2061,13 @@ static const struct snd_kcontrol_new snd
 
 static int patch_ad1888_specific(struct snd_ac97 *ac97)
 {
-	/* rename 0x04 as "Master" and 0x02 as "Master Surround" */
-	snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Master Surround Playback");
-	snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback");
+	if (!ac97->spec.ad18xx.lo_as_master) {
+		/* rename 0x04 as "Master" and 0x02 as "Master Surround" */
+		snd_ac97_rename_vol_ctl(ac97, "Master Playback",
+					"Master Surround Playback");
+		snd_ac97_rename_vol_ctl(ac97, "Headphone Playback",
+					"Master Playback");
+	}
 	return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
 }
 
@@ -2077,16 +2086,27 @@ static int patch_ad1888(struct snd_ac97 
 	
 	patch_ad1881(ac97);
 	ac97->build_ops = &patch_ad1888_build_ops;
-	/* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
-	/* it seems that most vendors connect line-out connector to headphone out of AC'97 */
+
+	/*
+	 * LO can be used as a real line-out on some devices,
+	 * and we need to revert the front/surround mixer switches
+	 */
+	if (ac97->subsystem_vendor == 0x1043 &&
+	    ac97->subsystem_device == 0x1193) /* ASUS A9T laptop */
+		ac97->spec.ad18xx.lo_as_master = 1;
+
+	misc = snd_ac97_read(ac97, AC97_AD_MISC);
 	/* AD-compatible mode */
 	/* Stereo mutes enabled */
-	misc = snd_ac97_read(ac97, AC97_AD_MISC);
-	snd_ac97_write_cache(ac97, AC97_AD_MISC, misc |
-			     AC97_AD198X_LOSEL |
-			     AC97_AD198X_HPSEL |
-			     AC97_AD198X_MSPLT |
-			     AC97_AD198X_AC97NC);
+	misc |= AC97_AD198X_MSPLT | AC97_AD198X_AC97NC;
+	if (!ac97->spec.ad18xx.lo_as_master)
+		/* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
+		/* it seems that most vendors connect line-out connector to
+		 * headphone out of AC'97
+		 */
+		misc |= AC97_AD198X_LOSEL | AC97_AD198X_HPSEL;
+
+	snd_ac97_write_cache(ac97, AC97_AD_MISC, misc);
 	ac97->flags |= AC97_STEREO_MUTES;
 	return 0;
 }

-- 

  parent reply	other threads:[~2008-08-04 20:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080804200515.110033151@mini.kroah.org>
2008-08-04 20:13 ` [patch 00/33] 2.6.25-stable review cycle Greg KH
2008-08-04 20:14   ` [patch 01/33] romfs_readpage: dont report errors for pages beyond i_size Greg KH
2008-08-04 20:14   ` [patch 02/33] x86: ioremap of 64-bit resource on 32-bit kernel fix Greg KH
2008-08-04 20:14   ` [patch 03/33] SCSI: megaraid_mbox: fix Dell CERC firmware problem Greg KH
2008-08-04 20:14   ` [patch 04/33] return to old errno choice in mkdir() et.al Greg KH
2008-08-04 20:14   ` [patch 05/33] POWERPC: PS3: Add time include to lpm Greg KH
2008-08-04 20:14   ` [patch 06/33] NFS: Ensure we zap only the access and acl caches when setting new acls Greg KH
2008-08-04 20:14   ` [patch 07/33] jbd: fix the way the b_modified flag is cleared Greg KH
2008-08-04 20:15   ` [patch 08/33] jbd: fix race between free buffer and commit transaction Greg KH
2008-08-04 20:15   ` [patch 09/33] jbd: fix possible journal overflow issues Greg KH
2008-08-04 20:15   ` [patch 10/33] Input: i8042 - retry failed CTR writes when resuming Greg KH
2008-08-04 20:15   ` [patch 11/33] Input: i8042 - add Intel D845PESV to nopnp list Greg KH
2008-08-04 20:15   ` [patch 12/33] Input: i8042 - add Gericom Bellagio to nomux blacklist Greg KH
2008-08-04 20:15   ` [patch 13/33] Input: i8042 - add Fujitsu-Siemens Amilo Pro V2030 to nomux table Greg KH
2008-08-04 20:15   ` [patch 14/33] Input: i8042 - add Fujitsu-Siemens Amilo Pro 2010 to nomux list Greg KH
2008-08-04 20:15   ` [patch 15/33] Input: i8042 - add Acer Aspire 1360 to nomux blacklist Greg KH
2008-08-04 20:15   ` [patch 16/33] FAT_VALID_MEDIA(): remove pointless test Greg KH
2008-08-04 20:15   ` [patch 17/33] fat: detect media without partition table correctly Greg KH
2008-08-04 20:15   ` [patch 18/33] Bluetooth: Signal user-space for HIDP and BNEP socket errors Greg KH
2008-08-04 20:15   ` [patch 19/33] bay: exit if notify handler cannot be installed Greg KH
2008-08-04 20:15   ` [patch 20/33] ath5k: Use software encryption for now Greg KH
2008-08-04 20:16   ` [patch 21/33] Add compat handler for PTRACE_GETSIGINFO Greg KH
2008-08-04 20:16   ` [patch 22/33] ACPI: Reject below-freezing temperatures as invalid critical temperatures Greg KH
2008-08-04 20:16   ` [patch 23/33] ACPI: update thermal temperature Greg KH
2008-08-04 20:16   ` [patch 24/33] Input: appletouch - implement reset-resume logic Greg KH
2008-08-04 20:16   ` [patch 25/33] USB: EHCI: fix remote-wakeup regression Greg KH
2008-08-04 20:16   ` [patch 26/33] pci: VT3336 cant do MSI either Greg KH
2008-08-04 20:16   ` Greg KH [this message]
2008-08-04 20:16   ` [patch 28/33] ALSA: Add more fallbacks to OSS PHONEOUT mixer map Greg KH
2008-08-04 20:16   ` [patch 29/33] ALSA: emu10k1 - Fix inverted Analog/Digital mixer switch on Audigy2 Greg KH
2008-08-04 20:16   ` [patch 30/33] ALSA: Fix Oops with usb-audio reconnection Greg KH
2008-08-04 20:16   ` [patch 31/33] ALSA: hda - Add missing Thinkpad Z60m support Greg KH
2008-08-04 20:16   ` [patch 32/33] ALSA: hda - Fix wrong volumes in AD1988 auto-probe mode Greg KH
2008-08-04 20:16   ` [patch 33/33] vfs: fix lookup on deleted directory Greg KH

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=20080804201616.GB1139@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=eteo@redhat.com \
    --cc=jake@lwn.net \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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