diff options
author | Eric Miao <ycmiao@ycmiao-ubuntu.internal.example.org> | 2008-08-24 05:32:15 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-23 17:04:34 -0400 |
commit | 9ee40d9acf928ef561d655e78cf6c97546b8b4fc (patch) | |
tree | 8b89ebfd1d23a387af3d73015e1cb2ec50b48757 /arch/arm | |
parent | 26b4c8dddd98ba9f759f1986e0116adaa9dce710 (diff) |
[ARM] pxa/poodle: use SPI based ads7846 touch screen driver
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/poodle.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 90 |
3 files changed, 44 insertions, 49 deletions
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 99ecbe7f8506..b069dcbb764c 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -31,7 +31,7 @@ obj-$(CONFIG_MACH_COLIBRI) += colibri.o | |||
31 | obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o | 31 | obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o |
32 | obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o | 32 | obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o |
33 | obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o | 33 | obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o |
34 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o | 34 | obj-$(CONFIG_MACH_POODLE) += poodle.o |
35 | obj-$(CONFIG_MACH_PCM027) += pcm027.o | 35 | obj-$(CONFIG_MACH_PCM027) += pcm027.o |
36 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o | 36 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o |
37 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 37 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h index 67debc47e8c6..ecdd7f693c4c 100644 --- a/arch/arm/mach-pxa/include/mach/poodle.h +++ b/arch/arm/mach-pxa/include/mach/poodle.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define POODLE_GPIO_AC_IN (1) | 23 | #define POODLE_GPIO_AC_IN (1) |
24 | #define POODLE_GPIO_CO 16 | 24 | #define POODLE_GPIO_CO 16 |
25 | #define POODLE_GPIO_TP_INT (5) | 25 | #define POODLE_GPIO_TP_INT (5) |
26 | #define POODLE_GPIO_TP_CS (24) | ||
26 | #define POODLE_GPIO_WAKEUP (11) /* change battery */ | 27 | #define POODLE_GPIO_WAKEUP (11) /* change battery */ |
27 | #define POODLE_GPIO_GA_INT (10) | 28 | #define POODLE_GPIO_GA_INT (10) |
28 | #define POODLE_GPIO_IR_ON (22) | 29 | #define POODLE_GPIO_IR_ON (22) |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 461af1c582bb..d39cbf3e9d28 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/spi/spi.h> | ||
25 | #include <linux/spi/ads7846.h> | ||
24 | 26 | ||
25 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
26 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
@@ -43,6 +45,7 @@ | |||
43 | #include <mach/pxafb.h> | 45 | #include <mach/pxafb.h> |
44 | #include <mach/sharpsl.h> | 46 | #include <mach/sharpsl.h> |
45 | #include <mach/ssp.h> | 47 | #include <mach/ssp.h> |
48 | #include <mach/pxa2xx_spi.h> | ||
46 | 49 | ||
47 | #include <asm/hardware/scoop.h> | 50 | #include <asm/hardware/scoop.h> |
48 | #include <asm/hardware/locomo.h> | 51 | #include <asm/hardware/locomo.h> |
@@ -63,9 +66,9 @@ static unsigned long poodle_pin_config[] __initdata = { | |||
63 | 66 | ||
64 | /* SSP1 */ | 67 | /* SSP1 */ |
65 | GPIO23_SSP1_SCLK, | 68 | GPIO23_SSP1_SCLK, |
66 | GPIO24_SSP1_SFRM, | ||
67 | GPIO25_SSP1_TXD, | 69 | GPIO25_SSP1_TXD, |
68 | GPIO26_SSP1_RXD, | 70 | GPIO26_SSP1_RXD, |
71 | GPIO24_GPIO, /* POODLE_GPIO_TP_CS - SFRM as chip select */ | ||
69 | 72 | ||
70 | /* I2S */ | 73 | /* I2S */ |
71 | GPIO28_I2S_BITCLK_OUT, | 74 | GPIO28_I2S_BITCLK_OUT, |
@@ -197,62 +200,55 @@ struct platform_device poodle_locomo_device = { | |||
197 | 200 | ||
198 | EXPORT_SYMBOL(poodle_locomo_device); | 201 | EXPORT_SYMBOL(poodle_locomo_device); |
199 | 202 | ||
200 | /* | 203 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
201 | * Poodle SSP Device | 204 | static struct pxa2xx_spi_master poodle_spi_info = { |
202 | */ | 205 | .num_chipselect = 1, |
203 | |||
204 | struct platform_device poodle_ssp_device = { | ||
205 | .name = "corgi-ssp", | ||
206 | .id = -1, | ||
207 | }; | 206 | }; |
208 | 207 | ||
209 | struct corgissp_machinfo poodle_ssp_machinfo = { | 208 | static struct ads7846_platform_data poodle_ads7846_info = { |
210 | .port = 1, | 209 | .model = 7846, |
211 | .cs_lcdcon = -1, | 210 | .vref_delay_usecs = 100, |
212 | .cs_ads7846 = -1, | 211 | .x_plate_ohms = 419, |
213 | .cs_max1111 = -1, | 212 | .y_plate_ohms = 486, |
214 | .clk_lcdcon = 2, | 213 | .gpio_pendown = POODLE_GPIO_TP_INT, |
215 | .clk_ads7846 = 36, | ||
216 | .clk_max1111 = 2, | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | 216 | static void ads7846_cs(u32 command) | |
220 | /* | ||
221 | * Poodle Touch Screen Device | ||
222 | */ | ||
223 | static struct resource poodlets_resources[] = { | ||
224 | [0] = { | ||
225 | .start = POODLE_IRQ_GPIO_TP_INT, | ||
226 | .end = POODLE_IRQ_GPIO_TP_INT, | ||
227 | .flags = IORESOURCE_IRQ, | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | static unsigned long poodle_get_hsync_invperiod(void) | ||
232 | { | 217 | { |
233 | return 0; | 218 | gpio_set_value(POODLE_GPIO_TP_CS, !(command == PXA2XX_CS_ASSERT)); |
234 | } | 219 | } |
235 | 220 | ||
236 | static void poodle_null_hsync(void) | 221 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { |
237 | { | 222 | .cs_control = ads7846_cs, |
238 | } | ||
239 | |||
240 | static struct corgits_machinfo poodle_ts_machinfo = { | ||
241 | .get_hsync_invperiod = poodle_get_hsync_invperiod, | ||
242 | .put_hsync = poodle_null_hsync, | ||
243 | .wait_hsync = poodle_null_hsync, | ||
244 | }; | 223 | }; |
245 | 224 | ||
246 | static struct platform_device poodle_ts_device = { | 225 | static struct spi_board_info poodle_spi_devices[] = { |
247 | .name = "corgi-ts", | 226 | { |
248 | .dev = { | 227 | .modalias = "ads7846", |
249 | .platform_data = &poodle_ts_machinfo, | 228 | .max_speed_hz = 10000, |
229 | .bus_num = 1, | ||
230 | .platform_data = &poodle_ads7846_info, | ||
231 | .controller_data= &poodle_ads7846_chip, | ||
232 | .irq = gpio_to_irq(POODLE_GPIO_TP_INT), | ||
250 | }, | 233 | }, |
251 | .id = -1, | ||
252 | .num_resources = ARRAY_SIZE(poodlets_resources), | ||
253 | .resource = poodlets_resources, | ||
254 | }; | 234 | }; |
255 | 235 | ||
236 | static void __init poodle_init_spi(void) | ||
237 | { | ||
238 | int err; | ||
239 | |||
240 | err = gpio_request(POODLE_GPIO_TP_CS, "ADS7846_CS"); | ||
241 | if (err) | ||
242 | return; | ||
243 | |||
244 | gpio_direction_output(POODLE_GPIO_TP_CS, 1); | ||
245 | |||
246 | pxa2xx_set_spi_info(1, &poodle_spi_info); | ||
247 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); | ||
248 | } | ||
249 | #else | ||
250 | static inline void poodle_init_spi(void) {} | ||
251 | #endif | ||
256 | 252 | ||
257 | /* | 253 | /* |
258 | * MMC/SD Device | 254 | * MMC/SD Device |
@@ -419,8 +415,6 @@ static struct pxafb_mach_info poodle_fb_info = { | |||
419 | static struct platform_device *devices[] __initdata = { | 415 | static struct platform_device *devices[] __initdata = { |
420 | &poodle_locomo_device, | 416 | &poodle_locomo_device, |
421 | &poodle_scoop_device, | 417 | &poodle_scoop_device, |
422 | &poodle_ssp_device, | ||
423 | &poodle_ts_device, | ||
424 | }; | 418 | }; |
425 | 419 | ||
426 | static void poodle_poweroff(void) | 420 | static void poodle_poweroff(void) |
@@ -445,7 +439,6 @@ static void __init poodle_init(void) | |||
445 | pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config)); | 439 | pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config)); |
446 | 440 | ||
447 | platform_scoop_config = &poodle_pcmcia_config; | 441 | platform_scoop_config = &poodle_pcmcia_config; |
448 | corgi_ssp_set_machinfo(&poodle_ssp_machinfo); | ||
449 | 442 | ||
450 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | 443 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
451 | if (ret) | 444 | if (ret) |
@@ -457,6 +450,7 @@ static void __init poodle_init(void) | |||
457 | pxa_set_mci_info(&poodle_mci_platform_data); | 450 | pxa_set_mci_info(&poodle_mci_platform_data); |
458 | pxa_set_ficp_info(&poodle_ficp_platform_data); | 451 | pxa_set_ficp_info(&poodle_ficp_platform_data); |
459 | pxa_set_i2c_info(NULL); | 452 | pxa_set_i2c_info(NULL); |
453 | poodle_init_spi(); | ||
460 | } | 454 | } |
461 | 455 | ||
462 | static void __init fixup_poodle(struct machine_desc *desc, | 456 | static void __init fixup_poodle(struct machine_desc *desc, |