Skip to content

Commit 95f4fe0

Browse files
committed
Fix: remove spin lock in machine trigger
1 parent 3392bf3 commit 95f4fe0

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

ac101.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,6 @@ static int ac101_aif1clk(struct snd_soc_codec* codec, int event, int quick) {
646646
struct ac10x_priv *ac10x = snd_soc_codec_get_drvdata(codec);
647647
int ret = 0;
648648

649-
/* spin_lock move to machine trigger */
650-
651649
switch (event) {
652650
case SND_SOC_DAPM_PRE_PMU:
653651
if (ac10x->aif1_clken == 0){

ac108.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,6 @@ static int ac108_add_widgets(struct snd_soc_codec *codec) {
12161216
}
12171217

12181218
static int ac108_codec_probe(struct snd_soc_codec *codec) {
1219-
12201219
spin_lock_init(&ac10x->lock);
12211220

12221221
ac10x->codec = codec;

ac10x.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
/* enable headset detecting & headset button pressing */
3030
#define CONFIG_AC101_SWITCH_DETECT
3131

32+
/* obsolete */
33+
#define CONFIG_AC10X_TRIG_LOCK 0
34+
3235

3336
#ifdef AC101_DEBG
3437
#define AC101_DBG(format,args...) printk("[AC101] %s() L%d " format, __func__, __LINE__, ##args)

seeed-voicecard.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <sound/soc.h>
2727
#include <sound/soc-dai.h>
2828
#include <sound/simple_card_utils.h>
29+
#include "ac10x.h"
2930

3031
/*
3132
* single codec:
@@ -47,7 +48,9 @@ struct seeed_card_data {
4748
unsigned channels_capture_default;
4849
unsigned channels_capture_override;
4950
struct snd_soc_dai_link *dai_link;
51+
#if CONFIG_AC10X_TRIG_LOCK
5052
spinlock_t lock;
53+
#endif
5154
struct work_struct work_codec_clk;
5255
#define TRY_STOP_MAX 3
5356
int try_stop;
@@ -190,7 +193,9 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
190193
struct snd_soc_pcm_runtime *rtd = substream->private_data;
191194
struct snd_soc_dai *dai = rtd->codec_dai;
192195
struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
196+
#if CONFIG_AC10X_TRIG_LOCK
193197
unsigned long flags;
198+
#endif
194199
int ret = 0;
195200

196201
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
202207
case SNDRV_PCM_TRIGGER_RESUME:
203208
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
204209
if (cancel_work_sync(&priv->work_codec_clk) != 0) {}
210+
#if CONFIG_AC10X_TRIG_LOCK
205211
/* I know it will degrades performance, but I have no choice */
206212
spin_lock_irqsave(&priv->lock, flags);
213+
#endif
207214
if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](1);
208215
if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](1);
216+
#if CONFIG_AC10X_TRIG_LOCK
209217
spin_unlock_irqrestore(&priv->lock, flags);
218+
#endif
210219
break;
211220

212221
case SNDRV_PCM_TRIGGER_STOP:
@@ -587,7 +596,9 @@ static int seeed_voice_card_probe(struct platform_device *pdev)
587596

588597
snd_soc_card_set_drvdata(&priv->snd_card, priv);
589598

599+
#if CONFIG_AC10X_TRIG_LOCK
590600
spin_lock_init(&priv->lock);
601+
#endif
591602

592603
INIT_WORK(&priv->work_codec_clk, work_cb_codec_clk);
593604

0 commit comments

Comments
 (0)