From f675fbc79c34cd7c2f100a3053b5f74e8af4e110 Mon Sep 17 00:00:00 2001 From: lw Date: Wed, 13 Jun 2012 15:17:45 +0800 Subject: [PATCH] rk30_phone:use new sensors driver --- arch/arm/configs/rk30_phone_defconfig | 13 +++--- arch/arm/mach-rk30/board-rk30-phone.c | 59 +++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/arch/arm/configs/rk30_phone_defconfig b/arch/arm/configs/rk30_phone_defconfig index 2a6da95bc078..cac209748794 100755 --- a/arch/arm/configs/rk30_phone_defconfig +++ b/arch/arm/configs/rk30_phone_defconfig @@ -232,13 +232,17 @@ CONFIG_INPUT_MISC=y CONFIG_INPUT_KEYCHORD=y CONFIG_INPUT_TWL6030_PWRBUTTON=y CONFIG_INPUT_UINPUT=y -CONFIG_MAG_SENSORS=y CONFIG_COMPASS_AK8975=y -CONFIG_G_SENSOR_DEVICE=y CONFIG_GS_MMA8452=y -CONFIG_GYRO_SENSOR_DEVICE=y CONFIG_GYRO_L3G4200D=y -CONFIG_LIGHT_SENSOR_DEVICE=y +CONFIG_SENSOR_DEVICE=y +CONFIG_GSENSOR_DEVICE=y +CONFIG_COMPASS_DEVICE=y +CONFIG_GYROSCOPE_DEVICE=y +CONFIG_LIGHT_DEVICE=y +CONFIG_LS_AL3006=y +CONFIG_PROXIMITY_DEVICE=y +CONFIG_PS_AL3006=y # CONFIG_SERIO is not set # CONFIG_CONSOLE_TRANSLATIONS is not set # CONFIG_LEGACY_PTYS is not set @@ -292,7 +296,6 @@ CONFIG_DISPLAY_SUPPORT=y CONFIG_LCD_HSD100PXN_FOR_TDW851=y CONFIG_FB_ROCKCHIP=y CONFIG_LCDC_RK30=y -# CONFIG_LCDC1_RK30 is not set CONFIG_RGA_RK30=y CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set diff --git a/arch/arm/mach-rk30/board-rk30-phone.c b/arch/arm/mach-rk30/board-rk30-phone.c index 1cfe58041be5..6d040538c0ae 100755 --- a/arch/arm/mach-rk30/board-rk30-phone.c +++ b/arch/arm/mach-rk30/board-rk30-phone.c @@ -42,6 +42,7 @@ #include #include #include +#include #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -856,10 +857,10 @@ static int mma8452_init_platform_hw(void) return 0; } -static struct gsensor_platform_data mma8452_info = { - .model = 8452, - .swap_xy = 0, - .swap_xyz = 1, +static struct sensor_platform_data mma8452_info = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, .init_platform_hw = mma8452_init_platform_hw, .orientation = {0, 1, 0, 0, 0, -1, 1, 0, 0}, }; @@ -919,8 +920,11 @@ struct platform_device rk_device_headset = { #endif #if defined (CONFIG_COMPASS_AK8975) -static struct akm8975_platform_data akm8975_info = +static struct sensor_platform_data akm8975_info = { + .type = SENSOR_TYPE_COMPASS, + .irq_enable = 1, + .poll_delay_ms = 30, .m_layout = { { @@ -963,9 +967,12 @@ static int l3g4200d_init_platform_hw(void) return 0; } -static struct l3g4200d_platform_data l3g4200d_info = { +static struct sensor_platform_data l3g4200d_info = { + .type = SENSOR_TYPE_GYROSCOPE, + .irq_enable = 1, + .poll_delay_ms = 30, .orientation = {1, 0, 0, 0, -1, 0, 0, 0, -1}, - .init = l3g4200d_init_platform_hw, + .init_platform_hw = l3g4200d_init_platform_hw, .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware .y_min = 40, .z_min = 20, @@ -1014,6 +1021,23 @@ static struct cm3217_platform_data cm3217_info = { }; #endif +#if defined(CONFIG_PS_AL3006) +static struct sensor_platform_data proximity_info = { + .type = SENSOR_TYPE_PROXIMITY, + .irq_enable = 1, + .poll_delay_ms = 200, +}; +#endif + +#if defined(CONFIG_LS_AL3006) +static struct sensor_platform_data light_info = { + .type = SENSOR_TYPE_LIGHT, + .irq_enable = 1, + .poll_delay_ms = 200, +}; +#endif + + #ifdef CONFIG_FB_ROCKCHIP /***************************************************************************************** @@ -1695,6 +1719,27 @@ static struct i2c_board_info __initdata i2c0_info[] = { .irq = RK30_PIN6_PA2, }, #endif + +#if defined (CONFIG_LS_AL3006) + { + .type = "light_al3006", + .addr = 0x1c, //sel = 0; if sel =1, then addr = 0x1D + .flags = 0, + .irq = RK30_PIN6_PA2, + .platform_data = &light_info, + }, +#endif + +#if defined (CONFIG_PS_AL3006) + { + .type = "proximity_al3006", + .addr = 0x1c, //sel = 0; if sel =1, then addr = 0x1D + .flags = 0, + .irq = RK30_PIN6_PA2, + .platform_data = &proximity_info, + }, +#endif + #if defined (CONFIG_SND_SOC_RK1000) { .type = "rk1000_i2c_codec", -- 2.34.1