All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: add dio2125 amplifier support
@ 2017-03-06 17:44 ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Jerome Brunet, alsa-devel, devicetree, linux-kernel,
	Kevin Hilman, Neil Armstrong

This patchset adds the support for the dio2125 from Dioo microcircuits.
The dio2125 is audio driver with adjustable gain. The EN pad allows to
enable or disable the outputs of the driver.

The link to the datasheet is not provided as part of the commit. It is not
provided the manufacturer and it is doubtful it will still be available a
few years from now. Still provided here in case anyone is interested [0].

This patchset has been tested on Amlogic's meson-gxbb-p200 board.

[0]: http://www.winine.com/Line%E9%9F%B3/DIO2125XM10%20V1.0.pdf

Jerome Brunet (3):
  dt-bindings: add vendor prefix for Dioo
  ASoC: dio2125: add dio2125 amp driver
  ASoC: dio2125: add dt-bindings

 .../devicetree/bindings/sound/dioo,dio2125.txt     |  12 +++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 sound/soc/codecs/Kconfig                           |   5 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/dio2125.c                         | 120 +++++++++++++++++++++
 5 files changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt
 create mode 100644 sound/soc/codecs/dio2125.c

-- 
2.9.3

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 0/3] ASoC: add dio2125 amplifier support
@ 2017-03-06 17:44 ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	linux-kernel, Jerome Brunet

This patchset adds the support for the dio2125 from Dioo microcircuits.
The dio2125 is audio driver with adjustable gain. The EN pad allows to
enable or disable the outputs of the driver.

The link to the datasheet is not provided as part of the commit. It is not
provided the manufacturer and it is doubtful it will still be available a
few years from now. Still provided here in case anyone is interested [0].

This patchset has been tested on Amlogic's meson-gxbb-p200 board.

[0]: http://www.winine.com/Line%E9%9F%B3/DIO2125XM10%20V1.0.pdf

Jerome Brunet (3):
  dt-bindings: add vendor prefix for Dioo
  ASoC: dio2125: add dio2125 amp driver
  ASoC: dio2125: add dt-bindings

 .../devicetree/bindings/sound/dioo,dio2125.txt     |  12 +++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 sound/soc/codecs/Kconfig                           |   5 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/dio2125.c                         | 120 +++++++++++++++++++++
 5 files changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt
 create mode 100644 sound/soc/codecs/dio2125.c

-- 
2.9.3

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/3] dt-bindings: add vendor prefix for Dioo
  2017-03-06 17:44 ` Jerome Brunet
@ 2017-03-06 17:44   ` Jerome Brunet
  -1 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Jerome Brunet, alsa-devel, devicetree, linux-kernel,
	Kevin Hilman, Neil Armstrong

Dioo (http://http://www.dioo.com) design and produce power analog and
mixed signal IC.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ec0bfb9bbebd..bb0edca6ec05 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -79,6 +79,7 @@ denx	Denx Software Engineering
 devantech	Devantech, Ltd.
 digi	Digi International Inc.
 digilent	Diglent, Inc.
+dioo	Dioo Microcircuit Co., Ltd
 dlg	Dialog Semiconductor
 dlink	D-Link Corporation
 dmo	Data Modul AG
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 1/3] dt-bindings: add vendor prefix for Dioo
@ 2017-03-06 17:44   ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	linux-kernel, Jerome Brunet

