static int msm_pcm_routing_hwdep_compat_ioctl(struct snd_hwdep *hw,
					      struct file *file,
					      unsigned int cmd,
					      unsigned long arg)
{
	int ret = 0;
	void __user *argp = (void __user *)arg;
	pr_debug("%s:cmd %x\n", __func__, cmd);
	switch (cmd) {
	case SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32:
	case SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32:
	case SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND32:
	case SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE32:
		msm_pcm_routing_acquire_lock();
		ret = msm_ds2_dap_compat_ioctl(hw, file, cmd, argp);
		msm_pcm_routing_release_lock();
		break;
	case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER32:
		ret = msm_ds2_dap_compat_ioctl(hw, file, cmd, argp);
		break;
	default:
		pr_err("%s called with invalid control 0x%X\n", __func__, cmd);
		ret = -EINVAL;
		break;
	}
	return ret;

}
/* RMS */
static int msm_qti_pp_get_rms_value_control(struct snd_kcontrol *kcontrol,
					    struct snd_ctl_elem_value *ucontrol)
{
	int rc = 0;
	int be_idx = 0, copp_idx;
	char *param_value;
	int *update_param_value;
	uint32_t param_length = sizeof(uint32_t);
	uint32_t param_payload_len = RMS_PAYLOAD_LEN * sizeof(uint32_t);
	struct msm_pcm_routing_bdai_data msm_bedai;
	param_value = kzalloc(param_length, GFP_KERNEL);
	if (!param_value) {
		pr_err("%s, param memory alloc failed\n", __func__);
		return -ENOMEM;
	}
	msm_pcm_routing_acquire_lock();
	for (be_idx = 0; be_idx < MSM_BACKEND_DAI_MAX; be_idx++) {
		msm_pcm_routing_get_bedai_info(be_idx, &msm_bedai);
		if (msm_bedai.port_id == SLIMBUS_0_TX)
			break;
	}
	if ((be_idx >= MSM_BACKEND_DAI_MAX) || !msm_bedai.active) {
		pr_err("%s, back not active to query rms be_idx:%d\n",
			__func__, be_idx);
		rc = -EINVAL;
		goto get_rms_value_err;
	}
	copp_idx = adm_get_default_copp_idx(SLIMBUS_0_TX);
	if ((copp_idx < 0) || (copp_idx > MAX_COPPS_PER_PORT)) {
		pr_err("%s, no active copp to query rms copp_idx:%d\n",
			__func__ , copp_idx);
		rc = -EINVAL;
		goto get_rms_value_err;
	}
	rc = adm_get_params(SLIMBUS_0_TX, copp_idx,
			RMS_MODULEID_APPI_PASSTHRU,
			RMS_PARAM_FIRST_SAMPLE,
			param_length + param_payload_len,
			param_value);
	if (rc) {
		pr_err("%s: get parameters failed rc=%d\n", __func__, rc);
		rc = -EINVAL;
		goto get_rms_value_err;
	}
	update_param_value = (int *)param_value;
	ucontrol->value.integer.value[0] = update_param_value[0];

	pr_debug("%s: FROM DSP value[0] 0x%x\n",
		__func__, update_param_value[0]);
get_rms_value_err:
	msm_pcm_routing_release_lock();
	kfree(param_value);
	return rc;
}
static int msm_qti_pp_put_eq_enable_mixer(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_value *ucontrol)
{
	int eq_idx = ((struct soc_multi_mixer_control *)
					kcontrol->private_value)->reg;
	int value = ucontrol->value.integer.value[0];

	if ((eq_idx < 0) || (eq_idx >= MAX_EQ_SESSIONS))
		return -EINVAL;
	pr_debug("%s: EQ #%d enable %d\n", __func__,
		eq_idx, value);
	eq_data[eq_idx].enable = value;
	msm_pcm_routing_acquire_lock();
	msm_qti_pp_send_eq_values_(eq_idx);
	msm_pcm_routing_release_lock();
	return 0;
}
static int msm_pcm_routing_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
				       unsigned int cmd, unsigned long arg)
{
	int ret = 0;
	void __user *argp = (void __user *)arg;
	pr_debug("%s:cmd %x\n", __func__, cmd);
	switch (cmd) {
	case SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM:
	case SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM:
	case SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND:
	case SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE:
		msm_pcm_routing_acquire_lock();
		ret = msm_ds2_dap_ioctl(hw, file, cmd, argp);
		msm_pcm_routing_release_lock();
		break;
	case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER:
		ret = msm_ds2_dap_ioctl(hw, file, cmd, argp);
		break;
	case DTS_EAGLE_IOCTL_GET_CACHE_SIZE:
	case DTS_EAGLE_IOCTL_SET_CACHE_SIZE:
	case DTS_EAGLE_IOCTL_GET_PARAM:
	case DTS_EAGLE_IOCTL_SET_PARAM:
	case DTS_EAGLE_IOCTL_SET_CACHE_BLOCK:
	case DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE:
	case DTS_EAGLE_IOCTL_GET_LICENSE:
	case DTS_EAGLE_IOCTL_SET_LICENSE:
	case DTS_EAGLE_IOCTL_SEND_LICENSE:
	case DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS:
		ret = msm_dts_eagle_ioctl(cmd, arg);
		if (ret == -EPERM) {
			pr_err("%s called with invalid control 0x%X\n",
				__func__, cmd);
			ret = -EINVAL;
		}
		break;
	default:
		pr_err("%s called with invalid control 0x%X\n", __func__, cmd);
		ret = -EINVAL;
		break;
	}
	return ret;
}