From patchwork Thu Feb 12 21:30:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 5822261 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C37F9F3CA for ; Thu, 12 Feb 2015 21:31:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2BCF20253 for ; Thu, 12 Feb 2015 21:31:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0B123201DD for ; Thu, 12 Feb 2015 21:30:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DD1312652FB; Thu, 12 Feb 2015 22:30:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_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 4447226063D; Thu, 12 Feb 2015 22:30:43 +0100 (CET) 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 9650E260644; Thu, 12 Feb 2015 22:30:41 +0100 (CET) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by alsa0.perex.cz (Postfix) with ESMTP id 4102726063B for ; Thu, 12 Feb 2015 22:30:34 +0100 (CET) Received: by mail-pa0-f54.google.com with SMTP id kx10so13964150pab.13 for ; Thu, 12 Feb 2015 13:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=L8LpFLAYqOZTa721ykWV8yXmixfmYUVwz/pFnjUVHnU=; b=bRoDryTT3F7sI8NIFaUurkzN1/SSnQJLxULP4DgFbLEv7i61eAGIl5Er9iz3oRHtZO wMY1apqWu883c1FEzrOkjQNVqUDD+HEd2D+qnah1nn6l/7MxzXh2uQYifS14Fk+9wbcs 3ZMZD1PrJDPtiX8oA9ks91ObuLfx38fBkzJy0dD5OdWNx6U7Kjt2jzQOMyM5u36Foika Qk6kSey7ylGYKwrAQduDx/VD0aMz9mQhJCl35zRFucXNgkDVJlDsS1eQSHsMMKkNiB9j mXHZhGpEHQuJrsK812sDFOVXiL/0h257MhQZBXBXV+Ex4cZnCZqA91RBoHeJ6X2J/432 jzfg== X-Received: by 10.66.242.141 with SMTP id wq13mr9519311pac.41.1423776632775; Thu, 12 Feb 2015 13:30:32 -0800 (PST) Received: from Alpha.attlocal.net (99-189-113-45.lightspeed.sntcca.sbcglobal.net. [99.189.113.45]) by mx.google.com with ESMTPSA id tn2sm4693280pbc.15.2015.02.12.13.30.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Feb 2015 13:30:31 -0800 (PST) From: Nicolin Chen To: broonie@kernel.org Date: Thu, 12 Feb 2015 13:30:02 -0800 Message-Id: <1423776602-28585-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing() 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds snd_soc_of_parse_audio_routing() to get dapm routes via Device Tree. Because snd_soc_of_parse_audio_routing() overrides dpam_routes, we use snd_soc_dapm_add_routes() to append the original build-in DPCM routes instead of linking them to dpam_routes directly. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl-asoc-card.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 3f6959c..bdc9671 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -388,6 +388,8 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) struct device *dev = card->dev; int ret; + snd_soc_dapm_add_routes(&card->dapm, audio_map, ARRAY_SIZE(audio_map)); + ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, codec_priv->mclk_freq, SND_SOC_CLOCK_IN); if (ret) { @@ -503,15 +505,19 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->card.dev = &pdev->dev; priv->card.name = priv->name; priv->card.dai_link = priv->dai_link; - priv->card.dapm_routes = audio_map; priv->card.late_probe = fsl_asoc_card_late_probe; - priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets; priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets); memcpy(priv->dai_link, fsl_asoc_card_dai, sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link)); + ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing"); + if (ret) { + dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret); + goto asrc_fail; + } + /* Normal DAI Link */ priv->dai_link[0].cpu_of_node = cpu_np; priv->dai_link[0].codec_of_node = codec_np;