Dioo (http://http://www.dioo.com) design and produce power analog and
mixed signal IC.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ec0bfb9bbebd..bb0edca6ec05 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -79,6 +79,7 @@ denx	Denx Software Engineering
 devantech	Devantech, Ltd.
 digi	Digi International Inc.
 digilent	Diglent, Inc.
+dioo	Dioo Microcircuit Co., Ltd
 dlg	Dialog Semiconductor
 dlink	D-Link Corporation
 dmo	Data Modul AG
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
  2017-03-06 17:44 ` Jerome Brunet
@ 2017-03-06 17:44   ` Jerome Brunet
  -1 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Jerome Brunet, alsa-devel, linux-kernel, Kevin Hilman, Neil Armstrong

The dio2125 is a stereo output driver with adjustable gain.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/codecs/Kconfig   |   5 ++
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/dio2125.c | 120 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
 create mode 100644 sound/soc/codecs/dio2125.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 7c7c2e96b836..09c187504e7c 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -69,6 +69,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_DA7219 if I2C
 	select SND_SOC_DA732X if I2C
 	select SND_SOC_DA9055 if I2C
+	select SND_SOC_DIO2125
 	select SND_SOC_DMIC
 	select SND_SOC_ES8328_SPI if SPI_MASTER
 	select SND_SOC_ES8328_I2C if I2C
@@ -517,6 +518,10 @@ config SND_SOC_DA732X
 config SND_SOC_DA9055
 	tristate
 
+config SND_SOC_DIO2125
+	tristate "Dioo DIO2125 Amplifier"
+	select GPIOLIB
+
 config SND_SOC_DMIC
 	tristate
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index b65868c963c9..0db0ffc1e552 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -222,6 +222,7 @@ snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-wm-hubs-objs := wm_hubs.o
 # Amp
+snd-soc-dio2125-objs := dio2125.o
 snd-soc-max9877-objs := max9877.o
 snd-soc-max98504-objs := max98504.o
 snd-soc-tpa6130a2-objs := tpa6130a2.o
@@ -450,6 +451,7 @@ obj-$(CONFIG_SND_SOC_WM_ADSP)	+= snd-soc-wm-adsp.o
 obj-$(CONFIG_SND_SOC_WM_HUBS)	+= snd-soc-wm-hubs.o
 
 # Amp
+obj-$(CONFIG_SND_SOC_DIO2125)	+= snd-soc-dio2125.o
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
 obj-$(CONFIG_SND_SOC_MAX98504)	+= snd-soc-max98504.o
 obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
diff --git a/sound/soc/codecs/dio2125.c b/sound/soc/codecs/dio2125.c
new file mode 100644
index 000000000000..015e310556d3
--- /dev/null
+++ b/sound/soc/codecs/dio2125.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <sound/soc.h>
+
+#define DRV_NAME "dio2125"
+
+struct dio2125 {
+	struct gpio_desc *gpiod_enable;
+};
+
+static int drv_event(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *control, int event)
+{
+	struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
+	struct dio2125 *priv = snd_soc_component_get_drvdata(c);
+	int val;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		val = 1;
+		break;
+	case SND_SOC_DAPM_PRE_PMD:
+		val = 0;
+		break;
+	default:
+		WARN(1, "Unexpected event");
+		return -EINVAL;
+	}
+
+	gpiod_set_value(priv->gpiod_enable, val);
+
+	return 0;
+}
+
+static const struct snd_soc_dapm_widget dio2125_dapm_widgets[] = {
+	SND_SOC_DAPM_INPUT("INL"),
+	SND_SOC_DAPM_INPUT("INR"),
+	SND_SOC_DAPM_OUT_DRV_E("DRV", SND_SOC_NOPM, 0, 0, NULL, 0, drv_event,
+			       (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)),
+	SND_SOC_DAPM_OUTPUT("OUTL"),
+	SND_SOC_DAPM_OUTPUT("OUTR"),
+};
+
+static const struct snd_soc_dapm_route dio2125_dapm_routes[] = {
+	{ "DRV", NULL, "INL" },
+	{ "DRV", NULL, "INR" },
+	{ "OUTL", NULL, "DRV" },
+	{ "OUTR", NULL, "DRV" },
+};
+
+static const struct snd_soc_component_driver dio2125_component_driver = {
+	.dapm_widgets		= dio2125_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(dio2125_dapm_widgets),
+	.dapm_routes		= dio2125_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(dio2125_dapm_routes),
+};
+
+static int dio2125_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct dio2125 *priv;
+	int err;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, priv);
+
+	priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(priv->gpiod_enable)) {
+		err = PTR_ERR(priv->gpiod_enable);
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get 'enable' gpio: %d", err);
+		return err;
+	}
+
+	return devm_snd_soc_register_component(dev, &dio2125_component_driver,
+					       NULL, 0);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id dio2125_ids[] = {
+	{ .compatible = "dioo,dio2125", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dio2125_ids);
+#endif
+
+static struct platform_driver dio2125_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.of_match_table = of_match_ptr(dio2125_ids),
+	},
+	.probe = dio2125_probe,
+};
+
+module_platform_driver(dio2125_driver);
+
+MODULE_DESCRIPTION("ASoC DIO2125 output driver");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL");
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
@ 2017-03-06 17:44   ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Kevin Hilman, alsa-devel, Neil Armstrong, linux-kernel, Jerome Brunet

The dio2125 is a stereo output driver with adjustable gain.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/codecs/Kconfig   |   5 ++
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/dio2125.c | 120 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
 create mode 100644 sound/soc/codecs/dio2125.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 7c7c2e96b836..09c187504e7c 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -69,6 +69,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_DA7219 if I2C
 	select SND_SOC_DA732X if I2C
 	select SND_SOC_DA9055 if I2C
+	select SND_SOC_DIO2125
 	select SND_SOC_DMIC
 	select SND_SOC_ES8328_SPI if SPI_MASTER
 	select SND_SOC_ES8328_I2C if I2C
@@ -517,6 +518,10 @@ config SND_SOC_DA732X
 config SND_SOC_DA9055
 	tristate
 
+config SND_SOC_DIO2125
+	tristate "Dioo DIO2125 Amplifier"
+	select GPIOLIB
+
 config SND_SOC_DMIC
 	tristate
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index b65868c963c9..0db0ffc1e552 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -222,6 +222,7 @@ snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-wm-hubs-objs := wm_hubs.o
 # Amp
+snd-soc-dio2125-objs := dio2125.o
 snd-soc-max9877-objs := max9877.o
 snd-soc-max98504-objs := max98504.o
 snd-soc-tpa6130a2-objs := tpa6130a2.o
@@ -450,6 +451,7 @@ obj-$(CONFIG_SND_SOC_WM_ADSP)	+= snd-soc-wm-adsp.o
 obj-$(CONFIG_SND_SOC_WM_HUBS)	+= snd-soc-wm-hubs.o
 
 # Amp
+obj-$(CONFIG_SND_SOC_DIO2125)	+= snd-soc-dio2125.o
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
 obj-$(CONFIG_SND_SOC_MAX98504)	+= snd-soc-max98504.o
 obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
