26
26
#include <sound/soc.h>
27
27
#include <sound/soc-dai.h>
28
28
#include <sound/simple_card_utils.h>
29
+ #include "ac10x.h"
29
30
30
31
/*
31
32
* single codec:
@@ -47,7 +48,9 @@ struct seeed_card_data {
47
48
unsigned channels_capture_default ;
48
49
unsigned channels_capture_override ;
49
50
struct snd_soc_dai_link * dai_link ;
51
+ #if CONFIG_AC10X_TRIG_LOCK
50
52
spinlock_t lock ;
53
+ #endif
51
54
struct work_struct work_codec_clk ;
52
55
#define TRY_STOP_MAX 3
53
56
int try_stop ;
@@ -190,7 +193,9 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
190
193
struct snd_soc_pcm_runtime * rtd = substream -> private_data ;
191
194
struct snd_soc_dai * dai = rtd -> codec_dai ;
192
195
struct seeed_card_data * priv = snd_soc_card_get_drvdata (rtd -> card );
196
+ #if CONFIG_AC10X_TRIG_LOCK
193
197
unsigned long flags ;
198
+ #endif
194
199
int ret = 0 ;
195
200
196
201
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
202
207
case SNDRV_PCM_TRIGGER_RESUME :
203
208
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE :
204
209
if (cancel_work_sync (& priv -> work_codec_clk ) != 0 ) {}
210
+ #if CONFIG_AC10X_TRIG_LOCK
205
211
/* I know it will degrades performance, but I have no choice */
206
212
spin_lock_irqsave (& priv -> lock , flags );
213
+ #endif
207
214
if (_set_clock [SNDRV_PCM_STREAM_CAPTURE ]) _set_clock [SNDRV_PCM_STREAM_CAPTURE ](1 );
208
215
if (_set_clock [SNDRV_PCM_STREAM_PLAYBACK ]) _set_clock [SNDRV_PCM_STREAM_PLAYBACK ](1 );
216
+ #if CONFIG_AC10X_TRIG_LOCK
209
217
spin_unlock_irqrestore (& priv -> lock , flags );
218
+ #endif
210
219
break ;
211
220
212
221
case SNDRV_PCM_TRIGGER_STOP :
@@ -587,7 +596,9 @@ static int seeed_voice_card_probe(struct platform_device *pdev)
587
596
588
597
snd_soc_card_set_drvdata (& priv -> snd_card , priv );
589
598
599
+ #if CONFIG_AC10X_TRIG_LOCK
590
600
spin_lock_init (& priv -> lock );
601
+ #endif
591
602
592
603
INIT_WORK (& priv -> work_codec_clk , work_cb_codec_clk );
593
604
0 commit comments