From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH] asoc: add dummy codec Date: Thu, 11 Apr 2013 20:02:33 +0200 Message-ID: <5166FAB9.9010506@metafoo.de> References: <51669249.8090100@list.ru> <51669353.7090903@metafoo.de> <5166D295.2070400@list.ru> <5166DB38.1010706@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailhost.informatik.uni-hamburg.de (mailhost.informatik.uni-hamburg.de [134.100.9.70]) by alsa0.perex.cz (Postfix) with ESMTP id D5F96266195 for ; Thu, 11 Apr 2013 20:00:03 +0200 (CEST) In-Reply-To: <5166DB38.1010706@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Gabriel M. Beddingfield" Cc: ALSA devel , Steve Chen , Stas Sergeev List-Id: alsa-devel@alsa-project.org On 04/11/2013 05:48 PM, Gabriel M. Beddingfield wrote: > On 04/11/2013 08:11 AM, Stas Sergeev wrote: >>> There is already a dummy codec driver. >>> >>> Please take a look at sound/soc/soc-utils.c >>> >>> - Lars >> Lars, indeed, this codec is present in a git kernel and >> it wasn't in mine android kernel. >> But, that driver is too dummy to even work at all. >> >> The attached patch adds a playback stream for the dummy >> codec. Would it be possible to apply this? > > No... not like that. > > Instead, wouldn't it be better to extend it by defining some platform data? Maybe something like: Either you want a dummy or you want one with specific requirements. For the former case use the dummy codec, for the later case add a proper driver. Putting these kinds of things in your board file is in my opinion a bad habit. - Lars > > diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c > index fe4541d..9d22718 100644 > --- a/sound/soc/soc-utils.c > +++ b/sound/soc/soc-utils.c > @@ -96,9 +96,14 @@ static struct snd_soc_dai_driver dummy_dai = { > > static int snd_soc_dummy_probe(struct platform_device *pdev) > { > + struct snd_soc_dummy_dai_pdata *pdata = dev_get_platdata(&pdev->dev); > int ret; > > - ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1); > + if (pdata->n_dai > 0) > + ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, > + &pdata->dai, &pdata->n_dai); > + else > + ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1); > if (ret < 0) > return ret; > > > ...then you can define whatever kind of DAI you want in the machine driver. > > -gabriel >