From e8113fc3ae664cc31a0337a749b39842854ba2dd Mon Sep 17 00:00:00 2001 From: lw Date: Wed, 23 May 2012 15:36:26 +0800 Subject: [PATCH] gsensor:add lis3dh support --- arch/arm/mach-rk30/board-rk30-phone-loquat.c | 30 ++++++++++++++++++++ drivers/input/gsensor/Makefile | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rk30/board-rk30-phone-loquat.c b/arch/arm/mach-rk30/board-rk30-phone-loquat.c index b764fd96eb1e..c0df9367017a 100755 --- a/arch/arm/mach-rk30/board-rk30-phone-loquat.c +++ b/arch/arm/mach-rk30/board-rk30-phone-loquat.c @@ -821,6 +821,26 @@ static struct gsensor_platform_data mma8452_info = { }; #endif +#if defined (CONFIG_GS_LIS3DH) +#define LIS3DH_INT_PIN RK30_PIN4_PC0 + +static int lis3dh_init_platform_hw(void) +{ + rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0); + + return 0; +} + +static struct gsensor_platform_data lis3dh_info = { + .model = 8452, + .swap_xy = 0, + .swap_xyz = 1, + .init_platform_hw = lis3dh_init_platform_hw, + .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0}, +}; +#endif + + #if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET) static int rk_headset_io_init(int gpio, char *iomux_name, int iomux_mode) @@ -1535,6 +1555,16 @@ static struct i2c_board_info __initdata i2c0_info[] = { .platform_data = &mma8452_info, }, #endif +#if defined (CONFIG_GS_LIS3DH) + { + .type = "lis3dh", + .addr = 0x19, + .flags = 0, + .irq = LIS3DH_INT_PIN, + .platform_data = &lis3dh_info, + }, +#endif + #if defined (CONFIG_COMPASS_AK8975) { .type = "ak8975", diff --git a/drivers/input/gsensor/Makefile b/drivers/input/gsensor/Makefile index f1bdebf8c1f8..55e9bc973f50 100755 --- a/drivers/input/gsensor/Makefile +++ b/drivers/input/gsensor/Makefile @@ -4,5 +4,5 @@ obj-$(CONFIG_GS_MMA7660) += mma7660.o obj-$(CONFIG_GS_MMA8452) += mma8452.o obj-$(CONFIG_GS_L3G4200D) += l3g4200d.o obj-$(CONFIG_GS_KXTF9) += kxtf9.o -obj-$(CONFIG_GS_LIS3DH) += lis3dh_acc_misc.o +obj-$(CONFIG_GS_LIS3DH) += lis3dh.o obj-$(CONFIG_GS_BMA023) += bma023.o -- 2.34.1