diff --git a/sound/soc/codecs/dio2125.c b/sound/soc/codecs/dio2125.c
new file mode 100644
index 000000000000..015e310556d3
--- /dev/null
+++ b/sound/soc/codecs/dio2125.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <sound/soc.h>
+
+#define DRV_NAME "dio2125"
+
+struct dio2125 {
+	struct gpio_desc *gpiod_enable;
+};
+
+static int drv_event(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *control, int event)
+{
+	struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
+	struct dio2125 *priv = snd_soc_component_get_drvdata(c);
+	int val;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		val = 1;
+		break;
+	case SND_SOC_DAPM_PRE_PMD:
+		val = 0;
+		break;
+	default:
+		WARN(1, "Unexpected event");
+		return -EINVAL;
+	}
+
+	gpiod_set_value(priv->gpiod_enable, val);
+
+	return 0;
+}
+
+static const struct snd_soc_dapm_widget dio2125_dapm_widgets[] = {
+	SND_SOC_DAPM_INPUT("INL"),
+	SND_SOC_DAPM_INPUT("INR"),
+	SND_SOC_DAPM_OUT_DRV_E("DRV", SND_SOC_NOPM, 0, 0, NULL, 0, drv_event,
+			       (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)),
+	SND_SOC_DAPM_OUTPUT("OUTL"),
+	SND_SOC_DAPM_OUTPUT("OUTR"),
+};
+
+static const struct snd_soc_dapm_route dio2125_dapm_routes[] = {
+	{ "DRV", NULL, "INL" },
+	{ "DRV", NULL, "INR" },
+	{ "OUTL", NULL, "DRV" },
+	{ "OUTR", NULL, "DRV" },
+};
+
+static const struct snd_soc_component_driver dio2125_component_driver = {
+	.dapm_widgets		= dio2125_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(dio2125_dapm_widgets),
+	.dapm_routes		= dio2125_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(dio2125_dapm_routes),
+};
+
+static int dio2125_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct dio2125 *priv;
+	int err;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, priv);
+
+	priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(priv->gpiod_enable)) {
+		err = PTR_ERR(priv->gpiod_enable);
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get 'enable' gpio: %d", err);
+		return err;
+	}
+
+	return devm_snd_soc_register_component(dev, &dio2125_component_driver,
+					       NULL, 0);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id dio2125_ids[] = {
+	{ .compatible = "dioo,dio2125", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dio2125_ids);
+#endif
+
+static struct platform_driver dio2125_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.of_match_table = of_match_ptr(dio2125_ids),
+	},
+	.probe = dio2125_probe,
+};
+
+module_platform_driver(dio2125_driver);
+
+MODULE_DESCRIPTION("ASoC DIO2125 output driver");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL");
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/3] ASoC: dio2125: add dt-bindings
  2017-03-06 17:44 ` Jerome Brunet
@ 2017-03-06 17:44   ` Jerome Brunet
  -1 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Jerome Brunet, alsa-devel, devicetree, linux-kernel,
	Kevin Hilman, Neil Armstrong

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 Documentation/devicetree/bindings/sound/dioo,dio2125.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt

diff --git a/Documentation/devicetree/bindings/sound/dioo,dio2125.txt b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
new file mode 100644
index 000000000000..63dbfe0f11d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
@@ -0,0 +1,12 @@
+DIO2125 Audio Driver
+
+Required properties:
+- compatible : "dioo,dio2125"
+- enable-gpios : the gpio connected to the enable pin of the dio2125
+
+Example:
+
+amp: analog-amplifier {
+	compatible = "dioo,dio2125";
+	enable-gpios = <&gpio GPIOH_3 0>;
+};
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/3] ASoC: dio2125: add dt-bindings
@ 2017-03-06 17:44   ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-06 17:44 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	linux-kernel, Jerome Brunet

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 Documentation/devicetree/bindings/sound/dioo,dio2125.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt

diff --git a/Documentation/devicetree/bindings/sound/dioo,dio2125.txt b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
new file mode 100644
index 000000000000..63dbfe0f11d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
@@ -0,0 +1,12 @@
+DIO2125 Audio Driver
+
+Required properties:
+- compatible : "dioo,dio2125"
+- enable-gpios : the gpio connected to the enable pin of the dio2125
+
+Example:
+
+amp: analog-amplifier {
+	compatible = "dioo,dio2125";
+	enable-gpios = <&gpio GPIOH_3 0>;
+};
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
  2017-03-06 17:44   ` Jerome Brunet
@ 2017-03-07 12:36     ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:36 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Liam Girdwood, alsa-devel, linux-kernel, Kevin Hilman, Neil Armstrong

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:

> +	gpiod_set_value(priv->gpiod_enable, val);

You should use gpiod_set_value_cansleep() so that the driver can work
with all GPIOs unless there's a specific need to have GPIOs you can
control in interrupt (which should be the case for anything you're using
for DAPM control).

Please submit an incremental patch fixing this.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
@ 2017-03-07 12:36     ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:36 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Kevin Hilman, alsa-devel, Neil Armstrong, Liam Girdwood, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 390 bytes --]

On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:

> +	gpiod_set_value(priv->gpiod_enable, val);

You should use gpiod_set_value_cansleep() so that the driver can work
with all GPIOs unless there's a specific need to have GPIOs you can
control in interrupt (which should be the case for anything you're using
for DAPM control).

Please submit an incremental patch fixing this.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Applied "ASoC: dio2125: add dt-bindings" to the asoc tree
  2017-03-06 17:44   ` Jerome Brunet
@ 2017-03-07 12:57     ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Mark Brown, Mark Brown, Liam Girdwood, devicetree, alsa-devel,
	Neil Armstrong, Kevin Hilman, linux-kernel, alsa-devel

The patch

   ASoC: dio2125: add dt-bindings

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1e03580b3a7213292fae9a6677edfaa83843fa4e Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 6 Mar 2017 18:44:51 +0100
Subject: [PATCH] ASoC: dio2125: add dt-bindings

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/sound/dioo,dio2125.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt

