Commit 95d779b4 authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Mark Brown

ASoC: mediatek: mt8183: move headset jack to card-specific storage

Move headset jack descriptor from module global scope to card-specific
storage to make its ownership more explicit.
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20190830074240.195166-3-tzungbi@google.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 96ed7698
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "mt8183-afe-common.h" #include "mt8183-afe-common.h"
#include "../../codecs/ts3a227e.h" #include "../../codecs/ts3a227e.h"
static struct snd_soc_jack headset_jack;
enum PINCTRL_PIN_STATE { enum PINCTRL_PIN_STATE {
PIN_STATE_DEFAULT = 0, PIN_STATE_DEFAULT = 0,
PIN_TDM_OUT_ON, PIN_TDM_OUT_ON,
...@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = { ...@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {
struct mt8183_mt6358_ts3a227_max98357_priv { struct mt8183_mt6358_ts3a227_max98357_priv {
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
struct pinctrl_state *pin_states[PIN_STATE_MAX]; 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, static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
...@@ -410,6 +409,8 @@ static int ...@@ -410,6 +409,8 @@ static int
mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component) mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
{ {
int ret; int ret;
struct mt8183_mt6358_ts3a227_max98357_priv *priv =
snd_soc_card_get_drvdata(component->card);
/* Enable Headset and 4 Buttons Jack detection */ /* Enable Headset and 4 Buttons Jack detection */
ret = snd_soc_card_jack_new(&mt8183_mt6358_ts3a227_max98357_card, 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) ...@@ -417,12 +418,12 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)
SND_JACK_HEADSET | SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3, SND_JACK_BTN_2 | SND_JACK_BTN_3,
&headset_jack, &priv->headset_jack,
NULL, 0); NULL, 0);
if (ret) if (ret)
return ret; return ret;
ret = ts3a227e_enable_jack_detect(component, &headset_jack); ret = ts3a227e_enable_jack_detect(component, &priv->headset_jack);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment