From c6bb80ecef0c3e868a12bb2495a927b254545fce Mon Sep 17 00:00:00 2001 From: luowei Date: Fri, 16 Aug 2013 17:42:33 +0800 Subject: [PATCH] add ak8963 sample code --- arch/arm/mach-rk3188/board-rk3188-sdk.c | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/arch/arm/mach-rk3188/board-rk3188-sdk.c b/arch/arm/mach-rk3188/board-rk3188-sdk.c index 1ecde6f6f52a..7e02094e6eb0 100755 --- a/arch/arm/mach-rk3188/board-rk3188-sdk.c +++ b/arch/arm/mach-rk3188/board-rk3188-sdk.c @@ -436,6 +436,48 @@ static struct sensor_platform_data akm8975_info = #endif +#if defined (CONFIG_COMPASS_AK8963) +static struct sensor_platform_data akm8963_info = +{ + .type = SENSOR_TYPE_COMPASS, + .irq_enable = 1, + .poll_delay_ms = 30, + .layout = 8, + .m_layout = + { + //compass + { + {0, 1, 0}, + {-1, 0, 0}, + {0, 0, 1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + //gsensor + { + {0, -1, 0}, + {1, 0, 0}, + {0, 0, -1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + + } +}; + +#endif + + #if defined(CONFIG_GYRO_L3G4200D) #include @@ -1482,6 +1524,16 @@ static struct i2c_board_info __initdata i2c0_info[] = { .platform_data = &akm8975_info, }, #endif +#if defined (CONFIG_COMPASS_AK8963) + { + .type = "ak8963", + .addr = 0x0d, + .flags = 0, + .irq = RK30_PIN3_PD7, + .platform_data = &akm8963_info, + }, +#endif + #if defined (CONFIG_GYRO_L3G4200D) { .type = "l3g4200d_gryo", -- 2.34.1