From patchwork Tue Aug 26 08:34:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4779001 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0D5D9C0338 for ; Tue, 26 Aug 2014 08:34:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE9B52018A for ; Tue, 26 Aug 2014 08:34:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C067020154 for ; Tue, 26 Aug 2014 08:34:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 46B65261ADA; Tue, 26 Aug 2014 10:34:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 27DD1261A60; Tue, 26 Aug 2014 10:34:38 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 17630261A7C; Tue, 26 Aug 2014 10:34:35 +0200 (CEST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by alsa0.perex.cz (Postfix) with ESMTP id C3BFA261A60 for ; Tue, 26 Aug 2014 10:34:26 +0200 (CEST) Received: by mail-pd0-f176.google.com with SMTP id y10so22161795pdj.21 for ; Tue, 26 Aug 2014 01:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:cc:subject:in-reply-to:references :user-agent:mime-version:content-type; bh=4jMc3Ui+ozN6K5UDDjpGaDxe+XeB7T+4AXGtZEb9E3A=; b=amnPvWdx1D9OsjMxTgzsbxukZJQnplkrV1cqwIvHbOfr/MIHl31njQhbxT5bdZ1LRi kx7hfdFZY24jjrDGpQB24AFNf4TKbVj1LmAOUKgMuoGADHw/+kY3cA61mK3nHVRJUWhx P6Vvnm4WB1/a7OTKSd7z/pvEm4IJcI/36LAAaqEVyJbyPrQo2a1QboNMPV60WYNIqBM2 dXTB0PRmMQp3tUEH0ZYEqcXl5Tn6xLftRQWFh4s06jLUpTrqbEkixhgRzu4ahPp0ySvg njVrqzblUMiu7jLBpUioH6EiCM4O1tgudljQUTTZFnKS7k4fEABczgUMQZeNl5SISmqE MNMA== X-Received: by 10.70.63.37 with SMTP id d5mr33920420pds.51.1409042062092; Tue, 26 Aug 2014 01:34:22 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id pv10sm3460680pdb.60.2014.08.26.01.34.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 26 Aug 2014 01:34:21 -0700 (PDT) Date: Tue, 26 Aug 2014 01:34:21 -0700 (PDT) Message-ID: <87wq9vmyyc.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto To: Mark Brown In-Reply-To: <20140826062558.GR17528@sirena.org.uk> References: <87fvgriqrb.wl%kuninori.morimoto.gx@gmail.com> <874mx7iqgt.wl%kuninori.morimoto.gx@renesas.com> <53F9A6EE.5070005@metafoo.de> <871ts4nmki.wl%kuninori.morimoto.gx@gmail.com> <20140826062558.GR17528@sirena.org.uk> User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: devicetree@vger.kernel.org, Linux-ALSA , Lars-Peter Clausen , Kuninori Morimoto , Liam Girdwood , Simon Subject: Re: [alsa-devel] [PATCH 8/8] ASoC: add snd-soc-dummy DT support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP Hi Mark, Lars > > > That's something we need to fix, but I don't think removing the stream names > > > is the right way to do this. In a multi CODEC environment you'll quite > > > likely end up with widgets of the same name. Ideally a route endpoint would > > > be expressed by a tuple of DT node and pin name. But I don't think it is > > > possible to mix integer and string elements in a property. > > It's not. Now that we have preprocessor support it's a lot easier to > just use numbers though - the legibility problems from just using raw > numbers in big tables don't apply so much any more. > > > Thank you for your advice. > > "DT node and name" seems nice idea, but it works on DT case only ? > > Anyway, I re-consider about this too. > > It can be trial and error... > > I think that for hardware which has fairly monolithic audio blocks using > DPCM it might be worth thinking about providing a way for the DT to look > like the DT for a simple I2S DAI with the driver for the IP in the SoC > filling in all the structure needed by DPCM. I expended route setting method like below, but what do you think ? I guess it can use not only DT case, and it is readable ? -------------------------- Subject: [PATCH] ASoC: dapm: enable DAI name on DAPM route DAPM route setting is using name matching. but, it can't match correctly if codec/platform driver have same name. This can be very serious issue on DAPM. FE CPU (ec500000.rcar_sound): "DAI0 Playback" Codec (snd-soc-dummy-dai): "Playback" BE CPU (snd-soc-dummy-dai): "Playback" Codec (ak4642-hifi): "Playback" This patch expand route setting by using DAI name. You can select "ak4642-hifi" side "Playback" by below. DT simple-audio-card,routing = "ak4642-hifi Playback", "DAI0 Playback"; non DT struct snd_soc_dapm_route route[] = { { "ak4642-hifi Playback", NULL, "DAI0 Playback"}, } Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) Best regards --- Kuninori Morimoto diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b24f70a..084f15b 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2395,6 +2395,30 @@ err: return ret; } +static void snd_soc_dapm_route_scan(struct snd_soc_dapm_widget *w, + struct snd_soc_dapm_widget **wsource, + struct snd_soc_dapm_widget **wsink, + struct snd_soc_dapm_widget **wtsource, + struct snd_soc_dapm_widget **wtsink, + struct snd_soc_dapm_context *dapm, + const char *sink, + const char *source, + const char *name) +{ + if (!*wsink && !(strcmp(name, sink))) { + *wtsink = w; + if (w->dapm == dapm) + *wsink = w; + return; + } + + if (!*wsource && !(strcmp(name, source))) { + *wtsource = w; + if (w->dapm == dapm) + *wsource = w; + } +} + static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route) { @@ -2425,17 +2449,20 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, * current DAPM context */ list_for_each_entry(w, &dapm->card->widgets, list) { - if (!wsink && !(strcmp(w->name, sink))) { - wtsink = w; - if (w->dapm == dapm) - wsink = w; - continue; - } - if (!wsource && !(strcmp(w->name, source))) { - wtsource = w; - if (w->dapm == dapm) - wsource = w; + if (w->dai) { + char w_name[80]; + + snprintf(w_name, sizeof(w_name), "%s %s", + w->dai->name, w->name); + + snd_soc_dapm_route_scan(w, &wsource, &wsink, + &wtsource, &wtsink, dapm, + sink, source, w_name); } + + snd_soc_dapm_route_scan(w, &wsource, &wsink, + &wtsource, &wtsink, dapm, + sink, source, w->name); } /* use widget from another DAPM context if not found from this */ if (!wsink)