Subject: Re: port-i386/34880: azalia support for Mac mini and MacBook Pro
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: TAMURA Kent <kent@NetBSD.org>
List: netbsd-bugs
Date: 03/11/2007 12:20:02
The following reply was made to PR port-i386/34880; it has been noted by GNATS.

From: TAMURA Kent <kent@NetBSD.org>
To: seebs@plethora.net (Peter Seebach), gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/34880: azalia support for Mac mini and MacBook Pro
Date: Sun, 11 Mar 2007 21:15:42 +0900 (JST)

 Would you test the following patch for the -current?
 
 Index: azalia_codec.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/azalia_codec.c,v
 retrieving revision 1.29
 diff -u -r1.29 azalia_codec.c
 --- azalia_codec.c	21 Feb 2007 23:00:00 -0000	1.29
 +++ azalia_codec.c	11 Mar 2007 12:14:10 -0000
 @@ -122,6 +122,7 @@
  static int	cmi9880_mixer_init(codec_t *);
  static int	stac9221_init_dacgroup(codec_t *);
  static int	stac9221_mixer_init(codec_t *);
 +static int	stac9221_gpio_unmute(codec_t *, int);
  static int	stac9220_mixer_init(codec_t *);
  
  
 @@ -2539,22 +2540,29 @@
  	err = generic_mixer_init(this);
  	if (err)
  		return err;
 -#if 0
  	if (this->subid == STAC9221_MAC) {
 -		uint32_t data, mask, dir;
 -		this->comresp(this, 0, CORB_GET_GPIO_DATA, 0, &data);
 -		this->comresp(this, 0, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
 -		this->comresp(this, 0, CORB_GET_GPIO_DIRECTION, 0, &dir);
 -		data |= 0x3;
 -		mask |= 0x3;
 -		dir |= 0x3;
 -		this->comresp(this, 0, 0x7e7, 0, NULL);
 -		this->comresp(this, 0, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
 -		this->comresp(this, 0, CORB_SET_GPIO_DIRECTION, dir, NULL);
 -		DELAY(1000);
 -		this->comresp(this, 0, CORB_SET_GPIO_DATA, data, NULL);
 +		stac9221_gpio_unmute(this, 0);
 +		stac9221_gpio_unmute(this, 1);
  	}
 -#endif
 +	return 0;
 +}
 +
 +static int
 +stac9221_gpio_unmute(codec_t *this, int pin)
 +{
 +	uint32_t data, mask, dir;
 +
 +	this->comresp(this, 0, CORB_GET_GPIO_DATA, 0, &data);
 +	this->comresp(this, 0, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
 +	this->comresp(this, 0, CORB_GET_GPIO_DIRECTION, 0, &dir);
 +	data &= ~(1 << pin);
 +	mask |= 1 << pin;
 +	dir |= 1 << pin;
 +	this->comresp(this, 0, 0x7e7, 0, NULL);
 +	this->comresp(this, 0, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
 +	this->comresp(this, 0, CORB_SET_GPIO_DIRECTION, dir, NULL);
 +	DELAY(1000);
 +	this->comresp(this, 0, CORB_SET_GPIO_DATA, data, NULL);
  	return 0;
  }
  
 
 -- 
 TAMURA Kent <kent_2007 at hauN.org> <kent at NetBSD.org>