X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=sound%2Fpci%2Fpcxhr%2Fpcxhr.c;h=31a3e8e1b2343eb8bc7cf6c77bae04014141bd98;hb=62932df8fb20ba2fb53a95fa52445eba22e821fe;hp=b8c0853a8278167b15f68976d4ad2c4b27229808;hpb=fed8bf19ec20efc0641740b2d10aa589dbd6d1ab;p=mv-sheeva.git diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index b8c0853a827..31a3e8e1b23 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include #include @@ -454,7 +456,7 @@ static int pcxhr_update_r_buffer(struct pcxhr_stream *stream) is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE); stream_num = is_capture ? 0 : subs->number; - snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%x) subs(%d)\n", + snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%zx) subs(%d)\n", is_capture ? 'c' : 'p', chip->chip_idx, (void*)subs->runtime->dma_addr, subs->runtime->dma_bytes, subs->number); @@ -518,7 +520,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) struct timeval my_tv1, my_tv2; do_gettimeofday(&my_tv1); #endif - down(&mgr->setup_mutex); + mutex_lock(&mgr->setup_mutex); /* check the pipes concerned and build pipe_array */ for (i = 0; i < mgr->num_cards; i++) { @@ -537,7 +539,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) } } if (capture_mask == 0 && playback_mask == 0) { - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n"); return; } @@ -548,7 +550,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) /* synchronous stop of all the pipes concerned */ err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); if (err) { - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n", playback_mask, capture_mask); return; @@ -592,7 +594,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) /* synchronous start of all the pipes concerned */ err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1); if (err) { - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n", playback_mask, capture_mask); return; @@ -619,7 +621,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) } spin_unlock_irqrestore(&mgr->lock, flags); - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); #ifdef CONFIG_SND_DEBUG_DETECT do_gettimeofday(&my_tv2); @@ -728,7 +730,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs) } */ - down(&mgr->setup_mutex); + mutex_lock(&mgr->setup_mutex); do { /* if the stream was stopped before, format and buffer were reset */ @@ -744,17 +746,18 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs) /* only the first stream can choose the sample rate */ /* the further opened streams will be limited to its frequency (see open) */ /* set the clock only once (first stream) */ - if (mgr->sample_rate == 0) { + if (mgr->sample_rate != subs->runtime->rate) { err = pcxhr_set_clock(mgr, subs->runtime->rate); if (err) break; + if (mgr->sample_rate == 0) + /* start the DSP-timer */ + err = pcxhr_hardware_timer(mgr, 1); mgr->sample_rate = subs->runtime->rate; - - err = pcxhr_hardware_timer(mgr, 1); /* start the DSP-timer */ } } while(0); /* do only once (so we can use break instead of goto) */ - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return err; } @@ -779,7 +782,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, /* set up format for the stream */ format = params_format(hw); - down(&mgr->setup_mutex); + mutex_lock(&mgr->setup_mutex); stream->channels = channels; stream->format = format; @@ -788,7 +791,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, /* err = pcxhr_set_format(stream); if(err) { - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return err; } */ @@ -800,7 +803,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, err = pcxhr_update_r_buffer(stream); } */ - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return err; } @@ -846,7 +849,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) struct pcxhr_stream *stream; int is_capture; - down(&mgr->setup_mutex); + mutex_lock(&mgr->setup_mutex); /* copy the struct snd_pcm_hardware struct */ runtime->hw = pcxhr_caps; @@ -870,7 +873,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) /* streams in use */ snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n", chip->chip_idx, subs->number); - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return -EBUSY; } @@ -886,7 +889,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) &external_rate) || external_rate == 0) { /* cannot detect the external clock rate */ - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return -EBUSY; } runtime->hw.rate_min = runtime->hw.rate_max = external_rate; @@ -904,7 +907,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) mgr->ref_count_rate++; - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return 0; } @@ -915,7 +918,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs) struct pcxhr_mgr *mgr = chip->mgr; struct pcxhr_stream *stream = subs->runtime->private_data; - down(&mgr->setup_mutex); + mutex_lock(&mgr->setup_mutex); snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number); @@ -928,7 +931,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs) stream->status = PCXHR_STREAM_STATUS_FREE; stream->substream = NULL; - up(&mgr->setup_mutex); + mutex_unlock(&mgr->setup_mutex); return 0; } @@ -1263,7 +1266,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id spin_lock_init(&mgr->msg_lock); /* init setup mutex*/ - init_MUTEX(&mgr->setup_mutex); + mutex_init(&mgr->setup_mutex); /* init taslket */ tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr);