From patchwork Wed Aug 6 01:18:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 4682911 Return-Path: X-Original-To: patchwork-linux-arm@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 788BFC0338 for ; Wed, 6 Aug 2014 01:27:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CB8B2018E for ; Wed, 6 Aug 2014 01:27:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D24C20170 for ; Wed, 6 Aug 2014 01:27:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEpy9-00088o-3g; Wed, 06 Aug 2014 01:24:45 +0000 Received: from vps0.lunn.ch ([178.209.37.122]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEpy1-00085L-0B for linux-arm-kernel@lists.infradead.org; Wed, 06 Aug 2014 01:24:37 +0000 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1XEpsF-00054S-AB; Wed, 06 Aug 2014 03:18:39 +0200 From: Andrew Lunn To: Russell King Subject: [RFC 4/8] ASoC: dt: Parse DPCM properties Date: Wed, 6 Aug 2014 03:18:28 +0200 Message-Id: <1407287912-19447-5-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1407287912-19447-1-git-send-email-andrew@lunn.ch> References: <1407287912-19447-1-git-send-email-andrew@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140805_182437_208128_664C7909 X-CRM114-Status: UNSURE ( 9.00 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Jean-Francois Moine , linux ARM , Andrew Lunn X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to describe DPCM links in DT, we need some additional properties. Is the DAI dynamic, i.e. a front end? Should no PCM be created for the DAI? Can it be used for DPCM playback and capture? Add parsing of these properties to the core and make use of them in simple card. Signed-off-by: Andrew Lunn --- .../devicetree/bindings/sound/simple-card.txt | 4 ++++ include/sound/soc.h | 6 ++++++ sound/soc/generic/simple-card.c | 4 ++++ sound/soc/soc-core.c | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index 8b9f902cdfc7..cba8b8406bb0 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -51,6 +51,10 @@ Optional dai-link subnode properties: dai-link uses frame clock inversion. - mclk-fs : Multiplication factor between stream rate and codec mclk. +- dynamic : This DAI link can route to other DAI links at runtime +- no_pcm : Do not create a PCM for this DAI link +- dpcm_capture : DPCM capture supported for this DAI link +- dpcm_playback : DPCM playback supported for this DAI link For backward compatibility the frame-master and bitclock-master properties can be used as booleans in codec subnode to indicate if the diff --git a/include/sound/soc.h b/include/sound/soc.h index ed9e2d7e5fdc..060e2f955292 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1374,6 +1374,12 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, struct device_node **framemaster); +void snd_soc_of_parse_dpcm(struct device_node *np, + struct snd_soc_dai_link *dai_link); +void snd_soc_of_parse_dynamic(struct device_node *np, + struct snd_soc_dai_link *dai_link); +void snd_soc_of_parse_no_pcm(struct device_node *np, + struct snd_soc_dai_link *dai_link); int snd_soc_of_get_dai_name(struct device_node *of_node, const char **dai_name); diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 63f3d16d43ba..735a54099b8d 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -188,6 +188,10 @@ static int simple_card_dai_link_of(struct device_node *node, &bitclkmaster, &framemaster); daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + snd_soc_of_parse_dpcm(node, dai_link); + snd_soc_of_parse_dynamic(node, dai_link); + snd_soc_of_parse_no_pcm(node, dai_link); + /* Factor to mclk, used in hw_params() */ of_property_read_u32(node, "mclk-fs", &dai_props->mclk_fs); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 91120b8e283e..8aa3a21d37af 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4745,6 +4745,28 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); +void snd_soc_of_parse_dpcm(struct device_node *np, + struct snd_soc_dai_link *dai_link) +{ + dai_link->dpcm_playback = of_property_read_bool(np, "dpcm_playback"); + dai_link->dpcm_capture = of_property_read_bool(np, "dpcm_capture"); +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_dpcm); + +void snd_soc_of_parse_dynamic(struct device_node *np, + struct snd_soc_dai_link *dai_link) +{ + dai_link->dynamic = of_property_read_bool(np, "dynamic"); +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_dynamic); + +void snd_soc_of_parse_no_pcm(struct device_node *np, + struct snd_soc_dai_link *dai_link) +{ + dai_link->no_pcm = of_property_read_bool(np, "no_pcm"); +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_no_pcm); + int snd_soc_of_get_dai_name(struct device_node *of_node, const char **dai_name) {