MLK-11479-09 pulseaudio5.0 mute Headphone volume when Headphone plugged
cherry-pick below patch from v3.14.y: ENGR00306857 pulseaudio5.0 mute Headphone volume when Headphone plugged Pulseaudio will detect the Headphone Jack, then swith to Headphone. So register new Jack for Headphone, the iface=CARD. Signed-off-by: Shengjiu Wang <b02247@freescale.com> (cherry picked from commit 6a715373c43f16e48883061049e67919281878d1)
This commit is contained in:
@ -278,6 +278,7 @@ config SND_SOC_IMX_WM8962
|
||||
select SND_SOC_IMX_PCM_DMA
|
||||
select SND_SOC_IMX_AUDMUX
|
||||
select SND_SOC_FSL_SSI
|
||||
select SND_KCTL_JACK
|
||||
help
|
||||
Say Y if you want to add support for SoC audio on an i.MX board with
|
||||
a wm8962 codec.
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/jack.h>
|
||||
#include <sound/control.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc-dapm.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
@ -50,6 +51,8 @@ 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;
|
||||
};
|
||||
static struct imx_priv card_priv;
|
||||
|
||||
@ -103,10 +106,12 @@ 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";
|
||||
@ -278,10 +283,12 @@ static struct snd_soc_ops imx_hifi_ops = {
|
||||
.hw_free = imx_hifi_hw_free,
|
||||
};
|
||||
|
||||
static int imx_wm8962_gpio_init(struct snd_soc_pcm_runtime *rtd)
|
||||
static int imx_wm8962_gpio_init(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_pcm_runtime *rtd = list_first_entry(
|
||||
&card->rtd_list, struct snd_soc_pcm_runtime, list);
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct imx_priv *priv = &card_priv;
|
||||
|
||||
priv->codec = codec;
|
||||
@ -488,7 +495,6 @@ static int imx_wm8962_probe(struct platform_device *pdev)
|
||||
data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev);
|
||||
data->dai.platform_of_node = ssi_np;
|
||||
data->dai.ops = &imx_hifi_ops;
|
||||
data->dai.init = &imx_wm8962_gpio_init;
|
||||
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM;
|
||||
|
||||
@ -516,6 +522,14 @@ static int imx_wm8962_probe(struct platform_device *pdev)
|
||||
goto 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)) {
|
||||
ret = driver_create_file(pdev->dev.driver, &driver_attr_headphone);
|
||||
if (ret) {
|
||||
|
||||
Reference in New Issue
Block a user