/*
* Description : open uart collision control
* Input : 
* Output : 
*/
static int snfc_uart_control_open(struct inode *inode, struct file *fp)
{
    int rc = 0;

    if(isopen_snfcuartcontrol == 1)
    {
        SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - already open \n");
        return 0;
    }
    SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - start \n");
    isopen_snfcuartcontrol = 1;

    __snfc_uart_control_set_uart_status(UART_STATUS_READY);

        if(gpio_init ==0)
        {
            rc = gpio_request(snfc_gpios.gpio_hvdd,"snfc_hvdd");
            if(rc){
                SNFC_DEBUG_MSG("[snfc_intu_poll] gpio_request snfc_hvdd fail\n");
            }
            snfc_gpio_write(snfc_gpios.gpio_hvdd, GPIO_HIGH_VALUE);

            rc = gpio_request(snfc_gpios.gpio_uicc_con, "snfc_uicc_con");
            {
                SNFC_DEBUG_MSG("[snfc_driver] gpio_request snfc_uicc_con fail\n");
            }
            snfc_gpio_write(snfc_gpios.gpio_uicc_con, GPIO_LOW_VALUE);

            gpio_init = 1;                
        }

    SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - end \n");

    return rc;
}
/*
* Description : 
* Input : 
* Output : 
*/
static int snfc_uart_control_init(void)
{
	int rc=0;

	SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_init - start \n");

	/* register the device file */
	rc = misc_register(&snfc_uart_control_device);
	if (rc)
	{
		SNFC_DEBUG_MSG("[snfc_uart_control] FAIL!! can not register snfc_uart_control \n");
		return rc;
	}
	__snfc_uart_control_set_uart_status(UART_STATUS_READY);
#ifndef	CONFIG_CXD2235AGG_GJ_KDDI
	rc = gpio_request(82,"snfc_hvdd");
	if(rc)
	{
		SNFC_DEBUG_MSG("[snfc_intu_poll] gpio_request snfc_hvdd fail\n");
	}
	snfc_gpio_write(82, GPIO_HIGH_VALUE);	
#endif	
	SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_init - end \n");
// 	koto_abnormal = 2;

	return 0;  	
}
int snfc_hvdd_wait_rfs_low(void)
{
    int rc = 0;

    do{
        snfcpollavail_sig = 0;
        if( snfc_gpio_read(snfc_gpios.gpio_rfs) == GPIO_HIGH_VALUE ){
            snfc_gpio_write(snfc_gpios.gpio_uicc_con ,GPIO_HIGH_VALUE );
        } else {
            snfc_gpio_write(snfc_gpios.gpio_uicc_con ,GPIO_LOW_VALUE );
            break;
        }
        rc = wait_event_interruptible( snfcpollavailwq, snfcpollavail_sig);
    }while(rc != -ERESTARTSYS);

    return rc;
}
Example #4
0
/*
* Description : open uart collision control
* Input :
* Output :
*/
static int snfc_uart_control_open(struct inode *inode, struct file *fp)
{
        int rc = 0;

        if(isopen_snfcuartcontrol == 1)
        {
                SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - already open \n");
                return 0;
        }
        SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - start \n");
        isopen_snfcuartcontrol = 1;

        if(gpio_init ==0)
        {
            rc = gpio_request(snfc_get_hsel_gpio_num(), "snfc_hsel");
            if (rc){
                    SNFC_DEBUG_MSG("[snfc_intu_poll] gpio_request snfc_hsel fail\n");
            }
            rc = gpio_request(GPIO_SNFC_PON, "snfc_pon");
            if (rc){
                    SNFC_DEBUG_MSG("[snfc_intu_poll] gpio_request snfc_pon fail\n");
            }

            //snfc_gpio_open(GPIO_SNFC_HSEL,GPIO_DIRECTION_OUT,GPIO_LOW_VALUE);
            //snfc_gpio_open(GPIO_SNFC_PON,GPIO_DIRECTION_OUT,GPIO_LOW_VALUE);
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] GPIO_SNFC_PON = %d, GPIO_SNFC_HSEL = %d\n",
                    snfc_gpio_read(GPIO_SNFC_PON),snfc_gpio_read(snfc_get_hsel_gpio_num()) );

            rc = gpio_request(snfc_get_hvdd_gpio_num(),"snfc_hvdd");
            if(rc){
                SNFC_DEBUG_MSG("[snfc_intu_poll] gpio_request snfc_hvdd fail\n");
            }
            snfc_gpio_write(snfc_get_hvdd_gpio_num(), GPIO_HIGH_VALUE);

            gpio_init = 1;                
        }
        SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_open - end \n");

        return rc;
}
/*
* Description : 
* Input : 
* Output : 
*/
static long snfc_uart_control_ioctl(struct file *flip, unsigned int cmd, unsigned long arg)
{
	//ioctl_buf *k_buf;
	//int i,err;
	int size;
	_e_snfc_uart_status current_status;
	int autopoll_wait_cnt;
	int break_cnt;
	unsigned char write_buf = 0x00/*, read_buf = 0x00*/;
	int rc =0;
	
	size = _IOC_SIZE(cmd);
	SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] snfc_uart_control_ioctl - start,cmd =%d\n", cmd);
		
	current_status = __snfc_uart_control_get_uart_status();
	if( current_status == UART_STATUS_FOR_FELICA )
	{
		SNFC_DEBUG_MSG("[snfc_uart_control] snfc_uart_control_ioctl, UART is used to FeliCa\n");
		return -1;
	}

	__snfc_uart_control_set_uart_status(UART_STATUS_FOR_NFC);	

	switch(cmd)
	{
		case IOCTL_SNFC_START_SETTING :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_SETTING - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);			
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			mdelay(10); 
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_SETTING - end\n");
			break;
			
		case IOCTL_SNFC_START_AUTOPOLL :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_AUTOPOLL - start\n");
			autopoll_wait_cnt = 0;
			break_cnt = 0;
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);	
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);

			#ifndef CONFIG_CXD2235AGG_GJ_KDDI	
				//SNFC_DEBUG_MSG("[snfc_uart_control] !!!! RFS disable start !!!!\n");
				disable_irq(gpio_to_irq(gpio_rfs));
			#endif
			
			mdelay(10);
			autopoll_status = 1;		
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_AUTOPOLL - end\n");
			break;
			
		case IOCTL_SNFC_START_RW :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_RW - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);				
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			mdelay(10);
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_RW - end\n");
			break;
			
		case IOCTL_SNFC_START_TARGET :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_TARGET - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;	
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);				
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			if(GPIO_HIGH_VALUE == snfc_gpio_read(gpio_rfs))
				mdelay(10);
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_TARGET - end\n");
			break;
			
		case IOCTL_SNFC_START_INTU :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_INTU - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);				
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			//mdelay(10);
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_INTU - end\n");
			break;
			
		case IOCTL_SNFC_START_WAITSIMBOOT:
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_WAITSIMBOOT - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
				break;
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);	
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			mdelay(10);
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_WAITSIMBOOT - end\n");		
			break;
			
		case IOCTL_SNFC_HSEL_UP:
			forced_hsel_up_flag = 1;
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hsel_up\n");	
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_HIGH_VALUE);	
			break;
			
		case IOCTL_SNFC_HSEL_DOWN:	
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hsel_down\n");	
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_LOW_VALUE);
			forced_hsel_up_flag = 0;
			if(forced_pon_up_flag == 0 && forced_hsel_up_flag == 0)
				__snfc_uart_control_set_uart_status(UART_STATUS_READY);
			break;
			
		case IOCTL_SNFC_PON_UP:
			forced_pon_up_flag = 1;
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_pon_up\n");	
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_HIGH_VALUE);
			mdelay(10);
			break;
			
		case IOCTL_SNFC_PON_DOWN:	
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_pon_down\n");	
			forced_pon_up_flag = 0;
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_LOW_VALUE);	
			if(forced_pon_up_flag == 0 && forced_hsel_up_flag == 0)
				__snfc_uart_control_set_uart_status(UART_STATUS_READY);
			break;

		case IOCTL_SNFC_BOOT_CEN_HI:		//Kernel init only
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_boot_hi\n");
			SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] CEN = High (UNLOCK) \n");
			write_buf = 0x81; // set unlock  
			//mutex_lock(&nfc_cen_mutex);	
			rc = snfc_i2c_write(0x02, &write_buf, 1);
			//mutex_unlock(&nfc_cen_mutex);   
			break;
			
		case IOCTL_SNFC_BOOT_CEN_LO:	//Kernel init only
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_boot_low\n");
			SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] CEN = Low (LOCK) \n");
			write_buf = 0x80; // set lock
			//mutex_lock(&nfc_cen_mutex);
			rc = snfc_i2c_write(0x02, &write_buf, 1);
			//mutex_unlock(&nfc_cen_mutex);  			
			break;

		case IOCTL_SNFC_HVDD_DOWN_SET:
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hvdd_down\n");
			while(koto_abnormal == 10)
			{
				if(snfc_poweroff_flag == 1)
				{
					break;
				}
				usleep(100);
			}		
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hvdd_down HVDD %d\n",snfc_gpio_read(86));
			break;
			
		case IOCTL_SNFC_END :
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_END - start\n");
			if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
			{
				SNFC_DEBUG_MSG("[snfc_uart_control] pon & hsel forced up!! pon and/or sel will keep high\n");
				break;
			}
			if(current_status != UART_STATUS_FOR_NFC)
			{
				SNFC_DEBUG_MSG("[snfc_uart_control] IOCTL_SNFC_END, UART is not used to NFC\n");
				//return -2;
			}				
			snfc_gpio_write(GPIO_SNFC_HSEL, GPIO_LOW_VALUE);
			snfc_gpio_write(GPIO_SNFC_PON, GPIO_LOW_VALUE);	
			__snfc_uart_control_set_uart_status(UART_STATUS_READY);
			
			#ifndef CONFIG_CXD2235AGG_GJ_KDDI	
				if(autopoll_status == 1) 
				{
					//SNFC_DEBUG_MSG("[snfc_uart_control] !!!! RFS disable end !!!!\n");
					enable_irq(gpio_to_irq(gpio_rfs));
				}
			#endif
			
			autopoll_status = 0;
			SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_END - end (hsel low)(pon low)\n");
			break;			
			
	}
	SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_ioctl - end\n");

	return 0;
}
/*
* Description :
* Input :
* Output :
*/
static long snfc_uart_control_ioctl(struct file *flip, unsigned int cmd, unsigned long arg)
{
    //ioctl_buf *k_buf;
    //int i,err;
    int size;
    _e_snfc_uart_status current_status;
       int break_cnt;
    int autopoll_wait_cnt;
    unsigned char write_buf = 0x00/*, read_buf = 0x00*/;
    int rc =0;
    int snfcbootmode;

    size = _IOC_SIZE(cmd);
    SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] snfc_uart_control_ioctl - start,cmd =%d\n", cmd);

    if(cmd == IOCTL_SNFC_READ_BOOTMODE){
            snfcbootmode = lge_get_boot_mode();
            SNFC_DEBUG_MSG("[snfc_uart_control] read boot mode %d \n",snfcbootmode);
             // 0 : NORMAL, 1 : CHARGER, 2 : CHARGERLOGO, 3 : FACTORY, 4 : FACTORY2, 5 : PIFBOOT, 6 : PIFBOOT2, 7 : MINIOS
            return snfcbootmode;
    }
    current_status = __snfc_uart_control_get_uart_status();
    if( current_status == UART_STATUS_FOR_FELICA )
    {
        SNFC_DEBUG_MSG("[snfc_uart_control] snfc_uart_control_ioctl, UART is used to FeliCa\n");
        return -1;
    }

    __snfc_uart_control_set_uart_status(UART_STATUS_FOR_NFC);

    switch(cmd)
    {
        case IOCTL_SNFC_START_SETTING :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_SETTING - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            mdelay(10);
                  SNFC_DEBUG_MSG_LOW("[snfc_uart_control] hsel %d, pon %d\n",
                    snfc_gpios.gpio_hsel,snfc_gpios.gpio_pon);
                  SNFC_DEBUG_MSG_LOW("[snfc_driver] GPIO_SNFC_PON = %d, GPIO_SNFC_HSEL = %d, GPIO_SNFC_HBDD = %d\n",
                    snfc_gpio_read(snfc_gpios.gpio_pon),snfc_gpio_read(snfc_gpios.gpio_hsel),snfc_gpio_read(snfc_gpios.gpio_hvdd)  );
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_SETTING - end\n");
            break;

        case IOCTL_SNFC_START_AUTOPOLL :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_AUTOPOLL - start\n");
            autopoll_wait_cnt = 0;
            break_cnt = 0;
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            mdelay(10);
            autopoll_status = 1;
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_AUTOPOLL - end\n");
            break;

        case IOCTL_SNFC_START_RW :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_RW - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            mdelay(10);
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_RW - end\n");
            break;

        case IOCTL_SNFC_START_TARGET :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_TARGET - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            if(GPIO_HIGH_VALUE == snfc_gpio_read(snfc_gpios.gpio_rfs))
                mdelay(10);
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_TARGET - end\n");
            break;

        case IOCTL_SNFC_START_INTU :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_INTU - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            //mdelay(10);
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_INTU - end\n");
            break;

        case IOCTL_SNFC_START_WAITSIMBOOT:
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_WAITSIMBOOT - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
                break;
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            mdelay(10);
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_START_WAITSIMBOOT - end\n");
            break;

        case IOCTL_SNFC_HSEL_UP:
            forced_hsel_up_flag = 1;
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hsel_up\n");
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_HIGH_VALUE);
            break;

        case IOCTL_SNFC_HSEL_DOWN:
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_hsel_down\n");
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_LOW_VALUE);
            forced_hsel_up_flag = 0;
            if(forced_pon_up_flag == 0 && forced_hsel_up_flag == 0)
                __snfc_uart_control_set_uart_status(UART_STATUS_READY);
            break;

        case IOCTL_SNFC_PON_UP:
            forced_pon_up_flag = 1;
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_pon_up\n");
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_HIGH_VALUE);
            mdelay(10);
            break;

        case IOCTL_SNFC_PON_DOWN:
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_pon_down\n");
            forced_pon_up_flag = 0;
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_LOW_VALUE);
            if(forced_pon_up_flag == 0 && forced_hsel_up_flag == 0)
                __snfc_uart_control_set_uart_status(UART_STATUS_READY);
            break;

        case IOCTL_SNFC_BOOT_CEN_HI:        //Kernel init only
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_boot_hi\n");
            SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] CEN = High (UNLOCK) \n");
            write_buf = 0x81; // set unlock
            //mutex_lock(&nfc_cen_mutex);
            rc = snfc_i2c_write(0x02, &write_buf, 1, snfc_i2c_dev.client);
            //mutex_unlock(&nfc_cen_mutex);
            break;

        case IOCTL_SNFC_BOOT_CEN_LO:    //Kernel init only
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] ioctl_snfc_boot_low\n");
            SNFC_DEBUG_MSG_MIDDLE("[snfc_uart_control] CEN = Low (LOCK) \n");
            write_buf = 0x80; // set lock
            //mutex_lock(&nfc_cen_mutex);
            rc = snfc_i2c_write(0x02, &write_buf, 1, snfc_i2c_dev.client);
            //mutex_unlock(&nfc_cen_mutex);
            break;

           case IOCTL_SNFC_HVDD_DOWN_SET:
                 SNFC_DEBUG_MSG("snfc_uart_control] before HVDD Down\n");
                 snfc_hvdd_wait_rfs_low();
                 break;

        case IOCTL_SNFC_END :
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_END - start\n");
            if(forced_pon_up_flag == 1 || forced_hsel_up_flag == 1)
            {
                SNFC_DEBUG_MSG("[snfc_uart_control] pon & hsel forced up!! pon and/or sel will keep high\n");
                break;
            }
            if(current_status != UART_STATUS_FOR_NFC)
            {
                SNFC_DEBUG_MSG("[snfc_uart_control] IOCTL_SNFC_END, UART is not used to NFC\n");
                //return -2;
            }
            snfc_gpio_write(snfc_gpios.gpio_hsel, GPIO_LOW_VALUE);
            snfc_gpio_write(snfc_gpios.gpio_pon, GPIO_LOW_VALUE);
            __snfc_uart_control_set_uart_status(UART_STATUS_READY);

            autopoll_status = 0;
            SNFC_DEBUG_MSG_LOW("[snfc_uart_control] IOCTL_SNFC_END - end (hsel low)(pon low)\n");
            break;

    }
    SNFC_DEBUG_MSG_LOW("[snfc_uart_control] snfc_uart_control_ioctl - end\n");

    return 0;
}