diff --git a/Documentation/devicetree/bindings/sound/dioo,dio2125.txt b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
new file mode 100644
index 000000000000..63dbfe0f11d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
@@ -0,0 +1,12 @@
+DIO2125 Audio Driver
+
+Required properties:
+- compatible : "dioo,dio2125"
+- enable-gpios : the gpio connected to the enable pin of the dio2125
+
+Example:
+
+amp: analog-amplifier {
+	compatible = "dioo,dio2125";
+	enable-gpios = <&gpio GPIOH_3 0>;
+};
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Applied "ASoC: dio2125: add dt-bindings" to the asoc tree
@ 2017-03-07 12:57     ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	Liam Girdwood, linux-kernel, Mark Brown

The patch

   ASoC: dio2125: add dt-bindings

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1e03580b3a7213292fae9a6677edfaa83843fa4e Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 6 Mar 2017 18:44:51 +0100
Subject: [PATCH] ASoC: dio2125: add dt-bindings

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/sound/dioo,dio2125.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/dioo,dio2125.txt

diff --git a/Documentation/devicetree/bindings/sound/dioo,dio2125.txt b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
new file mode 100644
index 000000000000..63dbfe0f11d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/dioo,dio2125.txt
@@ -0,0 +1,12 @@
+DIO2125 Audio Driver
+
+Required properties:
+- compatible : "dioo,dio2125"
+- enable-gpios : the gpio connected to the enable pin of the dio2125
+
+Example:
+
+amp: analog-amplifier {
+	compatible = "dioo,dio2125";
+	enable-gpios = <&gpio GPIOH_3 0>;
+};
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Applied "ASoC: dio2125: add dio2125 amp driver" to the asoc tree
  2017-03-06 17:44   ` Jerome Brunet
@ 2017-03-07 12:57     ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Mark Brown, Mark Brown, Liam Girdwood, Kevin Hilman, alsa-devel,
	Neil Armstrong, linux-kernel, alsa-devel

The patch

   ASoC: dio2125: add dio2125 amp driver

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 85825d5e886912655f6c1896d76035ce1316254b Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 6 Mar 2017 18:44:50 +0100
Subject: [PATCH] ASoC: dio2125: add dio2125 amp driver

The dio2125 is a stereo output driver with adjustable gain.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/Kconfig   |   5 ++
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/dio2125.c | 120 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
 create mode 100644 sound/soc/codecs/dio2125.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e49e9da7f1f6..5e5fcb660ca3 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -69,6 +69,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_DA7219 if I2C
 	select SND_SOC_DA732X if I2C
 	select SND_SOC_DA9055 if I2C
+	select SND_SOC_DIO2125
 	select SND_SOC_DMIC
 	select SND_SOC_ES8328_SPI if SPI_MASTER
 	select SND_SOC_ES8328_I2C if I2C
@@ -516,6 +517,10 @@ config SND_SOC_DA732X
 config SND_SOC_DA9055
 	tristate
 
+config SND_SOC_DIO2125
+	tristate "Dioo DIO2125 Amplifier"
+	select GPIOLIB
+
 config SND_SOC_DMIC
 	tristate
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 1796cb987e71..04894fa8891b 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -221,6 +221,7 @@ snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-wm-hubs-objs := wm_hubs.o
 # Amp
+snd-soc-dio2125-objs := dio2125.o
 snd-soc-max9877-objs := max9877.o
 snd-soc-max98504-objs := max98504.o
 snd-soc-tpa6130a2-objs := tpa6130a2.o
@@ -448,6 +449,7 @@ obj-$(CONFIG_SND_SOC_WM_ADSP)	+= snd-soc-wm-adsp.o
 obj-$(CONFIG_SND_SOC_WM_HUBS)	+= snd-soc-wm-hubs.o
 
 # Amp
+obj-$(CONFIG_SND_SOC_DIO2125)	+= snd-soc-dio2125.o
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
 obj-$(CONFIG_SND_SOC_MAX98504)	+= snd-soc-max98504.o
 obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
diff --git a/sound/soc/codecs/dio2125.c b/sound/soc/codecs/dio2125.c
new file mode 100644
index 000000000000..015e310556d3
--- /dev/null
+++ b/sound/soc/codecs/dio2125.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <sound/soc.h>
+
+#define DRV_NAME "dio2125"
+
+struct dio2125 {
+	struct gpio_desc *gpiod_enable;
+};
+
+static int drv_event(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *control, int event)
+{
+	struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
+	struct dio2125 *priv = snd_soc_component_get_drvdata(c);
+	int val;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		val = 1;
+		break;
+	case SND_SOC_DAPM_PRE_PMD:
+		val = 0;
+		break;
+	default:
+		WARN(1, "Unexpected event");
+		return -EINVAL;
+	}
+
+	gpiod_set_value(priv->gpiod_enable, val);
+
+	return 0;
+}
+
+static const struct snd_soc_dapm_widget dio2125_dapm_widgets[] = {
+	SND_SOC_DAPM_INPUT("INL"),
+	SND_SOC_DAPM_INPUT("INR"),
+	SND_SOC_DAPM_OUT_DRV_E("DRV", SND_SOC_NOPM, 0, 0, NULL, 0, drv_event,
+			       (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)),
+	SND_SOC_DAPM_OUTPUT("OUTL"),
+	SND_SOC_DAPM_OUTPUT("OUTR"),
+};
+
+static const struct snd_soc_dapm_route dio2125_dapm_routes[] = {
+	{ "DRV", NULL, "INL" },
+	{ "DRV", NULL, "INR" },
+	{ "OUTL", NULL, "DRV" },
+	{ "OUTR", NULL, "DRV" },
+};
+
+static const struct snd_soc_component_driver dio2125_component_driver = {
+	.dapm_widgets		= dio2125_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(dio2125_dapm_widgets),
+	.dapm_routes		= dio2125_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(dio2125_dapm_routes),
+};
+
+static int dio2125_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct dio2125 *priv;
+	int err;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, priv);
+
+	priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(priv->gpiod_enable)) {
+		err = PTR_ERR(priv->gpiod_enable);
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get 'enable' gpio: %d", err);
+		return err;
+	}
+
+	return devm_snd_soc_register_component(dev, &dio2125_component_driver,
+					       NULL, 0);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id dio2125_ids[] = {
+	{ .compatible = "dioo,dio2125", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dio2125_ids);
+#endif
+
+static struct platform_driver dio2125_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.of_match_table = of_match_ptr(dio2125_ids),
+	},
+	.probe = dio2125_probe,
+};
+
+module_platform_driver(dio2125_driver);
+
+MODULE_DESCRIPTION("ASoC DIO2125 output driver");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL");
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Applied "ASoC: dio2125: add dio2125 amp driver" to the asoc tree
@ 2017-03-07 12:57     ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 12:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: alsa-devel, Neil Armstrong, Kevin Hilman, Liam Girdwood,
	linux-kernel, Mark Brown

The patch

   ASoC: dio2125: add dio2125 amp driver

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 85825d5e886912655f6c1896d76035ce1316254b Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 6 Mar 2017 18:44:50 +0100
Subject: [PATCH] ASoC: dio2125: add dio2125 amp driver

The dio2125 is a stereo output driver with adjustable gain.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/Kconfig   |   5 ++
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/dio2125.c | 120 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
 create mode 100644 sound/soc/codecs/dio2125.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e49e9da7f1f6..5e5fcb660ca3 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -69,6 +69,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_DA7219 if I2C
 	select SND_SOC_DA732X if I2C
 	select SND_SOC_DA9055 if I2C
+	select SND_SOC_DIO2125
 	select SND_SOC_DMIC
 	select SND_SOC_ES8328_SPI if SPI_MASTER
 	select SND_SOC_ES8328_I2C if I2C
@@ -516,6 +517,10 @@ config SND_SOC_DA732X
 config SND_SOC_DA9055
 	tristate
 
+config SND_SOC_DIO2125
+	tristate "Dioo DIO2125 Amplifier"
+	select GPIOLIB
+
 config SND_SOC_DMIC
 	tristate
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 1796cb987e71..04894fa8891b 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -221,6 +221,7 @@ snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-wm-hubs-objs := wm_hubs.o
 # Amp
+snd-soc-dio2125-objs := dio2125.o
 snd-soc-max9877-objs := max9877.o
 snd-soc-max98504-objs := max98504.o
 snd-soc-tpa6130a2-objs := tpa6130a2.o
@@ -448,6 +449,7 @@ obj-$(CONFIG_SND_SOC_WM_ADSP)	+= snd-soc-wm-adsp.o
 obj-$(CONFIG_SND_SOC_WM_HUBS)	+= snd-soc-wm-hubs.o
 
 # Amp
+obj-$(CONFIG_SND_SOC_DIO2125)	+= snd-soc-dio2125.o
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
 obj-$(CONFIG_SND_SOC_MAX98504)	+= snd-soc-max98504.o
 obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
diff --git a/sound/soc/codecs/dio2125.c b/sound/soc/codecs/dio2125.c
new file mode 100644
index 000000000000..015e310556d3
--- /dev/null
+++ b/sound/soc/codecs/dio2125.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <sound/soc.h>
+
+#define DRV_NAME "dio2125"
+
+struct dio2125 {
+	struct gpio_desc *gpiod_enable;
+};
+
+static int drv_event(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *control, int event)
+{
+	struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
+	struct dio2125 *priv = snd_soc_component_get_drvdata(c);
+	int val;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		val = 1;
+		break;
+	case SND_SOC_DAPM_PRE_PMD:
+		val = 0;
+		break;
+	default:
+		WARN(1, "Unexpected event");
+		return -EINVAL;
+	}
+
+	gpiod_set_value(priv->gpiod_enable, val);
+
+	return 0;
+}
+
+static const struct snd_soc_dapm_widget dio2125_dapm_widgets[] = {
+	SND_SOC_DAPM_INPUT("INL"),
+	SND_SOC_DAPM_INPUT("INR"),
+	SND_SOC_DAPM_OUT_DRV_E("DRV", SND_SOC_NOPM, 0, 0, NULL, 0, drv_event,
+			       (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)),
+	SND_SOC_DAPM_OUTPUT("OUTL"),
+	SND_SOC_DAPM_OUTPUT("OUTR"),
+};
+
+static const struct snd_soc_dapm_route dio2125_dapm_routes[] = {
+	{ "DRV", NULL, "INL" },
+	{ "DRV", NULL, "INR" },
+	{ "OUTL", NULL, "DRV" },
+	{ "OUTR", NULL, "DRV" },
+};
+
+static const struct snd_soc_component_driver dio2125_component_driver = {
+	.dapm_widgets		= dio2125_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(dio2125_dapm_widgets),
+	.dapm_routes		= dio2125_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(dio2125_dapm_routes),
+};
+
+static int dio2125_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct dio2125 *priv;
+	int err;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, priv);
+
+	priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(priv->gpiod_enable)) {
+		err = PTR_ERR(priv->gpiod_enable);
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get 'enable' gpio: %d", err);
+		return err;
+	}
+
+	return devm_snd_soc_register_component(dev, &dio2125_component_driver,
+					       NULL, 0);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id dio2125_ids[] = {
+	{ .compatible = "dioo,dio2125", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dio2125_ids);
+#endif
+
+static struct platform_driver dio2125_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.of_match_table = of_match_ptr(dio2125_ids),
+	},
+	.probe = dio2125_probe,
+};
+
+module_platform_driver(dio2125_driver);
+
+MODULE_DESCRIPTION("ASoC DIO2125 output driver");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL");
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
  2017-03-07 12:36     ` Mark Brown
