modify gsensor lis3dh active function
authorlw@rock-chips.com <lw@rock-chips.com>
Wed, 20 Jun 2012 04:02:50 +0000 (12:02 +0800)
committerlw <lw@rock-chips.com>
Wed, 20 Jun 2012 04:03:44 +0000 (12:03 +0800)
arch/arm/configs/rk3066_sdk_defconfig
arch/arm/mach-rk30/board-rk30-sdk.c
drivers/input/sensors/accel/lis3dh.c

index 62da1748c241d5f08731d1a9fabf847e9d2b5108..45f44bbcccce969302ab163e5d67bd59e308760a 100755 (executable)
@@ -230,14 +230,15 @@ CONFIG_TOUCHSCREEN_GT8XX=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_KEYCHORD=y
 CONFIG_INPUT_UINPUT=y
-CONFIG_MAG_SENSORS=y
 CONFIG_COMPASS_AK8975=y
-CONFIG_G_SENSOR_DEVICE=y
 CONFIG_GS_LIS3DH=y
-CONFIG_GYRO_SENSOR_DEVICE=y
 CONFIG_GYRO_L3G4200D=y
-CONFIG_LIGHT_SENSOR_DEVICE=y
 CONFIG_LS_CM3217=y
+CONFIG_SENSOR_DEVICE=y
+CONFIG_GSENSOR_DEVICE=y
+CONFIG_COMPASS_DEVICE=y
+CONFIG_GYROSCOPE_DEVICE=y
+CONFIG_LIGHT_DEVICE=y
 # CONFIG_SERIO is not set
 # CONFIG_CONSOLE_TRANSLATIONS is not set
 # CONFIG_LEGACY_PTYS is not set
index dd136a44ff63da5a35c1a0a58dd74f0dc46ab4ec..fd47452bc23201c9a0e61b94792c65eb2d876070 100755 (executable)
@@ -710,12 +710,12 @@ static int lis3dh_init_platform_hw(void)
         return 0;
 }
 
-static struct gsensor_platform_data lis3dh_info = {
-        .model = 8452,
-        .swap_xy = 0,
-        .swap_xyz = 1,
+static struct sensor_platform_data lis3dh_info = {
+       .type = SENSOR_TYPE_ACCEL,
+       .irq_enable = 1,
+       .poll_delay_ms = 30,
         .init_platform_hw = lis3dh_init_platform_hw,
-        .orientation = {0, 0, 1, 0, 1, 0, 1, 0, 0},
+        .orientation = {0, 1, 0, 0, 0, 1, -1, 0, 0},
 };
 #endif
 #if defined (CONFIG_COMPASS_AK8975)
@@ -1301,7 +1301,7 @@ static struct i2c_board_info __initdata i2c0_info[] = {
 #endif
 #if defined (CONFIG_GS_LIS3DH)
        {
-               .type           = "lis3dh",
+               .type           = "gs_lis3dh",
                .addr           = 0x19,   //0x19(SA0-->VCC), 0x18(SA0-->GND)
                .flags          = 0,
                .irq            = LIS3DH_INT_PIN,
index 2a33d93624b18e616091670c88457a6e125236da..ac9c059f71ad5db317a3b1c147a51deed74c2893 100755 (executable)
 #define LIS3DH_RANGE                   2000000\r
 \r
 /* LIS3DH */\r
-#define LIS3DH_PRECISION               12\r
+#define LIS3DH_PRECISION               16\r
 #define LIS3DH_BOUNDARY                        (0x1 << (LIS3DH_PRECISION - 1))\r
 #define LIS3DH_GRAVITY_STEP            (LIS3DH_RANGE / LIS3DH_BOUNDARY)\r
 \r
+#define ODR1                           0x10  /* 1Hz output data rate */\r
+#define ODR10                          0x20  /* 10Hz output data rate */\r
+#define ODR25                          0x30  /* 25Hz output data rate */\r
+#define ODR50                          0x40  /* 50Hz output data rate */\r
+#define ODR100                         0x50  /* 100Hz output data rate */\r
+#define ODR200                         0x60  /* 200Hz output data rate */\r
+#define ODR400                         0x70  /* 400Hz output data rate */\r
+#define ODR1250                                0x90  /* 1250Hz output data rate */\r
+\r
+\r
 \r
 struct sensor_reg_data {\r
        char reg;\r
@@ -92,6 +102,8 @@ static int sensor_active(struct i2c_client *client, int enable, int rate)
        int status = 0;\r
                \r
        sensor->ops->ctrl_data = sensor_read_reg(client, sensor->ops->ctrl_reg);\r
+\r
+       sensor->ops->ctrl_data |= ODR100;       //100HZ,if 0 then power down\r
        \r
        //register setting according to chip datasheet          \r
        if(!enable)\r