[alsa-devel] [PATCH] ALSA: aureon - Patch for suspend/resume for Terratec Aureon cards.

Takashi Iwai tiwai at suse.de
Tue Mar 23 17:35:40 CET 2010


At Tue, 23 Mar 2010 04:12:38 +0100,
Bernhard Urban wrote:
> 
> Add proper suspend/resume code for Terratec Aureon cards.
> Based on ice1724 suspend/resume work of Igor Chernyshev.
> Fixes bug https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4944
> Tested on linux-2.6.32.9
> 
> Signed-off-by: Bernhard Urban <lewurm at gmail.com>

Applied now (with a minor coding-style fix).

Thanks,

Takashi

> ---
>  sound/pci/ice1712/aureon.c |   90 +++++++++++++++++++++++++++++++------------
>  1 files changed, 65 insertions(+), 25 deletions(-)
> 
> diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
> index 110d16e..1772e1a 100644
> --- a/sound/pci/ice1712/aureon.c
> +++ b/sound/pci/ice1712/aureon.c
> @@ -1971,11 +1971,10 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
>  	return 0;
>  }
>  
> -
>  /*
> - * initialize the chip
> + * reset the chip
>   */
> -static int __devinit aureon_init(struct snd_ice1712 *ice)
> +static int aureon_reset(struct snd_ice1712 *ice)
>  {
>  	static const unsigned short wm_inits_aureon[] = {
>  		/* These come first to reduce init pop noise */
> @@ -2062,30 +2061,10 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
>  		0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */
>  		(unsigned short)-1
>  	};
> -	struct aureon_spec *spec;
>  	unsigned int tmp;
>  	const unsigned short *p;
> -	int err, i;
> -
> -	spec = kzalloc(sizeof(*spec), GFP_KERNEL);
> -	if (!spec)
> -		return -ENOMEM;
> -	ice->spec = spec;
> -
> -	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
> -		ice->num_total_dacs = 6;
> -		ice->num_total_adcs = 2;
> -	} else {
> -		/* aureon 7.1 and prodigy 7.1 */
> -		ice->num_total_dacs = 8;
> -		ice->num_total_adcs = 2;
> -	}
> -
> -	/* to remeber the register values of CS8415 */
> -	ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
> -	if (!ice->akm)
> -		return -ENOMEM;
> -	ice->akm_codecs = 1;
> +	int err;
> +	struct aureon_spec *spec = ice->spec;
>  
>  	err = aureon_ac97_init(ice);
>  	if (err != 0)
> @@ -2133,6 +2112,62 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
>  	/* initialize PCA9554 pin directions & set default input */
>  	aureon_pca9554_write(ice, PCA9554_DIR, 0x00);
>  	aureon_pca9554_write(ice, PCA9554_OUT, 0x00);   /* internal AUX */
> +	return 0;
> +}
> +
> +/*
> + * suspend/resume
> + */
> +#ifdef CONFIG_PM
> +static int aureon_resume(struct snd_ice1712 *ice)
> +{
> +	struct aureon_spec *spec = ice->spec;
> +	int err, i;
> +
> +	err = aureon_reset(ice);
> +	if (err != 0)
> +		return err;
> +
> +	/* workaround for poking volume with alsamixer after resume:
> +	 * just set stored volume again */
> +	for (i = 0; i < ice->num_total_dacs; i++) {
> +		wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
> +	}
> +	return 0;
> +}
> +#endif
> +
> +/*
> + * initialize the chip
> + */
> +static int __devinit aureon_init(struct snd_ice1712 *ice)
> +{
> +	struct aureon_spec *spec;
> +	int i, err;
> +
> +	spec = kzalloc(sizeof(*spec), GFP_KERNEL);
> +	if (!spec)
> +		return -ENOMEM;
> +	ice->spec = spec;
> +
> +	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
> +		ice->num_total_dacs = 6;
> +		ice->num_total_adcs = 2;
> +	} else {
> +		/* aureon 7.1 and prodigy 7.1 */
> +		ice->num_total_dacs = 8;
> +		ice->num_total_adcs = 2;
> +	}
> +
> +	/* to remeber the register values of CS8415 */
> +	ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
> +	if (!ice->akm)
> +		return -ENOMEM;
> +	ice->akm_codecs = 1;
> +
> +	err = aureon_reset(ice);
> +	if (err != 0)
> +		return err;
>  
>  	spec->master[0] = WM_VOL_MUTE;
>  	spec->master[1] = WM_VOL_MUTE;
> @@ -2141,6 +2176,11 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
>  		wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
>  	}
>  
> +#ifdef CONFIG_PM
> +	ice->pm_resume = aureon_resume;
> +	ice->pm_suspend_enabled = 1;
> +#endif
> +
>  	return 0;
>  }
>  
> -- 
> 1.7.0.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list