All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC
@ 2018-10-03 19:34 Daniel Mack
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Daniel Mack @ 2018-10-03 19:34 UTC (permalink / raw)
  To: broonie; +Cc: tiwai, devicetree, alsa-devel, Daniel Mack

Add a device tree documentation file for the wm8782 stereo DAC to describe
the regulator handles.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 .../devicetree/bindings/sound/wm8782.txt        | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8782.txt

diff --git a/Documentation/devicetree/bindings/sound/wm8782.txt b/Documentation/devicetree/bindings/sound/wm8782.txt
new file mode 100644
index 000000000000..256cdec6ec4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/wm8782.txt
@@ -0,0 +1,17 @@
+WM8782 stereo ADC
+
+This device does not have any control interface or reset pins.
+
+Required properties:
+
+ - compatible  : "wlf,wm8782"
+ - Vdda-supply : phandle to a regulator for the analog power supply (2.7V - 5.5V)
+ - Vdd-supply  : phandle to a regulator for the digital power supply (2.7V - 3.6V)
+
+Example:
+
+wm8782: stereo-adc {
+	compatible = "wlf,wm8782";
+	Vdda-supply = <&vdda_supply>;
+	Vdd-supply = <&vdd_supply>;
+};
-- 
2.17.1

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

* [PATCH 2/2] ASoC: wm8782: add support for regulators
  2018-10-03 19:34 [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Daniel Mack
@ 2018-10-03 19:34 ` Daniel Mack
  2018-10-05 11:44   ` Mark Brown
                     ` (2 more replies)
  2018-10-08  9:33 ` [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Charles Keepax
  2018-10-08 13:57 ` Applied "ASoC: Add device tree documentation file for wm8782 stereo DAC" to the asoc tree Mark Brown
  2 siblings, 3 replies; 7+ messages in thread
From: Daniel Mack @ 2018-10-03 19:34 UTC (permalink / raw)
  To: broonie; +Cc: tiwai, devicetree, alsa-devel, Daniel Mack

Lookup regulators for Vdd and Vdda during probe, and enable them when the
component is linked.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 sound/soc/codecs/wm8782.c | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
index 317db9a149a7..cf2cdbece122 100644
--- a/sound/soc/codecs/wm8782.c
+++ b/sound/soc/codecs/wm8782.c
@@ -20,6 +20,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
+#include <linux/regulator/consumer.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -50,7 +51,51 @@ static struct snd_soc_dai_driver wm8782_dai = {
 	},
 };
 
+/* regulator power supply names */
+static const char *supply_names[] = {
+	"Vdda", /* analog supply, 2.7V - 3.6V */
+	"Vdd",  /* digital supply, 2.7V - 5.5V */
+};
+
+struct wm8782_priv {
+	struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
+};
+
+static int wm8782_soc_probe(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+
+static void wm8782_soc_remove(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+
+#ifdef CONFIG_PM
+static int wm8782_soc_suspend(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
+	return 0;
+}
+
+static int wm8782_soc_resume(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+#else
+#define wm8782_soc_suspend      NULL
+#define wm8782_soc_resume       NULL
+#endif /* CONFIG_PM */
+
 static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
+	.probe			= wm8782_soc_probe,
+	.remove			= wm8782_soc_remove,
+	.suspend		= wm8782_soc_suspend,
+	.resume			= wm8782_soc_resume,
 	.dapm_widgets		= wm8782_dapm_widgets,
 	.num_dapm_widgets	= ARRAY_SIZE(wm8782_dapm_widgets),
 	.dapm_routes		= wm8782_dapm_routes,
@@ -63,6 +108,24 @@ static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
 
 static int wm8782_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
+	struct wm8782_priv *priv;
+	int ret, i;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	dev_set_drvdata(dev, priv);
+
+	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
+		priv->supplies[i].supply = supply_names[i];
+
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
+				      priv->supplies);
+	if (ret < 0)
+		return ret;
+
 	return devm_snd_soc_register_component(&pdev->dev,
 			&soc_component_dev_wm8782, &wm8782_dai, 1);
 }
-- 
2.17.1

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

* Re: [PATCH 2/2] ASoC: wm8782: add support for regulators
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
@ 2018-10-05 11:44   ` Mark Brown
  2018-10-08  9:48   ` Charles Keepax
  2018-10-08 13:57   ` Applied "ASoC: wm8782: add support for regulators" to the asoc tree Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2018-10-05 11:44 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, devicetree, alsa-devel, patches


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

On Wed, Oct 03, 2018 at 09:34:36PM +0200, Daniel Mack wrote:
> Lookup regulators for Vdd and Vdda during probe, and enable them when the

Copying in the Cirrus people...

As documented in SubmittingPatches please send patches to the 
maintainers for the code you would like to change.  The normal kernel
workflow is that people apply patches from their inboxes, if they aren't
copied they are likely to not see the patch at all and it is much more
difficult to apply patches.

> component is linked.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  sound/soc/codecs/wm8782.c | 63 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
> 
> diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
> index 317db9a149a7..cf2cdbece122 100644
> --- a/sound/soc/codecs/wm8782.c
> +++ b/sound/soc/codecs/wm8782.c
> @@ -20,6 +20,7 @@
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/device.h>
> +#include <linux/regulator/consumer.h>
>  #include <sound/core.h>
>  #include <sound/pcm.h>
>  #include <sound/ac97_codec.h>
> @@ -50,7 +51,51 @@ static struct snd_soc_dai_driver wm8782_dai = {
>  	},
>  };
>  
> +/* regulator power supply names */
> +static const char *supply_names[] = {
> +	"Vdda", /* analog supply, 2.7V - 3.6V */
> +	"Vdd",  /* digital supply, 2.7V - 5.5V */
> +};
> +
> +struct wm8782_priv {
> +	struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
> +};
> +
> +static int wm8782_soc_probe(struct snd_soc_component *component)
> +{
> +	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
> +	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
> +}
> +
> +static void wm8782_soc_remove(struct snd_soc_component *component)
> +{
> +	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
> +	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
> +}
> +
> +#ifdef CONFIG_PM
> +static int wm8782_soc_suspend(struct snd_soc_component *component)
> +{
> +	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
> +	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
> +	return 0;
> +}
> +
> +static int wm8782_soc_resume(struct snd_soc_component *component)
> +{
> +	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
> +	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
> +}
> +#else
> +#define wm8782_soc_suspend      NULL
> +#define wm8782_soc_resume       NULL
> +#endif /* CONFIG_PM */
> +
>  static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
> +	.probe			= wm8782_soc_probe,
> +	.remove			= wm8782_soc_remove,
> +	.suspend		= wm8782_soc_suspend,
> +	.resume			= wm8782_soc_resume,
>  	.dapm_widgets		= wm8782_dapm_widgets,
>  	.num_dapm_widgets	= ARRAY_SIZE(wm8782_dapm_widgets),
>  	.dapm_routes		= wm8782_dapm_routes,
> @@ -63,6 +108,24 @@ static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
>  
>  static int wm8782_probe(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
> +	struct wm8782_priv *priv;
> +	int ret, i;
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	dev_set_drvdata(dev, priv);
> +
> +	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
> +		priv->supplies[i].supply = supply_names[i];
> +
> +	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
> +				      priv->supplies);
> +	if (ret < 0)
> +		return ret;
> +
>  	return devm_snd_soc_register_component(&pdev->dev,
>  			&soc_component_dev_wm8782, &wm8782_dai, 1);
>  }
> -- 
> 2.17.1
> 

