]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/intel_sst/intel_sst_app_interface.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / intel_sst / intel_sst_app_interface.c
index 991440015e9263e415a9449eb9fa7f34dae07f41..a367991d56008e79a0fa2cbca20dcd5594ab1544 100644 (file)
  *  Upper layer interfaces (MAD driver, MMF) to SST driver
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/pci.h>
 #include <linux/fs.h>
 #include <linux/uio.h>
 #include <linux/aio.h>
 #include <linux/uaccess.h>
 #include <linux/firmware.h>
+#include <linux/pm_runtime.h>
 #include <linux/ioctl.h>
 #ifdef CONFIG_MRST_RAR_HANDLER
 #include <linux/rar_register.h>
@@ -58,14 +61,14 @@ static int intel_sst_check_device(void)
 {
        int retval = 0;
        if (sst_drv_ctx->pmic_state != SND_MAD_INIT_DONE) {
-               pr_warn("sst: Sound card not availble\n ");
+               pr_warn("Sound card not available\n");
                return -EIO;
        }
        if (sst_drv_ctx->sst_state == SST_SUSPENDED) {
-               pr_debug("sst: Resuming from Suspended state\n");
+               pr_debug("Resuming from Suspended state\n");
                retval = intel_sst_resume(sst_drv_ctx->pci);
                if (retval) {
-                       pr_debug("sst: Resume Failed= %#x,abort\n", retval);
+                       pr_debug("Resume Failed= %#x,abort\n", retval);
                        return retval;
                }
        }
@@ -97,15 +100,22 @@ static int intel_sst_check_device(void)
  */
 int intel_sst_open(struct inode *i_node, struct file *file_ptr)
 {
-       int retval = intel_sst_check_device();
-       if (retval)
-               return retval;
+       unsigned int retval;
 
        mutex_lock(&sst_drv_ctx->stream_lock);
+       pm_runtime_get_sync(&sst_drv_ctx->pci->dev);
+       retval = intel_sst_check_device();
+       if (retval) {
+               pm_runtime_put(&sst_drv_ctx->pci->dev);
+               mutex_unlock(&sst_drv_ctx->stream_lock);
+               return retval;
+       }
+
        if (sst_drv_ctx->encoded_cnt < MAX_ENC_STREAM) {
                struct ioctl_pvt_data *data =
                        kzalloc(sizeof(struct ioctl_pvt_data), GFP_KERNEL);
                if (!data) {
+                       pm_runtime_put(&sst_drv_ctx->pci->dev);
                        mutex_unlock(&sst_drv_ctx->stream_lock);
                        return -ENOMEM;
                }
@@ -115,9 +125,10 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)
                data->pvt_id = sst_assign_pvt_id(sst_drv_ctx);
                data->str_id = 0;
                file_ptr->private_data = (void *)data;
-               pr_debug("sst: pvt_id handle = %d!\n", data->pvt_id);
+               pr_debug("pvt_id handle = %d!\n", data->pvt_id);
        } else {
                retval = -EUSERS;
+               pm_runtime_put(&sst_drv_ctx->pci->dev);
                mutex_unlock(&sst_drv_ctx->stream_lock);
        }
        return retval;
@@ -136,18 +147,26 @@ int intel_sst_open(struct inode *i_node, struct file *file_ptr)
  */
 int intel_sst_open_cntrl(struct inode *i_node, struct file *file_ptr)
 {
-       int retval = intel_sst_check_device();
-       if (retval)
-               return retval;
+       unsigned int retval;
 
        /* audio manager open */
        mutex_lock(&sst_drv_ctx->stream_lock);
+       pm_runtime_get_sync(&sst_drv_ctx->pci->dev);
+       retval = intel_sst_check_device();
+       if (retval) {
+               pm_runtime_put(&sst_drv_ctx->pci->dev);
+               mutex_unlock(&sst_drv_ctx->stream_lock);
+               return retval;
+       }
+
        if (sst_drv_ctx->am_cnt < MAX_AM_HANDLES) {
                sst_drv_ctx->am_cnt++;
-               pr_debug("sst: AM handle opened...\n");
+               pr_debug("AM handle opened...\n");
                file_ptr->private_data = NULL;
-       } else
+       } else {
                retval = -EACCES;
+               pm_runtime_put(&sst_drv_ctx->pci->dev);
+       }
 
        mutex_unlock(&sst_drv_ctx->stream_lock);
        return retval;
@@ -166,10 +185,11 @@ int intel_sst_release(struct inode *i_node, struct file *file_ptr)
 {
        struct ioctl_pvt_data *data = file_ptr->private_data;
 
-       pr_debug("sst: Release called, closing app handle\n");
+       pr_debug("Release called, closing app handle\n");
        mutex_lock(&sst_drv_ctx->stream_lock);
        sst_drv_ctx->encoded_cnt--;
        sst_drv_ctx->stream_cnt--;
+       pm_runtime_put(&sst_drv_ctx->pci->dev);
        mutex_unlock(&sst_drv_ctx->stream_lock);
        free_stream_context(data->str_id);
        kfree(data);
@@ -181,8 +201,9 @@ int intel_sst_release_cntrl(struct inode *i_node, struct file *file_ptr)
        /* audio manager close */
        mutex_lock(&sst_drv_ctx->stream_lock);
        sst_drv_ctx->am_cnt--;
+       pm_runtime_put(&sst_drv_ctx->pci->dev);
        mutex_unlock(&sst_drv_ctx->stream_lock);
-       pr_debug("sst: AM handle closed\n");
+       pr_debug("AM handle closed\n");
        return 0;
 }
 
@@ -208,7 +229,7 @@ int intel_sst_mmap(struct file *file_ptr, struct vm_area_struct *vma)
                return -EINVAL;
 
        length = vma->vm_end - vma->vm_start;
-       pr_debug("sst: called for stream %d length 0x%x\n", str_id, length);
+       pr_debug("called for stream %d length 0x%x\n", str_id, length);
 
        if (length > sst_drv_ctx->mmap_len)
                return -ENOMEM;
@@ -231,7 +252,7 @@ int intel_sst_mmap(struct file *file_ptr, struct vm_area_struct *vma)
        else
                sst_drv_ctx->streams[str_id].mmapped = true;
 
-       pr_debug("sst: mmap ret 0x%x\n", retval);
+       pr_debug("mmap ret 0x%x\n", retval);
        return retval;
 }
 
