public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: [PATCH 06/23] intel_sst: parameter tuning ioctl
Date: Tue, 03 May 2011 17:32:49 +0100	[thread overview]
Message-ID: <20110503163248.24853.15491.stgit@bob.linux.org.uk> (raw)
In-Reply-To: <20110503162919.24853.58699.stgit@bob.linux.org.uk>

From: Vinod Koul <vinod.koul@intel.com>

This patch adds new IOCTL for application interface.

Using parameter tuning IOCTL, application can fine
tune the audio firmware for it's requirement.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 .../staging/intel_sst/intel_sst_app_interface.c    |   37 ++++++++++++++++++++
 drivers/staging/intel_sst/intel_sst_common.h       |    4 +-
 drivers/staging/intel_sst/intel_sst_fw_ipc.h       |    1 +
 drivers/staging/intel_sst/intel_sst_ioctl.h        |    8 ++++
 drivers/staging/intel_sst/intel_sst_ipc.c          |   18 ++++++++++
 5 files changed, 66 insertions(+), 2 deletions(-)


diff --git a/drivers/staging/intel_sst/intel_sst_app_interface.c b/drivers/staging/intel_sst/intel_sst_app_interface.c
index d7454e2..b8c7ddb 100644
--- a/drivers/staging/intel_sst/intel_sst_app_interface.c
+++ b/drivers/staging/intel_sst/intel_sst_app_interface.c
@@ -961,6 +961,34 @@ free_mem:
 	return retval;
 }
 
+
+int sst_ioctl_tuning_params(unsigned long arg)
+{
+	struct snd_sst_tuning_params params;
+	struct ipc_post *msg;
+
+	if (copy_from_user(&params, (void __user *)arg, sizeof(params)))
+		return -EFAULT;
+	if (params.size > SST_MAILBOX_SIZE)
+		return -ENOMEM;
+	pr_debug("Parameter %d, Stream %d, Size %d\n", params.type,
+			params.str_id, params.size);
+	if (sst_create_large_msg(&msg))
+		return -ENOMEM;
+
+	sst_fill_header(&msg->header, IPC_IA_TUNING_PARAMS, 1, params.str_id);
+	msg->header.part.data = sizeof(u32) + sizeof(params) + params.size;
+	memcpy(msg->mailbox_data, &msg->header.full, sizeof(u32));
+	memcpy(msg->mailbox_data + sizeof(u32), &params, sizeof(params));
+	if (copy_from_user(msg->mailbox_data + sizeof(params),
+			(void __user *)(unsigned long)params.addr,
+			params.size)) {
+		kfree(msg->mailbox_data);
+		kfree(msg);
+		return -EFAULT;
+	}
+	return sst_send_algo_ipc(&msg);
+}
 /**
  * intel_sst_ioctl - receives the device ioctl's
  * @file_ptr:pointer to file
@@ -1412,6 +1440,15 @@ free_iobufs:
 		}
 		retval = intel_sst_ioctl_dsp(cmd, arg);
 		break;
+
+	case _IOC_NR(SNDRV_SST_TUNING_PARAMS):
+		if (minor != AM_MODULE) {
+			retval = -EBADRQC;
+			break;
+		}
+		retval = sst_ioctl_tuning_params(arg);
+		break;
+
 	default:
 		retval = -EINVAL;
 	}
diff --git a/drivers/staging/intel_sst/intel_sst_common.h b/drivers/staging/intel_sst/intel_sst_common.h
index 9aff1a3..e37b377 100644
--- a/drivers/staging/intel_sst/intel_sst_common.h
+++ b/drivers/staging/intel_sst/intel_sst_common.h
@@ -28,8 +28,8 @@
  *  Common private declarations for SST
  */
 
-#define SST_DRIVER_VERSION "1.2.14"
-#define SST_VERSION_NUM 0x1214
+#define SST_DRIVER_VERSION "1.2.15"
+#define SST_VERSION_NUM 0x1215
 
 /* driver names */
 #define SST_DRV_NAME "intel_sst_driver"
diff --git a/drivers/staging/intel_sst/intel_sst_fw_ipc.h b/drivers/staging/intel_sst/intel_sst_fw_ipc.h
index 8628a8a..5d0cc56 100644
--- a/drivers/staging/intel_sst/intel_sst_fw_ipc.h
+++ b/drivers/staging/intel_sst/intel_sst_fw_ipc.h
@@ -71,6 +71,7 @@
 #define IPC_IA_DECODE_FRAMES 0x18
 
 #define IPC_IA_ALG_PARAMS 0x1A
+#define IPC_IA_TUNING_PARAMS 0x1B
 
 /* I2L Stream config/control msgs */
 #define IPC_IA_ALLOC_STREAM 0x20 /* Allocate a stream ID */
diff --git a/drivers/staging/intel_sst/intel_sst_ioctl.h b/drivers/staging/intel_sst/intel_sst_ioctl.h
index bebc395..5da5ee0 100644
--- a/drivers/staging/intel_sst/intel_sst_ioctl.h
+++ b/drivers/staging/intel_sst/intel_sst_ioctl.h
@@ -400,6 +400,13 @@ struct snd_sst_dbufs  {
 	struct snd_sst_buffs *obufs;
 };
 
+struct snd_sst_tuning_params {
+	__u8 type;
+	__u8 str_id;
+	__u8 size;
+	__u8 rsvd;
+	__aligned_u64 addr;
+} __attribute__ ((packed));
 /*IOCTL defined here */
 /*SST MMF IOCTLS only */
 #define SNDRV_SST_STREAM_SET_PARAMS _IOR('L', 0x00, \
