From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 5/8] ASoC: simple-card: add DPCM support when DT case Date: Wed, 20 Aug 2014 00:11:31 -0700 (PDT) Message-ID: <878umjiqjm.wl%kuninori.morimoto.gx@renesas.com> References: <87fvgriqrb.wl%kuninori.morimoto.gx@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <87fvgriqrb.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mark Brown Cc: Linux-ALSA , Liam Girdwood , Simon , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org 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; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html