[-- 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] 7+ messages in thread

* Re: [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC
  2018-10-03 19:34 [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Daniel Mack
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
@ 2018-10-08  9:33 ` Charles Keepax
  2018-10-08 13:57 ` Applied "ASoC: Add device tree documentation file for wm8782 stereo DAC" to the asoc tree Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2018-10-08  9:33 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, devicetree, alsa-devel, broonie

On Wed, Oct 03, 2018 at 09:34:35PM +0200, Daniel Mack wrote:
> Add a device tree documentation file for the wm8782 stereo DAC to describe
> the regulator handles.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH 2/2] ASoC: wm8782: add support for regulators
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
  2018-10-05 11:44   ` Mark Brown
@ 2018-10-08  9:48   ` Charles Keepax
  2018-10-08 13:57   ` Applied "ASoC: wm8782: add support for regulators" to the asoc tree Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2018-10-08  9:48 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, devicetree, alsa-devel, broonie

On Wed, Oct 03, 2018 at 09:34:36PM +0200, Daniel Mack wrote:
> Lookup regulators for Vdd and Vdda during probe, and enable them when the
> component is linked.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Applied "ASoC: wm8782: add support for regulators" to the asoc tree
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
  2018-10-05 11:44   ` Mark Brown
  2018-10-08  9:48   ` Charles Keepax
@ 2018-10-08 13:57   ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2018-10-08 13:57 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, devicetree, alsa-devel, broonie

The patch

   ASoC: wm8782: add support for regulators

has been applied to the asoc tree at

   https://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 7454a21c13f7ce9bf1a4f9b639039b78462cec09 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@zonque.org>
Date: Wed, 3 Oct 2018 21:34:36 +0200
Subject: [PATCH] ASoC: wm8782: add support for regulators

Lookup regulators for Vdd and Vdda during probe, and enable them when the
component is linked.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/wm8782.c | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
index 317db9a149a7..cf2cdbece122 100644
--- a/sound/soc/codecs/wm8782.c
+++ b/sound/soc/codecs/wm8782.c
@@ -20,6 +20,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
+#include <linux/regulator/consumer.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -50,7 +51,51 @@ static struct snd_soc_dai_driver wm8782_dai = {
 	},
 };
 
+/* regulator power supply names */
+static const char *supply_names[] = {
+	"Vdda", /* analog supply, 2.7V - 3.6V */
+	"Vdd",  /* digital supply, 2.7V - 5.5V */
+};
+
+struct wm8782_priv {
+	struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
+};
+
+static int wm8782_soc_probe(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+
+static void wm8782_soc_remove(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+
+#ifdef CONFIG_PM
+static int wm8782_soc_suspend(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
+	return 0;
+}
+
+static int wm8782_soc_resume(struct snd_soc_component *component)
+{
+	struct wm8782_priv *priv = snd_soc_component_get_drvdata(component);
+	return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
+}
+#else
+#define wm8782_soc_suspend      NULL
+#define wm8782_soc_resume       NULL
+#endif /* CONFIG_PM */
+
 static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
+	.probe			= wm8782_soc_probe,
+	.remove			= wm8782_soc_remove,
+	.suspend		= wm8782_soc_suspend,
+	.resume			= wm8782_soc_resume,
 	.dapm_widgets		= wm8782_dapm_widgets,
 	.num_dapm_widgets	= ARRAY_SIZE(wm8782_dapm_widgets),
 	.dapm_routes		= wm8782_dapm_routes,
@@ -63,6 +108,24 @@ static const struct snd_soc_component_driver soc_component_dev_wm8782 = {
 
 static int wm8782_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
+	struct wm8782_priv *priv;
+	int ret, i;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	dev_set_drvdata(dev, priv);
+
+	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
+		priv->supplies[i].supply = supply_names[i];
+
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
+				      priv->supplies);
+	if (ret < 0)
+		return ret;
+
 	return devm_snd_soc_register_component(&pdev->dev,
 			&soc_component_dev_wm8782, &wm8782_dai, 1);
 }
-- 
2.19.0.rc2

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

* Applied "ASoC: Add device tree documentation file for wm8782 stereo DAC" to the asoc tree
  2018-10-03 19:34 [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Daniel Mack
  2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
  2018-10-08  9:33 ` [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Charles Keepax
@ 2018-10-08 13:57 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2018-10-08 13:57 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, devicetree, alsa-devel, broonie, Charles Keepax

The patch

   ASoC: Add device tree documentation file for wm8782 stereo DAC

has been applied to the asoc tree at

   https://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 cc65fb650c682e3b43d50202a0f01da7dc11e647 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@zonque.org>
Date: Wed, 3 Oct 2018 21:34:35 +0200
Subject: [PATCH] ASoC: Add device tree documentation file for wm8782 stereo
 DAC

Add a device tree documentation file for the wm8782 stereo DAC to describe
the regulator handles.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/wm8782.txt        | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8782.txt

diff --git a/Documentation/devicetree/bindings/sound/wm8782.txt b/Documentation/devicetree/bindings/sound/wm8782.txt
new file mode 100644
index 000000000000..256cdec6ec4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/wm8782.txt
@@ -0,0 +1,17 @@
+WM8782 stereo ADC
+
+This device does not have any control interface or reset pins.
+
+Required properties:
+
+ - compatible  : "wlf,wm8782"
+ - Vdda-supply : phandle to a regulator for the analog power supply (2.7V - 5.5V)
+ - Vdd-supply  : phandle to a regulator for the digital power supply (2.7V - 3.6V)
+
+Example:
+
+wm8782: stereo-adc {
+	compatible = "wlf,wm8782";
+	Vdda-supply = <&vdda_supply>;
+	Vdd-supply = <&vdd_supply>;
+};
-- 
2.19.0.rc2

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

end of thread, other threads:[~2018-10-08 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 19:34 [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Daniel Mack
2018-10-03 19:34 ` [PATCH 2/2] ASoC: wm8782: add support for regulators Daniel Mack
2018-10-05 11:44   ` Mark Brown
2018-10-08  9:48   ` Charles Keepax
2018-10-08 13:57   ` Applied "ASoC: wm8782: add support for regulators" to the asoc tree Mark Brown
2018-10-08  9:33 ` [PATCH 1/2] ASoC: Add device tree documentation file for wm8782 stereo DAC Charles Keepax
2018-10-08 13:57 ` Applied "ASoC: Add device tree documentation file for wm8782 stereo DAC" to the asoc tree Mark Brown

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.