Commit 3ee5990d authored by Mark Brown's avatar Mark Brown

Merge branch 'topic/jack' of...

Merge branch 'topic/jack' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
parents 275ed3a1 77c71765
...@@ -450,8 +450,10 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -450,8 +450,10 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai); struct snd_soc_dai *dai);
/* Jack reporting */ /* Jack reporting */
int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
struct snd_soc_jack *jack); struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
unsigned int num_pins);
void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
struct snd_soc_jack_pin *pins); struct snd_soc_jack_pin *pins);
...@@ -659,7 +661,7 @@ struct snd_soc_jack_gpio { ...@@ -659,7 +661,7 @@ struct snd_soc_jack_gpio {
struct snd_soc_jack { struct snd_soc_jack {
struct mutex mutex; struct mutex mutex;
struct snd_jack *jack; struct snd_jack *jack;
struct snd_soc_codec *codec; struct snd_soc_card *card;
struct list_head pins; struct list_head pins;
int status; int status;
struct blocking_notifier_head notifier; struct blocking_notifier_head notifier;
......
...@@ -783,19 +783,21 @@ static inline void sn95031_enable_jack_btn(struct snd_soc_codec *codec) ...@@ -783,19 +783,21 @@ static inline void sn95031_enable_jack_btn(struct snd_soc_codec *codec)
snd_soc_write(codec, SN95031_BTNCTRL2, 0x01); snd_soc_write(codec, SN95031_BTNCTRL2, 0x01);
} }
static int sn95031_get_headset_state(struct snd_soc_jack *mfld_jack) static int sn95031_get_headset_state(struct snd_soc_codec *codec,
struct snd_soc_jack *mfld_jack)
{ {
int micbias = sn95031_get_mic_bias(mfld_jack->codec); int micbias = sn95031_get_mic_bias(codec);
int jack_type = snd_soc_jack_get_type(mfld_jack, micbias); int jack_type = snd_soc_jack_get_type(mfld_jack, micbias);
pr_debug("jack type detected = %d\n", jack_type); pr_debug("jack type detected = %d\n", jack_type);
if (jack_type == SND_JACK_HEADSET) if (jack_type == SND_JACK_HEADSET)
sn95031_enable_jack_btn(mfld_jack->codec); sn95031_enable_jack_btn(codec);
return jack_type; return jack_type;
} }
void sn95031_jack_detection(struct mfld_jack_data *jack_data) void sn95031_jack_detection(struct snd_soc_codec *codec,
struct mfld_jack_data *jack_data)
{ {
unsigned int status; unsigned int status;
unsigned int mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_HEADSET; unsigned int mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_HEADSET;
...@@ -809,11 +811,11 @@ void sn95031_jack_detection(struct mfld_jack_data *jack_data) ...@@ -809,11 +811,11 @@ void sn95031_jack_detection(struct mfld_jack_data *jack_data)
status = SND_JACK_HEADSET | SND_JACK_BTN_1; status = SND_JACK_HEADSET | SND_JACK_BTN_1;
} else if (jack_data->intr_id & 0x4) { } else if (jack_data->intr_id & 0x4) {
pr_debug("headset or headphones inserted\n"); pr_debug("headset or headphones inserted\n");
status = sn95031_get_headset_state(jack_data->mfld_jack); status = sn95031_get_headset_state(codec, jack_data->mfld_jack);
} else if (jack_data->intr_id & 0x8) { } else if (jack_data->intr_id & 0x8) {
pr_debug("headset or headphones removed\n"); pr_debug("headset or headphones removed\n");
status = 0; status = 0;
sn95031_disable_jack_btn(jack_data->mfld_jack->codec); sn95031_disable_jack_btn(codec);
} else { } else {
pr_err("unidentified interrupt\n"); pr_err("unidentified interrupt\n");
return; return;
......
...@@ -127,6 +127,7 @@ struct mfld_jack_data { ...@@ -127,6 +127,7 @@ struct mfld_jack_data {
struct snd_soc_jack *mfld_jack; struct snd_soc_jack *mfld_jack;
}; };
extern void sn95031_jack_detection(struct mfld_jack_data *jack_data); extern void sn95031_jack_detection(struct snd_soc_codec *codec,
struct mfld_jack_data *jack_data);
#endif #endif
...@@ -53,9 +53,9 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -53,9 +53,9 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd)
/* Headphone jack detection */ /* Headphone jack detection */
if (gpio_is_valid(data->jack_gpio)) { if (gpio_is_valid(data->jack_gpio)) {
ret = snd_soc_jack_new(rtd->codec, "Headphone", ret = snd_soc_card_jack_new(rtd->card, "Headphone",
SND_JACK_HEADPHONE | SND_JACK_BTN_0, SND_JACK_HEADPHONE | SND_JACK_BTN_0,
&headset_jack); &headset_jack, NULL, 0);
if (ret) if (ret)
return ret; return ret;
......
...@@ -205,16 +205,14 @@ static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) ...@@ -205,16 +205,14 @@ static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Headphone jack detection */ /* Headphone jack detection */
snd_soc_jack_new(codec, "Headphone", SND_JACK_HEADPHONE, &hp_jack); snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE,
snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), &hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));
hp_jack_pins);
wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE);
/* Microphone jack detection */ /* Microphone jack detection */
snd_soc_jack_new(codec, "Microphone", snd_soc_card_jack_new(rtd->card, "Microphone",
SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack); SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack,
snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins), mic_jack_pins, ARRAY_SIZE(mic_jack_pins));
mic_jack_pins);
wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE, wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE,
SND_JACK_BTN_0); SND_JACK_BTN_0);
......
...@@ -176,11 +176,11 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -176,11 +176,11 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
if (gpio_is_valid(priv->gpio_hp_det)) { if (gpio_is_valid(priv->gpio_hp_det)) {
snd_soc_jack_new(codec->codec, "Headphones", SND_JACK_HEADPHONE, snd_soc_card_jack_new(rtd->card, "Headphones",
&simple_card_hp_jack); SND_JACK_HEADPHONE,
snd_soc_jack_add_pins(&simple_card_hp_jack, &simple_card_hp_jack,
ARRAY_SIZE(simple_card_hp_jack_pins), simple_card_hp_jack_pins,
simple_card_hp_jack_pins); ARRAY_SIZE(simple_card_hp_jack_pins));
simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det; simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert; simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
...@@ -189,11 +189,11 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -189,11 +189,11 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
} }
if (gpio_is_valid(priv->gpio_mic_det)) { if (gpio_is_valid(priv->gpio_mic_det)) {
snd_soc_jack_new(codec->codec, "Mic Jack", SND_JACK_MICROPHONE, snd_soc_card_jack_new(rtd->card, "Mic Jack",
&simple_card_mic_jack); SND_JACK_MICROPHONE,
snd_soc_jack_add_pins(&simple_card_mic_jack, &simple_card_mic_jack,
ARRAY_SIZE(simple_card_mic_jack_pins), simple_card_mic_jack_pins,
simple_card_mic_jack_pins); ARRAY_SIZE(simple_card_mic_jack_pins));
simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det; simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert; simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
snd_soc_jack_add_gpios(&simple_card_mic_jack, 1, snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
......
...@@ -80,15 +80,9 @@ static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -80,15 +80,9 @@ static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
int ret = 0; int ret = 0;
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(rtd->card, "Headset",
SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset); SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset,
broadwell_headset_pins, ARRAY_SIZE(broadwell_headset_pins));
if (ret)
return ret;
ret = snd_soc_jack_add_pins(&broadwell_headset,
ARRAY_SIZE(broadwell_headset_pins),
broadwell_headset_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -84,7 +84,6 @@ static struct snd_soc_jack_gpio hs_jack_gpios[] = { ...@@ -84,7 +84,6 @@ static struct snd_soc_jack_gpio hs_jack_gpios[] = {
static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime) static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime)
{ {
int ret; int ret;
struct snd_soc_codec *codec = runtime->codec;
struct snd_soc_card *card = runtime->card; struct snd_soc_card *card = runtime->card;
struct byt_max98090_private *drv = snd_soc_card_get_drvdata(card); struct byt_max98090_private *drv = snd_soc_card_get_drvdata(card);
struct snd_soc_jack *jack = &drv->jack; struct snd_soc_jack *jack = &drv->jack;
...@@ -100,13 +99,9 @@ static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime) ...@@ -100,13 +99,9 @@ static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime)
} }
/* Enable jack detection */ /* Enable jack detection */
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(runtime->card, "Headset",
SND_JACK_LINEOUT | SND_JACK_HEADSET, jack); SND_JACK_LINEOUT | SND_JACK_HEADSET, jack,
if (ret) hs_jack_pins, ARRAY_SIZE(hs_jack_pins));
return ret;
ret = snd_soc_jack_add_pins(jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -169,17 +169,17 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -169,17 +169,17 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
return ret; return ret;
} }
ret = snd_soc_jack_new(codec, "Headphone Jack", ret = snd_soc_card_jack_new(runtime->card, "Headphone Jack",
SND_JACK_HEADPHONE, SND_JACK_HEADPHONE, &ctx->hp_jack,
&ctx->hp_jack); NULL, 0);
if (ret) { if (ret) {
dev_err(runtime->dev, "HP jack creation failed %d\n", ret); dev_err(runtime->dev, "HP jack creation failed %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_jack_new(codec, "Mic Jack", ret = snd_soc_card_jack_new(runtime->card, "Mic Jack",
SND_JACK_MICROPHONE, SND_JACK_MICROPHONE, &ctx->mic_jack,
&ctx->mic_jack); NULL, 0);
if (ret) { if (ret) {
dev_err(runtime->dev, "Mic jack creation failed %d\n", ret); dev_err(runtime->dev, "Mic jack creation failed %d\n", ret);
return ret; return ret;
......
...@@ -228,10 +228,13 @@ static void mfld_jack_check(unsigned int intr_status) ...@@ -228,10 +228,13 @@ static void mfld_jack_check(unsigned int intr_status)
{ {
struct mfld_jack_data jack_data; struct mfld_jack_data jack_data;
if (!mfld_codec)
return;
jack_data.mfld_jack = &mfld_jack; jack_data.mfld_jack = &mfld_jack;
jack_data.intr_id = intr_status; jack_data.intr_id = intr_status;
sn95031_jack_detection(&jack_data); sn95031_jack_detection(mfld_codec, &jack_data);
/* TODO: add american headset detection post gpiolib support */ /* TODO: add american headset detection post gpiolib support */
} }
...@@ -240,8 +243,6 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) ...@@ -240,8 +243,6 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
struct snd_soc_dapm_context *dapm = &runtime->card->dapm; struct snd_soc_dapm_context *dapm = &runtime->card->dapm;
int ret_val; int ret_val;
mfld_codec = runtime->codec;
/* default is earpiece pin, userspace sets it explcitly */ /* default is earpiece pin, userspace sets it explcitly */
snd_soc_dapm_disable_pin(dapm, "Headphones"); snd_soc_dapm_disable_pin(dapm, "Headphones");
/* default is lineout NC, userspace sets it explcitly */ /* default is lineout NC, userspace sets it explcitly */
...@@ -254,20 +255,15 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) ...@@ -254,20 +255,15 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
snd_soc_dapm_disable_pin(dapm, "LINEINR"); snd_soc_dapm_disable_pin(dapm, "LINEINR");
/* Headset and button jack detection */ /* Headset and button jack detection */
ret_val = snd_soc_jack_new(mfld_codec, "Intel(R) MID Audio Jack", ret_val = snd_soc_card_jack_new(runtime->card,
SND_JACK_HEADSET | SND_JACK_BTN_0 | "Intel(R) MID Audio Jack", SND_JACK_HEADSET |
SND_JACK_BTN_1, &mfld_jack); SND_JACK_BTN_0 | SND_JACK_BTN_1, &mfld_jack,
mfld_jack_pins, ARRAY_SIZE(mfld_jack_pins));
if (ret_val) { if (ret_val) {
pr_err("jack creation failed\n"); pr_err("jack creation failed\n");
return ret_val; return ret_val;
} }
ret_val = snd_soc_jack_add_pins(&mfld_jack,
ARRAY_SIZE(mfld_jack_pins), mfld_jack_pins);
if (ret_val) {
pr_err("adding jack pins failed\n");
return ret_val;
}
ret_val = snd_soc_jack_add_zones(&mfld_jack, ret_val = snd_soc_jack_add_zones(&mfld_jack,
ARRAY_SIZE(mfld_zones), mfld_zones); ARRAY_SIZE(mfld_zones), mfld_zones);
if (ret_val) { if (ret_val) {
...@@ -275,6 +271,8 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) ...@@ -275,6 +271,8 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
return ret_val; return ret_val;
} }
mfld_codec = runtime->codec;
/* we want to check if anything is inserted at boot, /* we want to check if anything is inserted at boot,
* so send a fake event to codec and it will read adc * so send a fake event to codec and it will read adc
* to find if anything is there or not */ * to find if anything is there or not */
...@@ -359,8 +357,6 @@ static irqreturn_t snd_mfld_jack_detection(int irq, void *data) ...@@ -359,8 +357,6 @@ static irqreturn_t snd_mfld_jack_detection(int irq, void *data)
{ {
struct mfld_mc_private *mc_drv_ctx = (struct mfld_mc_private *) data; struct mfld_mc_private *mc_drv_ctx = (struct mfld_mc_private *) data;
if (mfld_jack.codec == NULL)
return IRQ_HANDLED;
mfld_jack_check(mc_drv_ctx->interrupt_status); mfld_jack_check(mc_drv_ctx->interrupt_status);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -479,8 +479,8 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) ...@@ -479,8 +479,8 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
/* Add hook switch - can be used to control the codec from userspace /* Add hook switch - can be used to control the codec from userspace
* even if line discipline fails */ * even if line discipline fails */
ret = snd_soc_jack_new(rtd->codec, "hook_switch", ret = snd_soc_card_jack_new(card, "hook_switch", SND_JACK_HEADSET,
SND_JACK_HEADSET, &ams_delta_hook_switch); &ams_delta_hook_switch, NULL, 0);
if (ret) if (ret)
dev_warn(card->dev, dev_warn(card->dev,
"Failed to allocate resources for hook switch, " "Failed to allocate resources for hook switch, "
......
...@@ -182,17 +182,17 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) ...@@ -182,17 +182,17 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
/* Headset jack detection only if it is supported */ /* Headset jack detection only if it is supported */
if (priv->jack_detection) { if (priv->jack_detection) {
ret = snd_soc_jack_new(codec, "Headset Jack", ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
SND_JACK_HEADSET, &hs_jack); SND_JACK_HEADSET, &hs_jack,
hs_jack_pins,
ARRAY_SIZE(hs_jack_pins));
if (ret) if (ret)
return ret; return ret;
ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
} }
return ret; return 0;
} }
static const struct snd_soc_dapm_route dmic_audio_map[] = { static const struct snd_soc_dapm_route dmic_audio_map[] = {
......
...@@ -170,14 +170,10 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) ...@@ -170,14 +170,10 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd)
if (priv->jack_detect > 0) { if (priv->jack_detect > 0) {
hs_jack_gpios[0].gpio = priv->jack_detect; hs_jack_gpios[0].gpio = priv->jack_detect;
ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
&priv->hs_jack); SND_JACK_HEADSET, &priv->hs_jack,
if (ret) hs_jack_pins,
return ret; ARRAY_SIZE(hs_jack_pins));
ret = snd_soc_jack_add_pins(&priv->hs_jack,
ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -311,9 +311,9 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) ...@@ -311,9 +311,9 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
} }
/* AV jack detection */ /* AV jack detection */
err = snd_soc_jack_new(codec, "AV Jack", err = snd_soc_card_jack_new(rtd->card, "AV Jack",
SND_JACK_HEADSET | SND_JACK_VIDEOOUT, SND_JACK_HEADSET | SND_JACK_VIDEOOUT,
&rx51_av_jack); &rx51_av_jack, NULL, 0);
if (err) { if (err) {
dev_err(card->dev, "Failed to add AV Jack\n"); dev_err(card->dev, "Failed to add AV Jack\n");
return err; return err;
......
...@@ -126,17 +126,12 @@ static const struct snd_soc_dapm_route hx4700_audio_map[] = { ...@@ -126,17 +126,12 @@ static const struct snd_soc_dapm_route hx4700_audio_map[] = {
*/ */
static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd) static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec;
int err; int err;
/* Jack detection API stuff */ /* Jack detection API stuff */
err = snd_soc_jack_new(codec, "Headphone Jack", err = snd_soc_card_jack_new(rtd->card, "Headphone Jack",
SND_JACK_HEADPHONE, &hs_jack); SND_JACK_HEADPHONE, &hs_jack, hs_jack_pin,
if (err) ARRAY_SIZE(hs_jack_pin));
return err;
err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pin),
hs_jack_pin);
if (err) if (err)
return err; return err;
......
...@@ -75,17 +75,12 @@ static struct snd_soc_card palm27x_asoc; ...@@ -75,17 +75,12 @@ static struct snd_soc_card palm27x_asoc;
static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd) static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec;
int err; int err;
/* Jack detection API stuff */ /* Jack detection API stuff */
err = snd_soc_jack_new(codec, "Headphone Jack", err = snd_soc_card_jack_new(rtd->card, "Headphone Jack",
SND_JACK_HEADPHONE, &hs_jack); SND_JACK_HEADPHONE, &hs_jack, hs_jack_pins,
if (err) ARRAY_SIZE(hs_jack_pins));
return err;
err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (err) if (err)
return err; return err;
......
...@@ -78,15 +78,12 @@ static int ttc_pm860x_init(struct snd_soc_pcm_runtime *rtd) ...@@ -78,15 +78,12 @@ static int ttc_pm860x_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
/* Headset jack detection */ /* Headset jack detection */
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE |
| SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2,
&hs_jack); &hs_jack, hs_jack_pins, ARRAY_SIZE(hs_jack_pins));
snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), snd_soc_card_jack_new(rtd->card, "Microphone Jack", SND_JACK_MICROPHONE,
hs_jack_pins); &mic_jack, mic_jack_pins,
snd_soc_jack_new(codec, "Microphone Jack", SND_JACK_MICROPHONE, ARRAY_SIZE(mic_jack_pins));
&mic_jack);
snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins),
mic_jack_pins);
/* headphone, microphone detection & headset short detection */ /* headphone, microphone detection & headset short detection */
pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE, pm860x_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADPHONE,
......
...@@ -143,13 +143,9 @@ static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) ...@@ -143,13 +143,9 @@ static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_disable_pin(dapm, "MONO1"); snd_soc_dapm_disable_pin(dapm, "MONO1");
/* Jack detection API stuff */ /* Jack detection API stuff */
ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", SND_JACK_HEADSET,
&hs_jack); &hs_jack, hs_jack_pins,
if (ret) ARRAY_SIZE(hs_jack_pins));
goto err;
ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (ret) if (ret)
goto err; goto err;
......
...@@ -162,13 +162,8 @@ static struct platform_device *s3c24xx_snd_device; ...@@ -162,13 +162,8 @@ static struct platform_device *s3c24xx_snd_device;
static int h1940_uda1380_init(struct snd_soc_pcm_runtime *rtd) static int h1940_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack);
snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins),
hp_jack_pins);
snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios),
hp_jack_gpios); hp_jack_gpios);
......
...@@ -260,12 +260,12 @@ static int littlemill_late_probe(struct snd_soc_card *card) ...@@ -260,12 +260,12 @@ static int littlemill_late_probe(struct snd_soc_card *card)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(card, "Headset",
SND_JACK_HEADSET | SND_JACK_MECHANICAL | SND_JACK_HEADSET | SND_JACK_MECHANICAL |
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 |
SND_JACK_BTN_4 | SND_JACK_BTN_5, SND_JACK_BTN_4 | SND_JACK_BTN_5,
&littlemill_headset); &littlemill_headset, NULL, 0);
if (ret) if (ret)
return ret; return ret;
......
...@@ -56,16 +56,10 @@ static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) ...@@ -56,16 +56,10 @@ static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(rtd->card, "Headset", SND_JACK_LINEOUT |
SND_JACK_LINEOUT | SND_JACK_HEADSET | SND_JACK_HEADSET | SND_JACK_BTN_0,
SND_JACK_BTN_0, &lowland_headset, lowland_headset_pins,
&lowland_headset); ARRAY_SIZE(lowland_headset_pins));
if (ret)
return ret;
ret = snd_soc_jack_add_pins(&lowland_headset,
ARRAY_SIZE(lowland_headset_pins),
lowland_headset_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -211,13 +211,8 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, ...@@ -211,13 +211,8 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd) static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack);
snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins),
hp_jack_pins);
snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios),
hp_jack_gpios); hp_jack_gpios);
......
...@@ -151,13 +151,10 @@ static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd) ...@@ -151,13 +151,10 @@ static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
/* Headphone jack detection */ /* Headphone jack detection */
err = snd_soc_jack_new(codec, "Headphone Jack", err = snd_soc_card_jack_new(rtd->card, "Headphone Jack",
SND_JACK_HEADPHONE, &smartq_jack); SND_JACK_HEADPHONE, &smartq_jack,
if (err) smartq_jack_pins,
return err; ARRAY_SIZE(smartq_jack_pins));
err = snd_soc_jack_add_pins(&smartq_jack, ARRAY_SIZE(smartq_jack_pins),
smartq_jack_pins);
if (err) if (err)
return err; return err;
......
...@@ -153,16 +153,10 @@ static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd) ...@@ -153,16 +153,10 @@ static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd)
pr_err("Failed to request HP_SEL GPIO: %d\n", ret); pr_err("Failed to request HP_SEL GPIO: %d\n", ret);
gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity); gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity);
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(rtd->card, "Headset", SND_JACK_LINEOUT |
SND_JACK_LINEOUT | SND_JACK_HEADSET | SND_JACK_HEADSET | SND_JACK_BTN_0,
SND_JACK_BTN_0, &speyside_headset, speyside_headset_pins,
&speyside_headset); ARRAY_SIZE(speyside_headset_pins));
if (ret)
return ret;
ret = snd_soc_jack_add_pins(&speyside_headset,
ARRAY_SIZE(speyside_headset_pins),
speyside_headset_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -179,15 +179,10 @@ static int tobermory_late_probe(struct snd_soc_card *card) ...@@ -179,15 +179,10 @@ static int tobermory_late_probe(struct snd_soc_card *card)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = snd_soc_jack_new(codec, "Headset", ret = snd_soc_card_jack_new(card, "Headset", SND_JACK_HEADSET |
SND_JACK_HEADSET | SND_JACK_BTN_0, SND_JACK_BTN_0, &tobermory_headset,
&tobermory_headset); tobermory_headset_pins,
if (ret) ARRAY_SIZE(tobermory_headset_pins));
return ret;
ret = snd_soc_jack_add_pins(&tobermory_headset,
ARRAY_SIZE(tobermory_headset_pins),
tobermory_headset_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -22,30 +22,42 @@ ...@@ -22,30 +22,42 @@
#include <trace/events/asoc.h> #include <trace/events/asoc.h>
/** /**
* snd_soc_jack_new - Create a new jack * snd_soc_card_jack_new - Create a new jack
* @codec: ASoC codec * @card: ASoC card
* @id: an identifying string for this jack * @id: an identifying string for this jack
* @type: a bitmask of enum snd_jack_type values that can be detected by * @type: a bitmask of enum snd_jack_type values that can be detected by
* this jack * this jack
* @jack: structure to use for the jack * @jack: structure to use for the jack
* @pins: Array of jack pins to be added to the jack or NULL
* @num_pins: Number of elements in the @pins array
* *
* Creates a new jack object. * Creates a new jack object.
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
* On success jack will be initialised. * On success jack will be initialised.
*/ */
int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
struct snd_soc_jack *jack) struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
unsigned int num_pins)
{ {
int ret;
mutex_init(&jack->mutex); mutex_init(&jack->mutex);
jack->codec = codec; jack->card = card;
INIT_LIST_HEAD(&jack->pins); INIT_LIST_HEAD(&jack->pins);
INIT_LIST_HEAD(&jack->jack_zones); INIT_LIST_HEAD(&jack->jack_zones);
BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier); BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier);
return snd_jack_new(codec->component.card->snd_card, id, type, &jack->jack); ret = snd_jack_new(card->snd_card, id, type, &jack->jack);
if (ret)
return ret;
if (num_pins)
return snd_soc_jack_add_pins(jack, num_pins, pins);
return 0;
} }
EXPORT_SYMBOL_GPL(snd_soc_jack_new); EXPORT_SYMBOL_GPL(snd_soc_card_jack_new);
/** /**
* snd_soc_jack_report - Report the current status for a jack * snd_soc_jack_report - Report the current status for a jack
...@@ -63,7 +75,6 @@ EXPORT_SYMBOL_GPL(snd_soc_jack_new); ...@@ -63,7 +75,6 @@ EXPORT_SYMBOL_GPL(snd_soc_jack_new);
*/ */
void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
{ {
struct snd_soc_codec *codec;
struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_context *dapm;
struct snd_soc_jack_pin *pin; struct snd_soc_jack_pin *pin;
unsigned int sync = 0; unsigned int sync = 0;
...@@ -74,8 +85,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) ...@@ -74,8 +85,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
if (!jack) if (!jack)
return; return;
codec = jack->codec; dapm = &jack->card->dapm;
dapm = &codec->dapm;
mutex_lock(&jack->mutex); mutex_lock(&jack->mutex);
...@@ -175,12 +185,12 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, ...@@ -175,12 +185,12 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (!pins[i].pin) { if (!pins[i].pin) {
dev_err(jack->codec->dev, "ASoC: No name for pin %d\n", dev_err(jack->card->dev, "ASoC: No name for pin %d\n",
i); i);
return -EINVAL; return -EINVAL;
} }
if (!pins[i].mask) { if (!pins[i].mask) {
dev_err(jack->codec->dev, "ASoC: No mask for pin %d" dev_err(jack->card->dev, "ASoC: No mask for pin %d"
" (%s)\n", i, pins[i].pin); " (%s)\n", i, pins[i].pin);
return -EINVAL; return -EINVAL;
} }
...@@ -260,7 +270,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio) ...@@ -260,7 +270,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
static irqreturn_t gpio_handler(int irq, void *data) static irqreturn_t gpio_handler(int irq, void *data)
{ {
struct snd_soc_jack_gpio *gpio = data; struct snd_soc_jack_gpio *gpio = data;
struct device *dev = gpio->jack->codec->component.card->dev; struct device *dev = gpio->jack->card->dev;
trace_snd_soc_jack_irq(gpio->name); trace_snd_soc_jack_irq(gpio->name);
...@@ -299,7 +309,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, ...@@ -299,7 +309,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (!gpios[i].name) { if (!gpios[i].name) {
dev_err(jack->codec->dev, dev_err(jack->card->dev,
"ASoC: No name for gpio at index %d\n", i); "ASoC: No name for gpio at index %d\n", i);
ret = -EINVAL; ret = -EINVAL;
goto undo; goto undo;
...@@ -320,7 +330,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, ...@@ -320,7 +330,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
} else { } else {
/* legacy GPIO number */ /* legacy GPIO number */
if (!gpio_is_valid(gpios[i].gpio)) { if (!gpio_is_valid(gpios[i].gpio)) {
dev_err(jack->codec->dev, dev_err(jack->card->dev,
"ASoC: Invalid gpio %d\n", "ASoC: Invalid gpio %d\n",
gpios[i].gpio); gpios[i].gpio);
ret = -EINVAL; ret = -EINVAL;
...@@ -350,7 +360,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, ...@@ -350,7 +360,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
if (gpios[i].wake) { if (gpios[i].wake) {
ret = irq_set_irq_wake(gpiod_to_irq(gpios[i].desc), 1); ret = irq_set_irq_wake(gpiod_to_irq(gpios[i].desc), 1);
if (ret != 0) if (ret != 0)
dev_err(jack->codec->dev, dev_err(jack->card->dev,
"ASoC: Failed to mark GPIO at index %d as wake source: %d\n", "ASoC: Failed to mark GPIO at index %d as wake source: %d\n",
i, ret); i, ret);
} }
......
...@@ -106,11 +106,10 @@ static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd) ...@@ -106,11 +106,10 @@ static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *dapm = &codec->dapm;
struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(rtd->card); struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(rtd->card);
snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, snd_soc_card_jack_new(rtd->card, "Headset Jack", SND_JACK_HEADSET,
&tegra_alc5632_hs_jack); &tegra_alc5632_hs_jack,
snd_soc_jack_add_pins(&tegra_alc5632_hs_jack, tegra_alc5632_hs_jack_pins,
ARRAY_SIZE(tegra_alc5632_hs_jack_pins), ARRAY_SIZE(tegra_alc5632_hs_jack_pins));
tegra_alc5632_hs_jack_pins);
if (gpio_is_valid(machine->gpio_hp_det)) { if (gpio_is_valid(machine->gpio_hp_det)) {
tegra_alc5632_hp_jack_gpio.gpio = machine->gpio_hp_det; tegra_alc5632_hp_jack_gpio.gpio = machine->gpio_hp_det;
......
...@@ -141,16 +141,14 @@ static const struct snd_kcontrol_new tegra_max98090_controls[] = { ...@@ -141,16 +141,14 @@ static const struct snd_kcontrol_new tegra_max98090_controls[] = {
static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd) static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
struct tegra_max98090 *machine = snd_soc_card_get_drvdata(rtd->card); struct tegra_max98090 *machine = snd_soc_card_get_drvdata(rtd->card);
if (gpio_is_valid(machine->gpio_hp_det)) { if (gpio_is_valid(machine->gpio_hp_det)) {
snd_soc_jack_new(codec, "Headphones", SND_JACK_HEADPHONE, snd_soc_card_jack_new(rtd->card, "Headphones",
&tegra_max98090_hp_jack); SND_JACK_HEADPHONE,
snd_soc_jack_add_pins(&tegra_max98090_hp_jack, &tegra_max98090_hp_jack,
ARRAY_SIZE(tegra_max98090_hp_jack_pins), tegra_max98090_hp_jack_pins,
tegra_max98090_hp_jack_pins); ARRAY_SIZE(tegra_max98090_hp_jack_pins));
tegra_max98090_hp_jack_gpio.gpio = machine->gpio_hp_det; tegra_max98090_hp_jack_gpio.gpio = machine->gpio_hp_det;
snd_soc_jack_add_gpios(&tegra_max98090_hp_jack, snd_soc_jack_add_gpios(&tegra_max98090_hp_jack,
...@@ -159,11 +157,11 @@ static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd) ...@@ -159,11 +157,11 @@ static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
} }
if (gpio_is_valid(machine->gpio_mic_det)) { if (gpio_is_valid(machine->gpio_mic_det)) {
snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, snd_soc_card_jack_new(rtd->card, "Mic Jack",
&tegra_max98090_mic_jack); SND_JACK_MICROPHONE,
snd_soc_jack_add_pins(&tegra_max98090_mic_jack, &tegra_max98090_mic_jack,
ARRAY_SIZE(tegra_max98090_mic_jack_pins), tegra_max98090_mic_jack_pins,
tegra_max98090_mic_jack_pins); ARRAY_SIZE(tegra_max98090_mic_jack_pins));
tegra_max98090_mic_jack_gpio.gpio = machine->gpio_mic_det; tegra_max98090_mic_jack_gpio.gpio = machine->gpio_mic_det;
snd_soc_jack_add_gpios(&tegra_max98090_mic_jack, snd_soc_jack_add_gpios(&tegra_max98090_mic_jack,
......
...@@ -108,15 +108,11 @@ static const struct snd_kcontrol_new tegra_rt5640_controls[] = { ...@@ -108,15 +108,11 @@ static const struct snd_kcontrol_new tegra_rt5640_controls[] = {
static int tegra_rt5640_asoc_init(struct snd_soc_pcm_runtime *rtd) static int tegra_rt5640_asoc_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(rtd->card); struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(rtd->card);
snd_soc_jack_new(codec, "Headphones", SND_JACK_HEADPHONE, snd_soc_card_jack_new(rtd->card, "Headphones", SND_JACK_HEADPHONE,
&tegra_rt5640_hp_jack); &tegra_rt5640_hp_jack, tegra_rt5640_hp_jack_pins,
snd_soc_jack_add_pins(&tegra_rt5640_hp_jack, ARRAY_SIZE(tegra_rt5640_hp_jack_pins));
ARRAY_SIZE(tegra_rt5640_hp_jack_pins),
tegra_rt5640_hp_jack_pins);
if (gpio_is_valid(machine->gpio_hp_det)) { if (gpio_is_valid(machine->gpio_hp_det)) {
tegra_rt5640_hp_jack_gpio.gpio = machine->gpio_hp_det; tegra_rt5640_hp_jack_gpio.gpio = machine->gpio_hp_det;
......
...@@ -146,10 +146,9 @@ static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd) ...@@ -146,10 +146,9 @@ static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *dapm = &codec->dapm;
struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(rtd->card); struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(rtd->card);
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
&tegra_rt5677_hp_jack); &tegra_rt5677_hp_jack,
snd_soc_jack_add_pins(&tegra_rt5677_hp_jack, 1, &tegra_rt5677_hp_jack_pins, 1);
&tegra_rt5677_hp_jack_pins);
if (gpio_is_valid(machine->gpio_hp_det)) { if (gpio_is_valid(machine->gpio_hp_det)) {
tegra_rt5677_hp_jack_gpio.gpio = machine->gpio_hp_det; tegra_rt5677_hp_jack_gpio.gpio = machine->gpio_hp_det;
...@@ -158,10 +157,9 @@ static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd) ...@@ -158,10 +157,9 @@ static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd)
} }
snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
&tegra_rt5677_mic_jack); &tegra_rt5677_mic_jack,
snd_soc_jack_add_pins(&tegra_rt5677_mic_jack, 1, &tegra_rt5677_mic_jack_pins, 1);
&tegra_rt5677_mic_jack_pins);
if (gpio_is_valid(machine->gpio_mic_present)) { if (gpio_is_valid(machine->gpio_mic_present)) {
tegra_rt5677_mic_jack_gpio.gpio = machine->gpio_mic_present; tegra_rt5677_mic_jack_gpio.gpio = machine->gpio_mic_present;
......
...@@ -177,21 +177,19 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) ...@@ -177,21 +177,19 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
if (gpio_is_valid(machine->gpio_hp_det)) { if (gpio_is_valid(machine->gpio_hp_det)) {
tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det;
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, snd_soc_card_jack_new(rtd->card, "Headphone Jack",
&tegra_wm8903_hp_jack); SND_JACK_HEADPHONE, &tegra_wm8903_hp_jack,
snd_soc_jack_add_pins(&tegra_wm8903_hp_jack, tegra_wm8903_hp_jack_pins,
ARRAY_SIZE(tegra_wm8903_hp_jack_pins), ARRAY_SIZE(tegra_wm8903_hp_jack_pins));
tegra_wm8903_hp_jack_pins);
snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
1, 1,
&tegra_wm8903_hp_jack_gpio); &tegra_wm8903_hp_jack_gpio);
} }
snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE, snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
&tegra_wm8903_mic_jack); &tegra_wm8903_mic_jack,
snd_soc_jack_add_pins(&tegra_wm8903_mic_jack, tegra_wm8903_mic_jack_pins,
ARRAY_SIZE(tegra_wm8903_mic_jack_pins), ARRAY_SIZE(tegra_wm8903_mic_jack_pins));
tegra_wm8903_mic_jack_pins);
wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
0); 0);
......
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