diff options
author | Andrew Victor <andrew@sanpeople.com> | 2007-05-02 12:58:51 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-05-03 09:10:23 -0400 |
commit | 235227285b3e4bae616be5720e6dedb49b914e9d (patch) | |
tree | d254ebb06b612bc7a5ce025ec7286e8bf689635c /arch/arm | |
parent | 7776a94c311504f26e73060920dfb3ccf02786b7 (diff) |
[ARM] 4353/1: AT91: Support ADS7846 touchsceen on SAM9261-EK board
Add support for the ADS7846 Touchscreen found on the Atmel
AT91SAM9261-EK board.
Original patch by Morten Larsen.
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/board-sam9261ek.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index b7e772467cf6..bcf71536cc6d 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/spi/spi.h> | 27 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | ||
28 | #include <linux/dm9000.h> | 29 | #include <linux/dm9000.h> |
29 | 30 | ||
30 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
@@ -195,6 +196,41 @@ static struct at91_nand_data __initdata ek_nand_data = { | |||
195 | }; | 196 | }; |
196 | 197 | ||
197 | /* | 198 | /* |
199 | * ADS7846 Touchscreen | ||
200 | */ | ||
201 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
202 | |||
203 | static int ads7843_pendown_state(void) | ||
204 | { | ||
205 | return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen PENIRQ */ | ||
206 | } | ||
207 | |||
208 | static struct ads7846_platform_data ads_info = { | ||
209 | .model = 7843, | ||
210 | .x_min = 150, | ||
211 | .x_max = 3830, | ||
212 | .y_min = 190, | ||
213 | .y_max = 3830, | ||
214 | .vref_delay_usecs = 100, | ||
215 | .x_plate_ohms = 450, | ||
216 | .y_plate_ohms = 250, | ||
217 | .pressure_max = 15000, | ||
218 | .debounce_max = 1, | ||
219 | .debounce_rep = 0, | ||
220 | .debounce_tol = (~0), | ||
221 | .get_pendown_state = ads7843_pendown_state, | ||
222 | }; | ||
223 | |||
224 | static void __init ek_add_device_ts(void) | ||
225 | { | ||
226 | at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */ | ||
227 | at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */ | ||
228 | } | ||
229 | #else | ||
230 | static void __init ek_add_device_ts(void) {} | ||
231 | #endif | ||
232 | |||
233 | /* | ||
198 | * SPI devices | 234 | * SPI devices |
199 | */ | 235 | */ |
200 | static struct spi_board_info ek_spi_devices[] = { | 236 | static struct spi_board_info ek_spi_devices[] = { |
@@ -204,6 +240,16 @@ static struct spi_board_info ek_spi_devices[] = { | |||
204 | .max_speed_hz = 15 * 1000 * 1000, | 240 | .max_speed_hz = 15 * 1000 * 1000, |
205 | .bus_num = 0, | 241 | .bus_num = 0, |
206 | }, | 242 | }, |
243 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
244 | { | ||
245 | .modalias = "ads7846", | ||
246 | .chip_select = 2, | ||
247 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | ||
248 | .bus_num = 0, | ||
249 | .platform_data = &ads_info, | ||
250 | .irq = AT91SAM9261_ID_IRQ0, | ||
251 | }, | ||
252 | #endif | ||
207 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) | 253 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) |
208 | { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */ | 254 | { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */ |
209 | .modalias = "mtd_dataflash", | 255 | .modalias = "mtd_dataflash", |
@@ -211,9 +257,9 @@ static struct spi_board_info ek_spi_devices[] = { | |||
211 | .max_speed_hz = 15 * 1000 * 1000, | 257 | .max_speed_hz = 15 * 1000 * 1000, |
212 | .bus_num = 0, | 258 | .bus_num = 0, |
213 | }, | 259 | }, |
214 | #elif defined(CONFIG_SND_AT73C213) | 260 | #elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) |
215 | { /* AT73C213 DAC */ | 261 | { /* AT73C213 DAC */ |
216 | .modalias = "snd_at73c213", | 262 | .modalias = "at73c213", |
217 | .chip_select = 3, | 263 | .chip_select = 3, |
218 | .max_speed_hz = 10 * 1000 * 1000, | 264 | .max_speed_hz = 10 * 1000 * 1000, |
219 | .bus_num = 0, | 265 | .bus_num = 0, |
@@ -241,6 +287,8 @@ static void __init ek_board_init(void) | |||
241 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 287 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
242 | /* SPI */ | 288 | /* SPI */ |
243 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 289 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
290 | /* Touchscreen */ | ||
291 | ek_add_device_ts(); | ||
244 | #else | 292 | #else |
245 | /* MMC */ | 293 | /* MMC */ |
246 | at91_add_device_mmc(0, &ek_mmc_data); | 294 | at91_add_device_mmc(0, &ek_mmc_data); |