static int q6_ioctl(struct inode *inode, struct file *file,
		    unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];
	uint32_t mute_status;

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_do_routing(id[0], id[1]);
		break;
	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_rx_volume(n);
		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc) {
			if (voice_started) {
				if (n == 1)
					mute_status = STREAM_MUTE;
				else
					mute_status = STREAM_UNMUTE;
			} else {
				if (n == 1)
					mute_status = DEVICE_MUTE;
				else
					mute_status = DEVICE_UNMUTE;
			}

			rc = q6audio_set_tx_mute(mute_status);
		}
		break;
	case AUDIO_UPDATE_ACDB:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_update_acdb(id[0], 0);
		break;
	case AUDIO_START_VOICE:
		rc = q6_voice_start();
		break;
	case AUDIO_STOP_VOICE:
		rc = q6_voice_stop();
		break;
	case AUDIO_REINIT_ACDB:
		rc = 0;
		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
Example #2
0
static int q6_ioctl(struct inode *inode, struct file *file,
		    unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc) {
			rc = q6audio_do_routing(id[0], id[1]);
			pr_info("[Audio_CTL] id[0] = 0x%x, id[1] = 0x%x\n",id[0], id[1]);
		}
		break;
	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_rx_volume(n);
		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_tx_mute(n);
		break;
	case AUDIO_UPDATE_ACDB:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_update_acdb(id[0], 0);
		break;
	case AUDIO_START_VOICE:
		rc = q6_voice_start();
		break;
	case AUDIO_STOP_VOICE:
		rc = q6_voice_stop();
		break;
	case AUDIO_START_FM:
		rc = q6_fm_start();
		break;
	case AUDIO_STOP_FM:
		rc = q6_fm_stop();
		break;
	case AUDIO_REINIT_ACDB:
		rc = 0;
		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
Example #3
0
static long q6_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];
	char filename[64];

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (rc) {
			pr_err("%s: bad user address\n", __func__);
			rc = -EFAULT;
		} else
			rc = q6audio_do_routing(id[0], id[1]);
		break;
	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (rc) {
			pr_err("%s: bad user address\n", __func__);
			rc = -EFAULT;
		} else
			rc = q6audio_set_rx_volume(n);
		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (rc) {
			pr_err("%s: bad user address\n", __func__);
			rc = -EFAULT;
		} else
			rc = q6audio_set_tx_mute(n);
		break;
	case AUDIO_UPDATE_ACDB:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (rc) {
			pr_err("%s: bad user address\n", __func__);
			rc = -EFAULT;
		} else
			rc = q6audio_update_acdb(id[0], id[1]);
		break;
	case AUDIO_START_VOICE:
		if (arg == 0)
			id[0] = id[1] = 0;
		else if (copy_from_user(&id, (void *)arg, sizeof(id))) {
			pr_info("voice: copy acdb_id from user failed\n");
			rc = -EFAULT;
			break;
		}
		rc = q6_voice_start(id[0], id[1]);
		break;
	case AUDIO_STOP_VOICE:
		rc = q6_voice_stop();
		break;
	case AUDIO_START_FM:
	        rc = q6_fm_start();
        	break;
	case AUDIO_STOP_FM:
	    	rc = q6_fm_stop();
		break;
	case AUDIO_REINIT_ACDB:
		rc = copy_from_user(&filename, (void *)arg, sizeof(filename));
		if (rc) {
			pr_err("%s: bad user address\n", __func__);
			rc = -EFAULT;
		} else
			rc = q6audio_reinit_acdb(filename);
		break;
	default:
		pr_info("%s: unknown %d\n", __func__, cmd);
		rc = -EINVAL;
	}

	return rc;
}
Example #4
0
static long q6_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];
	char filename[64];

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_do_routing(id[0], id[1]);
		break;
	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_rx_volume(n);
		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_tx_mute(n);
		break;
	case AUDIO_UPDATE_ACDB:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_update_acdb(id[0], id[1]);
		break;
	case AUDIO_START_VOICE:
		if (arg == 0) {
			id[0] = id[1] = 0;
		} else if (copy_from_user(&id, (void*) arg, sizeof(id))) {
			pr_info("voice: copy acdb_id from user failed\n");
			rc = -EFAULT;
			break;
		}
		rc = q6_voice_start(id[0], id[1]);
		break;
	case AUDIO_STOP_VOICE:
		rc = q6_voice_stop();
		break;
	case AUDIO_START_FM:
		rc = q6_fm_start();
		break;
	case AUDIO_STOP_FM:
		rc = q6_fm_stop();
		break;
	case AUDIO_REINIT_ACDB:
		rc = copy_from_user(&filename, (void *)arg, sizeof(filename));
		if (!rc)
			rc = q6audio_reinit_acdb(filename);
		break;
	case AUDIO_ENABLE_AUXPGA_LOOPBACK: {
		uint32_t enable;
		if (copy_from_user(&enable, (void*) arg, sizeof(enable))) {
			rc = -EFAULT;
			break;
		}
		rc = enable_aux_loopback(enable);
		break;
	}
	default:
		rc = -EINVAL;
	}

	return rc;
}
Example #5
0
static int q6_ioctl(struct inode *inode, struct file *file,
		    unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];
	char filename[64];

