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

Marek Vasut marek.vasut at gmail.com
Tue Jul 21 23:53:37 CEST 2009


Dne Út 21. července 2009 22:59:35 Takashi Iwai napsal(a):
> At Tue, 21 Jul 2009 22:24:21 +0200,
>
> Marek Vasut wrote:
> > From 082f09b9f3c1bbf3240610dc89baba33d47787b7 Mon Sep 17 00:00:00 2001
> > From: Marek Vasut <marek.vasut at gmail.com>
> > Date: Tue, 21 Jul 2009 16:22:29 +0200
> > Subject: [PATCH 1/5] Allow passing platform_data to devices attached to
> > AC97 bus
> >
> > This patch allows passing platform_data to devices attached to AC97 bus
> > (like touchscreens, battery measurement chips ...).
> >
> > Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
> > ---
> >  include/sound/ac97_codec.h |    6 ++++++
> >  include/sound/soc-dai.h    |    1 +
> >  sound/soc/soc-core.c       |    5 ++++-
> >  3 files changed, 11 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
> > index 251fc1c..702f90d 100644
> > --- a/include/sound/ac97_codec.h
> > +++ b/include/sound/ac97_codec.h
> > @@ -642,4 +642,10 @@ int snd_ac97_pcm_double_rate_rules(struct
> > snd_pcm_runtime *runtime); /* ad hoc AC97 device driver access */
> >  extern struct bus_type ac97_bus_type;
> >
> > +/* AC97 platform_data adding function */
> > +static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void
> > *data) +{
> > +	ac97->dev.platform_data = data;
> > +}
> > +
> >  #endif /* __SOUND_AC97_CODEC_H */
> > diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
> > index 352d7ee..0d65a03 100644
> > --- a/include/sound/soc-dai.h
> > +++ b/include/sound/soc-dai.h
> > @@ -179,6 +179,7 @@ struct snd_soc_dai {
> >  	int ac97_control;
> >
> >  	struct device *dev;
> > +	void *ac97_pdata;	/* platform_data for the ac97 codec */
> >
> >  	/* DAI callbacks */
> >  	int (*probe)(struct platform_device *pdev,
> > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> > index 1d70829..0b12fe5 100644
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> > @@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device
> > *socdev) continue;
> >  			}
> >  		}
> > -		if (card->dai_link[i].codec_dai->ac97_control)
> > +		if (card->dai_link[i].codec_dai->ac97_control) {
> >  			ac97 = 1;
> > +			codec->ac97->dev.platform_data =
> > +				card->dai_link[i].cpu_dai->ac97_pdata;
>
> Any reason not to use the newly added snd_ac97_dev_add_pdata()?

hm, that's true, one more iteration then.
>
>
> thanks,
>
> Takashi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-passing-platform_data-to-devices-attached-to-A.patch
Type: text/x-patch
Size: 2262 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20090721/8a1f89e7/attachment.patch 


More information about the Alsa-devel mailing list