@ 2017-03-07 13:13       ` Jerome Brunet
  -1 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-07 13:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, alsa-devel, linux-kernel, Kevin Hilman, Neil Armstrong

On Tue, 2017-03-07 at 13:36 +0100, Mark Brown wrote:
> On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:
> 
> > +	gpiod_set_value(priv->gpiod_enable, val);
> 
> You should use gpiod_set_value_cansleep() so that the driver can work
> with all GPIOs unless there's a specific need to have GPIOs you can
> control in interrupt (which should be the case for anything you're
> using
> for DAPM control).

Indeed, Thanks for pointing this out.
I have question regarding this DAPM control.
Here, I put the control in DAPM so it can help with the pop noise
reduction, but I think it would be nice if the user could force the
mute if he wants to.

Would it be OK to add a user control and some logic so the output is
enabled only if DAPM and the user agree it should ?

> 
> Please submit an incremental patch fixing this.

Done

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
@ 2017-03-07 13:13       ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-07 13:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kevin Hilman, alsa-devel, Neil Armstrong, Liam Girdwood, linux-kernel

On Tue, 2017-03-07 at 13:36 +0100, Mark Brown wrote:
> On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:
> 
> > +	gpiod_set_value(priv->gpiod_enable, val);
> 
> You should use gpiod_set_value_cansleep() so that the driver can work
> with all GPIOs unless there's a specific need to have GPIOs you can
> control in interrupt (which should be the case for anything you're
> using
> for DAPM control).

Indeed, Thanks for pointing this out.
I have question regarding this DAPM control.
Here, I put the control in DAPM so it can help with the pop noise
reduction, but I think it would be nice if the user could force the
mute if he wants to.

Would it be OK to add a user control and some logic so the output is
enabled only if DAPM and the user agree it should ?

> 
> Please submit an incremental patch fixing this.

Done

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [alsa-devel] [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
  2017-03-07 13:13       ` Jerome Brunet
