From: 邱建斌 Date: Sat, 11 Feb 2012 08:18:12 +0000 (+0800) Subject: add incalling cannot suspend interface X-Git-Tag: firefly_0821_release~9634 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fc7d65d1568811b4540e6c17f747b8a23f82b820;p=firefly-linux-kernel-4.4.55.git add incalling cannot suspend interface --- diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 040d9b4552f9..1dce22260ded 100755 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -28,6 +28,10 @@ #include #include +#ifdef CONFIG_PHONE_INCALL_IS_SUSPEND +#include +#endif + #if 0 #define DBG(x...) printk(KERN_DEBUG x) #else @@ -275,16 +279,16 @@ static const char *wm8958_main_supplies[] = { #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); @@ -329,16 +333,16 @@ static int wm8994_suspend(struct device *dev) 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; diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index fc697fd61dca..8f9411d572f1 100755 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h @@ -177,8 +177,6 @@ struct wm8994_pdata { /* WM8958 microphone bias configuration */ int micbias[2]; - - unsigned int lineout_status:1; }; #endif diff --git a/include/sound/soc.h b/include/sound/soc.h index 0cf11ec0ff3b..d52d36fce6b6 100755 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -258,6 +258,11 @@ enum snd_soc_compress_type { 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, diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 700a1f1e3f57..2322ac47b789 100755 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -912,29 +912,28 @@ static int wm8994_PA_event(struct snd_soc_dapm_widget *w, 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; } @@ -2630,15 +2629,16 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) { 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); @@ -2667,16 +2667,18 @@ static int wm8994_resume(struct snd_soc_codec *codec) { 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, @@ -3395,7 +3397,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) 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, diff --git a/sound/soc/rk29/Kconfig b/sound/soc/rk29/Kconfig index d2772c079bb1..16a990c0174b 100755 --- a/sound/soc/rk29/Kconfig +++ b/sound/soc/rk29/Kconfig @@ -129,5 +129,11 @@ config ADJUST_VOL_BY_CODEC 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 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 493ae7c4c041..4610963ae48f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1031,6 +1031,21 @@ static struct snd_pcm_ops soc_pcm_ops = { .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) @@ -1038,7 +1053,14 @@ 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. */ @@ -1188,6 +1210,7 @@ static void soc_resume_deferred(struct work_struct *work) * 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: @@ -1258,7 +1281,14 @@ int snd_soc_resume(struct device *dev) { 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