All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@google.com>
To: broonie@kernel.org
Cc: tzungbi@google.com, alsa-devel@alsa-project.org,
	dgreid@google.com, cychiang@google.com
Subject: [PATCH 2/4] ASoC: mediatek: mt8183: move headset jack to card-specific storage
Date: Fri, 30 Aug 2019 15:42:38 +0800	[thread overview]
Message-ID: <20190830074240.195166-3-tzungbi@google.com> (raw)
In-Reply-To: <20190830074240.195166-1-tzungbi@google.com>

Move headset jack descriptor from module global scope to card-specific
storage to make its ownership more explicit.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
 .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
index 1d4a1600f768..a7ad41b6e885 100644
--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
@@ -15,8 +15,6 @@
 #include "mt8183-afe-common.h"
 #include "../../codecs/ts3a227e.h"
 
-static struct snd_soc_jack headset_jack;
-
 enum PINCTRL_PIN_STATE {
 	PIN_STATE_DEFAULT = 0,
 	PIN_TDM_OUT_ON,
@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {
 struct mt8183_mt6358_ts3a227_max98357_priv {
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *pin_states[PIN_STATE_MAX];
+	struct snd_soc_jack headset_jack;
 };
 
 static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -410,6 +409,8 @@ static int
 mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
 {
 	int ret;
+	struct mt8183_mt6358_ts3a227_max98357_priv *priv =
+			snd_soc_card_get_drvdata(component->card);
 
 	/* Enable Headset and 4 Buttons Jack detection */
 	ret = snd_soc_card_jack_new(&mt8183_mt6358_ts3a227_max98357_card,
@@ -417,12 +418,12 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
 				    SND_JACK_HEADSET |
 				    SND_JACK_BTN_0 | SND_JACK_BTN_1 |
 				    SND_JACK_BTN_2 | SND_JACK_BTN_3,
-				    &headset_jack,
+				    &priv->headset_jack,
 				    NULL, 0);
 	if (ret)
 		return ret;
 
-	ret = ts3a227e_enable_jack_detect(component, &headset_jack);
+	ret = ts3a227e_enable_jack_detect(component, &priv->headset_jack);
 
 	return ret;
 }
-- 
2.23.0.187.g17f5b7556c-goog

WARNING: multiple messages have this Message-ID (diff)
From: Tzung-Bi Shih <tzungbi@google.com>
To: broonie@kernel.org
Cc: tzungbi@google.com, alsa-devel@alsa-project.org,
	dgreid@google.com, cychiang@google.com
Subject: [alsa-devel] [PATCH 2/4] ASoC: mediatek: mt8183: move headset jack to card-specific storage
Date: Fri, 30 Aug 2019 15:42:38 +0800	[thread overview]
Message-ID: <20190830074240.195166-3-tzungbi@google.com> (raw)
Message-ID: <20190830074238.avXin2twJpwmGpFnKT7U0JMFRAPtOHAe2VOdZqbtipI@z> (raw)
In-Reply-To: <20190830074240.195166-1-tzungbi@google.com>

Move headset jack descriptor from module global scope to card-specific
storage to make its ownership more explicit.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
 .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
index 1d4a1600f768..a7ad41b6e885 100644
--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
@@ -15,8 +15,6 @@
 #include "mt8183-afe-common.h"
 #include "../../codecs/ts3a227e.h"
 
-static struct snd_soc_jack headset_jack;
-
 enum PINCTRL_PIN_STATE {
 	PIN_STATE_DEFAULT = 0,
 	PIN_TDM_OUT_ON,
@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {
 struct mt8183_mt6358_ts3a227_max98357_priv {
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *pin_states[PIN_STATE_MAX];
+	struct snd_soc_jack headset_jack;
 };
 
 static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -410,6 +409,8 @@ static int
 mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
 {
 	int ret;
+	struct mt8183_mt6358_ts3a227_max98357_priv *priv =
+			snd_soc_card_get_drvdata(component->card);
 
 	/* Enable Headset and 4 Buttons Jack detection */
 	ret = snd_soc_card_jack_new(&mt8183_mt6358_ts3a227_max98357_card,
@@ -417,12 +418,12 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
 				    SND_JACK_HEADSET |
 				    SND_JACK_BTN_0 | SND_JACK_BTN_1 |
 				    SND_JACK_BTN_2 | SND_JACK_BTN_3,
-				    &headset_jack,
+				    &priv->headset_jack,
 				    NULL, 0);
 	if (ret)
 		return ret;
 
-	ret = ts3a227e_enable_jack_detect(component, &headset_jack);
+	ret = ts3a227e_enable_jack_detect(component, &priv->headset_jack);
 
 	return ret;
 }
-- 
2.23.0.187.g17f5b7556c-goog

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-08-30  7:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  7:42 [PATCH 0/4] ASoC: mediatek: mt8183: some cleanups Tzung-Bi Shih
2019-08-30  7:42 ` [alsa-devel] " Tzung-Bi Shih
2019-08-30  7:42 ` [PATCH 1/4] ASoC: mediatek: mt8183: move private structure Tzung-Bi Shih
2019-08-30  7:42   ` [alsa-devel] " Tzung-Bi Shih
2019-08-30 16:06   ` Applied "ASoC: mediatek: mt8183: move private structure" to the asoc tree Mark Brown
2019-08-30 16:06     ` [alsa-devel] " Mark Brown
2019-08-30  7:42 ` Tzung-Bi Shih [this message]
2019-08-30  7:42   ` [alsa-devel] [PATCH 2/4] ASoC: mediatek: mt8183: move headset jack to card-specific storage Tzung-Bi Shih
2019-08-30 16:06   ` Applied "ASoC: mediatek: mt8183: move headset jack to card-specific storage" to the asoc tree Mark Brown
2019-08-30 16:06     ` [alsa-devel] " Mark Brown
2019-08-30  7:42 ` [PATCH 3/4] ASoC: mediatek: mt8183: remove forward declaration of headset_init Tzung-Bi Shih
2019-08-30  7:42   ` [alsa-devel] " Tzung-Bi Shih
2019-08-30 16:06   ` Applied "ASoC: mediatek: mt8183: remove forward declaration of headset_init" to the asoc tree Mark Brown
2019-08-30 16:06     ` [alsa-devel] " Mark Brown
2019-08-30  7:42 ` [PATCH 4/4] ASoC: mediatek: mt8183: fix space issues Tzung-Bi Shih
2019-08-30  7:42   ` [alsa-devel] " Tzung-Bi Shih
2019-08-30 16:06   ` Applied "ASoC: mediatek: mt8183: fix space issues" to the asoc tree Mark Brown
2019-08-30 16:06     ` [alsa-devel] " 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=20190830074240.195166-3-tzungbi@google.com \
    --to=tzungbi@google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cychiang@google.com \
    --cc=dgreid@google.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 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.