From 1343b528aba9014c3e2a3cd10392914bc0539ce5 Mon Sep 17 00:00:00 2001
From: Shengjiu Wang <shengjiu.wang@nxp.com>
Date: Thu, 27 Sep 2018 11:52:58 +0800
Subject: [PATCH] MLK-19733-2: ASoC: imx-wm8962: Remove duplicate jack kcontrol

We first add the jack kcontrol in commit c2c7959e3af3 ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e277 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8962_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 72951c2da09799a32883457834479d6280138fb5)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
---
 sound/soc/fsl/imx-wm8962.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index d9739d8d781237..585905bddbdd9a 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -54,8 +54,6 @@ struct imx_priv {
 	struct platform_device *pdev;
 	struct snd_pcm_substream *first_stream;
 	struct snd_pcm_substream *second_stream;
-	struct snd_kcontrol *headphone_kctl;
-	struct snd_card *snd_card;
 	struct platform_device *asrc_pdev;
 	u32 asrc_rate;
 	u32 asrc_format;
@@ -117,12 +115,10 @@ static int hpjack_status_check(void *data)
 		snprintf(buf, 32, "STATE=%d", 2);
 		snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
 		ret = imx_hp_jack_gpio.report;
-		snd_kctl_jack_report(priv->snd_card, priv->headphone_kctl, 1);
 	} else {
 		snprintf(buf, 32, "STATE=%d", 0);
 		snd_soc_dapm_enable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
 		ret = 0;
-		snd_kctl_jack_report(priv->snd_card, priv->headphone_kctl, 0);
 	}
 
 	envp[0] = "NAME=headphone";
@@ -779,12 +775,6 @@ audmux_bypass:
 		goto clk_fail;
 	}
 
-	priv->snd_card = data->card.snd_card;
-	priv->headphone_kctl = snd_kctl_jack_new("Headphone", NULL);
-	ret = snd_ctl_add(data->card.snd_card, priv->headphone_kctl);
-	if (ret)
-		goto fail;
-
 	imx_wm8962_gpio_init(&data->card);
 
 	if (gpio_is_valid(priv->hp_gpio)) {
-- 
GitLab