static ssize_t L_switch_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret; char *L_operation = "off"; int power_state; trace_in(); power_state = L_dev_get_polling_state(); if( power_state == L_SYSFS_POLLING_OFF) { L_operation = "off"; } else if(power_state == L_SYSFS_POLLING_ON) { L_operation = "on"; } debug(" L_operation: %s", L_operation); ret = snprintf(buf, PAGE_SIZE, "%s\n",L_operation); trace_out(); return ret; }
static ssize_t L_illum_lvl_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret; int L_illum_lvl = L_SYSFS_ERROR; u16 illum_lvl; trace_in(); if( L_dev_get_illum_lvl(&illum_lvl) < 0 ) { L_illum_lvl = L_SYSFS_ERROR; failed(1); } else { L_illum_lvl = illum_lvl; } debug(" L_illum_lvl: %d", L_illum_lvl); ret = snprintf(buf, PAGE_SIZE, "%d\n",L_illum_lvl); trace_out(); return ret; }
static ssize_t P_switch_store(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret = 0; char *P_operation = buf; trace_in(); if (strncmp(P_operation, "off", 3) == 0 ) { ret = 3; printk("%s", P_operation); if( P_dev_shutdown() < 0 ) { printk("P_dev_powerup_set_op_mode() : fail!! \n"); ret = -1; } } else if(strncmp(P_operation, "on", 2) == 0 ) { ret = 2; printk("%s", P_operation); if( P_dev_powerup_set_op_mode(P_MODE_B) < 0 ) { printk("P_dev_powerup_set_op_mode() : fail!! \n"); ret = -1; } } trace_out(); return ret; }
static ssize_t L_switch_store(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret; char *L_operation = buf; trace_in(); if (strncmp(L_operation, "off", 3) == 0 ) { printk("%s", L_operation); if( L_dev_polling_stop() != 1 ) { printk("L_dev_polling_stop() : fail!! \n"); ret = -1; } } else if(strncmp(L_operation, "on", 2) == 0 ) { printk("%s", L_operation); if( L_dev_polling_start() != 0 ) { printk("L_dev_polling_start() : fail!! \n"); ret = -1; } } trace_out(); return ret; }
static ssize_t P_output_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret; int P_output = P_SYSFS_ERROR; u16 prox_op; trace_in(); if( P_dev_get_prox_output(&prox_op) < 0 ) { P_output = P_SYSFS_ERROR; failed(1); } else { if( prox_op == P_OBJ_DETECTED ) { P_output = P_SYSFS_OBJ_DETECTED; } else if( prox_op == P_OBJ_NOT_DETECTED ) { P_output = P_SYSFS_OBJ_NOT_DETECTED; } } debug(" P_output: %d", P_output); ret = snprintf(buf, PAGE_SIZE, "%d\n",P_output); trace_out(); return ret; }
static ssize_t KXSD9_switch_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret; int status ; char* str_normal = "on" ; char* str_standby = "off" ; trace_in(); status= KXSD9_dev_get_status() ; debug("KXSD9_switch: %d", status); if( status == STANDBY ) { ret = snprintf(buf, PAGE_SIZE, "%s\n", str_standby ); } else if( status == NORMAL ) { ret = snprintf(buf, PAGE_SIZE, "%s\n", str_normal ); } else { printk( "%s, unknown status check it!!!\n", __FUNCTION__ ) ; ret= -1 ; } trace_out(); return ret; }
static int PL_resume(struct i2c_client *client) { int ret = 0; trace_in(); if( strcmp(client->name, DEVICE_NAME) != 0 ) { ret = -1; failed(1); error("device not supported"); } else { P_dev_check_wakeup_src(); if( (ret = L_dev_resume()) < 0 ) { failed(3); } } trace_out(); return ret; }
static int PL_remove(struct i2c_client *client) { int ret = 0; trace_in(); if( strcmp(client->name, DEVICE_NAME) != 0 ) { ret = -1; failed(1); error("device not supported"); } else if( (ret = P_dev_exit()) < 0 ) { failed(2); } else if( (ret = L_dev_exit()) < 0 ) { failed(3); } trace_out(); return ret; }
static ssize_t P_interval_store(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret = strlen(buf); trace_in(); return ret; }
static int ags04_release (struct inode *inode, struct file *filp) { trace_in() ; trace_out() ; return 0; }
int L_sysfs_init(struct sensors_dev *sdev) #endif { int ret = 0; trace_in(); #ifdef CONFIG_MACH_OSCAR // ryun 20091212 for OSCAR static struct device_attribute sd[6]; struct device *dev = NULL; sd[0].attr.name = "name"; sd[0].attr.mode = 0444; sd[0].show = L_name_show; sd[0].store = NULL; sd[1].attr.name = "switch"; sd[1].attr.mode = 0666; sd[1].show = L_switch_show; sd[1].store = L_switch_store; sd[2].attr.name = "threshold"; sd[2].attr.mode = 0666 ; sd[2].show = L_threshold_show; sd[2].store = L_threshold_store; sd[3].attr.name = "interval"; sd[3].attr.mode = 0666; sd[3].show = L_interval_show; sd[3].store = L_interval_store; sd[4].attr.name = "vendor"; sd[4].attr.mode = 0444 ; sd[4].show = L_vendor_show; sd[4].store = NULL; sd[5].attr.name = "type"; sd[5].attr.mode = 0444 ; sd[5].show = L_type_show; sd[5].store = NULL; sensors_register(dev, sdev->dev, sd, 6, sdev); dev = sdev->dev; #endif // ryun 20091212 for OSCAR if( (ret = device_create_file( dev, &dev_attr_L_adc_val )) < 0 ) { failed(1); } else if( (ret = device_create_file( dev, &dev_attr_L_illum_lvl )) < 0 ) { device_remove_file( dev, &dev_attr_L_adc_val ); failed(2); } else if( (ret = device_create_file( dev, &dev_attr_L_op )) < 0 ) { device_remove_file( dev, &dev_attr_L_adc_val ); device_remove_file( dev, &dev_attr_L_illum_lvl ); failed(3); } trace_out(); return ret; }
int P_sysfs_init(struct sensors_dev *sdev) #endif { int ret = 0; trace_in(); #ifdef CONFIG_MACH_OSCAR // ryun 20091212 for OSCAR static struct device_attribute sd[6]; sd[0].attr.name = "name"; sd[0].attr.mode = 0444 ; sd[0].show = P_name_show; sd[0].store = NULL; sd[1].attr.name = "switch"; sd[1].attr.mode = 0666; sd[1].show = P_switch_show ; sd[1].store = P_switch_store; sd[2].attr.name = "threshold"; sd[2].attr.mode = 0666 ; sd[2].show = P_threshold_show; sd[2].store = P_threshold_store;; sd[3].attr.name = "interval"; sd[3].attr.mode = 0666 ; sd[3].show = P_interval_show; sd[3].store = P_interval_store; sd[4].attr.name = "vendor"; sd[4].attr.mode = 0444 ; sd[4].show = P_vendor_show; sd[4].store = NULL; sd[5].attr.name = "type"; sd[5].attr.mode = 0444 ; sd[5].show = P_type_show; sd[5].store = NULL; sensors_register(NULL, sdev->dev, sd, 6, sdev); #else // ryun 20091212 for OSCAR if( (ret = device_create_file( dev, &dev_attr_P_operation )) < 0 ) { failed(1); } else if( (ret = device_create_file( dev, &dev_attr_P_output )) < 0 ) { device_remove_file( dev, &dev_attr_P_operation ); failed(2); } else if( IS_ERR(P_obj_state = class_create( THIS_MODULE, "P_obj_state" )) ) { device_remove_file( dev, &dev_attr_P_output ); device_remove_file( dev, &dev_attr_P_operation ); ret = -1; failed(3); } #endif trace_out(); return ret; }
static ssize_t L_threshold_store(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t ret = strlen(buf); trace_in(); return ret; }
void PL_i2c_drv_exit(void) { trace_in(); i2c_del_driver(&PL_i2c_driver); trace_out(); }
static char i2c_acc_bma023_read(u8 reg, u8 *val, unsigned int len ) { #if 0 int err; struct i2c_msg msg[1]; unsigned char data[1]; trace_in() ; if( (bma_client == NULL) || (!bma_client->adapter) ) { printk( "ERROR 1\n" ) ; return -ENODEV; } msg->addr = bma_client->addr; msg->flags = I2C_M_WR; msg->len = 1; msg->buf = data; *data = reg; err = i2c_transfer(bma_client->adapter, msg, 1); debug( "MGS 2, err= %d\n", err ) ; if (err >= 0) { msg->flags = I2C_M_RD; msg->len = len; msg->buf = val; err = i2c_transfer(bma_client->adapter, msg, 1); debug( "MSG 3, err= %d\n", err ) ; } if (err >= 0) { debug( "ERROR 4, err= %d\n", err ) ; trace_out() ; return 0; } printk("%s %d i2c transfer error\n", __func__, __LINE__);/* add by inter.park */ trace_out(); return err; #else int dummy=0; int i=0; if( bma_client == NULL ) /* No global client pointer? */ return -1; while(i<len) { dummy = i2c_smbus_read_word_data(bma_client, reg); val[i] = dummy & 0x00ff; i++; reg++; dummy = len; } return 0; #endif }
void ags04_dev_work_func(void ) { int ret = 0; // ryun unsigned char data; trace_in(); 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"); ags04_enable_int(); trace_out(); }
void ags04_disable_int(void) { trace_in() ; printk(KERN_DEBUG "%s, INTERRUPT DISABLED\n", __FUNCTION__ ); disable_irq_nosync( GRIP_IRQ); irq_flag = 1; trace_out() ; }
static int ags04_open (struct inode *inode, struct file *filp) { int ret = 0; trace_in() ; nonseekable_open( inode, filp ) ; trace_out() ; return ret; }
void ags04_enable_int(void) { trace_in() ; printk(KERN_DEBUG "%s, INTERRUPT ENABLED\n", __FUNCTION__ ); irq_flag = 0; enable_irq( GRIP_IRQ); trace_out() ; }
void KXSD9_sysfs_exit(struct sensors_dev *sdev) #endif { trace_in(); #ifdef CONFIG_MACH_OSCAR sensors_unregister(sdev); #endif trace_out(); }
static ssize_t L_name_show(struct device *dev, struct device_attribute *attr, char *buf) { size_t ret; trace_in(); debug(" sensor name: lsensor"); ret = snprintf(buf, PAGE_SIZE, "lsensor\n"); trace_out(); return ret; }
int KXSD9_sysfs_init(struct sensors_dev *sdev) #endif { trace_in(); #ifdef CONFIG_MACH_OSCAR sensors_register(NULL, sdev->dev, attrs, sizeof(attrs)/sizeof(struct device_attribute), sdev); #endif trace_out(); return 0; }
static ssize_t L_vendor_show(struct device *dev, struct device_attribute *attr, char *buf) { size_t ret; trace_in(); debug(" L_vendor_show : samsung"); ret = snprintf(buf, PAGE_SIZE, "samsung\n"); trace_out(); return ret; }
static ssize_t L_type_show(struct device *dev, struct device_attribute *attr, char *buf) { size_t ret; trace_in(); debug(" L_type_show : 5"); ret = snprintf(buf, PAGE_SIZE, "5\n"); trace_out(); return ret; }
static ssize_t P_interval_show(struct device *dev, struct device_attribute *attr, char *buf) { size_t ret; trace_in(); debug(" P_interval_show()"); ret = snprintf(buf, PAGE_SIZE, "0\n"); trace_out(); return ret; }
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; }
static char i2c_acc_bma023_write( u8 reg, u8 *val ) { #if 0 int err; struct i2c_msg msg[1]; unsigned char data[2]; trace_in() ; if( (bma_client == NULL) || (!bma_client->adapter) ){ trace_out(); return -ENODEV; } data[0] = reg; data[1] = *val; msg->addr = bma_client->addr; msg->flags = I2C_M_WR; msg->len = 2; msg->buf = data; err = i2c_transfer(bma_client->adapter, msg, 1); if (err >= 0) trace_out(); return 0; printk("%s %d i2c transfer error\n", __func__, __LINE__);/* add by inter.park */ trace_out(); return err; #else int dummy; int i=0; unsigned char len = 1; if( bma_client == NULL ) /* No global client pointer? */ return -1; dummy = i2c_smbus_write_byte_data(bma_client, reg, val[0]); while(i<len) { dummy = i2c_smbus_write_byte_data(bma_client, reg, val[0]); reg++; val++; i++; if(dummy<0) return -1; } return 0; #endif }
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; }
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(); }
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(); }