Reply by pana...@yahoo.com November 13, 20102010-11-13
Hi dear friend,
I'm working on linux2.6.30 kernel for At91sam9261-ek like board,
in our board we have connected the irq pin of ads7846 to a gpio(PIN_PA22) instead of IRQ2(PIN_PC2), therefore we have encountered a problem in the kernel for activation of gpio interrupt instead of IRQ.

My question is, How can I redirect the interrupt routine from IRQ to gpio?

Also I have done the following modification in "board-sam9261ek.c" and "ads7846.c" files but while ADS7846 device is probed still the function "at91_aic_set_type" is called instead of "gpio_irq_type".

Thanks a lot for any help.

//if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
// spi->dev.driver->name, ts))
if (request_irq(spi->irq, ads7846_irq, IRQF_SAMPLE_RANDOM
|IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
spi->dev.driver->name, ts))

/*
* SPI devices
*/
static struct spi_board_info ek_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 0,
},
#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
{
.modalias = "ads7846",
.chip_select = 2,
.max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
.bus_num = 0,
.platform_data = &ads_info,
// .irq = AT91SAM9261_ID_IRQ0,
.irq = AT91SAM9261_ID_PIOA,
.controller_data = (void *) AT91_PIN_PA28, /* CS pin */
},
#endif
#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
{ /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
.modalias = "mtd_dataflash",
.chip_select = 3,
.max_speed_hz = 15 * 1000 * 1000,
.bus_num = 0,
},
#elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
{ /* AT73C213 DAC */
.modalias = "at73c213",
.chip_select = 3,
.max_speed_hz = 10 * 1000 * 1000,
.bus_num = 0,
.mode = SPI_MODE_1,
.platform_data = &at73c213_data,
.controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */
},
#endif
};
static int ads7843_pendown_state(void)
{
// return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen return !at91_get_gpio_value(AT91_PIN_PA22); /* Touchscreen PENIRQ */
}

static void __init ek_add_device_ts(void)
{
// at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */

at91_set_gpio_input(AT91_PIN_PA22, 1); /* btn0 */
at91_set_deglitch(AT91_PIN_PA22, 1);
at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */
}