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-ldp.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-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index ea9f049f9965..155b423784c5 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/ads7846.h> | ||
26 | #include <linux/regulator/machine.h> | 25 | #include <linux/regulator/machine.h> |
27 | #include <linux/i2c/twl.h> | 26 | #include <linux/i2c/twl.h> |
28 | #include <linux/io.h> | 27 | #include <linux/io.h> |
@@ -49,6 +48,7 @@ | |||
49 | #include "mux.h" | 48 | #include "mux.h" |
50 | #include "hsmmc.h" | 49 | #include "hsmmc.h" |
51 | #include "control.h" | 50 | #include "control.h" |
51 | #include "common-board-devices.h" | ||
52 | 52 | ||
53 | #define LDP_SMSC911X_CS 1 | 53 | #define LDP_SMSC911X_CS 1 |
54 | #define LDP_SMSC911X_GPIO 152 | 54 | #define LDP_SMSC911X_GPIO 152 |
@@ -168,55 +168,6 @@ static struct platform_device ldp_gpio_keys_device = { | |||
168 | }, | 168 | }, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static int ts_gpio; | ||
172 | |||
173 | /** | ||
174 | * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq | ||
175 | * | ||
176 | * @return - void. If request gpio fails then Flag KERN_ERR. | ||
177 | */ | ||
178 | static void ads7846_dev_init(void) | ||
179 | { | ||
180 | if (gpio_request(ts_gpio, "ads7846 irq") < 0) { | ||
181 | printk(KERN_ERR "can't get ads746 pen down GPIO\n"); | ||
182 | return; | ||
183 | } | ||
184 | |||
185 | gpio_direction_input(ts_gpio); | ||
186 | gpio_set_debounce(ts_gpio, 310); | ||
187 | } | ||
188 | |||
189 | static int ads7846_get_pendown_state(void) | ||
190 | { | ||
191 | return !gpio_get_value(ts_gpio); | ||
192 | } | ||
193 | |||
194 | static struct ads7846_platform_data tsc2046_config __initdata = { | ||
195 | .get_pendown_state = ads7846_get_pendown_state, | ||
196 | .keep_vref_on = 1, | ||
197 | }; | ||
198 | |||
199 | static struct omap2_mcspi_device_config tsc2046_mcspi_config = { | ||
200 | .turbo_mode = 0, | ||
201 | .single_channel = 1, /* 0: slave, 1: master */ | ||
202 | }; | ||
203 | |||
204 | static struct spi_board_info ldp_spi_board_info[] __initdata = { | ||
205 | [0] = { | ||
206 | /* | ||
207 | * TSC2046 operates at a max freqency of 2MHz, so | ||
208 | * operate slightly below at 1.5MHz | ||
209 | */ | ||
210 | .modalias = "ads7846", | ||
211 | .bus_num = 1, | ||
212 | .chip_select = 0, | ||
213 | .max_speed_hz = 1500000, | ||
214 | .controller_data = &tsc2046_mcspi_config, | ||
215 | .irq = 0, | ||
216 | .platform_data = &tsc2046_config, | ||
217 | }, | ||
218 | }; | ||
219 | |||
220 | static struct omap_smsc911x_platform_data smsc911x_cfg = { | 171 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
221 | .cs = LDP_SMSC911X_CS, | 172 | .cs = LDP_SMSC911X_CS, |
222 | .gpio_irq = LDP_SMSC911X_GPIO, | 173 | .gpio_irq = LDP_SMSC911X_GPIO, |
@@ -399,11 +350,7 @@ static void __init omap_ldp_init(void) | |||
399 | ldp_init_smsc911x(); | 350 | ldp_init_smsc911x(); |
400 | omap_i2c_init(); | 351 | omap_i2c_init(); |
401 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); | 352 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); |
402 | ts_gpio = 54; | 353 | omap_ads7846_init(1, 54, 310, NULL); |
403 | ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio); | ||
404 | spi_register_board_info(ldp_spi_board_info, | ||
405 | ARRAY_SIZE(ldp_spi_board_info)); | ||
406 | ads7846_dev_init(); | ||
407 | omap_serial_init(); | 354 | omap_serial_init(); |
408 | usb_musb_init(&musb_board_data); | 355 | usb_musb_init(&musb_board_data); |
409 | board_nand_init(ldp_nand_partitions, | 356 | board_nand_init(ldp_nand_partitions, |