sensor:add gsensor disable irq operation
authorlw@rock-chips.com <lw@rock-chips.com>
Wed, 15 Aug 2012 03:52:46 +0000 (11:52 +0800)
committerlw <lw@rock-chips.com>
Wed, 15 Aug 2012 03:53:26 +0000 (11:53 +0800)
drivers/input/sensors/sensor-dev.c

index e5ac3e97a3d1e42d364a43ffdb43bf2cbff52f18..6008deb94f3416ee7e45944b8e0214b895cd45e2 100644 (file)
@@ -35,8 +35,6 @@
 #include <linux/l3g4200d.h>\r
 #include <linux/sensor-dev.h>\r
 \r
-#define SENSOR_ON              1\r
-#define SENSOR_OFF             0\r
 \r
 #if 0\r
 #define SENSOR_DEBUG_TYPE SENSOR_TYPE_ACCEL\r
@@ -300,7 +298,7 @@ static int sensor_irq_init(struct i2c_client *client)
                        goto error;            \r
                }\r
                client->irq = irq;\r
-               if((sensor->pdata->type == SENSOR_TYPE_GYROSCOPE))\r
+               if((sensor->pdata->type == SENSOR_TYPE_GYROSCOPE) || (sensor->pdata->type == SENSOR_TYPE_ACCEL))\r
                disable_irq_nosync(client->irq);//disable irq\r
                printk("%s:use irq=%d\n",__func__,irq);\r
        }\r
@@ -399,8 +397,8 @@ static long gsensor_dev_ioctl(struct file *file,
                                }                       \r
                                if(sensor->pdata->irq_enable)\r
                                {\r
-                                       //printk("%s:enable irq,irq=%d\n",__func__,client->irq);\r
-                                       //enable_irq(client->irq);      //enable irq\r
+                                       DBG("%s:enable irq,irq=%d\n",__func__,client->irq);\r
+                                       enable_irq(client->irq);        //enable irq\r
                                }       \r
                                else\r
                                {\r
@@ -429,8 +427,8 @@ static long gsensor_dev_ioctl(struct file *file,
                                \r
                                if(sensor->pdata->irq_enable)\r
                                {                               \r
-                                       //printk("%s:disable irq,irq=%d\n",__func__,client->irq);\r
-                                       //disable_irq_nosync(client->irq);//disable irq\r
+                                       DBG("%s:disable irq,irq=%d\n",__func__,client->irq);\r
+                                       disable_irq_nosync(client->irq);//disable irq\r
                                }\r
                                else\r
                                cancel_delayed_work_sync(&sensor->delaywork);           \r
@@ -451,20 +449,8 @@ static long gsensor_dev_ioctl(struct file *file,
                        mutex_unlock(&sensor->operation_mutex);\r
                        goto error;\r
                }\r
-               if(sensor->status_cur == SENSOR_OFF)\r
-               {               \r
-                       if(sensor->pdata->irq_enable)\r
-                       {\r
-                               //printk("%s:enable irq,irq=%d\n",__func__,client->irq);\r
-                               //enable_irq(client->irq);      //enable irq\r
-                       }       \r
-                       else\r
-                       {\r
-                               PREPARE_DELAYED_WORK(&sensor->delaywork, sensor_delaywork_func);\r
-                               schedule_delayed_work(&sensor->delaywork, msecs_to_jiffies(sensor->pdata->poll_delay_ms));\r
-                       }\r
-                       sensor->status_cur = SENSOR_ON;\r
-               }                       \r
+\r
+               sensor->status_cur = SENSOR_ON;\r
                mutex_unlock(&sensor->operation_mutex); \r
                DBG("%s:GSENSOR_IOCTL_APP_SET_RATE OK\n", __func__);\r
                break;\r