irqreturn_t factory_reset_irq(int cpl, void *dev_id, struct pt_regs *regs) { unsigned int delay; if (ignore_resetbutton) { ar7100_gpio_config_int (FACTORY_RESET_GPIO,INT_TYPE_LEVEL, INT_POL_ACTIVE_LOW); ignore_resetbutton = 0; return IRQ_HANDLED; } ar7100_gpio_config_int (FACTORY_RESET_GPIO,INT_TYPE_LEVEL,INT_POL_ACTIVE_HIGH); ignore_resetbutton = 1; if (atomic_read(&ar7100_fr_status)) { local_irq_disable(); #define UDELAY_COUNT 4000 for (delay = UDELAY_COUNT; delay; delay--) { if (ar7100_gpio_in_val(FACTORY_RESET_GPIO)) { break; } udelay(1000); } /* * since we are going to reboot the board, we * don't need the interrupt handler anymore, * so disable it. */ disable_irq(AR7100_GPIO_IRQn(FACTORY_RESET_GPIO)); if (!delay) { wake_up(&ar7100_fr_wq); printk("\nar7100: factory configuration restored..\n"); } else { ar7100_restart(NULL); } local_irq_enable(); } return IRQ_HANDLED; }
static int push_button_read(char *page, char **start, off_t off, int count, int *eof, void *data) { ar7100_gpio_config_input(JUMPSTART_GPIO); return sprintf(page, "%d\n", ar7100_gpio_in_val(JUMPSTART_GPIO)); }