static int snd_stm_pcm_player_stop(struct snd_pcm_substream *substream) { struct snd_stm_pcm_player *pcm_player = snd_pcm_substream_chip(substream); snd_stm_printd(1, "snd_stm_pcm_player_stop(substream=0x%p)\n", substream); BUG_ON(!pcm_player); BUG_ON(!snd_stm_magic_valid(pcm_player)); /* Mute & shutdown DAC */ if (pcm_player->conv_group) { snd_stm_conv_mute(pcm_player->conv_group); snd_stm_conv_disable(pcm_player->conv_group); } /* Disable interrupts */ set__AUD_PCMOUT_IT_EN_CLR__NSAMPLE__CLEAR(pcm_player); set__AUD_PCMOUT_IT_EN_CLR__UNF__CLEAR(pcm_player); disable_irq_nosync(pcm_player->irq); /* Stop PCM player */ set__AUD_PCMOUT_CTRL__MODE__OFF(pcm_player); /* Stop FDMA transfer */ dma_stop_channel(pcm_player->fdma_channel); /* Stop the clock & reset PCM player */ clk_disable(pcm_player->clock); set__AUD_PCMOUT_RST__SRSTP__RESET(pcm_player); return 0; }
void ksnd_pcm_streaming_stop(ksnd_pcm_streaming_t handle) { // Raise the flag set_bit(FLAG_STOPPED, &handle->flags); // Clean ALSA notifications handle->capture_handle->substream->runtime->transfer_ack_end = NULL; // Break transfer (if any) dma_stop_channel(handle->fdma_channel); dma_wait_for_completion(handle->fdma_channel); // Free FDMA resources dma_params_free(&handle->fdma_params); free_dma(handle->fdma_channel); // Free description memory handle->magic = magic_bad; kfree(handle); }