示例#1
0
int bma023_get_image(bma023regs_t *bma023Image)
{
    int comres;
    unsigned char data;

    trace_in() ;

    if (p_bma023==0){
        trace_out();
        return E_bma023_NULL_PTR;
    }

    comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, EE_W__REG,&data, 1);
    data = bma023_SET_BITSLICE(data, EE_W, bma023_EE_W_ON);
    comres = p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, EE_W__REG, &data, 1);
    comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, bma023_IMAGE_BASE, (unsigned char *)bma023Image, bma023_IMAGE_LEN);
    data = bma023_SET_BITSLICE(data, EE_W, bma023_EE_W_OFF);
    comres = p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, EE_W__REG, &data, 1);

    trace_out();
    return comres;
}
static ssize_t 
L_interval_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	size_t ret;
	trace_in();
	unsigned long interval = L_dev_get_polling_interval();

	debug("   sensor L_interval_show() : %lu", interval );
	ret = snprintf(buf, PAGE_SIZE, "%lu\n", interval);

	trace_out();
	return ret;
}
示例#3
0
int bma023_set_range(char range) 
{			
    int comres = 0;
    unsigned char data;

    trace_in() ;

    if (p_bma023==0) {
        trace_out();
        return E_bma023_NULL_PTR;
    }

    if (range<3) 
    {	
        comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, RANGE__REG, &data, 1 );
        data = bma023_SET_BITSLICE(data, RANGE, range);		  	
        comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, RANGE__REG, &data, 1);
    }

    trace_out();
    return comres;

}
示例#4
0
int bma023_set_offset_eeprom(unsigned char xyz, unsigned short offset) 
{
    int comres;
    unsigned char data;

    trace_in() ;

    if (p_bma023==0) {
        trace_out();
        return E_bma023_NULL_PTR;   
    }

    comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, (OFFSET_X_LSB__REG+xyz), &data, 1);
    data = bma023_SET_BITSLICE(data, OFFSET_X_LSB, offset);
    comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, (bma023_EEP_OFFSET+OFFSET_X_LSB__REG + xyz), &data, 1);   
    p_bma023->delay_msec(34);
    data = (offset&0x3ff)>>2;
    comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, (bma023_EEP_OFFSET+ OFFSET_X_MSB__REG+xyz), &data, 1);
    p_bma023->delay_msec(34);

    trace_out();
    return comres;
}
static ssize_t 
KXSD9_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    char* str= "samsung" ;
  
    trace_in();

    debug("KXSD9_vendor: %s", buf);
    ret = snprintf(buf, PAGE_SIZE, "%s\n", str );

    trace_out();
    return ret;
}
示例#6
0
void P_sysfs_exit(struct sensors_dev *sdev)
#endif
{
    trace_in();

#ifdef CONFIG_MACH_OSCAR
    sensors_unregister(sdev);
#else
    class_destroy(P_obj_state);
    device_remove_file( dev, &dev_attr_P_output );
    device_remove_file( dev, &dev_attr_P_operation );
#endif
    trace_out();
}
static ssize_t 
KXSD9_name_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret = 0 ;
    char* str= "gsensor" ;
 
    trace_in();

    debug("KXSD9_name: %s", buf );
    ret = snprintf(buf, PAGE_SIZE, "%s\n", str );

    trace_out();
    return ret;
}
示例#8
0
void L_sysfs_exit(struct sensors_dev *sdev)
#endif
{
    trace_in();

#ifdef CONFIG_MACH_OSCAR
    struct device *dev = sdev->dev;
    sensors_unregister(sdev);
#endif
    device_remove_file( dev, &dev_attr_L_adc_val );
    device_remove_file( dev, &dev_attr_L_illum_lvl );

    trace_out();
}	
示例#9
0
int bma023_write_ee(unsigned char addr, unsigned char data) 
{	
    int comres;

    trace_in() ;

    if (p_bma023==0) { 			/* check pointers */
        trace_out();
        return E_bma023_NULL_PTR;
    }

    if (p_bma023->delay_msec == 0)
        trace_out();
    return E_bma023_NULL_PTR;

    comres = bma023_set_ee_w( bma023_EE_W_ON );
    addr|=0x20;   /* add eeprom address offset to image address if not applied */
    comres += bma023_write_reg(addr, &data, 1 );
    p_bma023->delay_msec( bma023_EE_W_DELAY );
    comres += bma023_set_ee_w( bma023_EE_W_OFF);

    trace_out();
    return comres;
}
static ssize_t 
KXSD9_interval_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret= 0;
    unsigned long polling_time ;
  
    trace_in();

    polling_time= KXSD9_timer_get_polling_time() ; 
    debug( "KXSD9_polling_time: %ld", polling_time );
    ret = snprintf(buf, PAGE_SIZE, "%ld\n", polling_time );
 
    trace_out();
    return ret;
}
static ssize_t 
KXSD9_type_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    u16 type;
  
    trace_in();

    type= 0x01 ;
    debug("KXSD9_type: %d", type);
    ret = snprintf(buf, PAGE_SIZE, "%d\n", type );
 
    trace_out();
    return ret;
}
示例#12
0
int bma023_selftest(unsigned char st)
{
    int comres;
    unsigned char data;

    trace_in() ;

    comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, SELF_TEST__REG, &data, 1);
    data = bma023_SET_BITSLICE(data, SELF_TEST, st);
    comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, SELF_TEST__REG, &data, 1);  

    trace_out();
    return comres;  

}
示例#13
0
int PL_i2c_drv_init(void)
{	
    int ret = 0;

    trace_in();

    if ( (ret = i2c_add_driver(&PL_i2c_driver) < 0) ) 
    {
        failed(1);
        error("i2c_add_driver failed");
    }
	debug("[ryun] PL_i2c_drv_init(void) : ret=%d \n", ret);
    trace_out();

    return ret;
}
static ssize_t 
KXSD9_threshold_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    unsigned short threshold ;
  
    trace_in();

    threshold = KXSD9_dev_get_threshold() ;

    debug("KXSD9_threshold: %d", threshold);
    ret = snprintf(buf, PAGE_SIZE, "%d\n", threshold );
 
    trace_out();
    return ret;
}
示例#15
0
static ssize_t 
L_interval_store(struct device *dev, struct device_attribute *attr, char *buf)
{

    ssize_t ret;
    unsigned long L_operation;
    
    trace_in();

    sscanf(buf, "%lu", &L_operation);
    ret = strnlen(buf, sizeof(L_operation));
	L_dev_set_polling_interval(L_operation);
	debug("   sensor L_interval_store() : %lu sec", L_operation );
    trace_out();

    return ret;

}
示例#16
0
int bma023_init(bma023_t *bma023) 
{
	int comres=0;
    unsigned char data;

    trace_in() ;

    p_bma023 = bma023;															/* assign bma023 ptr */
    p_bma023->dev_addr = bma023_I2C_ADDR;										/* preset SM380 I2C_addr */
    comres += p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, CHIP_ID__REG, &data, 1);	/* read Chip Id */

    p_bma023->chip_id = bma023_GET_BITSLICE(data, CHIP_ID);			/* get bitslice */

    comres += p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, ML_VERSION__REG, &data, 1); /* read Version reg */
    p_bma023->ml_version = bma023_GET_BITSLICE(data, ML_VERSION);	/* get ML Version */
    p_bma023->al_version = bma023_GET_BITSLICE(data, AL_VERSION);	/* get AL Version */

    trace_out();
    return comres;
}
示例#17
0
void __exit ags04_driver_exit(void)
{
    trace_in() ;
		  
    /*Delete the i2c driver*/
    ags04_i2c_drv_exit();

    free_irq( GRIP_IRQ, (void *)NULL);
    
#if 1
    input_unregister_device( input_dev ) ;
#endif

    /*misc device deregistration*/
    misc_deregister(&ags04_misc_device);
    /* wake lock destroy */
    wake_lock_destroy(&ags_wake_lock);

    trace_out() ;
}
示例#18
0
void P_obj_state_genev(struct input_dev *inputdevice, u16 obj_state)
{
    trace_in();
    
    if( obj_state == P_OBJ_DETECTED )
    {
    debug("[ryun] kobject_uevent(&inputdevice->dev.kobj, KOBJ_ADD);");
//        kobject_uevent(&inputdevice->dev.kobj, KOBJ_ADD);
//        kobject_uevent(&P_obj_state->dev_uevent, KOBJ_ADD);
    }
    else if( obj_state == P_OBJ_NOT_DETECTED )
    {
    debug("[ryun] kobject_uevent(&inputdevice->dev.kobj, KOBJ_REMOVE);");
//	    kobject_uevent(&inputdevice->dev.kobj, KOBJ_REMOVE);
//    kobject_uevent(&P_obj_state->dev_uevent, KOBJ_REMOVE);
//ryun        kobject_uevent(&P_obj_state->subsys.kobj, KOBJ_REMOVE);
    }

    trace_out();
}
示例#19
0
static int PL_suspend(struct i2c_client *client, pm_message_t mesg)
{
    int ret = 0;
	   
    trace_in();

    if( strcmp(client->name, DEVICE_NAME) != 0 )
    {
        ret = -1;
        failed(1);
        error("device not supported");
    }
    else if( (ret = L_dev_suspend()) < 0 )
    {
        failed(2);
    }

    trace_out();

    return 0;
}
int atoi( const char* name )
{
    int value = 0;

    trace_in() ;

    for( ; *name >= '0' && *name <= '9'; name++ ) {
        switch( *name ) {
            case '0'...'9':
                value= 10 * value + ( *name - '0' ) ;
                break ;
            default:
                break ;
        }
    }
    
    debug(" %d\n", value);

    trace_out() ;
    return value ;
}
示例#21
0
static int 
session_data_send(ssh_session_t *session, uint8_t command, const void* data, int len)
{
	int iRet = -1;
#if 1
	ssh2_command_t *cb = session_get_callback(command);
	if(session->type == SSH_SESSION_SERVER) {
		session->direct = IP_PS;
	} else {
		session->direct = IP_PC;
	}
	if(cb != NULL) {
		//ssh_log(session, "\"%s(%d)\"", cb->command_name, cb->command);
		trace_out("\"%s(%d)\"", cb->command_name, cb->command);
	}
	
	if(session->evbuffer) {
		iRet = evbuffer_add(session->evbuffer, data, len);
	}
#endif
	return 0;
}
示例#22
0
static ssize_t 
P_switch_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    char *P_operation = "off";
    u16 power_state, mode;
   
    trace_in();

    if( P_dev_get_pwrstate_mode(&power_state, &mode) < 0 )
    {
        P_operation = "off";
        failed(1);
    }
    else
    {
        if( power_state == P_SHUTDOWN )
        {
            P_operation = "off";
        }
        else if ( (mode == P_MODE_A) && (power_state == P_OPERATIONAL) )
        {
            P_operation = "on";
        }
        else if ( (mode == P_MODE_B) && (power_state == P_OPERATIONAL) )
        {
            P_operation = "on";
        }        
    }
    
    debug("   P_operation: %s", P_operation);

    ret = snprintf(buf, PAGE_SIZE, "%s\n",P_operation);

    trace_out();

    return ret;
}
示例#23
0
static ssize_t 
P_operation_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    int P_operation = P_SYSFS_ERROR;
    u16 power_state, mode;
   
    trace_in();

    if( P_dev_get_pwrstate_mode(&power_state, &mode) < 0 )
    {
        P_operation = P_SYSFS_ERROR;
        failed(1);
    }
    else
    {
        if( power_state == P_SHUTDOWN )
        {
            P_operation = P_SYSFS_DEV_SHUTDOWN;
        }
        else if ( (mode == P_MODE_A) && (power_state == P_OPERATIONAL) )
        {
            P_operation = P_SYSFS_MODE_A_OPERATIONAL;
        }
        else if ( (mode == P_MODE_B) && (power_state == P_OPERATIONAL) )
        {
            P_operation = P_SYSFS_MODE_B_OPERATIONAL;
        }        
    }
    
    debug("   P_operation: %d", P_operation);

    ret = snprintf(buf, PAGE_SIZE, "%d\n",P_operation);

    trace_out();

    return ret;
}
static ssize_t 
KXSD9_threshold_store(struct device *dev, struct device_attribute *attr, 
                    const char *buf, size_t count )
{
    char* str ;
    int operation ;
    trace_in() ;

    str = (char*)kmalloc( sizeof(char)*4, GFP_KERNEL ) ;

    sscanf( buf, "%s", str ) ;
    debug( "%s", str ) ;

    operation= atoi( str ) ;
    debug( "%d", operation ) ; 

    KXSD9_dev_set_threshold(operation);

    kfree( str ) ;

    trace_out() ;
    return count ; 
}
static ssize_t 
KXSD9_interval_store(struct device *dev, struct device_attribute *attr, 
                    const char *buf, size_t count )
{
    char* str ;
    unsigned long polling_time ;

    trace_in() ;

    str= (char*)kmalloc( count+1, GFP_KERNEL ) ;
    sscanf( buf, "%s", str ) ;
    debug( "%s", str ) ;
    
    polling_time= atoi( str ) ;

    kfree(str);

    debug("KXSD9_polling_time: %ld", polling_time );

    KXSD9_timer_set_polling_time( polling_time ) ;
    
    trace_out() ;
    return count ; 
}
示例#26
0
/*=============================+
 * evaluate -- Generic evaluator
 *============================*/
