From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relmlor4.renesas.com ([210.160.252.174]:41127 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756609AbcEaJAo (ORCPT ); Tue, 31 May 2016 05:00:44 -0400 Message-ID: <878tyqsj48.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm() To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> References: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Tue, 31 May 2016 09:00:40 +0000 Sender: linux-renesas-soc-owner@vger.kernel.org List-ID: From: Kuninori Morimoto simple-card is supporting TDM. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_utils.h | 12 ++++++++++++ sound/soc/generic/simple-card-utils.c | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 7acc798..6bb2c5f 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -12,10 +12,22 @@ #include +struct asoc_simple_dai { + const char *name; + unsigned int sysclk; + int slots; + int slot_width; + unsigned int tx_slot_mask; + unsigned int rx_slot_mask; + struct clk *clk; +}; + int asoc_simple_card_parse_daifmt(struct device *dev, struct device_node *node, struct device_node *codec, char *prefix, unsigned int *retfmt); +int asoc_simple_card_parse_tdm(struct device_node *port_np, + struct asoc_simple_dai *simple_dai); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 3f6b725..86fb2cf 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -52,3 +52,14 @@ int asoc_simple_card_parse_daifmt(struct device *dev, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt); + +int asoc_simple_card_parse_tdm(struct device_node *port_np, + struct asoc_simple_dai *simple_dai) +{ + return snd_soc_of_parse_tdm_slot(port_np, + &simple_dai->tx_slot_mask, + &simple_dai->rx_slot_mask, + &simple_dai->slots, + &simple_dai->slot_width); +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm); -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm() Date: Tue, 31 May 2016 09:00:40 +0000 Message-ID: <878tyqsj48.wl%kuninori.morimoto.gx@renesas.com> References: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org To: Mark Brown Cc: Linux-ALSA , Liam Girdwood , Simon , linux-renesas-soc@vger.kernel.org List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto simple-card is supporting TDM. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_utils.h | 12 ++++++++++++ sound/soc/generic/simple-card-utils.c | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 7acc798..6bb2c5f 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -12,10 +12,22 @@ #include +struct asoc_simple_dai { + const char *name; + unsigned int sysclk; + int slots; + int slot_width; + unsigned int tx_slot_mask; + unsigned int rx_slot_mask; + struct clk *clk; +}; + int asoc_simple_card_parse_daifmt(struct device *dev, struct device_node *node, struct device_node *codec, char *prefix, unsigned int *retfmt); +int asoc_simple_card_parse_tdm(struct device_node *port_np, + struct asoc_simple_dai *simple_dai); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 3f6b725..86fb2cf 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -52,3 +52,14 @@ int asoc_simple_card_parse_daifmt(struct device *dev, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt); + +int asoc_simple_card_parse_tdm(struct device_node *port_np, + struct asoc_simple_dai *simple_dai) +{ + return snd_soc_of_parse_tdm_slot(port_np, + &simple_dai->tx_slot_mask, + &simple_dai->rx_slot_mask, + &simple_dai->slots, + &simple_dai->slot_width); +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm); -- 1.9.1