@@ -245,7 +266,7 @@ static int intel_sst_mmap_play_capture(u32 str_id,
        struct snd_sst_mmap_buff_entry *buf_entry;
        struct snd_sst_mmap_buff_entry *tmp_buf;
 
-       pr_debug("sst:called for str_id %d\n", str_id);
+       pr_debug("called for str_id %d\n", str_id);
        retval = sst_validate_strid(str_id);
        if (retval)
                return -EINVAL;
@@ -270,7 +291,7 @@ static int intel_sst_mmap_play_capture(u32 str_id,
                goto out_free;
        }
 
-       pr_debug("sst:new buffers count %d status %d\n",
+       pr_debug("new buffers count %d status %d\n",
                        mmap_buf->entries, stream->status);
        buf_entry = tmp_buf;
        for (i = 0; i < mmap_buf->entries; i++) {
@@ -300,14 +321,14 @@ static int intel_sst_mmap_play_capture(u32 str_id,
                stream->status = STREAM_RUNNING;
                if (stream->ops == STREAM_OPS_PLAYBACK) {
                        if (sst_play_frame(str_id) < 0) {
-                               pr_warn("sst: play frames fail\n");
+                               pr_warn("play frames fail\n");
                                mutex_unlock(&stream->lock);
                                retval = -EIO;
                                goto out_free;
                        }
                } else if (stream->ops == STREAM_OPS_CAPTURE) {
                        if (sst_capture_frame(str_id) < 0) {
-                               pr_warn("sst: capture frame fail\n");
+                               pr_warn("capture frame fail\n");
                                mutex_unlock(&stream->lock);
                                retval = -EIO;
                                goto out_free;
@@ -324,7 +345,7 @@ static int intel_sst_mmap_play_capture(u32 str_id,
 
        if (retval >= 0)
                retval = stream->cumm_bytes;
-       pr_debug("sst:end of play/rec ioctl bytes = %d!!\n", retval);
+       pr_debug("end of play/rec ioctl bytes = %d!!\n", retval);
 
 out_free:
        kfree(tmp_buf);
@@ -349,7 +370,7 @@ static int intel_sst_play_capture(struct stream_info *stream, int str_id)
 
        if (stream->status == STREAM_INIT && stream->prev == STREAM_UN_INIT) {
                /* stream is not started yet */
-               pr_debug("sst: Stream isn't in started state %d, prev %d\n",
+               pr_debug("Stream isn't in started state %d, prev %d\n",
                        stream->status, stream->prev);
        } else if ((stream->status == STREAM_RUNNING ||
                        stream->status == STREAM_PAUSED) &&
@@ -358,13 +379,13 @@ static int intel_sst_play_capture(struct stream_info *stream, int str_id)
                if (stream->ops == STREAM_OPS_PLAYBACK ||
                                stream->ops == STREAM_OPS_PLAYBACK_DRM) {
                        if (sst_play_frame(str_id) < 0) {
-                               pr_warn("sst: play frames failed\n");
+                               pr_warn("play frames failed\n");
                                mutex_unlock(&stream->lock);
                                return -EIO;
                        }
                } else if (stream->ops == STREAM_OPS_CAPTURE) {
                        if (sst_capture_frame(str_id) < 0) {
-                               pr_warn("sst: capture frames failed\n ");
+                               pr_warn("capture frames failed\n");
                                mutex_unlock(&stream->lock);
                                return -EIO;
                        }
@@ -379,7 +400,7 @@ static int intel_sst_play_capture(struct stream_info *stream, int str_id)
        retval = sst_wait_interruptible(sst_drv_ctx, &stream->data_blk);
        if (retval) {
                stream->status = STREAM_INIT;
-               pr_debug("sst: wait returned error...\n");
+               pr_debug("wait returned error...\n");
        }
        return retval;
 }
@@ -477,7 +498,7 @@ static int snd_sst_fill_kernel_list(struct stream_info *stream,
                if (((unsigned long)iovec[index].iov_base
                                + iovec[index].iov_len) <
                                ((unsigned long)iovec[index].iov_base)) {
-                       pr_debug("sst: Buffer overflows");
+                       pr_debug("Buffer overflows\n");
                        kfree(stream_bufs);
                        return -EINVAL;
                }
@@ -490,7 +511,7 @@ static int snd_sst_fill_kernel_list(struct stream_info *stream,
                }
 
                copied_size += size;
-               pr_debug("sst: copied_size - %lx\n", copied_size);
+               pr_debug("copied_size - %lx\n", copied_size);
                if ((copied_size >= mmap_len) ||
                                (stream->sg_index == nr_segs)) {
                        add_to_list = 1;
@@ -520,7 +541,7 @@ static int snd_sst_copy_userbuf_capture(struct stream_info *stream,
        int retval = 0;
 
        /* copy sent buffers */
-       pr_debug("sst: capture stream copying to user now...\n");
+       pr_debug("capture stream copying to user now...\n");
        list_for_each_entry_safe(kbufs, _kbufs, &stream->bufs, node) {
                if (kbufs->in_use == true) {
                        /* copy to user */
@@ -538,7 +559,7 @@ static int snd_sst_copy_userbuf_capture(struct stream_info *stream,
                        }
                }
        }
-       pr_debug("sst: end of cap copy\n");
+       pr_debug("end of cap copy\n");
        return retval;
 }
 
@@ -590,7 +611,7 @@ static int intel_sst_read_write(unsigned int str_id, char __user *buf,
                return -EINVAL;
        stream = &sst_drv_ctx->streams[str_id];
        if (stream->mmapped == true) {
-               pr_warn("sst: user write and stream is mapped");
+               pr_warn("user write and stream is mapped\n");
                return -EIO;
        }
        if (!count)
@@ -598,7 +619,7 @@ static int intel_sst_read_write(unsigned int str_id, char __user *buf,
        stream->curr_bytes = 0;
        stream->cumm_bytes = 0;
        /* copy user buf details */
-       pr_debug("sst: new buffers %p, copy size %d, status %d\n" ,
+       pr_debug("new buffers %p, copy size %d, status %d\n" ,
                        buf, (int) count, (int) stream->status);
 
        stream->buf_type = SST_BUF_USER_STATIC;
@@ -618,7 +639,7 @@ static int intel_sst_read_write(unsigned int str_id, char __user *buf,
        stream->cur_ptr = NULL;
        if (retval >= 0)
                retval = stream->cumm_bytes;
-       pr_debug("sst: end of play/rec bytes = %d!!\n", retval);
+       pr_debug("end of play/rec bytes = %d!!\n", retval);
        return retval;
 }
 
@@ -639,7 +660,7 @@ int intel_sst_write(struct file *file_ptr, const char __user *buf,
        int str_id = data->str_id;
        struct stream_info *stream = &sst_drv_ctx->streams[str_id];
 
-       pr_debug("sst: called for %d\n", str_id);
+       pr_debug("called for %d\n", str_id);
        if (stream->status == STREAM_UN_INIT ||
                stream->status == STREAM_DECODE) {
                return -EBADRQC;
@@ -665,12 +686,12 @@ ssize_t intel_sst_aio_write(struct kiocb *kiocb, const struct iovec *iov,
        int str_id = data->str_id;
        struct stream_info *stream;
 
-       pr_debug("sst: entry - %ld\n", nr_segs);
+       pr_debug("entry - %ld\n", nr_segs);
 
        if (is_sync_kiocb(kiocb) == false)
                return -EINVAL;
 
-       pr_debug("sst: called for str_id %d\n", str_id);
+       pr_debug("called for str_id %d\n", str_id);
        retval = sst_validate_strid(str_id);
        if (retval)
                return -EINVAL;
@@ -683,7 +704,7 @@ ssize_t intel_sst_aio_write(struct kiocb *kiocb, const struct iovec *iov,
        }
        stream->curr_bytes = 0;
        stream->cumm_bytes = 0;
-       pr_debug("sst: new segs %ld, offset %d, status %d\n" ,
+       pr_debug("new segs %ld, offset %d, status %d\n" ,
                        nr_segs, (int) offset, (int) stream->status);
        stream->buf_type = SST_BUF_USER_STATIC;
        do {
@@ -698,7 +719,7 @@ ssize_t intel_sst_aio_write(struct kiocb *kiocb, const struct iovec *iov,
        stream->cur_ptr = NULL;
        if (retval >= 0)
                retval = stream->cumm_bytes;
-       pr_debug("sst: end of play/rec bytes = %d!!\n", retval);
+       pr_debug("end of play/rec bytes = %d!!\n", retval);
        return retval;
 }
 
@@ -719,7 +740,7 @@ int intel_sst_read(struct file *file_ptr, char __user *buf,
        int str_id = data->str_id;
        struct stream_info *stream = &sst_drv_ctx->streams[str_id];
 
-       pr_debug("sst: called for %d\n", str_id);
+       pr_debug("called for %d\n", str_id);
        if (stream->status == STREAM_UN_INIT ||
                        stream->status == STREAM_DECODE)
                return -EBADRQC;
@@ -744,14 +765,14 @@ ssize_t intel_sst_aio_read(struct kiocb *kiocb, const struct iovec *iov,
        int str_id = data->str_id;
        struct stream_info *stream;
 
-       pr_debug("sst: entry - %ld\n", nr_segs);
+       pr_debug("entry - %ld\n", nr_segs);
 
        if (is_sync_kiocb(kiocb) == false) {
-               pr_debug("sst: aio_read from user space is not allowed\n");
+               pr_debug("aio_read from user space is not allowed\n");
                return -EINVAL;
        }
 
-       pr_debug("sst: called for str_id %d\n", str_id);
+       pr_debug("called for str_id %d\n", str_id);
        retval = sst_validate_strid(str_id);
        if (retval)
                return -EINVAL;
@@ -764,7 +785,7 @@ ssize_t intel_sst_aio_read(struct kiocb *kiocb, const struct iovec *iov,
        stream->curr_bytes = 0;
        stream->cumm_bytes = 0;
 
-       pr_debug("sst: new segs %ld, offset %d, status %d\n" ,
+       pr_debug("new segs %ld, offset %d, status %d\n" ,
                        nr_segs, (int) offset, (int) stream->status);
        stream->buf_type = SST_BUF_USER_STATIC;
        do {
@@ -779,34 +800,169 @@ ssize_t intel_sst_aio_read(struct kiocb *kiocb, const struct iovec *iov,
        stream->cur_ptr = NULL;
        if (retval >= 0)
                retval = stream->cumm_bytes;
-       pr_debug("sst: end of play/rec bytes = %d!!\n", retval);
+       pr_debug("end of play/rec bytes = %d!!\n", retval);
        return retval;
 }
 
 /* sst_print_stream_params - prints the stream parameters (debug fn)*/
 static void sst_print_stream_params(struct snd_sst_get_stream_params *get_prm)
 {
-       pr_debug("sst: codec params:result =%d\n",
+       pr_debug("codec params:result = %d\n",
                                get_prm->codec_params.result);
-       pr_debug("sst: codec params:stream = %d\n",
+       pr_debug("codec params:stream = %d\n",
                                get_prm->codec_params.stream_id);
-       pr_debug("sst: codec params:codec = %d\n",
+       pr_debug("codec params:codec = %d\n",
                                get_prm->codec_params.codec);
-       pr_debug("sst: codec params:ops = %d\n",
+       pr_debug("codec params:ops = %d\n",
                                get_prm->codec_params.ops);
-       pr_debug("sst: codec params:stream_type= %d\n",
+       pr_debug("codec params:stream_type = %d\n",
                                get_prm->codec_params.stream_type);
-       pr_debug("sst: pcmparams:sfreq= %d\n",
+       pr_debug("pcmparams:sfreq = %d\n",
                                get_prm->pcm_params.sfreq);
-       pr_debug("sst: pcmparams:num_chan= %d\n",
+       pr_debug("pcmparams:num_chan = %d\n",
                                get_prm->pcm_params.num_chan);
-       pr_debug("sst: pcmparams:pcm_wd_sz= %d\n",
+       pr_debug("pcmparams:pcm_wd_sz = %d\n",
                                get_prm->pcm_params.pcm_wd_sz);
        return;
 }
 
 /**
- * intel_sst_ioctl - recieves the device ioctl's
+ * sst_create_algo_ipc - create ipc msg for algorithm parameters
+ *
+ * @algo_params: Algorithm parameters
+ * @msg: post msg pointer
+ *
+ * This function is called to create ipc msg
+ */
+int sst_create_algo_ipc(struct snd_ppp_params *algo_params,
+                                       struct ipc_post **msg)
+{
+       if (sst_create_large_msg(msg))
+               return -ENOMEM;
+       sst_fill_header(&(*msg)->header,
+                       IPC_IA_ALG_PARAMS, 1, algo_params->str_id);
+       (*msg)->header.part.data = sizeof(u32) +
+                       sizeof(*algo_params) + algo_params->size;
+       memcpy((*msg)->mailbox_data, &(*msg)->header, sizeof(u32));
+       memcpy((*msg)->mailbox_data + sizeof(u32),
+                               algo_params, sizeof(*algo_params));
+       return 0;
+}
+
+/**
+ * sst_send_algo_ipc - send ipc msg for algorithm parameters
+ *
+ * @msg: post msg pointer
+ *
+ * This function is called to send ipc msg
+ */
+int sst_send_algo_ipc(struct ipc_post **msg)
+{
+       sst_drv_ctx->ppp_params_blk.condition = false;
+       sst_drv_ctx->ppp_params_blk.ret_code = 0;
+       sst_drv_ctx->ppp_params_blk.on = true;
+       sst_drv_ctx->ppp_params_blk.data = NULL;
+       spin_lock(&sst_drv_ctx->list_spin_lock);
+       list_add_tail(&(*msg)->node, &sst_drv_ctx->ipc_dispatch_list);
+       spin_unlock(&sst_drv_ctx->list_spin_lock);
+       sst_post_message(&sst_drv_ctx->ipc_post_msg_wq);
+       return sst_wait_interruptible_timeout(sst_drv_ctx,
+                       &sst_drv_ctx->ppp_params_blk, SST_BLOCK_TIMEOUT);
+}
+
+/**
+ * intel_sst_ioctl_dsp - recieves the device ioctl's
+ *
+ * @cmd:Ioctl cmd
+ * @arg:data
+ *
+ * This function is called when a user space component
+ * sends a DSP Ioctl to SST driver
+ */
+long intel_sst_ioctl_dsp(unsigned int cmd, unsigned long arg)
+{
+       int retval = 0;
+       struct snd_ppp_params algo_params;
+       struct snd_ppp_params *algo_params_copied;
+       struct ipc_post *msg;
+
+       switch (_IOC_NR(cmd)) {
+       case _IOC_NR(SNDRV_SST_SET_ALGO):
+               if (copy_from_user(&algo_params, (void __user *)arg,
+                                                       sizeof(algo_params)))
+                       return -EFAULT;
+               if (algo_params.size > SST_MAILBOX_SIZE)
+                       return -EMSGSIZE;
+
+               pr_debug("Algo ID %d Str id %d Enable %d Size %d\n",
+                       algo_params.algo_id, algo_params.str_id,
+                       algo_params.enable, algo_params.size);
+               retval = sst_create_algo_ipc(&algo_params, &msg);
+               if (retval)
+                       break;
+               algo_params.reserved = 0;
+               if (copy_from_user(msg->mailbox_data + sizeof(algo_params),
+                               algo_params.params, algo_params.size))
+                       return -EFAULT;
+
+               retval = sst_send_algo_ipc(&msg);
+               if (retval) {
+                       pr_debug("Error in sst_set_algo = %d\n", retval);
+                       retval = -EIO;
+               }
+               break;
+
+       case _IOC_NR(SNDRV_SST_GET_ALGO):
+               if (copy_from_user(&algo_params, (void __user *)arg,
+                                                       sizeof(algo_params)))
+                       return -EFAULT;
+               pr_debug("Algo ID %d Str id %d Enable %d Size %d\n",
+                       algo_params.algo_id, algo_params.str_id,
+                       algo_params.enable, algo_params.size);
+               retval = sst_create_algo_ipc(&algo_params, &msg);
+               if (retval)
+                       break;
+               algo_params.reserved = 1;
+               retval = sst_send_algo_ipc(&msg);
+               if (retval) {
+                       pr_debug("Error in sst_get_algo = %d\n", retval);
+                       retval = -EIO;
+                       break;
+               }
+               algo_params_copied = (struct snd_ppp_params *)
+                                       sst_drv_ctx->ppp_params_blk.data;
+               if (algo_params_copied->size > algo_params.size) {
+                       pr_debug("mem insufficient to copy\n");
+                       retval = -EMSGSIZE;
+                       goto free_mem;
+               } else {
+                       char __user *tmp;
+
+                       if (copy_to_user(algo_params.params,
+                                       algo_params_copied->params,
+                                       algo_params_copied->size)) {
+                               retval = -EFAULT;
+                               goto free_mem;
+                       }
+                       tmp = (char __user *)arg + offsetof(
+                                       struct snd_ppp_params, size);
+                       if (copy_to_user(tmp, &algo_params_copied->size,
+                                                sizeof(__u32))) {
+                               retval = -EFAULT;
+                               goto free_mem;
+                       }
+
+               }
+free_mem:
+               kfree(algo_params_copied->params);
+               kfree(algo_params_copied);
+               break;
+       }
+       return retval;
+}
+
+/**
+ * intel_sst_ioctl - receives the device ioctl's
  * @file_ptr:pointer to file
  * @cmd:Ioctl cmd
  * @arg:data
@@ -832,7 +988,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
 
        switch (_IOC_NR(cmd)) {
        case _IOC_NR(SNDRV_SST_STREAM_PAUSE):
-               pr_debug("sst: IOCTL_PAUSE recieved for %d!\n", str_id);
+               pr_debug("IOCTL_PAUSE received for %d!\n", str_id);
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -841,7 +997,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                break;
 
        case _IOC_NR(SNDRV_SST_STREAM_RESUME):
-               pr_debug("sst: SNDRV_SST_IOCTL_RESUME recieved!\n");
+               pr_debug("SNDRV_SST_IOCTL_RESUME received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -852,7 +1008,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_STREAM_SET_PARAMS): {
                struct snd_sst_params str_param;
 
-               pr_debug("sst: IOCTL_SET_PARAMS recieved!\n");
+               pr_debug("IOCTL_SET_PARAMS received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -884,7 +1040,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                                        retval = -EINVAL;
                        }
                } else {
-                       pr_debug("sst: SET_STREAM_PARAMS recieved!\n");
+                       pr_debug("SET_STREAM_PARAMS received!\n");
                        /* allocated set params only */
                        retval = sst_set_stream_param(str_id, &str_param);
                        /* Block the call for reply */
@@ -907,14 +1063,14 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
 
                if (copy_from_user(&set_vol, (void __user *)arg,
                                sizeof(set_vol))) {
-                       pr_debug("sst: copy failed\n");
+                       pr_debug("copy failed\n");
                        retval = -EFAULT;
                        break;
                }
-               pr_debug("sst: SET_VOLUME recieved for %d!\n",
+               pr_debug("SET_VOLUME recieved for %d!\n",
                                set_vol.stream_id);
                if (minor == STREAM_MODULE && set_vol.stream_id == 0) {
-                       pr_debug("sst: invalid operation!\n");
+                       pr_debug("invalid operation!\n");
                        retval = -EPERM;
                        break;
                }
@@ -929,10 +1085,10 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                        retval = -EFAULT;
                        break;
                }
-               pr_debug("sst: IOCTL_GET_VOLUME recieved for stream = %d!\n",
+               pr_debug("IOCTL_GET_VOLUME recieved for stream = %d!\n",
                                get_vol.stream_id);
                if (minor == STREAM_MODULE && get_vol.stream_id == 0) {
-                       pr_debug("sst: invalid operation!\n");
+                       pr_debug("invalid operation!\n");
                        retval = -EPERM;
                        break;
                }
@@ -941,7 +1097,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                        retval = -EIO;
                        break;
                }
-               pr_debug("sst: id:%d\n, vol:%d, ramp_dur:%d, ramp_type:%d\n",
+               pr_debug("id:%d\n, vol:%d, ramp_dur:%d, ramp_type:%d\n",
                                get_vol.stream_id, get_vol.volume,
                                get_vol.ramp_duration, get_vol.ramp_type);
                if (copy_to_user((struct snd_sst_vol __user *)arg,
@@ -961,7 +1117,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                        retval = -EFAULT;
                        break;
                }
-               pr_debug("sst: SNDRV_SST_SET_VOLUME recieved for %d!\n",
+               pr_debug("SNDRV_SST_SET_VOLUME recieved for %d!\n",
                        set_mute.stream_id);
                if (minor == STREAM_MODULE && set_mute.stream_id == 0) {
                        retval = -EPERM;
@@ -973,7 +1129,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_STREAM_GET_PARAMS): {
                struct snd_sst_get_stream_params get_params;
 
-               pr_debug("sst: IOCTL_GET_PARAMS recieved!\n");
+               pr_debug("IOCTL_GET_PARAMS received!\n");
                if (minor != 0) {
                        retval = -EBADRQC;
                        break;
@@ -997,7 +1153,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_MMAP_CAPTURE): {
                struct snd_sst_mmap_buffs mmap_buf;
 
-               pr_debug("sst: SNDRV_SST_MMAP_PLAY/CAPTURE recieved!\n");
+               pr_debug("SNDRV_SST_MMAP_PLAY/CAPTURE recieved!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -1011,7 +1167,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                break;
        }
        case _IOC_NR(SNDRV_SST_STREAM_DROP):
-               pr_debug("sst: SNDRV_SST_IOCTL_DROP recieved!\n");
+               pr_debug("SNDRV_SST_IOCTL_DROP received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EINVAL;
                        break;
@@ -1023,7 +1179,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                struct snd_sst_tstamp tstamp = {0};
                unsigned long long time, freq, mod;
 
-               pr_debug("sst: SNDRV_SST_STREAM_GET_TSTAMP recieved!\n");
+               pr_debug("SNDRV_SST_STREAM_GET_TSTAMP received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -1044,7 +1200,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_STREAM_START):{
                struct stream_info *stream;
 
-               pr_debug("sst: SNDRV_SST_STREAM_START recieved!\n");
+               pr_debug("SNDRV_SST_STREAM_START received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EINVAL;
                        break;
@@ -1083,7 +1239,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_SET_TARGET_DEVICE): {
                struct snd_sst_target_device target_device;
 
-               pr_debug("sst: SET_TARGET_DEVICE recieved!\n");
+               pr_debug("SET_TARGET_DEVICE recieved!\n");
                if (copy_from_user(&target_device, (void __user *)arg,
                                sizeof(target_device))) {
                        retval = -EFAULT;
@@ -1100,7 +1256,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
        case _IOC_NR(SNDRV_SST_DRIVER_INFO): {
                struct snd_sst_driver_info info;
 
-               pr_debug("sst: SNDRV_SST_DRIVER_INFO recived\n");
+               pr_debug("SNDRV_SST_DRIVER_INFO recived\n");
                info.version = SST_VERSION_NUM;
                /* hard coding, shud get sumhow later */
                info.active_pcm_streams = sst_drv_ctx->stream_cnt -
@@ -1122,7 +1278,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                struct snd_sst_buff_entry *ibuf_tmp, *obuf_tmp;
                char __user *dest;
 
-               pr_debug("sst: SNDRV_SST_STREAM_DECODE recived\n");
+               pr_debug("SNDRV_SST_STREAM_DECODE received\n");
                if (minor != STREAM_MODULE) {
                        retval = -EBADRQC;
                        break;
@@ -1197,7 +1353,7 @@ free_iobufs:
        }
 
        case _IOC_NR(SNDRV_SST_STREAM_DRAIN):
-               pr_debug("sst: SNDRV_SST_STREAM_DRAIN recived\n");
+               pr_debug("SNDRV_SST_STREAM_DRAIN received\n");
                if (minor != STREAM_MODULE) {
                        retval = -EINVAL;
                        break;
@@ -1209,7 +1365,7 @@ free_iobufs:
                unsigned long long __user *bytes = (unsigned long long __user *)arg;
                struct snd_sst_tstamp tstamp = {0};
 
-               pr_debug("sst: STREAM_BYTES_DECODED recieved!\n");
+               pr_debug("STREAM_BYTES_DECODED received!\n");
                if (minor != STREAM_MODULE) {
                        retval = -EINVAL;
                        break;
@@ -1225,7 +1381,7 @@ free_iobufs:
        case _IOC_NR(SNDRV_SST_FW_INFO): {
                struct snd_sst_fw_info *fw_info;
 
-               pr_debug("sst: SNDRV_SST_FW_INFO recived\n");
+               pr_debug("SNDRV_SST_FW_INFO received\n");
 
                fw_info = kzalloc(sizeof(*fw_info), GFP_ATOMIC);
                if (!fw_info) {
@@ -1248,10 +1404,18 @@ free_iobufs:
                kfree(fw_info);
                break;
        }
+       case _IOC_NR(SNDRV_SST_GET_ALGO):
+       case _IOC_NR(SNDRV_SST_SET_ALGO):
+               if (minor != AM_MODULE) {
+                       retval = -EBADRQC;
+                       break;
+               }
+               retval = intel_sst_ioctl_dsp(cmd, arg);
+               break;
        default:
                retval = -EINVAL;
        }
-       pr_debug("sst: intel_sst_ioctl:complete ret code = %d\n", retval);
+       pr_debug("intel_sst_ioctl:complete ret code = %d\n", retval);
        return retval;
 }