mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve Lee <steve.lee.analog@gmail.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, ckeepax@opensource.cirrus.com,
	geert@linux-m68k.org, rf@opensource.wolfsonmicro.com,
	shumingf@realtek.com, srinivas.kandagatla@linaro.org,
	krzk@kernel.org, dmurphy@ti.com, jack.yu@realtek.com,
	nuno.sa@analog.com, steves.lee@maximintegrated.com,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Cc: Steve Lee <steve.lee.analog@gmail.com>
Subject: [PATCH] ASoC: max98390: Add reset gpio control
Date: Thu, 10 Mar 2022 17:15:48 +0900	[thread overview]
Message-ID: <20220310081548.31846-1-steve.lee.analog@gmail.com> (raw)

 Add reset gpio control to support RESET PIN connected to gpio.

Signed-off-by: Steve Lee <steve.lee.analog@gmail.com>
---
 sound/soc/codecs/max98390.c | 18 ++++++++++++++++++
 sound/soc/codecs/max98390.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index b392567c2b3e..574d8d5f1119 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -1073,6 +1073,24 @@ static int max98390_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	max98390->reset_gpio = of_get_named_gpio(i2c->dev.of_node,
+						"maxim,reset-gpios", 0);
+
+	/* Power on device */
+	if (gpio_is_valid(max98390->reset_gpio)) {
+		ret = devm_gpio_request(&i2c->dev, max98390->reset_gpio,
+					"MAX98390_RESET");
+		if (ret) {
+			dev_err(&i2c->dev, "%s: Failed to request gpio %d\n",
+				__func__, max98390->reset_gpio);
+			return -EINVAL;
+		}
+		gpio_direction_output(max98390->reset_gpio, 0);
+		usleep_range(1000, 2000);
+		gpio_direction_output(max98390->reset_gpio, 1);
+		usleep_range(1000, 2000);
+	}
+
 	/* Check Revision ID */
 	ret = regmap_read(max98390->regmap,
 		MAX98390_R24FF_REV_ID, &reg);
diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index c250740f73a2..5518f2340247 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -655,6 +655,7 @@
 
 struct max98390_priv {
 	struct regmap *regmap;
+	int reset_gpio;
 	unsigned int sysclk;
 	unsigned int master;
 	unsigned int tdm_mode;
-- 
2.17.1


             reply	other threads:[~2022-03-10  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  8:15 Steve Lee [this message]
2022-03-10  8:48 ` Sa, Nuno
2022-03-10 11:29   ` Mark Brown
2022-03-11  5:53     ` Lee Steve
2022-03-11  5:50   ` Lee Steve

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=20220310081548.31846-1-steve.lee.analog@gmail.com \
    --to=steve.lee.analog@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=dmurphy@ti.com \
    --cc=geert@linux-m68k.org \
    --cc=jack.yu@realtek.com \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=shumingf@realtek.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=steves.lee@maximintegrated.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

all inboxes | Powered by JetHome®