From patchwork Wed Aug 20 07:11:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4748731 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 E75E3C0338 for ; Wed, 20 Aug 2014 10:03:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3D6A20122 for ; Wed, 20 Aug 2014 10:03:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 472F920109 for ; Wed, 20 Aug 2014 10:03:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6774826589D; Wed, 20 Aug 2014 12:03:04 +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_SIGNED, 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 4D370265853; Wed, 20 Aug 2014 11:54:58 +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 8918526599B; Wed, 20 Aug 2014 11:54:56 +0200 (CEST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by alsa0.perex.cz (Postfix) with ESMTP id 2A0B7265832 for ; Wed, 20 Aug 2014 11:48:27 +0200 (CEST) Received: by mail-pa0-f54.google.com with SMTP id fa1so11984975pad.13 for ; Wed, 20 Aug 2014 02:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:sender:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=8SiAYTQddY6XGZE4BqJBJqNSumQ4JLfmPcVqtICAgAg=; b=q1Z7PcN6MUW/K5nzHXt94R9rPiI5vHWiFlG8hcHi/KNXyDWUyytudhSip/rBP1cmr5 QgtfcbUroUCUKuaH5sfCd6QPlni1Hc4WOaPJASdfg5QVSbKWAMmF34m7HwlphdDMWD4f AiQrFZm56i33eY2UFWvPzAhNyDO/rRF6UFKNIkrChNWKyfh8yUSsBFuCj8KHz2fFW0+0 hasutxYSnMT4R9UKOMxI0hT2BPd7FrxEA4CXNeHh1Fi/ErQyc4qHZYRFsFJAa7RzoKWF Dyu4BADkEYXFIZJbG2Esf/66sKqfvEiOYcjhOdYfKl6W6aNakB/TsI+qu/WwV94LV+eZ 3Liw== X-Received: by 10.69.26.68 with SMTP id iw4mr49449405pbd.137.1408518691670; Wed, 20 Aug 2014 00:11:31 -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 kt3sm32719896pdb.37.2014.08.20.00.11.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 20 Aug 2014 00:11:31 -0700 (PDT) Date: Wed, 20 Aug 2014 00:11:31 -0700 (PDT) Message-ID: <878umjiqjm.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <87fvgriqrb.wl%kuninori.morimoto.gx@gmail.com> References: <87fvgriqrb.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: devicetree@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 5/8] ASoC: simple-card: add DPCM support when DT case 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 From: Kuninori Morimoto This patch adds DPCM support on simple-card when DT case Signed-off-by: Kuninori Morimoto --- .../devicetree/bindings/sound/simple-card.txt | 35 ++++++++++++++++++++ sound/soc/generic/simple-card.c | 33 ++++++++++++++++-- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c2e9841..60ce432 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -51,6 +51,8 @@ Optional dai-link subnode properties: dai-link uses bit clock inversion. - frame-inversion : bool property. Add this if the dai-link uses frame clock inversion. +- remote : DPCM phandle to backend DAI entry. + and this DAI will be frontend entry. For backward compatibility the frame-master and bitclock-master properties can be used as booleans in codec subnode to indicate if the @@ -149,3 +151,36 @@ sound { }; }; }; + +Example 3 - DPCM: + +sound { + compatible = "simple-audio-card"; + + /* Front End <-> Back End route */ + simple-audio-card,routing = + "yyy Playback", "xxx Playback", + "xxx Capture", "yyy Capture"; + + simple-audio-card,dai-link@0 { /* Front End */ + ... + remote = <&backend>; + + cpu { + sound-dai = ; + }; + codec { + sound-dai = ; + }; + }; + + backend: simple-audio-card,dai-link@1 { /* Back End */ + ... + cpu { + sound-dai = ; + }; + codec { + sound-dai = ; + }; + }; +}; diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 60d277a..9481e70 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -163,7 +163,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np, return 0; } -static int asoc_simple_card_dai_link_of(struct device_node *node, +static int asoc_simple_card_dai_link_of(struct device_node *parent_node, + struct device_node *node, struct device *dev, struct snd_soc_dai_link *dai_link, struct simple_dai_props *dai_props, @@ -276,6 +277,32 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, dai_link->ops = &asoc_simple_card_ops; dai_link->init = asoc_simple_card_dai_init; + /* For DPCM */ + if (parent_node) { + struct device_node *e; + struct device_node *h; + + for_each_child_of_node(parent_node, e) { + h = of_parse_phandle(e, "remote", 0); + if (!h) + continue; + + /* Front End */ + if (e == node) { + dai_link->dynamic = 1; + dai_link->dpcm_playback = 1; /* FIXME */ + dai_link->dpcm_capture = 1; /* FIXME */ + } + + /* Back End */ + if (h == node) { + dai_link->no_pcm = 1; + dai_link->dpcm_playback = 1; /* FIXME */ + dai_link->dpcm_capture = 1; /* FIXME */ + } + } + } + dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); dev_dbg(dev, "\tcpu : %s / %04x / %d\n", dai_link->cpu_dai_name, @@ -350,7 +377,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, for_each_child_of_node(node, np) { dev_dbg(dev, "\tlink %d:\n", i); - ret = asoc_simple_card_dai_link_of(np, dev, + ret = asoc_simple_card_dai_link_of(node, np, dev, dai_link + i, dai_props + i, false); @@ -361,7 +388,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, i++; } } else { - ret = asoc_simple_card_dai_link_of(node, dev, + ret = asoc_simple_card_dai_link_of(NULL, node, dev, dai_link, dai_props, true); if (ret < 0) return ret;