All of lore.kernel.org
 help / color / mirror / Atom feed
From: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>,
	alsa-devel@alsa-project.org
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Subject: [PATCH v2 3/3] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card
Date: Mon, 11 Jun 2018 14:15:59 +0900	[thread overview]
Message-ID: <20180611051559.18082-3-suzuki.katsuhiro@socionext.com> (raw)
In-Reply-To: <20180611051559.18082-1-suzuki.katsuhiro@socionext.com>

This patch adds headphone and microphone jack detection gpios as same
as simple-card driver.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>

---

Changes from v1:
  - Move changes of audio-graph-card to other patch
---
 sound/soc/generic/audio-graph-card.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 1b6164249341..2baa60d3b3cc 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -21,7 +21,6 @@
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/jack.h>
 #include <sound/simple_card_utils.h>
 
 struct graph_card_data {
@@ -32,6 +31,8 @@ struct graph_card_data {
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
+	struct asoc_simple_jack hp_jack;
+	struct asoc_simple_jack mic_jack;
 	struct snd_soc_dai_link *dai_link;
 	struct gpio_desc *pa_gpio;
 };
@@ -278,6 +279,22 @@ static int asoc_graph_get_dais_count(struct device *dev)
 	return count;
 }
 
+static int asoc_graph_soc_card_probe(struct snd_soc_card *card)
+{
+	struct graph_card_data *priv = snd_soc_card_get_drvdata(card);
+	int ret;
+
+	ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL);
+	if (ret < 0)
+		return ret;
+
+	ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
 static int asoc_graph_card_probe(struct platform_device *pdev)
 {
 	struct graph_card_data *priv;
@@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	card->num_links	= num;
 	card->dapm_widgets = asoc_graph_card_dapm_widgets;
 	card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets);
+	card->probe	= asoc_graph_soc_card_probe;
 
 	ret = asoc_graph_card_parse_of(priv);
 	if (ret < 0) {
-- 
2.17.1

WARNING: multiple messages have this Message-ID (diff)
From: suzuki.katsuhiro@socionext.com (Katsuhiro Suzuki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card
Date: Mon, 11 Jun 2018 14:15:59 +0900	[thread overview]
Message-ID: <20180611051559.18082-3-suzuki.katsuhiro@socionext.com> (raw)
In-Reply-To: <20180611051559.18082-1-suzuki.katsuhiro@socionext.com>

This patch adds headphone and microphone jack detection gpios as same
as simple-card driver.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>

---

Changes from v1:
  - Move changes of audio-graph-card to other patch
---
 sound/soc/generic/audio-graph-card.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 1b6164249341..2baa60d3b3cc 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -21,7 +21,6 @@
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/jack.h>
 #include <sound/simple_card_utils.h>
 
 struct graph_card_data {
@@ -32,6 +31,8 @@ struct graph_card_data {
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
+	struct asoc_simple_jack hp_jack;
+	struct asoc_simple_jack mic_jack;
 	struct snd_soc_dai_link *dai_link;
 	struct gpio_desc *pa_gpio;
 };
@@ -278,6 +279,22 @@ static int asoc_graph_get_dais_count(struct device *dev)
 	return count;
 }
 
+static int asoc_graph_soc_card_probe(struct snd_soc_card *card)
+{
+	struct graph_card_data *priv = snd_soc_card_get_drvdata(card);
+	int ret;
+
+	ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL);
+	if (ret < 0)
+		return ret;
+
+	ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
 static int asoc_graph_card_probe(struct platform_device *pdev)
 {
 	struct graph_card_data *priv;
@@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	card->num_links	= num;
 	card->dapm_widgets = asoc_graph_card_dapm_widgets;
 	card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets);
+	card->probe	= asoc_graph_soc_card_probe;
 
 	ret = asoc_graph_card_parse_of(priv);
 	if (ret < 0) {
-- 
2.17.1

  parent reply	other threads:[~2018-06-11  5:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11  5:15 [PATCH v2 1/3] ASoC: simple-card-utils: move hp and mic detect gpios from simple-card Katsuhiro Suzuki
2018-06-11  5:15 ` Katsuhiro Suzuki
2018-06-11  5:15 ` [PATCH v2 2/3] ASoC: simple-card: move hp and mic detection to soc_card probe Katsuhiro Suzuki
2018-06-11  5:15   ` Katsuhiro Suzuki
2018-06-11  5:27   ` Kuninori Morimoto
2018-06-11  5:27     ` Kuninori Morimoto
2018-06-11  5:27     ` Kuninori Morimoto
2018-06-11  5:39     ` Katsuhiro Suzuki
2018-06-11  5:39       ` Katsuhiro Suzuki
2018-06-11  5:39       ` Katsuhiro Suzuki
2018-06-11  5:43       ` Kuninori Morimoto
2018-06-11  5:43         ` Kuninori Morimoto
2018-06-11  5:43         ` Kuninori Morimoto
2018-06-11  5:15 ` Katsuhiro Suzuki [this message]
2018-06-11  5:15   ` [PATCH v2 3/3] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card Katsuhiro Suzuki
2018-06-18 12:00   ` Applied "ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card" to the asoc tree Mark Brown
2018-06-18 12:00     ` Mark Brown
2018-06-18 12:00     ` Mark Brown
2018-06-18 12:00 ` Applied "ASoC: simple-card-utils: move hp and mic detect gpios from " Mark Brown
2018-06-18 12:00   ` Mark Brown
2018-06-18 12:00   ` 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=20180611051559.18082-3-suzuki.katsuhiro@socionext.com \
    --to=suzuki.katsuhiro@socionext.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu@linaro.org \
    /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.