summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Kumar Dasari <Arun@codeaurora.org>2016-08-09 16:22:38 +0530
committerSurendar karka <sukark@codeaurora.org>2016-11-24 21:08:09 +0530
commit35f5cc528f6a190d336c888fde3541de4ce31a67 (patch)
treef153dba77ddf8cd9cad387f91b8acc734598ae2a
parent2ca2287f95d909d734786ee147c594cb0e36e9a8 (diff)
misc: qcom: qdsp6v2: modify amr decoder driver
Modify decoder driver for amrwb and amrnb. Add compat ioctl to support 32-bit architecture. CRs-Fixed: 1094107 Change-Id: I7d463e4e14c896be33ffb3be418b9f91f49107c5 Signed-off-by: Yamit Mehta <ymehta@codeaurora.org> Signed-off-by: Surendar karka <sukark@codeaurora.org>
-rw-r--r--drivers/misc/qcom/qdsp6v2/audio_amrnb.c50
-rw-r--r--drivers/misc/qcom/qdsp6v2/audio_amrwb.c50
2 files changed, 100 insertions, 0 deletions
diff --git a/drivers/misc/qcom/qdsp6v2/audio_amrnb.c b/drivers/misc/qcom/qdsp6v2/audio_amrnb.c
index 78bcdb74af0e..9e4f74bfacd9 100644
--- a/drivers/misc/qcom/qdsp6v2/audio_amrnb.c
+++ b/drivers/misc/qcom/qdsp6v2/audio_amrnb.c
@@ -14,6 +14,9 @@
* GNU General Public License for more details.
*
*/
+
+#include <linux/types.h>
+#include <linux/compat.h>
#include "audio_utils_aio.h"
static struct miscdevice audio_amrnb_misc;
@@ -68,6 +71,52 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return rc;
}
+static long audio_compat_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ struct q6audio_aio *audio = file->private_data;
+ int rc = 0;
+
+ switch (cmd) {
+ case AUDIO_START: {
+ pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
+ audio, audio->ac->session);
+ if (audio->feedback == NON_TUNNEL_MODE) {
+ /* Configure PCM output block */
+ rc = q6asm_enc_cfg_blk_pcm(audio->ac,
+ audio->pcm_cfg.sample_rate,
+ audio->pcm_cfg.channel_count);
+ if (rc < 0) {
+ pr_err("%s: pcm output block config failed rc=%d\n",
+ __func__, rc);
+ break;
+ }
+ }
+
+ rc = audio_aio_enable(audio);
+ audio->eos_rsp = 0;
+ audio->eos_flag = 0;
+ if (!rc) {
+ audio->enabled = 1;
+ } else {
+ audio->enabled = 0;
+ pr_err("%s: Audio Start procedure failed rc=%d\n",
+ __func__, rc);
+ break;
+ }
+ pr_debug("AUDIO_START success enable[%d]\n", audio->enabled);
+ if (audio->stopped == 1)
+ audio->stopped = 0;
+ break;
+ }
+ default:
+ pr_debug("%s[%pK]: Calling compat ioctl\n", __func__, audio);
+ rc = audio->codec_compat_ioctl(file, cmd, arg);
+ }
+ return rc;
+}
+
+
static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
@@ -155,6 +204,7 @@ static const struct file_operations audio_amrnb_fops = {
.release = audio_aio_release,
.unlocked_ioctl = audio_ioctl,
.fsync = audio_aio_fsync,
+ .compat_ioctl = audio_compat_ioctl,
};
static struct miscdevice audio_amrnb_misc = {
diff --git a/drivers/misc/qcom/qdsp6v2/audio_amrwb.c b/drivers/misc/qcom/qdsp6v2/audio_amrwb.c
index 2283cf26bda9..2403dbbe426b 100644
--- a/drivers/misc/qcom/qdsp6v2/audio_amrwb.c
+++ b/drivers/misc/qcom/qdsp6v2/audio_amrwb.c
@@ -15,6 +15,8 @@
*
*/
+#include <linux/compat.h>
+#include <linux/types.h>
#include "audio_utils_aio.h"
static struct miscdevice audio_amrwb_misc;
@@ -71,6 +73,53 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return rc;
}
+static long audio_compat_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ struct q6audio_aio *audio = file->private_data;
+ int rc = 0;
+
+ switch (cmd) {
+ case AUDIO_START: {
+ pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
+ audio, audio->ac->session);
+ if (audio->feedback == NON_TUNNEL_MODE) {
+ /* Configure PCM output block */
+ rc = q6asm_enc_cfg_blk_pcm(audio->ac,
+ audio->pcm_cfg.sample_rate,
+ audio->pcm_cfg.channel_count);
+ if (rc < 0) {
+ pr_err("%s: pcm output block config failed rc=%d\n",
+ __func__, rc);
+ break;
+ }
+ }
+
+ rc = audio_aio_enable(audio);
+ audio->eos_rsp = 0;
+ audio->eos_flag = 0;
+ if (!rc) {
+ audio->enabled = 1;
+ } else {
+ audio->enabled = 0;
+ pr_err("%s: Audio Start procedure failed rc=%d\n",
+ __func__, rc);
+ break;
+ }
+ pr_debug("%s: AUDIO_START sessionid[%d]enable[%d]\n", __func__,
+ audio->ac->session,
+ audio->enabled);
+ if (audio->stopped == 1)
+ audio->stopped = 0;
+ break;
+ }
+ default:
+ pr_debug("%s[%pK]: Calling compat ioctl\n", __func__, audio);
+ rc = audio->codec_compat_ioctl(file, cmd, arg);
+ }
+ return rc;
+}
+
static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
@@ -159,6 +208,7 @@ static const struct file_operations audio_amrwb_fops = {
.release = audio_aio_release,
.unlocked_ioctl = audio_ioctl,
.fsync = audio_aio_fsync,
+ .compat_ioctl = audio_compat_ioctl,
};
static struct miscdevice audio_amrwb_misc = {