From patchwork Wed Aug 6 01:18:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 4682941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 98B189F375 for ; Wed, 6 Aug 2014 01:27:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDF67201DE for ; Wed, 6 Aug 2014 01:27:11 +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 E27B820173 for ; Wed, 6 Aug 2014 01:27:10 +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 1XEpxx-00086F-Hq; Wed, 06 Aug 2014 01:24:33 +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 1XEpxu-00083r-BY for linux-arm-kernel@lists.infradead.org; Wed, 06 Aug 2014 01:24:31 +0000 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1XEpsF-00054e-FH; Wed, 06 Aug 2014 03:18:39 +0200 From: Andrew Lunn To: Russell King Subject: [RFC 7/8] ASoC: simple-card: Allow use of snd-soc-dummy as codec Date: Wed, 6 Aug 2014 03:18:31 +0200 Message-Id: <1407287912-19447-8-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_182430_556009_8B73ECFF X-CRM114-Status: GOOD ( 12.81 ) 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 The DPCM front end does not have a codec attached. So use the Boolean property 'snd-soc-dummy' to indicate that snd-soc-dummy should be used, instead of a phandle to a real codec. Signed-off-by: Andrew Lunn --- .../devicetree/bindings/sound/simple-card.txt | 3 +++ sound/soc/generic/simple-card.c | 27 ++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index cba8b8406bb0..79ba1138dfa8 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -65,7 +65,10 @@ properties should also be placed in the codec node if needed. Required CPU/CODEC subnodes properties: +Either: - sound-dai : phandle and port of CPU/CODEC +Or: +- snd-soc-dummy : Boolean that dummy should be used Optional CPU/CODEC subnodes properties: diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index a99aad16d8f9..e7fccd0940bb 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -114,6 +114,7 @@ static int asoc_simple_card_sub_parse_of(struct device_node *np, struct asoc_simple_dai *dai, const struct device_node **p_node, + const char **dai_name, const char **name) { struct device_node *node; @@ -125,14 +126,20 @@ asoc_simple_card_sub_parse_of(struct device_node *np, * it will be used as xxx_of_node on soc_bind_dai_link() */ node = of_parse_phandle(np, "sound-dai", 0); - if (!node) - return -ENODEV; - *p_node = node; + if (!node) { + if (!of_property_read_bool(np, "snd-soc-dummy")) + return -ENODEV; + *name = "snd-soc-dummy"; + *dai_name = "snd-soc-dummy-dai"; + p_node = NULL; + } else { + *p_node = node; - /* get dai->name */ - ret = snd_soc_of_get_dai_name(np, name); - if (ret < 0) - return ret; + /* get dai->name */ + ret = snd_soc_of_get_dai_name(np, dai_name); + if (ret < 0) + return ret; + } /* parse TDM slot */ ret = snd_soc_of_parse_tdm_slot(np, &dai->slots, &dai->slot_width); @@ -253,7 +260,8 @@ static int simple_card_dai_link_of(struct device_node *node, ret = asoc_simple_card_sub_parse_of(np, &dai_props->cpu_dai, &dai_link->cpu_of_node, - &dai_link->cpu_dai_name); + &dai_link->cpu_dai_name, + &dai_link->cpu_name); if (ret < 0) goto dai_link_of_err; @@ -272,7 +280,8 @@ static int simple_card_dai_link_of(struct device_node *node, ret = asoc_simple_card_sub_parse_of(np, &dai_props->codec_dai, &dai_link->codec_of_node, - &dai_link->codec_dai_name); + &dai_link->codec_dai_name, + &dai_link->codec_name); if (ret < 0) goto dai_link_of_err;