[alsa-devel] [PATCH] Allow passing platform_data to devices attached to AC97 bus

Robert Jarzmik robert.jarzmik at free.fr
Tue Jul 21 17:11:03 CEST 2009


Marek Vasut <marek.vasut at gmail.com> writes:

> diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h
> index 16eb025..8825b18 100644
> --- a/arch/arm/mach-pxa/include/mach/audio.h
> +++ b/arch/arm/mach-pxa/include/mach/audio.h
> @@ -20,6 +20,7 @@ typedef struct {
>  	void (*resume)(void *);
>  	void *priv;
>  	int reset_gpio;
> +	void *codec_pdata[4];
I don't understand where that '4' comes from. Would you explain ?

> diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
> index c570ebd..cfab74e 100644
> --- a/sound/arm/pxa2xx-ac97.c
> +++ b/sound/arm/pxa2xx-ac97.c
> @@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
>  	struct snd_ac97_bus *ac97_bus;
>  	struct snd_ac97_template ac97_template;
>  	int ret;
> +	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
> +	int id = dev->id < 0 ? 0 : dev->id;
>  
>  	ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
>  			      THIS_MODULE, 0, &card);
> @@ -200,6 +202,7 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
>  	snprintf(card->longname, sizeof(card->longname),
>  		 "%s (%s)", dev->dev.driver->name, card->mixername);
>  
> +	snd_ac97_dev_add_pdata(ac97_bus->codec[id], pdata->codec_pdata[id]);
Is there something that grants that dev->id is lesser than 4 ?

Cheers.

-- 
Robert


More information about the Alsa-devel mailing list