drm/rockchip: add DRM_RENDER_ALLOW
[firefly-linux-kernel-4.4.55.git] / include / linux / l3g4200d.h
index 8d90fec4f8b4c4eb386dbdfc32d1981d56063787..c040b5121fe40b91495ba4a79c6d050c19ca3f1f 100755 (executable)
 /** This define controls compilation of the master device interface */
 /*#define L3G4200D_MASTER_DEVICE*/
 
-#define L3G4200D_IOCTL_BASE 'g'
-/* The following define the IOCTL command values via the ioctl macros */
-#define L3G4200D_SET_RANGE             _IOW(L3G4200D_IOCTL_BASE, 1, int)
-#define L3G4200D_SET_MODE              _IOW(L3G4200D_IOCTL_BASE, 2, int)
-#define L3G4200D_SET_BANDWIDTH         _IOW(L3G4200D_IOCTL_BASE, 3, int)
-#define L3G4200D_READ_GYRO_VALUES      _IOW(L3G4200D_IOCTL_BASE, 4, int)
+#define L3G4200D_IOCTL_BASE 77
+
+#define L3G4200D_IOCTL_SET_DELAY _IOW(L3G4200D_IOCTL_BASE, 0, int)
+#define L3G4200D_IOCTL_GET_DELAY _IOR(L3G4200D_IOCTL_BASE, 1, int)
+#define L3G4200D_IOCTL_SET_ENABLE _IOW(L3G4200D_IOCTL_BASE, 2, int)
+#define L3G4200D_IOCTL_GET_ENABLE _IOR(L3G4200D_IOCTL_BASE, 3, int)
 
 #define L3G4200D_FS_250DPS     0x00
 #define L3G4200D_FS_500DPS     0x10
 #define L3G4200D_FS_2000DPS    0x30
 
-#define PM_OFF         0x00
-#define PM_NORMAL      0x08
-#define ENABLE_ALL_AXES        0x07
+#define PM_OFF                         0x00
+#define PM_NORMAL                      0x08
+#define ENABLE_ALL_AXES                0x07
+
+/* l3g4200d gyroscope registers */
+#define GYRO_WHO_AM_I          0x0F
+#define GYRO_CTRL_REG1         0x20    /* power control reg */
+#define GYRO_CTRL_REG2         0x21    /* power control reg */
+#define GYRO_CTRL_REG3         0x22    /* power control reg */
+#define GYRO_CTRL_REG4         0x23    /* interrupt control reg */
+#define GYRO_CTRL_REG5         0x24    /* interrupt control reg */
+#define GYRO_DATA_REG          0x28
+#define GYRO_INT_SRC           0x31
+
+
+
 
 /*status*/
-#define L3G4200D_SUSPEND           2
+#define L3G4200D_SUSPEND               2
 #define L3G4200D_OPEN           1
 #define L3G4200D_CLOSE          0
 
 #define L3G4200D_REG_CTRL_REG1 0x20
 #define ACTIVE_MASK 0x08
 
+#define GYRO_DEVID_L3G4200D            0xD3
+#define GYRO_DEVID_L3G20D              0xD4
+
+
 #ifdef __KERNEL__
 struct l3g4200d_platform_data {
        u8 fs_range;
@@ -89,7 +106,10 @@ struct l3g4200d_platform_data {
        u8 negate_x;
        u8 negate_y;
        u8 negate_z;
-
+       signed char orientation[9];
+       int x_min;
+       int y_min;
+       int z_min;
        int (*init)(void);
        void (*exit)(void);
        int (*power_on)(void);
@@ -99,40 +119,23 @@ struct l3g4200d_platform_data {
 
 #endif /* __KERNEL__ */
 
-#define MMAIO                          0xA1
-
-/* IOCTLs for MMA8452 library */
-#define ECS_IOCTL_INIT                  _IO(MMAIO, 0x01)
-#define ECS_IOCTL_RESET                  _IO(MMAIO, 0x04)
-#define ECS_IOCTL_CLOSE                           _IO(MMAIO, 0x02)
-#define ECS_IOCTL_START                             _IO(MMAIO, 0x03)
-#define ECS_IOCTL_GETDATA               _IOR(MMAIO, 0x08, char[RBUFF_SIZE+1])
-
-#define GYROSENSOR_IOCTL_MAGIC 'l'
-#define GYROSENSOR_IOCTL_GET_ENABLED _IOR(GYROSENSOR_IOCTL_MAGIC, 1, int *)
-#define GYROSENSOR_IOCTL_ENABLE _IOW(GYROSENSOR_IOCTL_MAGIC, 2, int *)
-
-/* IOCTLs for APPs */
-#define ECS_IOCTL_APP_SET_RATE         _IOW(MMAIO, 0x10, char)
-
-#define EVENT_TYPE_GYRO_X           ABS_RY
-#define ECS_IOCTL_APP_GET_ABS EVIOCGABS(EVENT_TYPE_GYRO_X)             
+struct l3g4200d_axis {
+       int x;
+       int y;
+       int z;
+};
 
 
 struct l3g4200d_data {
     char  status;
     char  curr_tate;
+       unsigned int devid;
        struct input_dev *input_dev;
        struct i2c_client *client;
        struct work_struct work;
        struct delayed_work delaywork;  /*report second event*/
        struct l3g4200d_platform_data *pdata;
-};
-
-struct l3g4200d_axis {
-       int x;
-       int y;
-       int z;
+       struct l3g4200d_axis axis;
 };
 
 #define  GSENSOR_DEV_PATH    "/dev/gyrosensors"