static int msm8k_audio_dev_ctrl_ioctl(struct inode *inode, struct file *f,
		unsigned int cmd, unsigned long arg)
{
	int rc;
	u32 uparam;
	struct msm_mute_info m;
	struct msm_vol_info v;

	D("%s\n", __func__);

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		if (copy_from_user(&uparam, (void *)arg,
				sizeof(uparam)))
			return CAD_RES_FAILURE;

		rc = audio_switch_device(uparam);
		break;
	case AUDIO_SET_VOLUME:
		if (copy_from_user(&uparam, (void *)arg,
				sizeof(uparam)))
			return CAD_RES_FAILURE;

		rc = audio_set_device_volume(uparam);

		break;
	case AUDIO_SET_VOLUME_PATH:
		if (copy_from_user(&v, (void *)arg,
				sizeof(struct msm_vol_info)))
			return CAD_RES_FAILURE;

		rc = audio_set_device_volume_path(&v);

		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&m, (void *)arg,
				sizeof(struct msm_mute_info));
		if (rc) {
			pr_err("AUDIO_SET_MUTE copy from user failed\n");
			break;
		}

		rc = audio_set_device_mute(&m);

		break;
	case AUDIO_SET_MAX_VOL_ALL:
		rc = volume_set_max_vol_all();

		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
Esempio n. 2
0
static int snd_vol_put(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
{
	int rc = 0;

	rc = audio_set_device_volume(ucontrol->value.integer.value[0]);
	if (rc)
		printk(KERN_ERR "audio_set_device_volume failed\n");
	else
		qsd_glb_ctl.volume = ucontrol->value.integer.value[0];

	return rc;
}