From e031c6866d1325e1973e8c961d7e443bf949fd8b Mon Sep 17 00:00:00 2001 From: lyx Date: Mon, 13 Jun 2011 20:16:34 -0700 Subject: [PATCH] phonesdk: add mpu3050 sensors --- arch/arm/configs/rk29_phonesdk_defconfig | 25 +++++++++++- arch/arm/mach-rk29/board-rk29-phonesdk.c | 50 +++++++++++++++++++++++- 2 files changed, 72 insertions(+), 3 deletions(-) mode change 100644 => 100755 arch/arm/configs/rk29_phonesdk_defconfig diff --git a/arch/arm/configs/rk29_phonesdk_defconfig b/arch/arm/configs/rk29_phonesdk_defconfig old mode 100644 new mode 100755 index 70c976ce575f..147d7053cdf2 --- a/arch/arm/configs/rk29_phonesdk_defconfig +++ b/arch/arm/configs/rk29_phonesdk_defconfig @@ -651,8 +651,29 @@ CONFIG_GPS_GNS7560=y # Motion Sensors Support # # CONFIG_MPU_NONE is not set -# CONFIG_SENSORS_MPU3050 is not set +CONFIG_SENSORS_MPU3050=y # CONFIG_SENSORS_MPU6000 is not set +# CONFIG_SENSORS_ACCELEROMETER_NONE is not set +# CONFIG_SENSORS_ADXL346 is not set +# CONFIG_SENSORS_BMA150 is not set +# CONFIG_SENSORS_BMA222 is not set +# CONFIG_SENSORS_KXSD9 is not set +CONFIG_SENSORS_KXTF9=y +# CONFIG_SENSORS_LIS331DLH is not set +# CONFIG_SENSORS_LSM303DLHA is not set +# CONFIG_SENSORS_MMA8450 is not set +# CONFIG_SENSORS_MMA8451 is not set +# CONFIG_SENSORS_COMPASS_NONE is not set +CONFIG_SENSORS_AK8975=y +# CONFIG_SENSORS_MMC314X is not set +# CONFIG_SENSORS_AMI30X is not set +# CONFIG_SENSORS_HMC5883 is not set +# CONFIG_SENSORS_LSM303DLHM is not set +# CONFIG_SENSORS_YAS529 is not set +# CONFIG_SENSORS_HSCDTD00XX is not set +CONFIG_SENSORS_PRESSURE_NONE=y +# CONFIG_SENSORS_BMA085 is not set +# CONFIG_SENSORS_MPU_DEBUG is not set CONFIG_HAVE_IDE=y # CONFIG_IDE is not set @@ -887,7 +908,7 @@ CONFIG_INPUT_WM831X_ON=y # CONFIG_MAG_SENSORS is not set CONFIG_G_SENSOR_DEVICE=y # CONFIG_GS_MMA7660 is not set -CONFIG_GS_MMA8452=y +# CONFIG_GS_MMA8452 is not set # CONFIG_GS_L3G4200D is not set # CONFIG_INPUT_JOGBALL is not set # CONFIG_LIGHT_SENSOR_DEVICE is not set diff --git a/arch/arm/mach-rk29/board-rk29-phonesdk.c b/arch/arm/mach-rk29/board-rk29-phonesdk.c index 5fa25ecdd462..84604ed82fd9 100755 --- a/arch/arm/mach-rk29/board-rk29-phonesdk.c +++ b/arch/arm/mach-rk29/board-rk29-phonesdk.c @@ -56,7 +56,7 @@ #include #include #include - +#include #include "devices.h" #if defined(CONFIG_MTK23D) @@ -546,6 +546,45 @@ static struct mma8452_platform_data mma8452_info = { }; #endif +#if defined (CONFIG_SENSORS_MPU3050) +/*mpu3050*/ +static struct mpu3050_platform_data mpu3050_data = { + .int_config = 0x10, + //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 }, + //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 }, + .orientation = { 1, 0, 0,0, 1, 0, 0, 0, 1 }, + .level_shifter = 0, +#if defined (CONFIG_SENSORS_KXTF9) + .accel = { + .get_slave_descr = kxtf9_get_slave_descr , + .adapt_num = 0, // The i2c bus to which the mpu device is + // connected + .irq = RK29_PIN6_PC4, + .bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU + .address = 0x0f, + //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 }, + //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 }, + //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 }, + .orientation = {1, 0, 0, 0, 1, 0, 0, 0, 1}, + }, +#endif +#if defined (CONFIG_SENSORS_AK8975) + .compass = { + .get_slave_descr = ak8975_get_slave_descr,/*ak5883_get_slave_descr,*/ + .adapt_num = 0, // The i2c bus to which the compass device is. + // It can be difference with mpu + // connected + .irq = RK29_PIN6_PC5, + .bus = EXT_SLAVE_BUS_PRIMARY, + .address = 0x0d, + //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 }, + //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 }, + .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1}, + }, +#endif +}; +#endif + #if defined(CONFIG_GPIO_WM831X) struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = { { @@ -1763,6 +1802,15 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = { .platform_data = &l3g4200d_info, }, #endif +#if defined (CONFIG_SENSORS_MPU3050) + { + .type = "mpu3050", + .addr = 0x68, + .flags = 0, + .irq = RK29_PIN4_PC4, + .platform_data = &mpu3050_data, + }, +#endif }; #endif -- 2.34.1