@ 2017-03-07 13:47         ` Lars-Peter Clausen
  -1 siblings, 0 replies; 26+ messages in thread
From: Lars-Peter Clausen @ 2017-03-07 13:47 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown
  Cc: Kevin Hilman, alsa-devel, Neil Armstrong, Liam Girdwood, linux-kernel

On 03/07/2017 02:13 PM, Jerome Brunet wrote:
> On Tue, 2017-03-07 at 13:36 +0100, Mark Brown wrote:
>> On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:
>>
>>> +	gpiod_set_value(priv->gpiod_enable, val);
>>
>> You should use gpiod_set_value_cansleep() so that the driver can work
>> with all GPIOs unless there's a specific need to have GPIOs you can
>> control in interrupt (which should be the case for anything you're
>> using
>> for DAPM control).
> 
> Indeed, Thanks for pointing this out.
> I have question regarding this DAPM control.
> Here, I put the control in DAPM so it can help with the pop noise
> reduction, but I think it would be nice if the user could force the
> mute if he wants to.
> 
> Would it be OK to add a user control and some logic so the output is
> enabled only if DAPM and the user agree it should ?

You could put a DAPM switch on the path. This way DAPM will take care of
muting the output if the user toggles the control and other DAPM widgets
connected to the output of the AMP will also be aware that it is off.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
@ 2017-03-07 13:47         ` Lars-Peter Clausen
  0 siblings, 0 replies; 26+ messages in thread
From: Lars-Peter Clausen @ 2017-03-07 13:47 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown
  Cc: Kevin Hilman, alsa-devel, Liam Girdwood, linux-kernel, Neil Armstrong

On 03/07/2017 02:13 PM, Jerome Brunet wrote:
> On Tue, 2017-03-07 at 13:36 +0100, Mark Brown wrote:
>> On Mon, Mar 06, 2017 at 06:44:50PM +0100, Jerome Brunet wrote:
>>
>>> +	gpiod_set_value(priv->gpiod_enable, val);
>>
>> You should use gpiod_set_value_cansleep() so that the driver can work
>> with all GPIOs unless there's a specific need to have GPIOs you can
>> control in interrupt (which should be the case for anything you're
>> using
>> for DAPM control).
> 
> Indeed, Thanks for pointing this out.
> I have question regarding this DAPM control.
> Here, I put the control in DAPM so it can help with the pop noise
> reduction, but I think it would be nice if the user could force the
> mute if he wants to.
> 
> Would it be OK to add a user control and some logic so the output is
> enabled only if DAPM and the user agree it should ?

