From patchwork Wed Feb 12 07:45:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiubo Li X-Patchwork-Id: 3635581 X-Patchwork-Delegate: broonie@sirena.org.uk 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 1369CBF13A for ; Wed, 12 Feb 2014 08:50:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4A2920123 for ; Wed, 12 Feb 2014 08:50:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A30D920122 for ; Wed, 12 Feb 2014 08:50:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BC1112650A0; Wed, 12 Feb 2014 09:50:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY,UNRESOLVED_TEMPLATE autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 06947265053; Wed, 12 Feb 2014 09:49:16 +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 98474265013; Wed, 12 Feb 2014 09:49:13 +0100 (CET) Received: from co9outboundpool.messaging.microsoft.com (co9ehsobe002.messaging.microsoft.com [207.46.163.25]) by alsa0.perex.cz (Postfix) with ESMTP id 80058264F8D for ; Wed, 12 Feb 2014 09:48:56 +0100 (CET) Received: from mail130-co9-R.bigfish.com (10.236.132.234) by CO9EHSOBE023.bigfish.com (10.236.130.86) with Microsoft SMTP Server id 14.1.225.22; Wed, 12 Feb 2014 08:48:55 +0000 Received: from mail130-co9 (localhost [127.0.0.1]) by mail130-co9-R.bigfish.com (Postfix) with ESMTP id 1FF3414041D; Wed, 12 Feb 2014 08:48:55 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzc8kzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah21bch1fc6hzz1de098h8275bh1de097hz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h24afh2327h2336h2438h2461h2487h24d7h2516h2545h255eh1155h) Received: from mail130-co9 (localhost.localdomain [127.0.0.1]) by mail130-co9 (MessageSwitch) id 1392194933339019_4796; Wed, 12 Feb 2014 08:48:53 +0000 (UTC) Received: from CO9EHSMHS012.bigfish.com (unknown [10.236.132.236]) by mail130-co9.bigfish.com (Postfix) with ESMTP id 4DF6570004D; Wed, 12 Feb 2014 08:48:53 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS012.bigfish.com (10.236.130.22) with Microsoft SMTP Server (TLS) id 14.16.227.3; Wed, 12 Feb 2014 08:48:53 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.3.158.2; Wed, 12 Feb 2014 08:48:51 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s1C8m7Oa007607; Wed, 12 Feb 2014 01:48:48 -0700 From: Xiubo Li To: , Date: Wed, 12 Feb 2014 15:45:12 +0800 Message-ID: <1392191112-27028-4-git-send-email-Li.Xiubo@freescale.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1392191112-27028-1-git-send-email-Li.Xiubo@freescale.com> References: <1392191112-27028-1-git-send-email-Li.Xiubo@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-FOPE-CONNECTOR: Id%0$Dn%FREESCALE.MAIL.ONMICROSOFT.COM$RO%1$TLS%0$FQDN%$TlsDn% Cc: alsa-devel@alsa-project.org, kuninori.morimoto.gx@renesas.com, tiwai@suse.de, linux-kernel@vger.kernel.org, Xiubo Li Subject: [alsa-devel] [PATCH v2 3/3] ASoC: simple-card: add slot information parsing supports 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 For some CPU/CODEC DAI devices the slot information maybe needed. This patch adds the slot information parsing for simple-card driver. Signed-off-by: Xiubo Li --- .../devicetree/bindings/sound/simple-card.txt | 1 + include/sound/simple_card.h | 1 + sound/soc/generic/simple-card.c | 35 ++++++++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index 0527358..7abf8f3 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -18,6 +18,7 @@ Optional properties: Each entry is a pair of strings, the first being the connection's sink, the second being the connection's source. +- simple-audio-card,slot-info : Please refer to tdm-slot.txt. Required subnodes: diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h index e1ac996..d645241 100644 --- a/include/sound/simple_card.h +++ b/include/sound/simple_card.h @@ -18,6 +18,7 @@ struct asoc_simple_dai { const char *name; unsigned int fmt; unsigned int sysclk; + struct soc_slot_info *slot; }; struct asoc_simple_card_info { diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 4fe8abc..fd230c7 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -9,11 +9,14 @@ * published by the Free Software Foundation. */ #include +#include #include #include #include #include #include +#include +#include struct simple_card_data { struct snd_soc_card snd_card; @@ -44,6 +47,17 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, } } + if (set->slot) { + ret = snd_soc_dai_set_tdm_slot(dai, set->slot->tx_mask, + set->slot->rx_mask, + set->slot->slots, + set->slot->slot_width); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); + goto err; + } + } + ret = 0; err: @@ -74,7 +88,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np, unsigned int daifmt, struct asoc_simple_dai *dai, const struct device_node **p_node, - const char **name) + const char **name, + struct device *dev) { struct device_node *node; struct clk *clk; @@ -94,6 +109,18 @@ asoc_simple_card_sub_parse_of(struct device_node *np, if (ret < 0) goto parse_error; + /* parse TDM slot information */ + if (of_property_read_bool(np, "simple-audio-card,slot-info")) { + dai->slot = devm_kzalloc(dev, sizeof(*dai->slot), GFP_KERNEL); + if (!dai->slot) + return -ENOMEM; + + ret = snd_soc_of_parse_slot_info(np, dai->slot, + "simple-audio-card,slot-info"); + if (ret < 0) + goto parse_error; + } + /* * bitclock-inversion, frame-inversion * bitclock-master, frame-master @@ -173,7 +200,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = asoc_simple_card_sub_parse_of(np, priv->daifmt, &priv->cpu_dai, &dai_link->cpu_of_node, - &dai_link->cpu_dai_name); + &dai_link->cpu_dai_name, + dev); if (ret < 0) return ret; @@ -184,7 +212,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = asoc_simple_card_sub_parse_of(np, priv->daifmt, &priv->codec_dai, &dai_link->codec_of_node, - &dai_link->codec_dai_name); + &dai_link->codec_dai_name, + dev); if (ret < 0) return ret;