PVALUE
evaluate (PNODE node, SYMTAB stab, BOOLEAN *eflg)
{
    if (prog_trace) {
        trace_out("%d: ", iline(node)+1);
        trace_pnode(node);
        trace_endl();
    }
    if (iistype(node, IIDENT))
        return evaluate_iden(node, stab, eflg);
    if (iistype(node, IBCALL))
        return evaluate_func(node, stab, eflg);
    if (iistype(node, IFCALL))
        return evaluate_ufunc(node, stab, eflg);
    *eflg = FALSE;
    if (iistype(node, IICONS))
        return copy_pvalue(ivalue(node));
    if (iistype(node, ISCONS))
        return copy_pvalue(ivalue(node));
    if (iistype(node, IFCONS))
        return copy_pvalue(ivalue(node));
    *eflg = TRUE;
    return NULL;
}
示例#27
0
/*
 * bma023_dev_operating()
 *
 *  Perform Chip power Up/Down
 *      mode - bma023_MODE_SLEEP = 0
 *             bma023_MODE_NORMAL = 2   
 */
int bma023_dev_operating(unsigned char mode)
{
    int comres=0 ;
    unsigned char data1, data2;

    trace_in() ;

    if (p_bma023==0) {
        trace_out();
        return E_bma023_NULL_PTR;
    }

    debug( "mode= %c, bma023_status= %d", mode, bma023_status ) ;

    if (mode<4 || mode!=1) 
    {
        comres = p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, WAKE_UP__REG, &data1, 1 );
        data1  = bma023_SET_BITSLICE(data1, WAKE_UP, mode);		  
        comres += p_bma023->bma023_BUS_READ_FUNC(p_bma023->dev_addr, SLEEP__REG, &data2, 1 );
        data2  = bma023_SET_BITSLICE(data2, SLEEP, (mode>>1));
        comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, WAKE_UP__REG, &data1, 1);
        comres += p_bma023->bma023_BUS_WRITE_FUNC(p_bma023->dev_addr, SLEEP__REG, &data2, 1);
        p_bma023->mode = mode;
    } 