You could put a DAPM switch on the path. This way DAPM will take care of
muting the output if the user toggles the control and other DAPM widgets
connected to the output of the AMP will also be aware that it is off.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
  2017-03-07 13:13       ` Jerome Brunet
@ 2017-03-07 13:55         ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 13:55 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Liam Girdwood, alsa-devel, linux-kernel, Kevin Hilman, Neil Armstrong

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

On Tue, Mar 07, 2017 at 02:13:20PM +0100, Jerome Brunet wrote:

> Indeed, Thanks for pointing this out.
> I have question regarding this DAPM control.
> Here, I put the control in DAPM so it can help with the pop noise
> reduction, but I think it would be nice if the user could force the
> mute if he wants to.

> Would it be OK to add a user control and some logic so the output is
> enabled only if DAPM and the user agree it should ?

You should be able to do something with an autodisable control, or
extend the mechanism to support this.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver
@ 2017-03-07 13:55         ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-07 13:55 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Kevin Hilman, alsa-devel, Neil Armstrong, Liam Girdwood, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 544 bytes --]

On Tue, Mar 07, 2017 at 02:13:20PM +0100, Jerome Brunet wrote:

> Indeed, Thanks for pointing this out.
> I have question regarding this DAPM control.
> Here, I put the control in DAPM so it can help with the pop noise
> reduction, but I think it would be nice if the user could force the
> mute if he wants to.

> Would it be OK to add a user control and some logic so the output is
> enabled only if DAPM and the user agree it should ?

You should be able to do something with an autodisable control, or
extend the mechanism to support this.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
  2017-03-06 17:44 ` Jerome Brunet
@ 2017-03-07 16:26   ` Jerome Brunet
  -1 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-07 16:26 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, devicetree, linux-kernel, Kevin Hilman, Neil Armstrong

Hi Mark,

In this series, you applied patch 2 and 3 but not patch 1.
(so the dioo prefix is used but not documented)

Is it on purpose ?
The patch does not have the "ASoC" prefix, this maybe why it was
missed. Since, the file does no belong to alsa, I wasn't sure whether
to put the prefix or not.

Regards

Jerome

On Mon, 2017-03-06 at 18:44 +0100, Jerome Brunet wrote:
> This patchset adds the support for the dio2125 from Dioo
> microcircuits.
> The dio2125 is audio driver with adjustable gain. The EN pad allows
> to
> enable or disable the outputs of the driver.
> 
> The link to the datasheet is not provided as part of the commit. It
> is not
> provided the manufacturer and it is doubtful it will still be
> available a
> few years from now. Still provided here in case anyone is interested
> [0].
> 
> This patchset has been tested on Amlogic's meson-gxbb-p200 board.
> 
> [0]: http://www.winine.com/Line%E9%9F%B3/DIO2125XM10%20V1.0.pdf
> 
> Jerome Brunet (3):
>   dt-bindings: add vendor prefix for Dioo
>   ASoC: dio2125: add dio2125 amp driver
>   ASoC: dio2125: add dt-bindings
> 
>  .../devicetree/bindings/sound/dioo,dio2125.txt     |  12 +++
>  .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>  sound/soc/codecs/Kconfig                           |   5 +
>  sound/soc/codecs/Makefile                          |   2 +
>  sound/soc/codecs/dio2125.c                         | 120
> +++++++++++++++++++++
>  5 files changed, 140 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/sound/dioo,dio2125.txt
>  create mode 100644 sound/soc/codecs/dio2125.c
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
@ 2017-03-07 16:26   ` Jerome Brunet
  0 siblings, 0 replies; 26+ messages in thread
From: Jerome Brunet @ 2017-03-07 16:26 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Neil Armstrong, linux-kernel, Kevin Hilman

Hi Mark,

In this series, you applied patch 2 and 3 but not patch 1.
(so the dioo prefix is used but not documented)

Is it on purpose ?
The patch does not have the "ASoC" prefix, this maybe why it was
missed. Since, the file does no belong to alsa, I wasn't sure whether
to put the prefix or not.

Regards

Jerome

On Mon, 2017-03-06 at 18:44 +0100, Jerome Brunet wrote:
> This patchset adds the support for the dio2125 from Dioo
> microcircuits.
> The dio2125 is audio driver with adjustable gain. The EN pad allows
> to
> enable or disable the outputs of the driver.
> 
> The link to the datasheet is not provided as part of the commit. It
> is not
> provided the manufacturer and it is doubtful it will still be
> available a
> few years from now. Still provided here in case anyone is interested
> [0].
> 
> This patchset has been tested on Amlogic's meson-gxbb-p200 board.
> 
> [0]: http://www.winine.com/Line%E9%9F%B3/DIO2125XM10%20V1.0.pdf
> 
> Jerome Brunet (3):
>   dt-bindings: add vendor prefix for Dioo
>   ASoC: dio2125: add dio2125 amp driver
>   ASoC: dio2125: add dt-bindings
> 
>  .../devicetree/bindings/sound/dioo,dio2125.txt     |  12 +++
>  .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>  sound/soc/codecs/Kconfig                           |   5 +
>  sound/soc/codecs/Makefile                          |   2 +
>  sound/soc/codecs/dio2125.c                         | 120
> +++++++++++++++++++++
>  5 files changed, 140 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/sound/dioo,dio2125.txt
>  create mode 100644 sound/soc/codecs/dio2125.c
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
  2017-03-07 16:26   ` Jerome Brunet
@ 2017-03-08 10:00     ` Mark Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-08 10:00 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Liam Girdwood, alsa-devel, devicetree, linux-kernel,
	Kevin Hilman, Neil Armstrong

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

