[alsa-devel] [PATCH 02/19] ASoC: sst_platform: add cpu dai driver for moorestown platform

Lu Guanqun guanqun.lu at intel.com
Thu May 5 06:48:06 CEST 2011


On Thu, May 05, 2011 at 11:23:01AM +0800, Koul, Vinod wrote:
> On Wed, 2011-05-04 at 19:15 +0530, Lu, Guanqun wrote:
> > Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
> > ---
> >  sound/soc/mid-x86/sst_platform.c |   14 ++++++++++++++
> >  1 files changed, 14 insertions(+), 0 deletions(-)
> > 
> > diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
> > index 139db15..ce0ac3c 100644
> > --- a/sound/soc/mid-x86/sst_platform.c
> > +++ b/sound/soc/mid-x86/sst_platform.c
> > @@ -110,6 +110,20 @@ struct snd_soc_dai_driver sst_platform_dai[] = {
> >  		.formats = SNDRV_PCM_FMTBIT_S24_LE,
> >  	},
> >  },
> > +{
> > +	.name = "mrst-cpu-pcm2",
> > +	.id = 4,
> > +	.playback = {
> > +		.channels_min = 1,
> > +		.channels_max = 2,
> > +		.rates = (SNDRV_PCM_RATE_48000 |
> > +			  SNDRV_PCM_RATE_44100 |
> > +			  SNDRV_PCM_RATE_8000),
> > +		.formats = (SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_U16 |
> > +			    SNDRV_PCM_FMTBIT_S24 | SNDRV_PCM_FMTBIT_U24 |
> > +			    SNDRV_PCM_FMTBIT_S32 | SNDRV_PCM_FMTBIT_U32),
> > +	},
> > +},
> Nope, We cant keep on adding these DAIs for every new platform :(
> Even the current way is not best as it just creates 4 instance of DAI
> where we could have done with two (as they have same properties)
> I would use the current headset DAI and change the ops there, or create
> a new one for each type so that it can be reused.

So how about this one (not tested yet):

diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index 7985cfe..78660e4 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -68,16 +68,21 @@ struct snd_soc_dai_driver sst_platform_dai[] = {
        .name = "Headset-cpu-dai",
        .id = 0,
        .playback = {
-               .channels_min = SST_STEREO,
+               .channels_min = SST_MONO,
                .channels_max = SST_STEREO,
-               .rates = SNDRV_PCM_RATE_48000,
-               .formats = SNDRV_PCM_FMTBIT_S24_LE,
+               .rates = (SNDRV_PCM_RATE_48000 |
+                         SNDRV_PCM_RATE_44100 |
+                         SNDRV_PCM_RATE_8000),
+               .formats = (SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_U16 |
+                           SNDRV_PCM_FMTBIT_S24 | SNDRV_PCM_FMTBIT_U24 |
+                           SNDRV_PCM_FMTBIT_S32 | SNDRV_PCM_FMTBIT_U32),
        },
        .capture = {
                .channels_min = 1,
                .channels_max = 5,
                .rates = SNDRV_PCM_RATE_48000,
-               .formats = SNDRV_PCM_FMTBIT_S24_LE,
+               .formats = (SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_U16 |
+                           SNDRV_PCM_FMTBIT_S24_LE),
        },
 },
 {

-- 
guanqun


More information about the Alsa-devel mailing list