示例#28
0
int __init ags04_driver_init(void)
{
	int ret = 0;
	unsigned int val = 0;
	trace_in() ;

	/*Initilize the ags04 dev mutex*/
	ags04_dev_mutex_init();

	/*Add the i2c driver*/
	if ( (ret = ags04_i2c_drv_init() < 0) ) 
	{
		printk(KERN_ERR "%s, ags04_i2c_drv_init failed, ret= %d\n", __FUNCTION__, ret );
		goto MISC_IRQ_DREG;
	}

	/* gpiot setting */
	s3c_gpio_setpull(GPIO_GRIP_INT, S3C_GPIO_PULL_UP); 

#if 1
	/*Add the input device driver*/
	input_dev= input_allocate_device() ;

	if( !input_dev ) {
		printk( "%s, Input_allocate_deivce failed!, ret= %d\n",	__FUNCTION__, ret ) ;
		return -ENODEV ;
	}

	//set_bit( EV_KEY, input_dev->evbit ) ;

	input_set_capability(input_dev, EV_KEY, ags_code[0]);
	input_set_capability(input_dev, EV_KEY, ags_code[1]);
	input_set_capability(input_dev, EV_KEY, ags_code[2]);
	input_set_capability(input_dev, EV_KEY, ags_code[3]);


	input_dev->name= "grip_sensor" ;

	ret= input_register_device( input_dev ) ;
	if( ret ) {
		printk( "%s, Unable to register Input device: %s, ret= %d\n", __FUNCTION__,  input_dev->name, ret ) ;
		return ret ;
	}
#endif

	/*misc device registration*/
	if( (ret = misc_register(&ags04_misc_device)) < 0 )
	{
		printk(KERN_ERR "%s, ags04_driver_init misc_register failed, ret= %d\n", __FUNCTION__, ret );
		goto MISC_DREG;
	}

	INIT_WORK(&ags04_ws, (void (*)(struct work_struct*))ags04_dev_work_func ) ;

	/* set sysfs for light sensor */

	gripsensor_class = class_create(THIS_MODULE, "grip_sensor");
	if (IS_ERR(gripsensor_class))
		pr_err("Failed to create class(grip_sensor)!\n");

	switch_cmd = device_create(gripsensor_class, NULL, 0, NULL, "switch");
	if (IS_ERR(switch_cmd))
		pr_err("Failed to create device(switch_cmd_dev)!\n");

	if (device_create_file(switch_cmd, &dev_attr_grip_read_cnt) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_grip_read_cnt.attr.name);

#if 0
	/*set interrupt service routine*/
	set_irq_type ( GRIP_IRQ, IRQ_TYPE_EDGE_FALLING );
	enable_irq_wake ( GRIP_IRQ );
#if 0
	if( (ret = request_irq(GRIP_IRQ, ags04_isr,0 , "ags04", (void *)NULL)) < 0 )
	{
		printk("%s, request_irq failed %d, ret= %d\n",__FUNCTION__, GRIP_IRQ, ret );
	}
#endif
	GRIP_INT_GPIO= GRIP_IRQ;
	printk(KERN_DEBUG "%s, GRIP_INT_GPIO: %d\n",__FUNCTION__, GRIP_IRQ ) ;
#else

	if (gpio_request(GPIO_GRIP_INT,"grip_gpio")) {
		printk("gpio request failure %d\n", GPIO_GRIP_INT);
		return -ENODEV;
	}

	GRIP_IRQ = gpio_to_irq( GPIO_GRIP_INT);

	/*set interrupt service routine*/
	set_irq_type ( GRIP_IRQ, IRQ_TYPE_EDGE_FALLING );
	enable_irq_wake ( GRIP_IRQ );		

	ret = request_threaded_irq(GRIP_IRQ, NULL,
			ags04_isr,
			IRQ_TYPE_EDGE_FALLING, "ags04", NULL);
	if (ret) {
		pr_err("%s : Failed to request_irq IRQ-%d err-%d\n", __func__,GRIP_IRQ,ret);
	}

	GRIP_INT_GPIO= GRIP_IRQ;
	printk(KERN_DEBUG "%s, GRIP_INT_GPIO: %d\n",__FUNCTION__, GRIP_IRQ ) ;

#endif

	ags04_disable_int() ;

	udelay( 500 ) ;

	ags04_enable_int() ;

	/* wake lock init */
	wake_lock_init(&ags_wake_lock, WAKE_LOCK_SUSPEND, "ags_wake_lock");

	trace_out() ;
	return ret;

MISC_IRQ_DREG:
	/*
	   free_irq(ags04_IRQ, (void *)NULL);
	 */

MISC_DREG:
	misc_deregister(&ags04_misc_device);

	trace_out() ;
	return ret; 
}
示例#29
0
static irqreturn_t ags04_isr( int irq, void *unused )
{
//	int ret = 0; // ryun
//	unsigned char data;
    trace_in(); 

    ags04_disable_int() ;
    
    schedule_work(&ags04_ws);

    //read_count(&count_table[0], &count_table[1], &count_table[2]);
    //printk(KERN_DEBUG "%s: rndcnt :%d , ch1cnt:%d , ch3cnt:%d \n", __FUNCTION__, count_table[0], count_table[1], count_table[2]);

#if 0
    if( (ret = i2c_read( 0x00, &data )) < 0 )
    {
        printk(KERN_ERR "%s: Reading I2C data is failed.\n", __FUNCTION__);
     }

    data &= 0x05;
	printk(KERN_DEBUG "%s, GRIP interrupt!!\t data:0x%x\t", __FUNCTION__, data);

    if(pattern_int)
    {
      if(ags04_status == ALL_DETECTED)
      {
        ags04_status = NOT_DETECTED ;
        printk(KERN_DEBUG ": ags04_status is %d\n", ags04_status ) ;
      }
      else
      {
        ags04_status = ALL_DETECTED;
        printk(KERN_DEBUG ": ags04_status is %d\n", ags04_status ) ;
      }
    }
    else
    {
      switch(data)
      {
        case 1:
          ags04_status= CS1_DETECTED ;
    	  printk(KERN_DEBUG "CS1 Detected\n" ) ;
          break;
        case 4:
          ags04_status= CS3_DETECTED ;
    	  printk(KERN_DEBUG "CS3 Detected\n" ) ;
          break;
        case 5:
          ags04_status= ALL_DETECTED ;
          printk(KERN_DEBUG "ALL Detected\n" ) ;
          break;
        default:
          ags04_status= NOT_DETECTED ;
    	  printk(KERN_DEBUG "NOT Detected\n" ) ;
          break;
        }
    }
    
	/* call wake lock */
    wake_lock_timeout(&ags_wake_lock,2*HZ);
    printk(KERN_INFO "[GRIP] wake_lock_timeout : 2*HZ \n");
#endif
    trace_out();

    return IRQ_HANDLED;
}
示例#30
0
static int ags04_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,  unsigned long arg)
{
    int ret = 0, size = 0, err = 0;

    if(_IOC_TYPE(cmd) != AGS04_IOC_MAGIC)
      return -EINVAL;

    if(_IOC_NR(cmd) >= AGS04_IOC_NR_MAX)
      return -EINVAL;

    size = _IOC_SIZE(cmd);
    
    if(size)
    {
      err = 0;
      if(_IOC_DIR(cmd) & _IOC_READ)
        err = access_ok(VERIFY_WRITE, (void*)arg, size);
      else if(_IOC_DIR(cmd & _IOC_WRITE))
        err = access_ok(VERIFY_READ, (void*)arg, size);

      if(!err)
        return err;
    }
      
    trace_in() ;

    switch(cmd)
    {
      case AGS04_IOC_START_NORMAL_OP:
        if((ret = start_normal_operation()) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_START_NORMAL_OP is failed. ret(%d)", __FUNCTION__, ret);
        break;
        
      case AGS04_IOC_START_PATTERN_OP:
        if((ret = start_pattern_operation()) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_START_PATTERN_OP is failed. ret(%d)", __FUNCTION__, ret);
        break;
        
      case AGS04_IOC_I2C_TEST:
        if((ret = grip_i2c_test()) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_I2C_TEST is failed. ret(%d)", __FUNCTION__, ret);
        err = copy_to_user((void *)arg, (void *)&ret, sizeof(int));
        break;

      case AGS04_IOC_RND_CS_TEST:
        if((ret = grip_rnd_cs_test()) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_RND_CS_TEST is failed. ret(%d)", __FUNCTION__, ret);
        err = copy_to_user((void *)arg, (void *)&ret, sizeof(int));        
        break;

      case AGS04_IOC_INT_PIN_TEST:
        if((ret = grip_pin_test(INT_PIN)) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_INT_PIN_TEST is failed. ret(%d)", __FUNCTION__, ret);
        err = copy_to_user((void *)arg, (void *)&ret, sizeof(int));        
        break;

      case AGS04_IOC_VDD_PIN_TEST:
        if((ret = grip_pin_test(VDD_PIN)) < 0)
          printk(KERN_ERR "%s : AGS04_IOC_VDD_PIN_TEST is failed. ret(%d)", __FUNCTION__, ret);
        err = copy_to_user((void *)arg, (void *)&ret, sizeof(int));        
        break;

      case AGS04_IOC_READ_CNT  :
        err = copy_to_user((void *)arg, (void *)&count_table, sizeof(count_table));        
        break;
        

      default:
        err = -EINVAL;
        break;
    }

    trace_out() ;
    return err;
}