On Tue, Mar 07, 2017 at 05:26:17PM +0100, Jerome Brunet wrote:
> Hi Mark,

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> In this series, you applied patch 2 and 3 but not patch 1.
> (so the dioo prefix is used but not documented)

> Is it on purpose ?
> The patch does not have the "ASoC" prefix, this maybe why it was
> missed. Since, the file does no belong to alsa, I wasn't sure whether
> to put the prefix or not.

This is a generic DT patch, not part of the bindings, so I'd expect the
DT maintainers to take it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
@ 2017-03-08 10:00     ` Mark Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Brown @ 2017-03-08 10:00 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	Liam Girdwood, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 716 bytes --]

On Tue, Mar 07, 2017 at 05:26:17PM +0100, Jerome Brunet wrote:
> Hi Mark,

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> In this series, you applied patch 2 and 3 but not patch 1.
> (so the dioo prefix is used but not documented)

> Is it on purpose ?
> The patch does not have the "ASoC" prefix, this maybe why it was
> missed. Since, the file does no belong to alsa, I wasn't sure whether
> to put the prefix or not.

This is a generic DT patch, not part of the bindings, so I'd expect the
DT maintainers to take it.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
  2017-03-08 10:00     ` Mark Brown
@ 2017-03-15 17:07       ` Rob Herring
  -1 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2017-03-15 17:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jerome Brunet, Liam Girdwood, alsa-devel, devicetree,
	linux-kernel, Kevin Hilman, Neil Armstrong

On Wed, Mar 08, 2017 at 11:00:20AM +0100, Mark Brown wrote:
> On Tue, Mar 07, 2017 at 05:26:17PM +0100, Jerome Brunet wrote:
> > Hi Mark,
> 
> Please don't top post, reply in line with needed context.  This allows
> readers to readily follow the flow of conversation and understand what
> you are talking about and also helps ensure that everything in the
> discussion is being addressed.
> 
> > In this series, you applied patch 2 and 3 but not patch 1.
> > (so the dioo prefix is used but not documented)
> 
> > Is it on purpose ?
> > The patch does not have the "ASoC" prefix, this maybe why it was
> > missed. Since, the file does no belong to alsa, I wasn't sure whether
> > to put the prefix or not.
> 
> This is a generic DT patch, not part of the bindings, so I'd expect the
> DT maintainers to take it.

I usually don't if it's part of a series, but I have applied it.

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/3] ASoC: add dio2125 amplifier support
@ 2017-03-15 17:07       ` Rob Herring
  0 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2017-03-15 17:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, Neil Armstrong, Kevin Hilman,
	Liam Girdwood, linux-kernel, Jerome Brunet

On Wed, Mar 08, 2017 at 11:00:20AM +0100, Mark Brown wrote:
> On Tue, Mar 07, 2017 at 05:26:17PM +0100, Jerome Brunet wrote:
> > Hi Mark,
> 
> Please don't top post, reply in line with needed context.  This allows
> readers to readily follow the flow of conversation and understand what
> you are talking about and also helps ensure that everything in the
> discussion is being addressed.
> 
> > In this series, you applied patch 2 and 3 but not patch 1.
> > (so the dioo prefix is used but not documented)
> 
> > Is it on purpose ?
> > The patch does not have the "ASoC" prefix, this maybe why it was
> > missed. Since, the file does no belong to alsa, I wasn't sure whether
> > to put the prefix or not.
> 
> This is a generic DT patch, not part of the bindings, so I'd expect the
> DT maintainers to take it.

I usually don't if it's part of a series, but I have applied it.

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-03-15 17:08 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 17:44 [PATCH 0/3] ASoC: add dio2125 amplifier support Jerome Brunet
2017-03-06 17:44 ` Jerome Brunet
2017-03-06 17:44 ` [PATCH 1/3] dt-bindings: add vendor prefix for Dioo Jerome Brunet
2017-03-06 17:44   ` Jerome Brunet
2017-03-06 17:44 ` [PATCH 2/3] ASoC: dio2125: add dio2125 amp driver Jerome Brunet
2017-03-06 17:44   ` Jerome Brunet
2017-03-07 12:36   ` Mark Brown
2017-03-07 12:36     ` Mark Brown
2017-03-07 13:13     ` Jerome Brunet
2017-03-07 13:13       ` Jerome Brunet
2017-03-07 13:47       ` [alsa-devel] " Lars-Peter Clausen
2017-03-07 13:47         ` Lars-Peter Clausen
2017-03-07 13:55       ` Mark Brown
2017-03-07 13:55         ` Mark Brown
2017-03-07 12:57   ` Applied "ASoC: dio2125: add dio2125 amp driver" to the asoc tree Mark Brown
2017-03-07 12:57     ` Mark Brown
2017-03-06 17:44 ` [PATCH 3/3] ASoC: dio2125: add dt-bindings Jerome Brunet
2017-03-06 17:44   ` Jerome Brunet
2017-03-07 12:57   ` Applied "ASoC: dio2125: add dt-bindings" to the asoc tree Mark Brown
2017-03-07 12:57     ` Mark Brown
2017-03-07 16:26 ` [PATCH 0/3] ASoC: add dio2125 amplifier support Jerome Brunet
2017-03-07 16:26   ` Jerome Brunet
2017-03-08 10:00   ` Mark Brown
2017-03-08 10:00     ` Mark Brown
2017-03-15 17:07     ` Rob Herring
2017-03-15 17:07       ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.