intel_sst: parameter tuning ioctl
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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
5572a44829
commit
2784a80c97
5 changed files with 66 additions and 2 deletions
|
@ -961,6 +961,34 @@ free_mem:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int sst_ioctl_tuning_params(unsigned long arg)
|
||||||
|
{
|
||||||
|
struct snd_sst_tuning_params params;
|
||||||
|
struct ipc_post *msg;
|
||||||
|
|
||||||
|
if (copy_from_user(¶ms, (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), ¶ms, 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
|
* intel_sst_ioctl - receives the device ioctl's
|
||||||
* @file_ptr:pointer to file
|
* @file_ptr:pointer to file
|
||||||
|
@ -1412,6 +1440,15 @@ free_iobufs:
|
||||||
}
|
}
|
||||||
retval = intel_sst_ioctl_dsp(cmd, arg);
|
retval = intel_sst_ioctl_dsp(cmd, arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case _IOC_NR(SNDRV_SST_TUNING_PARAMS):
|
||||||
|
if (minor != AM_MODULE) {
|
||||||
|
retval = -EBADRQC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retval = sst_ioctl_tuning_params(arg);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
* Common private declarations for SST
|
* Common private declarations for SST
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SST_DRIVER_VERSION "1.2.14"
|
#define SST_DRIVER_VERSION "1.2.15"
|
||||||
#define SST_VERSION_NUM 0x1214
|
#define SST_VERSION_NUM 0x1215
|
||||||
|
|
||||||
/* driver names */
|
/* driver names */
|
||||||
#define SST_DRV_NAME "intel_sst_driver"
|
#define SST_DRV_NAME "intel_sst_driver"
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
#define IPC_IA_DECODE_FRAMES 0x18
|
#define IPC_IA_DECODE_FRAMES 0x18
|
||||||
|
|
||||||
#define IPC_IA_ALG_PARAMS 0x1A
|
#define IPC_IA_ALG_PARAMS 0x1A
|
||||||
|
#define IPC_IA_TUNING_PARAMS 0x1B
|
||||||
|
|
||||||
/* I2L Stream config/control msgs */
|
/* I2L Stream config/control msgs */
|
||||||
#define IPC_IA_ALLOC_STREAM 0x20 /* Allocate a stream ID */
|
#define IPC_IA_ALLOC_STREAM 0x20 /* Allocate a stream ID */
|
||||||
|
|
|
@ -400,6 +400,13 @@ struct snd_sst_dbufs {
|
||||||
struct snd_sst_buffs *obufs;
|
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 */
|
/*IOCTL defined here */
|
||||||
/*SST MMF IOCTLS only */
|
/*SST MMF IOCTLS only */
|
||||||
#define SNDRV_SST_STREAM_SET_PARAMS _IOR('L', 0x00, \
|
#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*/
|
/*DSP Ioctls on /dev/intel_sst_ctrl only*/
|
||||||
#define SNDRV_SST_SET_ALGO _IOW('L', 0x30, struct snd_ppp_params *)
|
#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_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__ */
|
#endif /* __INTEL_SST_IOCTL_H__ */
|
||||||
|
|
|
@ -416,6 +416,24 @@ void sst_process_reply(struct work_struct *work)
|
||||||
}
|
}
|
||||||
break;
|
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: {
|
case IPC_IA_GET_FW_INFO: {
|
||||||
struct snd_sst_fw_info *fw_info =
|
struct snd_sst_fw_info *fw_info =
|
||||||
(struct snd_sst_fw_info *)msg->mailbox;
|
(struct snd_sst_fw_info *)msg->mailbox;
|
||||||
|
|
Loading…
Add table
Reference in a new issue