diff options
author | Ameya Palande <ameya.palande@nokia.com> | 2012-05-09 17:19:15 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-05-09 17:19:15 -0400 |
commit | 3b5112011508c3d92938438db506c6794e8a61a5 (patch) | |
tree | a70a1123bf1e35569c7a870b491b2fac72dfec8a /arch/arm/mach-omap2/board-rx51-peripherals.c | |
parent | a0fcda3e12258f9d5886dcaba44992e7daac4e8b (diff) |
ARM: OMAP: rx51: Platform support for lis3lv02d accelerometer
Platform support for lis3lv02d accelerometer
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-rx51-peripherals.c')
-rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index d87ee0612098..415a4b7e86b8 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/leds-lp5523.h> | 44 | #include <linux/leds-lp5523.h> |
45 | 45 | ||
46 | #include <../drivers/staging/iio/light/tsl2563.h> | 46 | #include <../drivers/staging/iio/light/tsl2563.h> |
47 | #include <linux/lis3lv02d.h> | ||
47 | 48 | ||
48 | #include "mux.h" | 49 | #include "mux.h" |
49 | #include "hsmmc.h" | 50 | #include "hsmmc.h" |
@@ -63,6 +64,9 @@ | |||
63 | #define RX51_TSC2005_RESET_GPIO 104 | 64 | #define RX51_TSC2005_RESET_GPIO 104 |
64 | #define RX51_TSC2005_IRQ_GPIO 100 | 65 | #define RX51_TSC2005_IRQ_GPIO 100 |
65 | 66 | ||
67 | #define LIS302_IRQ1_GPIO 181 | ||
68 | #define LIS302_IRQ2_GPIO 180 /* Not yet in use */ | ||
69 | |||
66 | /* list all spi devices here */ | 70 | /* list all spi devices here */ |
67 | enum { | 71 | enum { |
68 | RX51_SPI_WL1251, | 72 | RX51_SPI_WL1251, |
@@ -73,6 +77,77 @@ enum { | |||
73 | static struct wl12xx_platform_data wl1251_pdata; | 77 | static struct wl12xx_platform_data wl1251_pdata; |
74 | static struct tsc2005_platform_data tsc2005_pdata; | 78 | static struct tsc2005_platform_data tsc2005_pdata; |
75 | 79 | ||
80 | #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE) | ||
81 | static int lis302_setup(void) | ||
82 | { | ||
83 | int err; | ||
84 | int irq1 = LIS302_IRQ1_GPIO; | ||
85 | int irq2 = LIS302_IRQ2_GPIO; | ||
86 | |||
87 | /* gpio for interrupt pin 1 */ | ||
88 | err = gpio_request(irq1, "lis3lv02dl_irq1"); | ||
89 | if (err) { | ||
90 | printk(KERN_ERR "lis3lv02dl: gpio request failed\n"); | ||
91 | goto out; | ||
92 | } | ||
93 | |||
94 | /* gpio for interrupt pin 2 */ | ||
95 | err = gpio_request(irq2, "lis3lv02dl_irq2"); | ||
96 | if (err) { | ||
97 | gpio_free(irq1); | ||
98 | printk(KERN_ERR "lis3lv02dl: gpio request failed\n"); | ||
99 | goto out; | ||
100 | } | ||
101 | |||
102 | gpio_direction_input(irq1); | ||
103 | gpio_direction_input(irq2); | ||
104 | |||
105 | out: | ||
106 | return err; | ||
107 | } | ||
108 | |||
109 | static int lis302_release(void) | ||
110 | { | ||
111 | gpio_free(LIS302_IRQ1_GPIO); | ||
112 | gpio_free(LIS302_IRQ2_GPIO); | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static struct lis3lv02d_platform_data rx51_lis3lv02d_data = { | ||
118 | .click_flags = LIS3_CLICK_SINGLE_X | LIS3_CLICK_SINGLE_Y | | ||
119 | LIS3_CLICK_SINGLE_Z, | ||
120 | /* Limits are 0.5g * value */ | ||
121 | .click_thresh_x = 8, | ||
122 | .click_thresh_y = 8, | ||
123 | .click_thresh_z = 10, | ||
124 | /* Click must be longer than time limit */ | ||
125 | .click_time_limit = 9, | ||
126 | /* Kind of debounce filter */ | ||
127 | .click_latency = 50, | ||
128 | |||
129 | /* Limits for all axis. millig-value / 18 to get HW values */ | ||
130 | .wakeup_flags = LIS3_WAKEUP_X_HI | LIS3_WAKEUP_Y_HI, | ||
131 | .wakeup_thresh = 800 / 18, | ||
132 | .wakeup_flags2 = LIS3_WAKEUP_Z_HI , | ||
133 | .wakeup_thresh2 = 900 / 18, | ||
134 | |||
135 | .hipass_ctrl = LIS3_HIPASS1_DISABLE | LIS3_HIPASS2_DISABLE, | ||
136 | |||
137 | /* Interrupt line 2 for click detection, line 1 for thresholds */ | ||
138 | .irq_cfg = LIS3_IRQ2_CLICK | LIS3_IRQ1_FF_WU_12, | ||
139 | |||
140 | .axis_x = LIS3_DEV_X, | ||
141 | .axis_y = LIS3_INV_DEV_Y, | ||
142 | .axis_z = LIS3_INV_DEV_Z, | ||
143 | .setup_resources = lis302_setup, | ||
144 | .release_resources = lis302_release, | ||
145 | .st_min_limits = {-32, 3, 3}, | ||
146 | .st_max_limits = {-3, 32, 32}, | ||
147 | .irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO), | ||
148 | }; | ||
149 | #endif | ||
150 | |||
76 | #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE) | 151 | #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE) |
77 | static struct tsl2563_platform_data rx51_tsl2563_platform_data = { | 152 | static struct tsl2563_platform_data rx51_tsl2563_platform_data = { |
78 | .cover_comp_gain = 16, | 153 | .cover_comp_gain = 16, |
@@ -950,6 +1025,16 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = { | |||
950 | } | 1025 | } |
951 | }; | 1026 | }; |
952 | 1027 | ||
1028 | static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = { | ||
1029 | #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE) | ||
1030 | { | ||
1031 | I2C_BOARD_INFO("lis3lv02d", 0x1d), | ||
1032 | .platform_data = &rx51_lis3lv02d_data, | ||
1033 | .irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO), | ||
1034 | }, | ||
1035 | #endif | ||
1036 | }; | ||
1037 | |||
953 | static int __init rx51_i2c_init(void) | 1038 | static int __init rx51_i2c_init(void) |
954 | { | 1039 | { |
955 | if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || | 1040 | if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || |
@@ -971,7 +1056,8 @@ static int __init rx51_i2c_init(void) | |||
971 | omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); | 1056 | omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); |
972 | omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, | 1057 | omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, |
973 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); | 1058 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); |
974 | omap_register_i2c_bus(3, 400, NULL, 0); | 1059 | omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3, |
1060 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_3)); | ||
975 | return 0; | 1061 | return 0; |
976 | } | 1062 | } |
977 | 1063 | ||