diff --git a/ac101.c b/ac101.c index 1a7bb78..eb212f8 100644 --- a/ac101.c +++ b/ac101.c @@ -646,8 +646,6 @@ static int ac101_aif1clk(struct snd_soc_codec* codec, int event, int quick) { struct ac10x_priv *ac10x = snd_soc_codec_get_drvdata(codec); int ret = 0; - /* spin_lock move to machine trigger */ - switch (event) { case SND_SOC_DAPM_PRE_PMU: if (ac10x->aif1_clken == 0){ diff --git a/ac108.c b/ac108.c index e9782de..9f79735 100644 --- a/ac108.c +++ b/ac108.c @@ -1216,7 +1216,6 @@ static int ac108_add_widgets(struct snd_soc_codec *codec) { } static int ac108_codec_probe(struct snd_soc_codec *codec) { - spin_lock_init(&ac10x->lock); ac10x->codec = codec; diff --git a/ac10x.h b/ac10x.h index 65e8b76..ae371a6 100644 --- a/ac10x.h +++ b/ac10x.h @@ -29,6 +29,9 @@ /* enable headset detecting & headset button pressing */ #define CONFIG_AC101_SWITCH_DETECT +/* obsolete */ +#define CONFIG_AC10X_TRIG_LOCK 0 + #ifdef AC101_DEBG #define AC101_DBG(format,args...) printk("[AC101] %s() L%d " format, __func__, __LINE__, ##args) diff --git a/seeed-voicecard.c b/seeed-voicecard.c index 174e9f0..1a5151d 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -26,6 +26,7 @@ #include #include #include +#include "ac10x.h" /* * single codec: @@ -47,7 +48,9 @@ struct seeed_card_data { unsigned channels_capture_default; unsigned channels_capture_override; struct snd_soc_dai_link *dai_link; + #if CONFIG_AC10X_TRIG_LOCK spinlock_t lock; + #endif struct work_struct work_codec_clk; #define TRY_STOP_MAX 3 int try_stop; @@ -190,7 +193,9 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *dai = rtd->codec_dai; struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + #if CONFIG_AC10X_TRIG_LOCK unsigned long flags; + #endif int ret = 0; dev_dbg(rtd->card->dev, "%s() stream=%s cmd=%d play:%d, capt:%d\n", @@ -202,11 +207,15 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (cancel_work_sync(&priv->work_codec_clk) != 0) {} + #if CONFIG_AC10X_TRIG_LOCK /* I know it will degrades performance, but I have no choice */ spin_lock_irqsave(&priv->lock, flags); + #endif if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](1); if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](1); + #if CONFIG_AC10X_TRIG_LOCK spin_unlock_irqrestore(&priv->lock, flags); + #endif break; case SNDRV_PCM_TRIGGER_STOP: @@ -587,7 +596,9 @@ static int seeed_voice_card_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(&priv->snd_card, priv); + #if CONFIG_AC10X_TRIG_LOCK spin_lock_init(&priv->lock); + #endif INIT_WORK(&priv->work_codec_clk, work_cb_codec_clk);