#include <mach/gpio.h>
#include <mach/iomux.h>
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
+#include <sound/soc.h>
+#endif
+
#if 0
#define DBG(x...) printk(KERN_DEBUG x)
#else
#ifdef CONFIG_PM
static int wm8994_suspend(struct device *dev)
{
- struct wm8994 *wm8994 = dev_get_drvdata(dev);
- struct wm8994_pdata *pdata = wm8994->dev->platform_data;
+ struct wm8994 *wm8994 = dev_get_drvdata(dev);
int ret;
-
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
printk("on wm8994-core.c wm8994_suspend\n");
- if(pdata->lineout_status)
+ if(snd_soc_incall_status(0,0))
{
- printk("lineout is work cannot suspend\n");
+ DBG("incalling cannot suspend\n");
return 0;
}
+#endif
/* Don't actually go through with the suspend if the CODEC is
* still active (eg, for audio passthrough from CP. */
ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_1);
static int wm8994_resume(struct device *dev)
{
- struct wm8994 *wm8994 = dev_get_drvdata(dev);
- struct wm8994_pdata *pdata = wm8994->dev->platform_data;
+ struct wm8994 *wm8994 = dev_get_drvdata(dev);
int ret;
-
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
printk("on wm8994-core.c wm8994_resume\n");
- if(pdata->lineout_status)
+ if(snd_soc_incall_status(0,0))
{
- printk("lineout is work cannot suspend\n");
+ DBG("incalling cannot resume\n");
return 0;
- }
+ }
+#endif
/* We may have lied to the PM core about suspending */
if (!wm8994->suspended)
return 0;
/* WM8958 microphone bias configuration */
int micbias[2];
-
- unsigned int lineout_status:1;
};
#endif
SND_SOC_RBTREE_COMPRESSION
};
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
+int snd_soc_incall_status(int read_or_write, int status);
+#endif
+
+
int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
unsigned int freq, int dir);
int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
int lineout_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *control, int event)
{
- struct snd_soc_codec *codec = w->codec;
- struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
- struct wm8994_pdata *pdata = wm8994->pdata;
+// struct snd_soc_codec *codec = w->codec;
+// struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
+// struct wm8994_pdata *pdata = wm8994->pdata;
// printk("Enter %s::%s---%d\n",__FILE__,__FUNCTION__,__LINE__);
-
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
switch (event) {
case SND_SOC_DAPM_POST_PMU:
printk("wm8994 is incall status\n");
- pdata->lineout_status = 1;
-
+ snd_soc_incall_status(1,1);
break;
case SND_SOC_DAPM_PRE_PMD:
printk("wm8994 exit incall status\n");
- pdata->lineout_status = 0;
+ snd_soc_incall_status(1,0);
break;
default:
BUG();
break;
}
-
+#endif
return 0;
}
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = codec->control_data;
- struct wm8994_pdata *pdata = wm8994->pdata;
int i, ret;
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
DBG("on wm8994.c wm8994_suspend\n");
- if(pdata->lineout_status)
+ if(snd_soc_incall_status(0,0))
{
- DBG("lineout is work cannot suspend\n");
+ DBG("incalling cannot suspend\n");
return 0;
}
+#endif
switch (control->type) {
case WM8994:
snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0);
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = codec->control_data;
- struct wm8994_pdata *pdata = wm8994->pdata;
int i, ret;
unsigned int val, mask;
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
printk("on wm8994.c wm8994_resume\n");
- if(pdata->lineout_status)
+ if(snd_soc_incall_status(0,0))
{
- DBG("lineout is work cannot resume\n");
+ DBG("incalling cannot resume\n");
return 0;
}
+#endif
+
if (wm8994->revision < 4) {
/* force a HW read */
val = wm8994_reg_read(codec->control_data,
dev_info(codec->dev, "have not pa control\n");
//lineout off
- pdata->lineout_status = 0;
// snd_soc_dapm_new_controls(dapm, wm8994_lineout_status_dapm_widgets,
// ARRAY_SIZE(wm8994_lineout_status_dapm_widgets));
// snd_soc_dapm_add_routes(dapm, wm8994_lineout_status_intercon,
default n
help
adjust volume by codec
-
+
+config PHONE_INCALL_IS_SUSPEND
+ bool "Incalling Whether suspend codec"
+ default n
+ help
+ set "y" phone incall status cannot into suspend codec
+
endif
.pointer = soc_pcm_pointer,
};
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
+int snd_soc_incall_status(int read_or_write, int status)
+{
+ static int now_status = 0;
+ if(read_or_write == 1)
+ {//write
+ now_status = status;
+ }
+
+ return now_status;
+}
+EXPORT_SYMBOL_GPL(snd_soc_incall_status);
+#endif
+
+
#ifdef CONFIG_PM_SLEEP
/* powers down audio subsystem for suspend */
int snd_soc_suspend(struct device *dev)
struct snd_soc_card *card = dev_get_drvdata(dev);
struct snd_soc_codec *codec;
int i;
-
+
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
+ if(snd_soc_incall_status(0,0))
+ {
+ printk("card is incall cannot into suspend\n");
+ return 0;
+ }
+#endif
/* If the initialization of this soc device failed, there is no codec
* associated with it. Just bail out in this case.
*/
* left with bias OFF or STANDBY and suspended so we must now
* resume. Otherwise the suspend was suppressed.
*/
+
if (codec->driver->resume && codec->suspended) {
switch (codec->dapm.bias_level) {
case SND_SOC_BIAS_STANDBY:
{
struct snd_soc_card *card = dev_get_drvdata(dev);
int i, ac97_control = 0;
-
+
+#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND
+ if(snd_soc_incall_status(0,0))
+ {
+ printk("card is incall cannot into suspend\n");
+ return 0;
+ }
+#endif
/* AC97 devices might have other drivers hanging off them so
* need to resume immediately. Other drivers don't have that
* problem and may take a substantial amount of time to resume