@@ -428,5 +435,6 @@ struct snd_sst_dbufs  {
 /*DSP Ioctls on /dev/intel_sst_ctrl only*/
 #define SNDRV_SST_SET_ALGO	_IOW('L', 0x30,  struct snd_ppp_params *)
 #define SNDRV_SST_GET_ALGO	_IOWR('L', 0x31,  struct snd_ppp_params *)
+#define SNDRV_SST_TUNING_PARAMS	_IOW('L', 0x32,  struct snd_sst_tuning_params *)
 
 #endif /* __INTEL_SST_IOCTL_H__ */
diff --git a/drivers/staging/intel_sst/intel_sst_ipc.c b/drivers/staging/intel_sst/intel_sst_ipc.c
index 878b19d..5c3444f 100644
--- a/drivers/staging/intel_sst/intel_sst_ipc.c
+++ b/drivers/staging/intel_sst/intel_sst_ipc.c
@@ -416,6 +416,24 @@ void sst_process_reply(struct work_struct *work)
 		}
 		break;
 	}
+
+	case IPC_IA_TUNING_PARAMS: {
+		pr_debug("sst:IPC_TUNING_PARAMS resp: %x\n", msg->header.full);
+		pr_debug("data value %x\n", msg->header.part.data);
+		if (msg->header.part.large) {
+			pr_debug("alg set failed\n");
+			sst_drv_ctx->ppp_params_blk.ret_code =
+							-msg->header.part.data;
+		} else {
+			pr_debug("alg set success\n");
+			sst_drv_ctx->ppp_params_blk.ret_code = 0;
+		}
+		if (sst_drv_ctx->ppp_params_blk.on == true) {
+			sst_drv_ctx->ppp_params_blk.condition = true;
+			wake_up(&sst_drv_ctx->wait_queue);
+		}
+	}
+
 	case IPC_IA_GET_FW_INFO: {
 		struct snd_sst_fw_info *fw_info =
 			(struct snd_sst_fw_info *)msg->mailbox;


  parent reply	other threads:[~2011-05-03 16:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 16:31 [PATCH 00/23] Intel SST driver update Alan Cox
2011-05-03 16:31 ` [PATCH 01/23] intel_sst: Save audio state across D3 on Medfield Alan Cox
2011-05-03 17:42   ` Greg KH
2011-05-03 21:29     ` Alan Cox
2011-05-03 21:39       ` Mark Brown
2011-05-03 21:53         ` Alan Cox
2011-05-03 22:02           ` Greg KH
2011-05-03 22:26             ` Mark Brown
2011-05-03 22:32               ` Greg KH
2011-05-03 22:59                 ` Alan Cox
2011-05-03 23:06                   ` Greg KH
2011-05-04  8:57                     ` Mark Brown
2011-05-10 20:01                       ` Greg KH
2011-05-03 16:32 ` [PATCH 02/23] intel_sst: MSIC codec power optimisation Alan Cox
2011-05-03 16:58   ` Mark Brown
2011-05-03 17:02     ` Alan Cox
2011-05-03 17:02       ` Mark Brown
2011-05-03 16:32 ` [PATCH 03/23] intel_sst: fix unload bugs Alan Cox
2011-05-03 16:32 ` [PATCH 04/23] intel_sst: ignore IRQ when suspended Alan Cox
2011-05-03 16:32 ` [PATCH 05/23] intel_sst: Line out support Alan Cox
2011-05-03 16:32 ` Alan Cox [this message]
2011-05-03 16:33 ` [PATCH 07/23] intel_sst: DMIC routing Alan Cox
2011-05-03 16:33 ` [PATCH 08/23] intel_sst: rework jack implementation Alan Cox
2011-05-03 16:33 ` [PATCH 09/23] intel_sst: Set de-bounce time Alan Cox
2011-05-03 16:33 ` [PATCH 10/23] intel_sst: Enable recording via HS_MIC Alan Cox
2011-05-03 16:33 ` [PATCH 11/23] intel_sst: Enable recording via DMIC Alan Cox
2011-05-03 16:34 ` [PATCH 12/23] intel_sst: Headphone Automute support Alan Cox
2011-05-03 16:34 ` [PATCH 13/23] intel_sst: move jack detection related configs to init time Alan Cox
2011-05-03 16:34 ` [PATCH 14/23] sst: return correct output/input device id Alan Cox
2011-05-03 16:34 ` [PATCH 15/23] intel_sst: make sure the sst_drop_stream() get called when needed Alan Cox
2011-05-03 16:35 ` [PATCH 16/23] intel_sst: MRST can only do mono recording Alan Cox
2011-05-03 16:35 ` [PATCH 17/23] intel_sst: MRST can only do 16bit recording Alan Cox
2011-05-03 16:35 ` [PATCH 18/23] intel_sst: intelmid_v2_control: correct jack event type Alan Cox
2011-05-03 16:37 ` [PATCH 19/23] intel_sst: fix runtime pm issue Alan Cox
2011-05-03 16:38 ` [PATCH 20/23] sst: set default output and input device Alan Cox
2011-05-03 16:38 ` [PATCH 21/23] intel_sst: add Master Volume Alan Cox
2011-05-03 16:43 ` [PATCH 22/23] sst: internal speaker needs setting a GPIO line Alan Cox
2011-05-03 16:43 ` [PATCH 23/23] intel_sst: fix output noises when it's not in playback Alan Cox
2011-05-03 17:15 ` [PATCH 00/23] Intel SST driver update Mark Brown
2011-05-03 18:36   ` Alan Cox
2011-05-03 18:40     ` Mark Brown
2011-05-03 20:27       ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110503163248.24853.15491.stgit@bob.linux.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox