gsensor code result in system reboot,gsensor code by lw update
authorywj <ywj@rockchip.com>
Fri, 17 Aug 2012 10:20:55 +0000 (18:20 +0800)
committerywj <ywj@rockchip.com>
Fri, 17 Aug 2012 10:20:55 +0000 (18:20 +0800)
drivers/input/sensors/accel/kxtik.c
drivers/input/sensors/accel/lis3dh.c
drivers/input/sensors/accel/mma8452.c

index 3a014208704d62f7340058b2b7fda8f6d6536331..ac0eca4b950db0cd7855fb9a22103a3af7c4eb34 100755 (executable)
 #define DBG(x...)
 #endif
 
-struct i2c_client *kxtik_client=NULL;
-static struct class *sensor_class = NULL;
-
-static ssize_t sensor_setoratitention(struct device *dev,
-               struct device_attribute *attr, char *buf)
-{
-       int i=0;
-       char gsensororatation[20];
-       
-       struct sensor_private_data *sensor =
-           (struct sensor_private_data *) i2c_get_clientdata(kxtik_client);    
-       struct sensor_platform_data *pdata = sensor->pdata;
-
-       
-       char *p = strstr(buf,"gsensor");
-       int start = strcspn(p,"{");
-       int end = strcspn(p,"}");
-       
-       strncpy(gsensororatation,p+start,end-start+1);
-       char *tmp=gsensororatation;
-       
-
-       while(strncmp(tmp,"}",1)!=0)
-        {
-               if((strncmp(tmp,",",1)==0)||(strncmp(tmp,"{",1)==0))
-               {
-                       
-                        tmp++;         
-                        continue;
-               }       
-               else if(strncmp(tmp,"-",1)==0)
-               {
-                       pdata->orientation[i++]=-1;
-                       DBG("i=%d,data=%d\n",i,pdata->orientation[i]);
-                        tmp++;
-               }               
-               else
-               {
-                       pdata->orientation[i++]=tmp[0]-48;              
-                       DBG("----i=%d,data=%d\n",i,pdata->orientation[i]);      
-               }       
-               tmp++;
-       
-                                               
-        }
-
-       for(i=0;i<9;i++)
-               DBG("i=%d gsensor_info=%d\n",i,pdata->orientation[i]);
-       return 0;
-
-}
-
-static CLASS_ATTR(oratiention, 0777, NULL,sensor_setoratitention);
-
-static int  sensor_sys_init(void)
-{
-       int ret ;
-       sensor_class = class_create(THIS_MODULE, "gsensor");
-       ret =  class_create_file(sensor_class, &class_attr_oratiention);
-      if (ret)
-      {
-       printk("Fail to creat class oratiention.\n");
-      }
-       return 0;
-}
-
-
 /****************operate according to sensor chip:start************/
 
 static int sensor_active(struct i2c_client *client, int enable, int rate)
@@ -152,7 +85,6 @@ static int sensor_init(struct i2c_client *client)
                return result;
        }
        
-       kxtik_client=client;
        sensor->status_cur = SENSOR_OFF;
        
        result = sensor_write_reg(client, KXTIK_DATA_CTRL_REG, KXTIK_ODR400F);
@@ -180,8 +112,6 @@ static int sensor_init(struct i2c_client *client)
                return result;
        }
 
-       sensor_sys_init();
-       
        return result;
 }
 
index 7d6852271abc9eb2d1fa1029d397da5fa0b66d68..1ca48a8cece99a7bdae496dd1ab48aadde66863d 100755 (executable)
@@ -91,73 +91,6 @@ struct sensor_reg_data {
        char data;
 };
 
-struct i2c_client *lis3dgh_client=NULL;
-static struct class *sensor_class = NULL;
-
-static ssize_t sensor_setoratitention(struct device *dev,
-               struct device_attribute *attr, char *buf)
-{
-       int i=0;
-       char gsensororatation[20];
-       
-       struct sensor_private_data *sensor =
-           (struct sensor_private_data *) i2c_get_clientdata(lis3dgh_client);  
-       struct sensor_platform_data *pdata = sensor->pdata;
-
-       
-       char *p = strstr(buf,"gsensor");
-       int start = strcspn(p,"{");
-       int end = strcspn(p,"}");
-       
-       strncpy(gsensororatation,p+start,end-start+1);
-       char *tmp=gsensororatation;
-       
-
-       while(strncmp(tmp,"}",1)!=0)
-        {
-               if((strncmp(tmp,",",1)==0)||(strncmp(tmp,"{",1)==0))
-               {
-                       
-                        tmp++;         
-                        continue;
-               }       
-               else if(strncmp(tmp,"-",1)==0)
-               {
-                       pdata->orientation[i++]=-1;
-                       DBG("i=%d,data=%d\n",i,pdata->orientation[i]);
-                        tmp++;
-               }               
-               else
-               {
-                       pdata->orientation[i++]=tmp[0]-48;              
-                       DBG("----i=%d,data=%d\n",i,pdata->orientation[i]);      
-               }       
-               tmp++;
-       
-                                               
-        }
-
-       for(i=0;i<9;i++)
-               DBG("i=%d gsensor_info=%d\n",i,pdata->orientation[i]);
-       return 0;
-
-}
-
-static CLASS_ATTR(oratiention, 0777, NULL,sensor_setoratitention);
-
-static int  sensor_sys_init(void)
-{
-       int ret ;
-       sensor_class = class_create(THIS_MODULE, "gsensor");
-       ret =  class_create_file(sensor_class, &class_attr_oratiention);
-      if (ret)
-      {
-       printk("Fail to creat class oratiention.\n");
-      }
-       return 0;
-}
-
-
 /****************operate according to sensor chip:start************/
 
 static int sensor_active(struct i2c_client *client, int enable, int rate)
@@ -216,7 +149,6 @@ static int sensor_init(struct i2c_client *client)
                printk("%s:line=%d,error\n",__func__,__LINE__);
                return result;
        }
-       lis3dgh_client = client;
 
        sensor->status_cur = SENSOR_OFF;
        
@@ -250,7 +182,6 @@ static int sensor_init(struct i2c_client *client)
 
        }
        
-       sensor_sys_init();
        return result;
 }
 
index 5258a8b0e51051ae1c7254ae07b6b956623b1b7d..0264e5f009d2c5059d7cefb22019e2de22e5fc4d 100755 (executable)
 #define MMA8452_ENABLE         1
 
 
-struct i2c_client *mma8452_client=NULL;
-static struct class *sensor_class = NULL;
-
-static ssize_t sensor_setoratitention(struct device *dev,
-               struct device_attribute *attr, char *buf)
-{
-       int i=0;
-       char gsensororatation[20];
-       
-       struct sensor_private_data *sensor =
-           (struct sensor_private_data *) i2c_get_clientdata(mma8452_client);  
-       struct sensor_platform_data *pdata = sensor->pdata;
-
-       
-       char *p = strstr(buf,"gsensor");
-       int start = strcspn(p,"{");
-       int end = strcspn(p,"}");
-       
-       strncpy(gsensororatation,p+start,end-start+1);
-       char *tmp=gsensororatation;
-       
-
-       while(strncmp(tmp,"}",1)!=0)
-        {
-               if((strncmp(tmp,",",1)==0)||(strncmp(tmp,"{",1)==0))
-               {
-                       
-                        tmp++;         
-                        continue;
-               }       
-               else if(strncmp(tmp,"-",1)==0)
-               {
-                       pdata->orientation[i++]=-1;
-                       DBG("i=%d,data=%d\n",i,pdata->orientation[i]);
-                        tmp++;
-               }               
-               else
-               {
-                       pdata->orientation[i++]=tmp[0]-48;              
-                       DBG("----i=%d,data=%d\n",i,pdata->orientation[i]);      
-               }       
-               tmp++;
-       
-                                               
-        }
-
-       for(i=0;i<9;i++)
-               DBG("i=%d gsensor_info=%d\n",i,pdata->orientation[i]);
-       return 0;
-
-}
-
-static CLASS_ATTR(oratiention, 0777, NULL,sensor_setoratitention);
-
-static int  sensor_sys_init(void)
-{
-       int ret ;
-       sensor_class = class_create(THIS_MODULE, "gsensor");
-       ret =  class_create_file(sensor_class, &class_attr_oratiention);
-      if (ret)
-      {
-       printk("Fail to creat class oratiention.\n");
-      }
-       return 0;
-}
-
-
 /****************operate according to sensor chip:start************/
 
 static int sensor_active(struct i2c_client *client, int enable, int rate)
@@ -161,7 +94,6 @@ static int sensor_init(struct i2c_client *client)
                return ret;
        }
        
-       mma8452_client=client;
        sensor->status_cur = SENSOR_OFF;
 
        /* disable FIFO  FMODE = 0*/
@@ -193,8 +125,8 @@ static int sensor_init(struct i2c_client *client)
 
        DBG("mma8452 MMA8452_REG_SYSMOD:%x\n",sensor_read_reg(client,MMA8452_REG_SYSMOD));
 
-       sensor_sys_init();
-
+       printk("------sensor_chip_init\n");
+       
        return ret;
 }