Skip to contentSkip to conversation

oss: AC97 quirk facility

PATCH In review John W. Linville 6 participants 10 messages Nov 17, 2004 – Nov 28, 2004 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oss: AC97 quirk facility

Add a quirk facility for AC97 in OSS, and add a quirk list for the i810_audio driver.

---
This allows automatically "correct" behaviour for sound hardware w/ known oddities. For example, many cards have the headphone and line-out outputs swapped or headphone outputs only.

The code is stolen shamelessly from ALSA, FWIW...

 include/linux/ac97_codec.h |   21 +++++++
 sound/oss/ac97_codec.c     |   91 +++++++++++++++++++++++++++++++
 sound/oss/i810_audio.c     |  132 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 240 insertions(+), 4 deletions(-)
include/linux/ac97_codec.h renamed from include/linux/ac97_codec.h.orig +21 -0
@@ -315,4 +315,25 @@ struct ac97_driver {
 extern int ac97_register_driver(struct ac97_driver *driver);
 extern void ac97_unregister_driver(struct ac97_driver *driver);
 
+/* quirk types */
+enum {
+	AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
+	AC97_TUNE_NONE = 0,     /* nothing extra to do */
+	AC97_TUNE_HP_ONLY,      /* headphone (true line-out) control as master only */
+	AC97_TUNE_SWAP_HP,      /* swap headphone and master controls */
+	AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */
+	AC97_TUNE_AD_SHARING,   /* for AD1985, turn on OMS bit and use headphone */
+	AC97_TUNE_ALC_JACK,     /* for Realtek, enable JACK detection */
+};
+
+struct ac97_quirk {
+	unsigned short vendor;  /* PCI vendor id */
+	unsigned short device;  /* PCI device id */
+	unsigned short mask;    /* device id bit mask, 0 = accept all */
+	const char *name;       /* name shown as info */
+	int type;               /* quirk type above */
+};
+
+extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
+
 #endif /* _AC97_CODEC_H_ */
sound/oss/ac97_codec.c renamed from sound/oss/ac97_codec.c.orig +91 -0

108 lines not on this page · raw message

sound/oss/i810_audio.c renamed from sound/oss/i810_audio.c.orig +128 -4

156 lines not on this page · raw message

#1 lore raw
Quoted 11 lines · John W. Linville

Add a quirk facility for AC97 in OSS, and add a quirk list for the i810_audio driver.

---
This allows automatically "correct" behaviour for sound hardware w/ known oddities. For example, many cards have the headphone and line-out outputs swapped or headphone outputs only.

The code is stolen shamelessly from ALSA, FWIW...

Dumb question: why not just use the ALSA driver?

#2 lore raw
Quoted 11 lines · Andrew Morton
Quoted 9 lines · John W. Linville

Add a quirk facility for AC97 in OSS, and add a quirk list for the i810_audio driver.

---
This allows automatically "correct" behaviour for sound hardware w/ known oddities. For example, many cards have the headphone and line-out outputs swapped or headphone outputs only.

Quoted 4 lines
Quoted 1 line

The code is stolen shamelessly from ALSA, FWIW...

Dumb question: why not just use the ALSA driver?

Until we actually remove the OSS drivers, it's sorta silly to leave them broken.

	Jeff, still using i810_audio...
#3 lore raw
Quoted 4 lines
Quoted 1 line

Dumb question: why not just use the ALSA driver?

Until we actually remove the OSS drivers, it's sorta silly to leave them broken.

It's just as silly to fix something we're removing anyway.

Jan Engelhardt

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
#4 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 4 lines
Quoted 1 line

Dumb question: why not just use the ALSA driver?

Until we actually remove the OSS drivers, it's sorta silly to leave them broken.

It's just as silly to fix something we're removing anyway.

Until it's gone, the current users would prefer not-broken to broken.

Jeff

#5 lore raw
Quoted 1 line

Until it's gone, the current users would prefer not-broken to broken.

Well, leave it broken and reason it with "come over to ALSA".

Jan Engelhardt

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
#6 lore raw
Quoted 3 lines · Jan Engelhardt
Quoted 1 line

Until it's gone, the current users would prefer not-broken to broken.

Well, leave it broken and reason it with "come over to ALSA".

i810 audio still locks up in ALSA ATM...

Jeff

#7 lore raw
Quoted 7 lines · Jeff Garzik
Quoted 3 lines · Jan Engelhardt
Quoted 1 line

Until it's gone, the current users would prefer not-broken to broken.

Well, leave it broken and reason it with "come over to ALSA".

i810 audio still locks up in ALSA ATM...

Fixed in ALSA CVS on Tuesday. This fix needs to go in 2.6.10 IMO.

Lee

#8 lore raw
In reply to Jan Engelhardt
Quoted 6 lines · Jan Engelhardt
Quoted 4 lines
Quoted 1 line

Dumb question: why not just use the ALSA driver?

Until we actually remove the OSS drivers, it's sorta silly to leave them broken.

It's just as silly to fix something we're removing anyway.

A lot of people are still using OSS. Thats likel to continue for some time when people are using new kernels on older distributions

#9 lore raw
In reply to Andrew Morton
Quoted 5 lines · Andrew Morton
Quoted 1 line · John W. Linville

The code is stolen shamelessly from ALSA, FWIW...

Dumb question: why not just use the ALSA driver?

Makes sense to me. This was mostly done for 2.4 kernels using OSS.

I posted the 2.6-based patch mostly 'for completeness'...and to help the OSS hold-outs... :-)

John

Signature · 2 lines
John W. Linville
[email protected]