All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Daniel Mack <daniel@zonque.org>
Cc: tiwai@suse.de, devicetree@vger.kernel.org,
	alsa-devel@alsa-project.org, patches@opensource.cirrus.com
Subject: Re: [PATCH 2/2] ASoC: wm8782: add support for regulators
Date: Fri, 5 Oct 2018 12:44:20 +0100	[thread overview]
Message-ID: <20181005114420.GC6266@sirena.org.uk> (raw)
In-Reply-To: <20181003193436.5281-2-daniel@zonque.org>


[-- 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 --]



  reply	other threads:[~2018-10-05 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181005114420.GC6266@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=daniel@zonque.org \
    --cc=devicetree@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.