//	printk("$$$ AUDIO IOCTL=%08X\n", cmd);

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		AUDIO_INFO("SWITCH DEVICE %d, acdb %d\n", id[0], id[1]);
		if (!rc)
			rc = q6audio_do_routing(id[0], id[1]);
		break;
	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_rx_volume(n);
		break;
	case AUDIO_SET_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_tx_mute(n);
		break;
	case AUDIO_UPDATE_ACDB:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc)
			rc = q6audio_update_acdb(id[0], id[1]);
		break;
	case AUDIO_START_VOICE:
		if (arg == 0) {
			id[0] = id[1] = 0;
		} else if (copy_from_user(&id, (void*) arg, sizeof(id))) {
			pr_info("voice: copy acdb_id from user failed\n");
			rc = -EFAULT;
			break;
		}
		AUDIO_INFO("voice: start\n");
		rc = q6_voice_start(id[0], id[1]);
		break;
	case AUDIO_STOP_VOICE:
		AUDIO_INFO("voice: stop\n");
		rc = q6_voice_stop();
		break;
	case AUDIO_START_FM:
		AUDIO_INFO("FM: start\n");
		rc = q6_fm_start();
		break;
	case AUDIO_STOP_FM:
		AUDIO_INFO("FM: stop\n");
		rc = q6_fm_stop();
		break;
	case AUDIO_REINIT_ACDB:
		rc = copy_from_user(&filename, (void *)arg, sizeof(filename));
		if (!rc)
			rc = q6audio_reinit_acdb(filename);
		break;
	case AUDIO_ENABLE_AUXPGA_LOOPBACK: {
		uint32_t enable;
		if (copy_from_user(&enable, (void*) arg, sizeof(enable))) {
			rc = -EFAULT;
			break;
		}
		AUDIO_INFO("audio_ctl: enable aux loopback %d\n", enable);
		rc = enable_aux_loopback(enable);
		break;
	}
	case AUDIO_SET_AUXPGA_GAIN: {
		int level;
		if (copy_from_user(&level, (void*) arg, sizeof(level))) {
			rc = -EFAULT;
			break;
		}
		AUDIO_INFO("audio_ctl: set aux gain %d\n", level);
		rc = set_aux_gain(level);
		break;
	}
	case AUDIO_SET_RX_MUTE:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
			rc = q6audio_set_rx_mute(n);
		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
Example #6
0
static int q6_ioctl(struct inode *inode, struct file *file,
		    unsigned int cmd, unsigned long arg)
{
	int rc;
	uint32_t n;
	uint32_t id[2];
	uint32_t mute_status;

	switch (cmd) {
	case AUDIO_SWITCH_DEVICE:
		rc = copy_from_user(&id, (void *)arg, sizeof(id));
		if (!rc) {
			D("AUDIO_SWITCH_DEVICE to 0x%x\n", id[0]);
			if (id[0] <= 0xff){

				uint32_t  	arg1 = 0;
				uint32_t	arg2 = 0;
				
				rc = q6_voice_stop();
				printk("voice stop rc = %d\n", rc);						
				if (QISDA_HANDSET_LOOKBACK == id[0]){
					arg1 = SMEM_PC_OEM_AUD_LB_HANDSET;
				}
				else if (QISDA_HEADSET_LOOKBACK == id[0] ){
					rc = q6_voice_start();
					printk("voice start rc = %d\n", rc);					
					arg1 = SMEM_PC_OEM_AUD_LB_HEADSET;
				}
				else if( QISDA_LOUDSPEAKER_LOOKBACK == id[0] ){
						
					arg1 = SMEM_PC_OEM_AUD_LB_LOUDSPEAKER;
				}
				else if(QISDA_HANDSET_LOOKBACK_START == id[0] ){

					arg1 = SMEM_PC_OEM_AUD_LB_HANDSET_START;
				}
				else if(QISDA_HANDSET_LOOKBACK_STOP == id[0] ){
					 arg1 = SMEM_PC_OEM_AUD_LB_HANDSET_STOP;

				}
				rc = cust_mproc_comm1(&arg1,&arg2);
				D("Start rout to loopback mode arg1 = %d, ret = %d\n", arg1, rc);	
			}	
			else{			
			rc = q6audio_do_routing(id[0], id[1]);
			}
		}
		break;

	case AUDIO_SET_VOLUME:
		rc = copy_from_user(&n, (void *)arg, sizeof(n));
		if (!rc)
		{
			pr_info("[%s:%s] SET_VOLUME: vol = %d\n", __MM_FILE__,
					__func__, n);
			if ((atomic_read(&voice_started)) || ( n > 100 ))
			{
				pr_info("[%s:%s] SET_VOLUME: vol = %d\n", __MM_FILE__,
					__func__, n);
			rc = q6audio_set_rx_volume(n);
			}
			else
			{
				if( n == 0)
#ifdef CONFIG_DSC_FORCE_SPEAKER_ENABLE
//hPa
//cm7 streak
					q6audio_pmic_speaker_enable(1);
#else
					q6audio_pmic_speaker_enable(0);
#endif
				else
					q6audio_pmic_speaker_enable(1);
				
			}
			
		}