#define ASRC_RATIO_DECIMAL_DEPTH 26
DEFINE_SPINLOCK(data_lock);
+DEFINE_SPINLOCK(pair_lock);
DEFINE_SPINLOCK(input_int_lock);
DEFINE_SPINLOCK(output_int_lock);
unsigned long lock_flags;
/* asrc output work struct */
+ spin_lock_irqsave(&pair_lock, lock_flags);
+ if (!params->pair_hold) {
+ spin_unlock_irqrestore(&pair_lock, lock_flags);
+ return;
+ }
switch (params->output_word_width) {
case ASRC_WIDTH_24_BIT:
asrc_read_output_FIFO_S24(params);
default:
pr_err("%s: error word width\n", __func__);
}
+ spin_unlock_irqrestore(&pair_lock, lock_flags);
/* finish receiving all output data */
spin_lock_irqsave(&output_int_lock, lock_flags);
case ASRC_RELEASE_PAIR:
{
enum asrc_pair_index index;
+ unsigned long lock_flags;
if (copy_from_user
(&index, (void __user *)arg,
sizeof(enum asrc_pair_index))) {
err = -EFAULT;
break;
}
+ params->asrc_active = 0;
+ spin_lock_irqsave(&pair_lock, lock_flags);
+ params->pair_hold = 0;
+ spin_unlock_irqrestore(&pair_lock, lock_flags);
if (params->input_dma_channel)
dma_release_channel(params->input_dma_channel);
if (params->output_dma_channel)
mxc_free_dma_buf(params);
asrc_release_pair(index);
asrc_finish_conv(index);
- params->asrc_active = 0;
- params->pair_hold = 0;
break;
}
case ASRC_CONVERT:
static int mxc_asrc_close(struct inode *inode, struct file *file)
{
struct asrc_pair_params *pair_params;
+ unsigned long lock_flags;
pair_params = file->private_data;
if (pair_params) {
if (pair_params->asrc_active) {
+ pair_params->asrc_active = 0;
dmaengine_terminate_all(
pair_params->input_dma_channel);
dmaengine_terminate_all(
wake_up_interruptible(&pair_params->output_wait_queue);
}
if (pair_params->pair_hold) {
+ spin_lock_irqsave(&pair_lock, lock_flags);
+ pair_params->pair_hold = 0;
+ spin_unlock_irqrestore(&pair_lock, lock_flags);
if (pair_params->input_dma_channel)
dma_release_channel(
pair_params->input_dma_channel);