[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1392191112-27028-3-git-send-email-Li.Xiubo@freescale.com>
Date: Wed, 12 Feb 2014 15:45:11 +0800
From: Xiubo Li <Li.Xiubo@...escale.com>
To: <broonie@...nel.org>, <lgirdwood@...il.com>
CC: <kuninori.morimoto.gx@...esas.com>, <alsa-devel@...a-project.org>,
<linux-kernel@...r.kernel.org>, <tiwai@...e.de>, <perex@...ex.cz>,
Xiubo Li <Li.Xiubo@...escale.com>
Subject: [PATCH v2 2/3] ASoC: core: add slot information parsing supports
For some CPU/CODEC DAI devices the slot infomation maybe needed. This
patch adds the slot parsing from DT supports.
The style of the slot information in DT should be:
<tx_mask, rx_mask, slots, slot_width>
For instance:
simple-slot-info = <0xffffffc 0xffffffc 2 0>;
Please refer to tdm-slot.txt for more detail.
Signed-off-by: Xiubo Li <Li.Xiubo@...escale.com>
---
include/sound/soc.h | 10 ++++++++++
sound/soc/soc-core.c | 23 +++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 21d025e..1aa85d0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1110,6 +1110,13 @@ struct soc_enum {
const unsigned int *values;
};
+struct soc_slot_info {
+ unsigned int tx_mask;
+ unsigned int rx_mask;
+ int slots;
+ int slot_width;
+};
+
/* codec IO */
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
unsigned int snd_soc_write(struct snd_soc_codec *codec,
@@ -1190,6 +1197,9 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
const char *propname);
int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
const char *propname);
+int snd_soc_of_parse_slot_info(struct device_node *np,
+ struct soc_slot_info *info,
+ const char *propname);
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
const char *propname);
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index abee5f4..3ad4b88 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4558,6 +4558,29 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
}
EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets);
+int snd_soc_of_parse_slot_info(struct device_node *np,
+ struct soc_slot_info *info,
+ const char *propname)
+{
+ u32 out_value[4];
+ int ret;
+
+ if (!info)
+ return -EINVAL;
+
+ ret = of_property_read_u32_array(np, propname, out_value, 4);
+ if (ret)
+ return ret;
+
+ info->tx_mask = out_value[0];
+ info->rx_mask = out_value[1];
+ info->slots = out_value[2];
+ info->slot_width = out_value[3];
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_slot_info);
+
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
const char *propname)
{
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists