From 350763b2dd507ce5d9203d2a2368df5b4be4e545 Mon Sep 17 00:00:00 2001 From: lw Date: Thu, 1 Mar 2012 14:49:35 +0800 Subject: [PATCH] rk30:add akm8975 support --- arch/arm/mach-rk30/board-rk30-sdk.c | 43 +++++++++++++++++++++++++ arch/arm/mach-rk30/include/mach/board.h | 12 ------- arch/arm/plat-rk/include/plat/board.h | 20 ++++++++++++ 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index 47e292a59e90..c87edce5d575 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -291,6 +291,40 @@ static struct mma8452_platform_data mma8452_info = { .orientation = { -1, 0, 0, 0, 0, 1, 0, -1, 0}, }; #endif +#if defined (CONFIG_COMPASS_AK8975) +static struct akm8975_platform_data akm8975_info = +{ + .m_layout = + { + { + {1, 0, 0 }, + {0, -1, 0 }, + {0, 0, -1 }, + }, + + { + {1, 0, 0 }, + {0, 1, 0 }, + {0, 0, 1 }, + }, + + { + {1, 0, 0 }, + {0, 1, 0 }, + {0, 0, 1 }, + }, + + { + {1, 0, 0 }, + {0, 1, 0 }, + {0, 0, 1 }, + }, + } + +}; + +#endif + #if defined(CONFIG_GYRO_L3G4200D) #include @@ -375,6 +409,15 @@ static struct i2c_board_info __initdata i2c0_info[] = { .platform_data = &mma8452_info, }, #endif +#if defined (CONFIG_COMPASS_AK8975) + { + .type = "ak8975", + .addr = 0x0d, + .flags = 0, + .irq = RK30_PIN4_PC1, + .platform_data = &akm8975_info, + }, +#endif #if defined (CONFIG_GYRO_L3G4200D) { .type = "l3g4200d_gryo", diff --git a/arch/arm/mach-rk30/include/mach/board.h b/arch/arm/mach-rk30/include/mach/board.h index 07d71ef0ee1c..551e5da66f27 100755 --- a/arch/arm/mach-rk30/include/mach/board.h +++ b/arch/arm/mach-rk30/include/mach/board.h @@ -22,18 +22,6 @@ struct rk30_i2c_platform_data { int (*io_deinit)(void); }; -struct mma8452_platform_data { - u16 model; - u16 swap_xy; - u16 swap_xyz; - signed char orientation[9]; - int (*get_pendown_state)(void); - int (*init_platform_hw)(void); - int (*mma8452_platform_sleep)(void); - int (*mma8452_platform_wakeup)(void); - void (*exit_platform_hw)(void); -}; - extern struct rk29_sdmmc_platform_data default_sdmmc0_data; extern struct rk29_sdmmc_platform_data default_sdmmc1_data; diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 40b96dcd4e4f..7fca0a4ab1ac 100644 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -76,6 +76,26 @@ struct rk29_sdmmc_platform_data { int write_prt; }; +struct mma8452_platform_data { + u16 model; + u16 swap_xy; + u16 swap_xyz; + signed char orientation[9]; + int (*get_pendown_state)(void); + int (*init_platform_hw)(void); + int (*mma8452_platform_sleep)(void); + int (*mma8452_platform_wakeup)(void); + void (*exit_platform_hw)(void); +}; + +struct akm8975_platform_data { + short m_layout[4][3][3]; + char project_name[64]; + int gpio_DRDY; +}; + + + #define BOOT_MODE_NORMAL 0 #define BOOT_MODE_FACTORY2 1 #define BOOT_MODE_RECOVERY 2 -- 2.34.1