Skip to contentSkip to conversation

off-codec widgets

PATCH Applied Xiubo Li 2 participants 6 messages Feb 8, 2014 – Feb 10, 2014

Subsystems (4)
lore
Share & tools
lore

Xiubo Li

author
#0 lore raw

v3 cover off-codec widgets

This patch series has removed the code about tdm slot, and need to do more study.

This adds "ASoC: binding: add widgets.txt" new patch.

This also revises some others from Mark's comment.

Xiubo Li (4):
ASoC: add snd_soc_of_parse_audio_simple_widgets for DT
ASoC: simple-card: add off-codec widgets supports.
ASoC: binding: add widgets.txt
ASoC: binding: for new properties documenting and usage

 .../devicetree/bindings/sound/simple-card.txt      | 12 ++-
 .../devicetree/bindings/sound/widgets.txt          | 20 +++++
 include/sound/soc.h                                |  2 +
 sound/soc/generic/simple-card.c                    |  8 ++
 sound/soc/soc-core.c                               | 87 ++++++++++++++++++++++
 5 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/widgets.txt
Signature · 1 line
1.8.4
author
#1 lore raw

PATCH v3 1/4 ASoC: add snd_soc_of_parse_audio_simple_widgets for DT

This patch adds snd_soc_of_parse_audio_simple_widgets() and supports below style of widgets name on DT:

"template-wname", "user supplied wname"

For instance:
simple-audio-widgets =
"Microphone", "Microphone Jack",
"Line", "Line In Jack",
"Line", "Line Out Jack",
"Headphone", "Headphone Jack",
"Speaker", "Speaker External";

The "template-wname" currently includes: "Microphone", "Line", "Headphone" and "Speaker".

---
 include/sound/soc.h  |  2 ++
 sound/soc/soc-core.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)
include/sound/soc.h +2 -0
index c4be7ab..21d025e 100644
@@ -1188,6 +1188,8 @@ void snd_soc_util_exit(void);
 
 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_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
sound/soc/soc-core.c +87 -0

93 lines not on this page · raw message

Signature · 1 line
1.8.4
author
#2 lore raw

PATCH v3 2/4 ASoC: simple-card: add off-codec widgets supports.

In reply to Xiubo Li
---
 sound/soc/generic/simple-card.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/generic/simple-card.c +8 -0
index 3177aa8..ec2a65d 100644
@@ -202,6 +202,14 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
 		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
 
+	/* off-codec widgets */
+	if (of_property_read_bool(node, "simple-audio-card,widgets")) {
+		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
+					"simple-audio-card,widgets");
+		if (ret)
+			return ret;
+	}
+
 	/* DAPM routes */
 	if (of_property_read_bool(node, "simple-audio-card,routing")) {
 		ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
Signature · 1 line
1.8.4
author
#3 lore raw

PATCH v3 3/4 ASoC: binding: add widgets.txt

In reply to Xiubo Li
---
 Documentation/devicetree/bindings/sound/widgets.txt | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/widgets.txt
Documentation/devicetree/bindings/sound/widgets.txt new file +20 -0
new file mode 100644
index 0000000..b6de5ba
@@ -0,0 +1,20 @@
+Widgets:
+
+This mainly specifies audio off-codec DAPM widgets.
+
+Each entry is a pair of strings in DT:
+
+	"template-wname", "user-supplied-wname"
+
+The "template-wname" being the template widget name and currently includes:
+"Microphone", "Line", "Headphone" and "Speaker".
+
+The "user-supplied-wname" being the user specified widget name.
+
+For instance:
+	simple-audio-widgets =
+		"Microphone", "Microphone Jack",
+		"Line", "Line In Jack",
+		"Line", "Line Out Jack",
+		"Headphone", "Headphone Jack",
+		"Speaker", "Speaker External";
Signature · 1 line
1.8.4
author
#4 lore raw

PATCH v3 4/4 ASoC: binding: for new properties documenting and usage

In reply to Xiubo Li

This add the following three new properties documenting and usage for simple card:

"simple-audio-card,name",
"simple-audio-card,widgets",

---
 Documentation/devicetree/bindings/sound/simple-card.txt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/simple-card.txt +10 -2
index 19c84df..0527358 100644
@@ -8,9 +8,12 @@ Required properties:
 
 Optional properties:
 
+- simple-audio-card,name		: User specified audio sound card name, one string
+					  property.
 - simple-audio-card,format		: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
+- simple-audio-card,widgets		: Please refer to widgets.txt.
 - simple-audio-card,routing		: A list of the connections between audio components.
 					  Each entry is a pair of strings, the first being the
 					  connection's sink, the second being the connection's
@@ -42,11 +45,16 @@ Example:
 
 sound {
 	compatible = "simple-audio-card";
+	simple-audio-card,name = "VF610-Tower-Sound-Card";
 	simple-audio-card,format = "left_j";
+	simple-audio-card,widgets =
+		"Microphone", "Microphone Jack",
+		"Headphone", "Headphone Jack",
+		"Speaker", "External Speaker";
 	simple-audio-card,routing =
-		"MIC_IN", "Mic Jack",
+		"MIC_IN", "Microphone Jack",
 		"Headphone Jack", "HP_OUT",
-		"Ext Spk", "LINE_OUT";
+		"External Speaker", "LINE_OUT";
 
 	simple-audio-card,cpu {
 		sound-dai = <&sh_fsi2 0>;
Signature · 1 line
1.8.4
maintainer Applied
#5 lore raw
In reply to Xiubo Li
Quoted 2 lines · Xiubo Li

This patch series has removed the code about tdm slot, and need to do more study.

Applied all, thanks.