diff options
author | Mike Rapoport <mike@compulab.co.il> | 2011-04-24 18:09:05 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-05-03 05:38:09 -0400 |
commit | 96974a249b0cf3537f49115a59be67e2c54f315c (patch) | |
tree | 4415a81a5ad4a91313bacf6b534b77f5556858a9 /arch/arm/mach-omap2/board-cm-t35.c | |
parent | d14f81741f4ca5c96f52eff0210c8da0b0997d6f (diff) |
omap: consolidate touch screen initialization among different boards
Add common-board-devices.c that will contain the code for peripheral
devices initializatoin shared between multiple boards.
Start small with touchscreen initialization.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-cm-t35.c')
-rw-r--r-- | arch/arm/mach-omap2/board-cm-t35.c | 58 |
1 files changed, 2 insertions, 56 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 7c70f56d628c..4af5cf9ef43a 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include "mux.h" | 54 | #include "mux.h" |
55 | #include "sdram-micron-mt46h32m32lf-6.h" | 55 | #include "sdram-micron-mt46h32m32lf-6.h" |
56 | #include "hsmmc.h" | 56 | #include "hsmmc.h" |
57 | #include "common-board-devices.h" | ||
57 | 58 | ||
58 | #define CM_T35_GPIO_PENDOWN 57 | 59 | #define CM_T35_GPIO_PENDOWN 57 |
59 | 60 | ||
@@ -177,61 +178,6 @@ static void __init cm_t35_init_nand(void) | |||
177 | static inline void cm_t35_init_nand(void) {} | 178 | static inline void cm_t35_init_nand(void) {} |
178 | #endif | 179 | #endif |
179 | 180 | ||
180 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ | ||
181 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
182 | #include <linux/spi/ads7846.h> | ||
183 | |||
184 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
185 | .turbo_mode = 0, | ||
186 | .single_channel = 1, /* 0: slave, 1: master */ | ||
187 | }; | ||
188 | |||
189 | static int ads7846_get_pendown_state(void) | ||
190 | { | ||
191 | return !gpio_get_value(CM_T35_GPIO_PENDOWN); | ||
192 | } | ||
193 | |||
194 | static struct ads7846_platform_data ads7846_config = { | ||
195 | .x_max = 0x0fff, | ||
196 | .y_max = 0x0fff, | ||
197 | .x_plate_ohms = 180, | ||
198 | .pressure_max = 255, | ||
199 | .debounce_max = 10, | ||
200 | .debounce_tol = 3, | ||
201 | .debounce_rep = 1, | ||
202 | .get_pendown_state = ads7846_get_pendown_state, | ||
203 | .keep_vref_on = 1, | ||
204 | }; | ||
205 | |||
206 | static struct spi_board_info cm_t35_spi_board_info[] __initdata = { | ||
207 | { | ||
208 | .modalias = "ads7846", | ||
209 | .bus_num = 1, | ||
210 | .chip_select = 0, | ||
211 | .max_speed_hz = 1500000, | ||
212 | .controller_data = &ads7846_mcspi_config, | ||
213 | .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN), | ||
214 | .platform_data = &ads7846_config, | ||
215 | }, | ||
216 | }; | ||
217 | |||
218 | static void __init cm_t35_init_ads7846(void) | ||
219 | { | ||
220 | if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && | ||
221 | (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) { | ||
222 | gpio_export(CM_T35_GPIO_PENDOWN, 0); | ||
223 | } else { | ||
224 | pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n"); | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | spi_register_board_info(cm_t35_spi_board_info, | ||
229 | ARRAY_SIZE(cm_t35_spi_board_info)); | ||
230 | } | ||
231 | #else | ||
232 | static inline void cm_t35_init_ads7846(void) {} | ||
233 | #endif | ||
234 | |||
235 | #define CM_T35_LCD_EN_GPIO 157 | 181 | #define CM_T35_LCD_EN_GPIO 157 |
236 | #define CM_T35_LCD_BL_GPIO 58 | 182 | #define CM_T35_LCD_BL_GPIO 58 |
237 | #define CM_T35_DVI_EN_GPIO 54 | 183 | #define CM_T35_DVI_EN_GPIO 54 |
@@ -734,7 +680,7 @@ static void __init cm_t35_init(void) | |||
734 | omap_serial_init(); | 680 | omap_serial_init(); |
735 | cm_t35_init_i2c(); | 681 | cm_t35_init_i2c(); |
736 | cm_t35_init_nand(); | 682 | cm_t35_init_nand(); |
737 | cm_t35_init_ads7846(); | 683 | omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL); |
738 | cm_t35_init_ethernet(); | 684 | cm_t35_init_ethernet(); |
739 | cm_t35_init_led(); | 685 | cm_t35_init_led(); |
740 | cm_t35_init_display(); | 686 | cm_t35_init_display(); |