Fix: remove spin lock in machine trigger
This commit is contained in:
parent
3392bf394b
commit
95f4fe0688
4 changed files with 14 additions and 3 deletions
2
ac101.c
2
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){
|
||||
|
|
1
ac108.c
1
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;
|
||||
|
|
3
ac10x.h
3
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)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <sound/soc.h>
|
||||
#include <sound/soc-dai.h>
|
||||
#include <sound/simple_card_utils.h>
|
||||
#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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue