* [PATCHv2 1/6] ASoC: core: add off-CODEC widgets list register/unregister
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
2014-01-13 5:53 ` [PATCHv2 2/6] ASoC: core: add snd_soc_get_widgets Xiubo Li
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
This will be need for some audio card, which maybe using the simple
card and the off-CODEC widgets is needed.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
include/sound/soc.h | 10 ++++++++++
sound/soc/soc-core.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 03ce45b..23f9572 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -326,6 +326,7 @@ struct snd_soc_platform_driver;
struct snd_soc_codec;
struct snd_soc_codec_driver;
struct snd_soc_component;
+struct snd_soc_widgets;
struct snd_soc_component_driver;
struct soc_enum;
struct snd_soc_jack;
@@ -385,6 +386,8 @@ int devm_snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *cmpnt_drv,
struct snd_soc_dai_driver *dai_drv, int num_dai);
void snd_soc_unregister_component(struct device *dev);
+int snd_soc_register_widgets(struct snd_soc_widgets *wdg);
+void snd_soc_unregister_widgets(struct snd_soc_widgets *wdg);
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
unsigned int reg);
int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
@@ -664,6 +667,13 @@ struct snd_soc_component {
const struct snd_soc_component_driver *driver;
};
+struct snd_soc_widgets {
+ const char *name;
+ struct list_head list;
+ const struct snd_soc_dapm_widget *widgets;
+ unsigned int cnt;
+};
+
/* SoC Audio Codec device */
struct snd_soc_codec {
const char *name;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a128f0..9adcada 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3821,6 +3821,45 @@ int snd_soc_unregister_card(struct snd_soc_card *card)
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_card);
+static DEFINE_MUTEX(widgets_mutex);
+static LIST_HEAD(widgets_list);
+/**
+ * snd_soc_register_widgets - Register off codec widgets with
+ * the ASoC core
+ *
+ * @wdg: widgets to register
+ *
+ */
+int snd_soc_register_widgets(struct snd_soc_widgets *wdg)
+{
+ int ret;
+
+ if (!wdg)
+ return -EINVAL;
+
+ mutex_lock(&widgets_mutex);
+ list_add(&wdg->list, &widgets_list);
+ mutex_unlock(&widgets_mutex);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_register_widgets);
+
+/**
+ * snd_soc_unregister_widgets - Unregister off codec widgets with
+ * the ASoC core
+ *
+ * @wdg: widgets to unregister
+ *
+ */
+void snd_soc_unregister_widgets(struct snd_soc_widgets *wdg)
+{
+ mutex_lock(&widgets_mutex);
+ list_del(&wdg->list);
+ mutex_unlock(&widgets_mutex);
+}
+EXPORT_SYMBOL_GPL(snd_soc_unregister_widgets);
+
/*
* Simplify DAI link configuration by removing ".-1" from device names
* and sanitizing names.
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCHv2 2/6] ASoC: core: add snd_soc_get_widgets
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
2014-01-13 5:53 ` [PATCHv2 1/6] ASoC: core: add off-CODEC widgets list register/unregister Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
2014-01-13 5:53 ` [PATCHv2 3/6] ASoC: simple-card: simple audio card widgets getting Xiubo Li
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
Add widgets list getting.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
include/sound/soc.h | 1 +
sound/soc/soc-core.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 23f9572..f352333 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -388,6 +388,7 @@ int devm_snd_soc_register_component(struct device *dev,
void snd_soc_unregister_component(struct device *dev);
int snd_soc_register_widgets(struct snd_soc_widgets *wdg);
void snd_soc_unregister_widgets(struct snd_soc_widgets *wdg);
+struct snd_soc_widgets *snd_soc_get_widgets(struct device_node *np);
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
unsigned int reg);
int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9adcada..e1d26e6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3860,6 +3860,37 @@ void snd_soc_unregister_widgets(struct snd_soc_widgets *wdg)
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_widgets);
+struct snd_soc_widgets *snd_soc_get_widgets(struct device_node *np)
+{
+ struct snd_soc_widgets *wdg;
+ const char *string;
+ int ret;
+
+ if (!np)
+ return ERR_PTR(-EINVAL);
+
+ if (!of_property_read_bool(np, "sound-widgets"))
+ return NULL;
+
+ ret = of_property_read_string(np, "sound-widgets",
+ &string);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ mutex_lock(&widgets_mutex);
+ list_for_each_entry(wdg, &widgets_list, list) {
+ if (!strcmp(string, wdg->name)) {
+ mutex_unlock(&widgets_mutex);
+ return wdg;
+ }
+
+ }
+ mutex_unlock(&widgets_mutex);
+
+ return ERR_PTR(-EPROBE_DEFER);
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_widgets);
+
/*
* Simplify DAI link configuration by removing ".-1" from device names
* and sanitizing names.
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCHv2 3/6] ASoC: simple-card: simple audio card widgets getting
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
2014-01-13 5:53 ` [PATCHv2 1/6] ASoC: core: add off-CODEC widgets list register/unregister Xiubo Li
2014-01-13 5:53 ` [PATCHv2 2/6] ASoC: core: add snd_soc_get_widgets Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
2014-01-13 5:53 ` [PATCHv2 4/6] ASoC: simple-card: add sound-widgets usage Xiubo Li
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
sound/soc/generic/simple-card.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index b7dc63e..dbd93cc 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -125,6 +125,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
struct device_node **of_codec,
struct device_node **of_platform)
{
+ struct snd_soc_widgets *wdg;
struct device_node *np;
char *name;
int ret;
@@ -133,6 +134,14 @@ static int asoc_simple_card_parse_of(struct device_node *node,
info->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
+ wdg = snd_soc_get_widgets(node);
+ if (!IS_ERR_OR_NULL(wdg)) {
+ info->snd_card.dapm_widgets = wdg->widgets;
+ info->snd_card.num_dapm_widgets = wdg->cnt;
+ } else if (IS_ERR(wdg)) {
+ return PTR_ERR(wdg);
+ }
+
/* DAPM routes */
if (of_property_read_bool(node, "simple-audio-card,routing")) {
ret = snd_soc_of_parse_audio_routing(&info->snd_card,
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCHv2 4/6] ASoC: simple-card: add sound-widgets usage
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
` (2 preceding siblings ...)
2014-01-13 5:53 ` [PATCHv2 3/6] ASoC: simple-card: simple audio card widgets getting Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
2014-01-13 5:53 ` [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver Xiubo Li
2014-01-13 5:53 ` [PATCHv2 6/6] ARM: dts: Enable SGTL5000 codec based audio driver node for VF610 TOWER Xiubo Li
5 siblings, 0 replies; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
Documentation/devicetree/bindings/sound/simple-card.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index e9e20ec..01eb2d0 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -15,6 +15,10 @@ Optional properties:
Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's
source.
+- sound-widgets : The name of the audio card's off-CODEC widgets. If the
+ audio card need the off-CODEC widgets, the card driver
+ should register its widgets with one specified name:
+ "XXXX", and in dt node the sound-widgets = "XXXX".
Required subnodes:
@@ -42,6 +46,7 @@ Example:
sound {
compatible = "simple-audio-card";
+ sound-widgets = "widgets"
simple-audio-card,format = "left_j";
simple-audio-routing =
"MIC_IN", "Mic Jack",
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver.
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
` (3 preceding siblings ...)
2014-01-13 5:53 ` [PATCHv2 4/6] ASoC: simple-card: add sound-widgets usage Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
2014-01-13 17:16 ` Mark Brown
2014-01-13 5:53 ` [PATCHv2 6/6] ARM: dts: Enable SGTL5000 codec based audio driver node for VF610 TOWER Xiubo Li
5 siblings, 1 reply; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
This is the SGTL5000 codec based off-CODEC widgets supports.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
sound/soc/fsl/Kconfig | 25 ++++++++++++++++++
sound/soc/fsl/Makefile | 3 +++
sound/soc/fsl/snd-soc-simple-card-vf610.c | 43 +++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+)
create mode 100644 sound/soc/fsl/snd-soc-simple-card-vf610.c
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 324988d..1a09028 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -219,3 +219,28 @@ config SND_SOC_IMX_MC13783
select SND_SOC_IMX_PCM_DMA
endif # SND_IMX_SOC
+
+menuconfig SND_VF610_SOC
+ tristate "SoC Audio for Freescale VF610 CPUs"
+ select DMA_ENGINE
+ help
+ Say Y or M if you want to add support for codecs attached to
+ the VF610 CPUs.
+
+ This will enable Freeacale SAI and SGTL5000 codec, and an extra
+ TWR-AUDIO-SGTL sub-board is needed for SGTL5000.
+
+if SND_VF610_SOC
+
+config SND_SOC_VF610_SGTL5000
+ tristate "SoC Audio support for VF610 boards with SGTL5000"
+ depends on OF && I2C
+ select SND_SOC_FSL_SAI
+ select SND_SOC_SGTL5000
+ select SND_SIMPLE_CARD
+ help
+ Say Y if you want to add support for SoC audio on an VF610 board with
+ a SGTL5000 codec and a SAI.
+
+
+endif #SND_VF610_SOC
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index b12ad4b..668cead 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -60,3 +60,6 @@ obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o
obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o
+
+# Simple audio card widgets Support
+obj-$(CONFIG_SND_SOC_VF610_SGTL5000) += snd-soc-simple-card-vf610.o
diff --git a/sound/soc/fsl/snd-soc-simple-card-vf610.c b/sound/soc/fsl/snd-soc-simple-card-vf610.c
new file mode 100644
index 0000000..ee28748
--- /dev/null
+++ b/sound/soc/fsl/snd-soc-simple-card-vf610.c
@@ -0,0 +1,43 @@
+/*
+ * ASoC VF610 SGTL5000 off-CODEC widgets support
+ *
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/module.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+
+static const struct snd_soc_dapm_widget vf610_sgtl5000_dapm_widgets[] = {
+ SND_SOC_DAPM_MIC("Mic Jack", NULL),
+ SND_SOC_DAPM_LINE("Line In Jack", NULL),
+ SND_SOC_DAPM_HP("Headphone Jack", NULL),
+ SND_SOC_DAPM_SPK("Line Out Jack", NULL),
+ SND_SOC_DAPM_SPK("Ext Spk", NULL),
+};
+
+struct snd_soc_widgets vf610_sgtl5000_widgets = {
+ .name = "vf610-sgtl5000",
+ .widgets = vf610_sgtl5000_dapm_widgets,
+ .cnt = ARRAY_SIZE(vf610_sgtl5000_dapm_widgets),
+};
+
+static int __init __vf610_sgtl5000_widgets_init(void)
+{
+ return snd_soc_register_widgets(&vf610_sgtl5000_widgets);
+}
+module_init(__vf610_sgtl5000_widgets_init);
+
+static void __exit __vf610_sgtl5000_widgets_exit(void)
+{
+ snd_soc_unregister_widgets(&vf610_sgtl5000_widgets);
+}
+module_exit(__vf610_sgtl5000_widgets_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:vf610-simple-card-widgets");
+MODULE_DESCRIPTION("ASoC Simple Sound Card Widgets");
+MODULE_AUTHOR("Xiubo Li <Li.Xiubo@freescale.com>");
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver.
2014-01-13 5:53 ` [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver Xiubo Li
@ 2014-01-13 17:16 ` Mark Brown
2014-01-14 9:55 ` Li.Xiubo
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2014-01-13 17:16 UTC (permalink / raw)
To: Xiubo Li
Cc: lgirdwood, kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree
[-- Attachment #1: Type: text/plain, Size: 627 bytes --]
On Mon, Jan 13, 2014 at 01:53:57PM +0800, Xiubo Li wrote:
> This is the SGTL5000 codec based off-CODEC widgets supports.
>
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
> sound/soc/fsl/Kconfig | 25 ++++++++++++++++++
> sound/soc/fsl/Makefile | 3 +++
> sound/soc/fsl/snd-soc-simple-card-vf610.c | 43 +++++++++++++++++++++++++++++++
My previous comment on this still stands - if we're adding an explicit
machine driver for a simple card that defeats the point of having simple
card in the first place, the system may as well just have a normal
machine driver.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver.
2014-01-13 17:16 ` Mark Brown
@ 2014-01-14 9:55 ` Li.Xiubo
0 siblings, 0 replies; 9+ messages in thread
From: Li.Xiubo @ 2014-01-14 9:55 UTC (permalink / raw)
To: Mark Brown
Cc: lgirdwood, kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree
Hi Mark,
I have sent another patch, if that patch is ok, please ignore this patch
series.
The new patch :" ASoC: add snd_soc_of_parse_audio_simple_widgets for
DeviceTree"
Thanks,
--
Best Regards,
Xiubo
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCHv2 6/6] ARM: dts: Enable SGTL5000 codec based audio driver node for VF610 TOWER.
2014-01-13 5:53 [PATCHv2 0/6] One simple card use case Xiubo Li
` (4 preceding siblings ...)
2014-01-13 5:53 ` [PATCHv2 5/6] ASoC: fsl: Add VF610 simple audio card widgets driver Xiubo Li
@ 2014-01-13 5:53 ` Xiubo Li
5 siblings, 0 replies; 9+ messages in thread
From: Xiubo Li @ 2014-01-13 5:53 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: kuninori.morimoto.gx, alsa-devel, linux-kernel, devicetree, Xiubo Li
This patch adds and enables SGTL5000 codec support, and also specified
the corresponding SAI node.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
arch/arm/boot/dts/vf610-twr.dts | 47 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index e60c20c..acc860a 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -34,6 +34,43 @@
};
};
+ regulators {
+ compatible = "simple-bus";
+
+ reg_3p3v: 3p3v {
+ compatible = "regulator-fixed";
+ regulator-name = "3P3V";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ };
+ };
+
+ sound {
+ compatible = "simple-audio-card";
+ sound-widgets = "vf610-sgtl5000";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,routing =
+ "MIC_IN", "Mic Jack",
+ "Mic Jack", "Mic Bias",
+ "LINE_IN", "Line In Jack",
+ "Headphone Jack", "HP_OUT",
+ "Ext Spk", "LINE_OUT";
+
+ simple-audio-card,cpu {
+ sound-dai = <&sai2>;
+ master-clkdir-out;
+ frame-master;
+ bitclock-master;
+ };
+
+ simple-audio-card,codec {
+ sound-dai = <&codec>;
+ frame-master;
+ bitclock-master;
+ };
+ };
+
};
&dspi0 {
@@ -72,9 +109,19 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c0_1>;
status = "okay";
+
+ codec: sgtl5000@0a {
+ #sound-dai-cells = <0>;
+ compatible = "fsl,sgtl5000";
+ reg = <0x0a>;
+ VDDA-supply = <®_3p3v>;
+ VDDIO-supply = <®_3p3v>;
+ clocks = <&clks VF610_CLK_SAI2>;
+ };
};
&sai2 {
+ #sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2_1>;
status = "okay";
--
1.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread