From: "Mylène Josserand" <mylene.josserand@bootlin.com>
To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, perex@perex.cz, tiwai@suse.com
Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, mylene.josserand@bootlin.com,
alexandre.belloni@bootlin.com, thomas.petazzoni@bootlin.com
Subject: [PATCH v1 3/4] ASoC: codecs: pcm179x: Add reset gpio
Date: Tue, 27 Feb 2018 22:24:32 +0100 [thread overview]
Message-ID: <20180227212433.2189-4-mylene.josserand@bootlin.com> (raw)
In-Reply-To: <20180227212433.2189-1-mylene.josserand@bootlin.com>
Add a reset gpio to be able to reset this line at startup.
Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
sound/soc/codecs/pcm179x.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c
index 2285a51ff9e9..0242dfd67b53 100644
--- a/sound/soc/codecs/pcm179x.c
+++ b/sound/soc/codecs/pcm179x.c
@@ -22,6 +22,8 @@
#include <linux/device.h>
#include <sound/core.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/initval.h>
@@ -106,6 +108,7 @@ struct pcm179x_private {
struct regmap *regmap;
unsigned int format;
unsigned int rate;
+ int reset;
};
static int pcm179x_set_dai_fmt(struct snd_soc_dai *codec_dai,
@@ -381,6 +384,8 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap,
enum pcm17xx_type type)
{
struct pcm179x_private *pcm179x;
+ struct device_node *np = dev->of_node;
+ int ret;
pcm179x = devm_kzalloc(dev, sizeof(struct pcm179x_private),
GFP_KERNEL);
@@ -390,6 +395,21 @@ int pcm179x_common_init(struct device *dev, struct regmap *regmap,
pcm179x->regmap = regmap;
dev_set_drvdata(dev, pcm179x);
+ pcm179x->reset = of_get_named_gpio(np, "reset-gpios", 0);
+ if (gpio_is_valid(pcm179x->reset)) {
+ ret = devm_gpio_request_one(dev, pcm179x->reset,
+ GPIOF_OUT_INIT_LOW,
+ "pcm179x reset");
+ if (ret) {
+ dev_err(dev,
+ "Failed to request GPIO %d as reset pin, error %d\n",
+ pcm179x->reset, ret);
+ return ret;
+ }
+
+ gpio_set_value(pcm179x->reset, 1);
+ }
+
if (type == PCM1789)
return devm_snd_soc_register_component(dev,
&soc_component_dev_pcm1789,
--
2.11.0
next prev parent reply other threads:[~2018-02-27 21:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 21:24 [PATCH v1 0/4] ASoC: Add support for DAC PCM1789 Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 1/4] ASoC: codecs: pcm179x: Add PCM1789 id Mylène Josserand
2018-02-27 21:51 ` Thomas Petazzoni
2018-03-01 7:43 ` Mylène Josserand
2018-03-01 9:04 ` [alsa-devel] " Michael Nazzareno Trimarchi
2018-03-01 13:53 ` Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 2/4] ASoC: codecs: pcm179x: Add support for PCM1789 Mylène Josserand
2018-02-27 21:56 ` Thomas Petazzoni
2018-03-01 7:47 ` Mylène Josserand
2018-02-27 21:24 ` Mylène Josserand [this message]
2018-02-27 22:02 ` [PATCH v1 3/4] ASoC: codecs: pcm179x: Add reset gpio Thomas Petazzoni
2018-03-01 7:48 ` Mylène Josserand
2018-02-27 22:30 ` Fabio Estevam
2018-03-01 8:13 ` Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 4/4] ASoC: codecs: pcm179x: Add trigger function to perform a reset Mylène Josserand
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=20180227212433.2189-4-mylene.josserand@bootlin.com \
--to=mylene.josserand@bootlin.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tiwai@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).