diff --git a/drivers/sensors_ancora/ak8975.c b/drivers/sensors_ancora/ak8975.c index 23525a901ce..02fb2fe5876 100644 --- a/drivers/sensors_ancora/ak8975.c +++ b/drivers/sensors_ancora/ak8975.c @@ -81,8 +81,9 @@ static int akm8975_ecs_set_mode(struct akm8975_data *akm, char mode) return -EINVAL; } - if (ret < 0) + if (ret < 0) { return ret; + } /* Wait at least 300us after changing mode. */ udelay(300); @@ -144,7 +145,7 @@ static int akm8975_wait_for_data_ready(struct akm8975_data *akm) enable_irq(akm->irq); - err = wait_for_completion_timeout(&akm->data_ready, 5*HZ); + err = wait_for_completion_timeout(&akm->data_ready, 10*HZ); if (err > 0) return 0; @@ -166,8 +167,7 @@ extern unsigned int get_hw_rev(void); static ssize_t akmd_read(struct file *file, char __user *buf, size_t count, loff_t *pos) { - //struct akm8975_data *akm = container_of(file->private_data, - // struct akm8975_data, akmd_device); + short x = 0, y = 0, z = 0; #if defined (CONFIG_JPN_MODEL_SC_02D) short tmp = 0; @@ -201,8 +201,7 @@ static ssize_t akmd_read(struct file *file, char __user *buf, y = (data[4] << 8) + data[3]; z = (data[6] << 8) + data[5]; #if defined (CONFIG_JPN_MODEL_SC_02D) - if (get_hw_rev() >= 0x00 ) // real 0.0 - { + if (get_hw_rev() >= 0x00 ) { // real 0.0 tmp = x; x = y; y = tmp; @@ -219,8 +218,6 @@ static ssize_t akmd_read(struct file *file, char __user *buf, static long akmd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; - //struct akm8975_data *akm = container_of(file->private_data, - //struct akm8975_data, akmd_device); int ret; union { char raw[RWBUF_SIZE]; @@ -230,8 +227,9 @@ static long akmd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } rwbuf; ret = akmd_copy_in(cmd, argp, rwbuf.raw, sizeof(rwbuf)); - if (ret) + if (ret) { return ret; + } switch (cmd) { case ECS_IOCTL_WRITE: @@ -285,8 +283,9 @@ static long akmd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -ENOTTY; } - if (ret < 0) + if (ret < 0) { return ret; + }w return akmd_copy_out(cmd, argp, rwbuf.raw, sizeof(rwbuf)); } @@ -331,8 +330,6 @@ static int akm8975_setup_irq(struct akm8975_data *akm) goto done; err_request_irq: -//err_gpio_direction_input: -// gpio_free(pdata->gpio_data_ready_int); done: return rc; } @@ -373,8 +370,9 @@ int akm8975_probe(struct i2c_client *client, akm->this_client = client; err = akm8975_ecs_set_mode_power_down(akm); - if (err < 0) + if (err < 0) { goto exit_set_mode_power_down_failed; + } err = akm8975_setup_irq(akm); if (err) { @@ -387,8 +385,9 @@ int akm8975_probe(struct i2c_client *client, akm->akmd_device.fops = &akmd_fops; err = misc_register(&akm->akmd_device); - if (err) + if (err) { goto exit_akmd_device_register_failed; + } init_waitqueue_head(&akm->state_wq); gakm = akm; @@ -398,7 +397,6 @@ int akm8975_probe(struct i2c_client *client, exit_akmd_device_register_failed: free_irq(akm->irq, akm); -// gpio_free(akm->pdata->gpio_data_ready_int); exit_setup_irq: exit_set_mode_power_down_failed: mutex_destroy(&akm->lock); @@ -415,7 +413,6 @@ static int __devexit akm8975_remove(struct i2c_client *client) misc_deregister(&akm->akmd_device); free_irq(akm->irq, akm); -// gpio_free(akm->pdata->gpio_data_ready_int); mutex_destroy(&akm->lock); kfree(akm); return 0; diff --git a/drivers/sensors_ancora/bma222.c b/drivers/sensors_ancora/bma222.c index 0cfc7a16575..76714a307a6 100644 --- a/drivers/sensors_ancora/bma222.c +++ b/drivers/sensors_ancora/bma222.c @@ -96,30 +96,30 @@ #define BMA222_COMP_TARGET_OFFSET_X__POS 1 #define BMA222_COMP_TARGET_OFFSET_X__LEN 2 #define BMA222_COMP_TARGET_OFFSET_X__MSK 0x06 -#define BMA222_COMP_TARGET_OFFSET_X__REG 0x37 +#define BMA222_COMP_TARGET_OFFSET_X__REG 0x37 #define BMA222_COMP_TARGET_OFFSET_Y__POS 3 #define BMA222_COMP_TARGET_OFFSET_Y__LEN 2 #define BMA222_COMP_TARGET_OFFSET_Y__MSK 0x18 -#define BMA222_COMP_TARGET_OFFSET_Y__REG 0x37 +#define BMA222_COMP_TARGET_OFFSET_Y__REG 0x37 #define BMA222_COMP_TARGET_OFFSET_Z__POS 5 #define BMA222_COMP_TARGET_OFFSET_Z__LEN 2 #define BMA222_COMP_TARGET_OFFSET_Z__MSK 0x60 -#define BMA222_COMP_TARGET_OFFSET_Z__REG 0x37 +#define BMA222_COMP_TARGET_OFFSET_Z__REG 0x37 #define BMA222_OFFSET_FILT_X_REG 0x38 #define BMA222_OFFSET_FILT_Y_REG 0x39 #define BMA222_OFFSET_FILT_Z_REG 0x3A #define BMA222_UNLOCK_EE_WRITE_SETTING__POS 0 #define BMA222_UNLOCK_EE_WRITE_SETTING__LEN 1 #define BMA222_UNLOCK_EE_WRITE_SETTING__MSK 0x01 -#define BMA222_UNLOCK_EE_WRITE_SETTING__REG 0x33 +#define BMA222_UNLOCK_EE_WRITE_SETTING__REG 0x33 #define BMA222_START_EE_WRITE_SETTING__POS 1 #define BMA222_START_EE_WRITE_SETTING__LEN 1 #define BMA222_START_EE_WRITE_SETTING__MSK 0x02 -#define BMA222_START_EE_WRITE_SETTING__REG 0x33 +#define BMA222_START_EE_WRITE_SETTING__REG 0x33 #define BMA222_EE_WRITE_SETTING_S__POS 2 #define BMA222_EE_WRITE_SETTING_S__LEN 1 #define BMA222_EE_WRITE_SETTING_S__MSK 0x04 -#define BMA222_EEPROM_CTRL_REG 0x33 +#define BMA222_EEPROM_CTRL_REG 0x33 #define BMA222_EN_FAST_COMP__POS 5 #define BMA222_EN_FAST_COMP__LEN 2 #define BMA222_EN_FAST_COMP__MSK 0x60 @@ -843,34 +843,25 @@ static int bma222_measure(int *out_data, int *out_raw) static int bma222_set_calibration(signed char* data_cal, int cal_init) { int count = 0; - // for debug + printk("[diony] bma222_set_calibration!!!! .\n"); signed char tmp; data_cal[0] = data_cal[1] = 0; data_cal[2]=1; - //bma222_write_reg_byte(BMA222_SOFT_RESET_REG, BMA222_SOFT_RESET_VAL); - //bma222_msleep(1); - /* Set axes range*/ - //bma222_update_bits(BMA222_RANGE, BMA222_RANGE_2G); - //bma222_set_delay(acc_data.delay); - //bma222_update_bits(BMA222_DATA_ENBL, 1); - - if (cal_init == 1) - { + + if (cal_init == 1) { printk(KERN_INFO "[HSS] Calibraion Init\n"); bma222_set_offset_filt_x(0); bma222_set_offset_filt_y(0); bma222_set_offset_filt_z(0); - } - else - { + } else { #ifdef DEBUG printk(KERN_INFO "%s\n",__FUNCTION__); printk(KERN_INFO "data are %d,%d,%d\n",data_cal[0],data_cal[1],data_cal[2]); printk(KERN_INFO "start x axis fast calibration\n"); #endif bma222_set_offset_target_x(data_cal[0]); - tmp=1;//selet x axis in cal_trigger + tmp=1; /*select x axis in cal_trigger*/ bma222_set_cal_trigger(tmp); do { @@ -880,12 +871,11 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) #ifdef DEBUG printk(KERN_INFO "wait 2ms and got cal ready flag is %d\n",tmp); #endif - if (count > 1500) - { + if (count > 1500) { printk("[HSS] Calibration ready fail for x\n"); return -1; } - }while(tmp==0); + } while(tmp==0); #ifdef DEBUG bma222_get_offset_filt_x(&tmp); @@ -894,11 +884,7 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) printk(KERN_INFO "start y axis fast calibration\n"); #endif bma222_set_offset_target_y(data_cal[1]); - //bma222_get_offset_target_y(&tmp); - //printk(KERN_INFO "y offset is %d\n",tmp); - //bma222_get_offset_filt_y(&tmp); - //printk(KERN_INFO "y offset filt is %d\n",tmp); - tmp=2;//selet y axis in cal_trigger + tmp=2; /*select y axis in cal_trigger*/ bma222_set_cal_trigger(tmp); count = 0; do @@ -909,12 +895,11 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) #ifdef DEBUG printk(KERN_INFO "wait 2ms and got cal ready flag is %d\n",tmp); #endif - if (count > 1500) - { + if (count > 1500) { printk("[HSS] Calibration ready fail for y\n"); return -1; } - }while(tmp==0); + } while(tmp==0); #ifdef DEBUG bma222_get_offset_filt_y(&tmp); @@ -924,11 +909,7 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) #endif bma222_set_offset_target_z(data_cal[2]); - //bma222_get_offset_target_z(&tmp); - //printk(KERN_INFO "z offset is %d\n",tmp); - //bma222_get_offset_filt_z(&tmp); - //printk(KERN_INFO "z offset filt is %d\n",tmp); - tmp=3;//selet z axis in cal_trigger + tmp=3; /*select z axis in cal_trigger*/ bma222_set_cal_trigger(tmp); count = 0; do @@ -939,12 +920,11 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) #ifdef DEBUG printk(KERN_INFO "wait 2ms and got cal ready flag is %d\n",tmp); #endif - if (count > 1500) - { + if (count > 1500) { printk("[HSS] Calibration ready fail for z\n"); return -1; } - }while(tmp==0); + } while(tmp==0); #ifdef DEBUG bma222_get_offset_filt_z(&tmp); @@ -966,12 +946,11 @@ static int bma222_set_calibration(signed char* data_cal, int cal_init) #ifdef DEBUG printk(KERN_INFO "wait 2ms and got eeprom writing status is %d\n",tmp); #endif - if (count > 1500) - { + if (count > 1500) { printk("[HSS] Calibration eeprom writing fai\n"); return -1; } - }while(tmp==0); + } while(tmp==0); tmp=0;//lock eemprom bma222_set_ee_w(tmp); @@ -1002,15 +981,13 @@ int bma222_set_offset_target_x(unsigned char offsettarget) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_X__REG, &data, 1); printk("[diony] bma222_set_offset_target_data = %d . (read) \n",data); data = BMA222_SET_BITSLICE(data, BMA222_COMP_TARGET_OFFSET_X, offsettarget ); printk("[diony] bma222_set_offset_target_data = %d . (after BITSLICE,write) \n",data); err =bma222_write_reg(BMA222_COMP_TARGET_OFFSET_X__REG, &data, 1); - } + } return err; } /* EasyCASE ) */ @@ -1053,13 +1030,11 @@ int bma222_get_offset_target_x(unsigned char *offsettarget ) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_X__REG, &data, 1); data = BMA222_GET_BITSLICE(data,BMA222_COMP_TARGET_OFFSET_X); *offsettarget = data; - } + } return err; } @@ -1098,13 +1073,11 @@ int bma222_set_offset_target_y(unsigned char offsettarget) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_Y__REG, &data, 1); data = BMA222_SET_BITSLICE(data, BMA222_COMP_TARGET_OFFSET_Y, offsettarget ); err = bma222_write_reg(BMA222_COMP_TARGET_OFFSET_Y__REG, &data, 1); - } + } return err; } @@ -1144,13 +1117,11 @@ int bma222_get_offset_target_y(unsigned char *offsettarget ) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_Y__REG, &data, 1); data = BMA222_GET_BITSLICE(data, BMA222_COMP_TARGET_OFFSET_Y); *offsettarget = data; - } + } return err; } /* EasyCASE ) */ @@ -1188,9 +1159,7 @@ int bma222_set_offset_target_z(unsigned char offsettarget) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_Z__REG, &data, 1); data = BMA222_SET_BITSLICE(data, BMA222_COMP_TARGET_OFFSET_Z, offsettarget ); err = bma222_write_reg(BMA222_COMP_TARGET_OFFSET_Z__REG, &data, 1); @@ -1232,13 +1201,11 @@ int bma222_get_offset_target_z(unsigned char *offsettarget ) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_COMP_TARGET_OFFSET_Z__REG, &data, 1); data =BMA222_GET_BITSLICE(data, BMA222_COMP_TARGET_OFFSET_Z); *offsettarget = data; - } + } return err; } @@ -1251,15 +1218,13 @@ int bma222_set_cal_trigger(unsigned char caltrigger) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_EN_FAST_COMP__REG, &data, 1); printk("[diony] bma222_set_cal_trigger data = %d . (read) \n",data); data = BMA222_SET_BITSLICE(data, BMA222_EN_FAST_COMP, caltrigger ); printk("[diony] bma222_set_cal_trigger data = %d . (after BITSLICE,write) \n",data); err = bma222_write_reg(BMA222_EN_FAST_COMP__REG, &data, 1); - } + } return err; } @@ -1271,15 +1236,13 @@ int bma222_get_cal_ready(unsigned char *calrdy ) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_OFFSET_CTRL_REG, &data, 1); printk("[diony] bma222_get_cal_ready data= %d (read) \n",data); data = BMA222_GET_BITSLICE(data, BMA222_FAST_COMP_RDY_S); printk("[diony] bma222_get_cal_ready data = %d (after BITSLICE)\n",data); *calrdy = data; - } + } return err; } @@ -1292,12 +1255,10 @@ int bma222_set_offset_filt_x(unsigned char offsetfilt) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { data = offsetfilt; err = bma222_write_reg(BMA222_OFFSET_FILT_X_REG, &data, 1); - } + } return err; } @@ -1344,12 +1305,10 @@ int bma222_get_offset_filt_x(unsigned char *offsetfilt ) /* Check initialize */ if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_OFFSET_FILT_X_REG, &data, 1); *offsetfilt = data; - } + } return err; } /* EasyCASE ) */ @@ -1393,14 +1352,12 @@ int bma222_set_offset_filt_y(unsigned char offsetfilt) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { + if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { data = offsetfilt; err = bma222_write_reg(BMA222_OFFSET_FILT_Y_REG, &data, 1); - } + } return err; } /* EasyCASE ) */ @@ -1444,14 +1401,12 @@ int bma222_get_offset_filt_y(unsigned char *offsetfilt ) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { - return BMA_ERROR_NOT_INITIALIZED; - } - else - { - err = bma222_read_reg(BMA222_OFFSET_FILT_Y_REG, &data, 1); + if (acc_data.initialize == 0) { + return BMA_ERROR_NOT_INITIALIZED; + } else { + err = bma222_read_reg(BMA222_OFFSET_FILT_Y_REG, &data, 1); *offsetfilt = data; - } + } return err; } /* EasyCASE ) */ @@ -1495,14 +1450,12 @@ int bma222_set_offset_filt_z(unsigned char offsetfilt) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { - return BMA_ERROR_NOT_INITIALIZED; - } - else - { - data = offsetfilt; - err = bma222_write_reg(BMA222_OFFSET_FILT_Z_REG, &data, 1); - } + if (acc_data.initialize == 0) { + return BMA_ERROR_NOT_INITIALIZED; + } else { + data = offsetfilt; + err = bma222_write_reg(BMA222_OFFSET_FILT_Z_REG, &data, 1); + } return err; } /* EasyCASE ) */ @@ -1546,14 +1499,12 @@ int bma222_get_offset_filt_z(unsigned char *offsetfilt ) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { - return BMA_ERROR_NOT_INITIALIZED; - } - else - { + if (acc_data.initialize == 0) { + return BMA_ERROR_NOT_INITIALIZED; + } else { err = bma222_read_reg(BMA222_OFFSET_FILT_Z_REG, &data, 1); *offsetfilt = data; - } + } return err; } int bma222_set_ee_w(unsigned char eew) @@ -1561,11 +1512,9 @@ int bma222_set_ee_w(unsigned char eew) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { - return BMA_ERROR_NOT_INITIALIZED; - } - else - { + if (acc_data.initialize == 0) { + return BMA_ERROR_NOT_INITIALIZED; + } else { err = bma222_read_reg(BMA222_UNLOCK_EE_WRITE_SETTING__REG, &data, 1); data = BMA222_SET_BITSLICE(data, BMA222_UNLOCK_EE_WRITE_SETTING, eew); err = bma222_write_reg(BMA222_UNLOCK_EE_WRITE_SETTING__REG, &data, 1); @@ -1576,15 +1525,13 @@ int bma222_set_ee_w(unsigned char eew) int bma222_set_ee_prog_trig(void) { int err=0; - unsigned char data; - unsigned char eeprog; + unsigned char data; + unsigned char eeprog; eeprog = 0x01; /* Check initialize */ - if (acc_data.initialize == 0) { + if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_START_EE_WRITE_SETTING__REG, &data, 1); data = BMA222_SET_BITSLICE(data, BMA222_START_EE_WRITE_SETTING, eeprog); err = bma222_write_reg(BMA222_START_EE_WRITE_SETTING__REG, &data, 1); @@ -1597,11 +1544,9 @@ int bma222_get_eeprom_writing_status(unsigned char *eewrite ) int err=0; unsigned char data; /* Check initialize */ - if (acc_data.initialize == 0) { + if (acc_data.initialize == 0) { return BMA_ERROR_NOT_INITIALIZED; - } - else - { + } else { err = bma222_read_reg(BMA222_EEPROM_CTRL_REG, &data, 1); data = BMA222_GET_BITSLICE(data, BMA222_EE_WRITE_SETTING_S); *eewrite = data; diff --git a/drivers/sensors_ancora/bma_accel_driver.c b/drivers/sensors_ancora/bma_accel_driver.c index 048fd318801..e921cce9164 100644 --- a/drivers/sensors_ancora/bma_accel_driver.c +++ b/drivers/sensors_ancora/bma_accel_driver.c @@ -152,24 +152,20 @@ struct bma_acc{ struct bma_acc_private_data *gbma_acc; -static int bma_acc_open(struct inode *inode, struct file *file) +static int bma_acc_open(struct file *file) { int err= 0 ; - //struct bma_acc_private_data* data = container_of(file -> private_data, - // struct bma_acc_private_data, - // bma_acc_device); struct bma_acc_private_data* data = gbma_acc; printk("yac_acc_open(%d)\n", data->ref_count); - if(data->ref_count++ == 0) - { - err = bma_acc_set_enable(data->driver, 1); + if(data->ref_count++ == 0) { + err = bma_acc_set_enable(data->driver, 1); } file -> private_data = data; return err; } -static int bma_acc_close(struct inode *inode, struct file *file) +static int bma_acc_close(struct file *file) { int err= 0 ; struct bma_acc_private_data* data = gbma_acc; @@ -191,14 +187,12 @@ static long bma_acc_ioctl(struct file *file, unsigned int cmd, unsigned long arg struct bma_acc accel_data; switch(cmd) { case BMA_IOCTL_SET_DELAY: - // printk("[diony] BMA_IOCTL_SET_DELAY.\n"); if (copy_from_user(&delay_ns, (void __user *)arg, sizeof(delay_ns))) return -EFAULT; err = bma_acc_set_delay(data->driver, (int)delay_ns); break; case BMA_IOCTL_GET_DELAY: - // printk("[diony] BMA_IOCTL_GET_DELAY.\n"); delay_ns = (unsigned long)bma_acc_get_delay(data->driver); if (put_user(&delay_ns, (s64 __user *) arg)) return -EFAULT; @@ -433,9 +427,7 @@ static int bma_acc_set_enable(struct bma_acc_driver *driver, int enable) if (bma_acc_ischg_enable(driver, enable)) { if (enable) { driver->set_enable(enable); - // schedule_delayed_work(&data->work, delay_to_jiffies(delay) + 1); } else { - // cancel_delayed_work_sync(&data->work); driver->set_enable(enable); } } @@ -813,7 +805,6 @@ static ssize_t bma_acc_calibration_store(struct device *dev, struct input_dev *input = to_input_dev(dev); struct bma_acc_private_data *data = input_get_drvdata(input); struct bma_acc_data accel; - //unsigned long enable_test = 1; data_cal[0] = data_cal[1] = 0; data_cal[2] = 1; @@ -1015,7 +1006,6 @@ static void bma_acc_work_func(struct work_struct *work) data->last = accel; mutex_unlock(&data->data_mutex); - // schedule_delayed_work(&data->work, delay); } static int bma_acc_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -1109,7 +1099,6 @@ static int bma_acc_suspend(struct i2c_client *client, pm_message_t mesg) if (data->suspend == 0) { data->suspend_enable = bma_acc_get_enable(driver); if (data->suspend_enable) { - // cancel_delayed_work_sync(&data->work); bma_acc_set_enable(driver, 0); } } @@ -1131,7 +1120,6 @@ static int bma_acc_resume(struct i2c_client *client) if (data->suspend == 1) { if (data->suspend_enable) { delay = bma_acc_get_delay(driver); - // schedule_delayed_work(&data->work, delay_to_jiffies(delay) + 1); bma_acc_set_enable(driver, 1); } } diff --git a/drivers/sensors_ancora/gp2a_proximity.c b/drivers/sensors_ancora/gp2a_proximity.c index 49f5925da44..eb87f95014d 100644 --- a/drivers/sensors_ancora/gp2a_proximity.c +++ b/drivers/sensors_ancora/gp2a_proximity.c @@ -51,21 +51,8 @@ #define GPIO_PS_VOUT 118 #define PMIC_GPIO_PROX_EN 15 /* PMIC GPIO 16 */ #define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + NR_GPIO_IRQS) -//#define PROX_MODE_A #define PROX_MODE_B -#if defined(CONFIG_MACH_APACHE) -//#define PROX_MODE_B_15 //B1.5 mode -//#define PROX_MODE_B_20 -/* -HYS reg setting - - B1 B1.5 B2.0 -VO=0 0x40 0x2F 0x20 -VO=1 0x20 0x0F 0x00 -*/ -#endif - #if defined(PROX_MODE_B) #if defined(PROX_MODE_B_20) #define REGS_HYS_VAL_VO_0 (0x20) @@ -501,8 +488,7 @@ static int gp2a_opt_probe( struct platform_device* pdev ) /* allocate driver_data */ gp2a = kzalloc(sizeof(struct gp2a_data),GFP_KERNEL); - if(!gp2a) - { + if(!gp2a) { pr_err("kzalloc error\n"); return -ENOMEM; @@ -534,7 +520,7 @@ static int gp2a_opt_probe( struct platform_device* pdev ) /* set platdata */ platform_set_drvdata(pdev, gp2a); - gp2a->uevent_kobj = &pdev->dev.kobj; + gp2a->uevent_kobj = &pdev->dev.kobj; /* wake lock init */ wake_lock_init(&prx_wake_lock, WAKE_LOCK_SUSPEND, "prx_wake_lock"); @@ -542,12 +528,10 @@ static int gp2a_opt_probe( struct platform_device* pdev ) /* init i2c */ opt_i2c_init(); - if(opt_i2c_client == NULL) - { + if(opt_i2c_client == NULL) { pr_err("opt_probe failed : i2c_client is NULL\n"); return -ENODEV; - } - else + } else printk("opt_i2c_client : (0x%p)\n",opt_i2c_client); @@ -635,14 +619,12 @@ static int gp2a_opt_resume( struct platform_device* pdev ) gprintk("\n"); - if(gp2a->enabled) //calling - { + if(gp2a->enabled) { //calling err = irq_set_irq_wake(IRQ_GP2A_INT, 0); // enable : 1, disable : 0 printk("[TAEKS] irq_set_irq_wake = %d\n",err); if (err) printk("[TAEKS] irq_set_irq_wake failed\n"); - if (device_may_wakeup(&pdev->dev)) - { + if (device_may_wakeup(&pdev->dev)) { printk("[TAEKS] device_may_wakeup\n"); disable_irq_wake(IRQ_GP2A_INT); } @@ -657,15 +639,11 @@ static int proximity_onoff(u8 onoff) u8 value; int i; - if(onoff) - { - for(i=1;i<5;i++) - { - opt_i2c_write((u8)(i),&gp2a_original_image[i]); - } - } - else - { + if(onoff) { + for(i=1;i<5;i++) { + opt_i2c_write((u8)(i),&gp2a_original_image[i]); + } + } else { #ifdef PROX_MODE_A value = 0x00; #else @@ -690,7 +668,7 @@ static int opt_i2c_probe(struct i2c_client *client, const struct i2c_device_id { struct opt_state *opt; - gprintk("\n"); + gprintk("\n"); opt = kzalloc(sizeof(struct opt_state), GFP_KERNEL); if (opt == NULL) { printk("failed to allocate memory \n"); @@ -729,7 +707,7 @@ static struct i2c_driver opt_i2c_driver = { static struct platform_driver gp2a_opt_driver = { .probe = gp2a_opt_probe, - .remove = gp2a_opt_remove, + .remove = gp2a_opt_remove, .suspend = gp2a_opt_suspend, .resume = gp2a_opt_resume, .driver = { diff --git a/drivers/sensors_ancora/gp2a_rpc.c b/drivers/sensors_ancora/gp2a_rpc.c index 045791952ca..fe3c642b65b 100644 --- a/drivers/sensors_ancora/gp2a_rpc.c +++ b/drivers/sensors_ancora/gp2a_rpc.c @@ -3,9 +3,7 @@ #include #include -#if defined(CONFIG_MACH_ARIESVE) || defined(CONFIG_MACH_ANCORA) || defined(CONFIG_MACH_GODART) || defined(CONFIG_MACH_ANCORA_TMO) || defined(CONFIG_MACH_APACHE) #define MSM_LIGHTSENSOR_ADC_READ -#endif #ifdef MSM_LIGHTSENSOR_ADC_READ @@ -47,8 +45,6 @@ u32 lightsensor_get_adc(void) int rc; static int cnt = 0; - //printk("%s : cnt(%d)\n", __func__, cnt); - cnt = cnt + 1; struct msm_lightsensor_get_adc_ret_data rep; @@ -64,8 +60,6 @@ u32 lightsensor_get_adc(void) return 0; } - //printk("%s : return(%d)\n", __func__, rep.lightsensor_adc); - return rep.lightsensor_adc; } EXPORT_SYMBOL(lightsensor_get_adc); @@ -100,17 +94,15 @@ static int msm_lightsensor_cb_func(struct msm_rpc_client *client, if (rc) pr_err("%s: FAIL: sending reply. rc=%d\n", __func__, rc); - /*if (accept_status == RPC_ACCEPTSTAT_SUCCESS) - msm_batt_update_psy_status();*/ - return rc; } void msm_lightsensor_cleanup(void) { - if (light_client) + if (light_client) { msm_rpc_unregister_client(light_client); + } } EXPORT_SYMBOL(msm_lightsensor_cleanup);