Browse Source

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 6a715373c4)
isee-imx_3.14.28.y
Shengjiu Wang 7 years ago
committed by Nitin Garg
parent
commit
f56676475f
2 changed files with 17 additions and 3 deletions
  1. +1
    -0
      sound/soc/fsl/Kconfig
  2. +16
    -3
      sound/soc/fsl/imx-wm8962.c

+ 1
- 0
sound/soc/fsl/Kconfig View File

@ -259,6 +259,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.


+ 16
- 3
sound/soc/fsl/imx-wm8962.c View File

@ -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)
snprintf(buf, 32, "STATE=%d", 2);
snd_soc_dapm_disable_pin(&priv->codec->dapm, "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(&priv->codec->dapm, "Ext Spk");
ret = 0;
snd_kctl_jack_report(priv->snd_card, priv->headphone_kctl, 0);
}
envp[0] = "NAME=headphone";
@ -278,9 +283,10 @@ 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_codec *codec = rtd->codec;
struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
struct imx_priv *priv = &card_priv;
priv->codec = codec;
@ -481,7 +487,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;
@ -508,6 +513,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", 0, 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) {


Loading…
Cancel
Save