Subject: ac97 patch for ad1981
To: current-users@netbsd.org <current-users@netbsd.org>
From: Lars Heidieker <lars@heidieker.de>
List: current-users
Date: 02/15/2003 10:33:38
This is a multi-part message in MIME format.
--------------B82054DA23042B24BF493DF8
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi,

this patches the ac97 codec ad1981 to work properly.
This codec is found on ASUS P4PE mainboards etc.
The problem before was silent output as the analogue
channels weren't connect to the output.
There is probably room for improvment as the volume is
controlled by surround and not master (or is that correct
for a surround codec?)

Lars




--
Mystische Erklärungen.
Die mystischen Erklärungen gelten für tief;
die Wahrheit ist, daß sie noch nicht einmal oberflächlich sind.
                --Friedrich Nietzsche



--------------B82054DA23042B24BF493DF8
Content-Type: text/plain; charset=us-ascii;
 name="ac97.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ac97.diff"

*** ac97.c.orig	Sat Feb 15 10:28:06 2003
--- ac97.c	Sat Feb 15 10:28:53 2003
*************** void ac97_set_clock(struct ac97_codec_if
*** 324,329 ****
--- 324,330 ----
  u_int16_t ac97_get_extcaps(struct ac97_codec_if *codec_if);
  int ac97_add_port(struct ac97_softc *as, const struct ac97_source_info *src);
  
+ static void ac97_ad1981_init(struct ac97_softc *);
  static void ac97_alc650_init(struct ac97_softc *);
  static void ac97_vt1616_init(struct ac97_softc *);
  
*************** static const struct ac97_codecid {
*** 365,371 ****
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x63),
  	  0xffffffff,			"Analog Devices AD1886A" },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x70),
! 	  0xffffffff,			"Analog Devices AD1981" },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x72),
  	  0xffffffff,			"Analog Devices AD1981A" },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x74),
--- 366,372 ----
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x63),
  	  0xffffffff,			"Analog Devices AD1886A" },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x70),
! 	  0xffffffff,			"Analog Devices AD1981", ac97_ad1981_init },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x72),
  	  0xffffffff,			"Analog Devices AD1981A" },
  	{ AC97_CODEC_ID('A', 'D', 'S', 0x74),
*************** ac97_add_port(struct ac97_softc *as, con
*** 1438,1443 ****
--- 1439,1454 ----
  	return 0;
  }
  
+ #define AC97_AD_MISC 0x76
+ static void
+ ac97_ad1981_init(struct ac97_softc *as)
+ {
+ 	unsigned short misc;
+ 
+ 	ac97_read(as, AC97_AD_MISC, &misc);
+ 	ac97_write(as, AC97_AD_MISC, misc | 0x0420);
+ }
+ 
  #define ALC650_REG_MULTI_CHANNEL_CONTROL	0x6a
  #define		ALC650_MCC_SLOT_MODIFY_MASK		0xc000
  #define		ALC650_MCC_FRONTDAC_FROM_SPDIFIN	0x2000 /* 13 */

--------------B82054DA23042B24BF493DF8--