summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShengjiu Wang <b02247@freescale.com>2014-03-24 18:05:31 +0800
committerShengjiu Wang <b02247@freescale.com>2014-03-25 18:43:06 +0800
commit0a70c5b6c69014f5eb17a519fc8f31124a7c4ee2 (patch)
treec23034b0d62afe680fc221f298af2794ad9b5ded
parentf53fd88eea3667e19b10b254e6d9f80b2a918da5 (diff)
ENGR00303824 audio: Headphone hotplug not work in mx6sl_evk
When hotplug, user will close and reopen the device, shutdown() will be called, MCLK will be disabled, then I2C access to wm8962 will have issue. so the drive didn't switch to headphone. Move the clk enable and disable to codec driver to fix this issue. Signed-off-by: Shengjiu Wang <b02247@freescale.com>
-rw-r--r--arch/arm/mach-mx6/board-mx6q_sabresd.c1
-rwxr-xr-xarch/arm/mach-mx6/board-mx6sl_arm2.c10
-rw-r--r--arch/arm/mach-mx6/board-mx6sl_evk.c10
-rw-r--r--include/sound/wm8962.h2
-rw-r--r--sound/soc/codecs/wm8962.c6
-rw-r--r--sound/soc/imx/imx-wm8962.c32
6 files changed, 19 insertions, 42 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c
index a65832413a96..c14f9fea047d 100644
--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -457,6 +457,7 @@ static struct wm8962_pdata wm8962_config_data = {
[2] = WM8962_GPIO_FN_DMICCLK,
[4] = 0x8000 | WM8962_GPIO_FN_DMICDAT,
},
+ .clock_enable = wm8962_clk_enable,
};
static struct mxc_audio_platform_data wm8962_data = {
diff --git a/arch/arm/mach-mx6/board-mx6sl_arm2.c b/arch/arm/mach-mx6/board-mx6sl_arm2.c
index a29f3bcb9b07..ce9bf7c82cdc 100755
--- a/arch/arm/mach-mx6/board-mx6sl_arm2.c
+++ b/arch/arm/mach-mx6/board-mx6sl_arm2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012-2014 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -451,10 +451,6 @@ static struct platform_device mx6_sabresd_audio_wm8962_device = {
.name = "imx-wm8962",
};
-static struct wm8962_pdata wm8962_config_data = {
-
-};
-
static int wm8962_clk_enable(int enable)
{
if (enable)
@@ -465,6 +461,10 @@ static int wm8962_clk_enable(int enable)
return 0;
}
+static struct wm8962_pdata wm8962_config_data = {
+ .clock_enable = wm8962_clk_enable,
+};
+
static int mxc_wm8962_init(void)
{
struct clk *pll4;
diff --git a/arch/arm/mach-mx6/board-mx6sl_evk.c b/arch/arm/mach-mx6/board-mx6sl_evk.c
index 72ae00cbfc78..db6e9119d8d3 100644
--- a/arch/arm/mach-mx6/board-mx6sl_evk.c
+++ b/arch/arm/mach-mx6/board-mx6sl_evk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012-2014 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -530,10 +530,6 @@ static struct platform_device mx6_sabresd_audio_wm8962_device = {
.name = "imx-wm8962",
};
-static struct wm8962_pdata wm8962_config_data = {
-
-};
-
static int wm8962_clk_enable(int enable)
{
if (enable)
@@ -544,6 +540,10 @@ static int wm8962_clk_enable(int enable)
return 0;
}
+static struct wm8962_pdata wm8962_config_data = {
+ .clock_enable = wm8962_clk_enable,
+};
+
static int mxc_wm8962_init(void)
{
struct clk *pll4;
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h
index 1750bed7c2f6..54d626421ed0 100644
--- a/include/sound/wm8962.h
+++ b/include/sound/wm8962.h
@@ -49,6 +49,8 @@ struct wm8962_pdata {
bool irq_active_low;
bool spk_mono; /* Speaker outputs tied together as mono */
+ /* MCLK enable/disable for wm8962 */
+ int (*clock_enable) (int enable);
};
#endif
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index b54ddb751adb..509c0fef5555 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -5,7 +5,7 @@
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
*
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013-2014 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -3066,6 +3066,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
+ struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
int ret;
if (level == codec->dapm.bias_level)
@@ -3085,6 +3086,8 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
+ pdata->clock_enable(1);
+
ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
wm8962->supplies);
if (ret != 0) {
@@ -3126,6 +3129,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies),
wm8962->supplies);
+ pdata->clock_enable(0);
break;
}
codec->dapm.bias_level = level;
diff --git a/sound/soc/imx/imx-wm8962.c b/sound/soc/imx/imx-wm8962.c
index fed3a7f1e07d..bad0a2cc5ca8 100644
--- a/sound/soc/imx/imx-wm8962.c
+++ b/sound/soc/imx/imx-wm8962.c
@@ -1,7 +1,7 @@
/*
* imx-wm8962.c
*
- * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2012-2014 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -91,32 +91,6 @@ static struct snd_soc_jack_gpio imx_mic_jack_gpio = {
.invert = 0,
};
-static int imx_hifi_startup(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct imx_priv *priv = &card_priv;
- struct mxc_audio_platform_data *plat = priv->pdev->dev.platform_data;
-
- if (!codec_dai->active)
- plat->clock_enable(1);
-
- return 0;
-}
-
-static void imx_hifi_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct imx_priv *priv = &card_priv;
- struct mxc_audio_platform_data *plat = priv->pdev->dev.platform_data;
-
- if (!codec_dai->active)
- plat->clock_enable(0);
-
- return;
-}
-
static int check_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -521,8 +495,6 @@ static int imx_wm8962_init(struct snd_soc_pcm_runtime *rtd)
}
static struct snd_soc_ops imx_hifi_ops = {
- .startup = imx_hifi_startup,
- .shutdown = imx_hifi_shutdown,
.hw_params = imx_hifi_hw_params,
.hw_free = imx_hifi_hw_free,
.trigger = imx_hifi_trigger,
@@ -614,8 +586,6 @@ static int __devexit imx_wm8962_remove(struct platform_device *pdev)
struct mxc_audio_platform_data *plat = pdev->dev.platform_data;
struct imx_priv *priv = &card_priv;
- plat->clock_enable(0);
-
if (plat->finit)
plat->finit();