static irqreturn_t phone_active_irq_handler(int irq, void *_mc) { int phone_reset = 0; int phone_active_value = 0; int phone_state = 0; struct modem_ctl *mc = (struct modem_ctl *)_mc; if (!mc->gpio_cp_reset || !mc->gpio_phone_active) { pr_err("[MODEM_IF] no gpio data\n"); return IRQ_HANDLED; } phone_reset = gpio_get_value(mc->gpio_cp_reset); phone_active_value = gpio_get_value(mc->gpio_phone_active); if (phone_reset && phone_active_value) { phone_state = STATE_ONLINE; if (mc->iod && mc->iod->modem_state_changed) mc->iod->modem_state_changed(mc->iod, phone_state); } else if (phone_reset && !phone_active_value) { if (mc->phone_state == STATE_ONLINE) { phone_state = STATE_CRASH_EXIT; if (mc->iod && mc->iod->modem_state_changed) mc->iod->modem_state_changed(mc->iod, phone_state); } } else { phone_state = STATE_OFFLINE; if (mc->iod && mc->iod->modem_state_changed) mc->iod->modem_state_changed(mc->iod, phone_state); } if (phone_active_value) irq_set_irq_type(mc->irq_phone_active, IRQ_TYPE_LEVEL_LOW); else irq_set_irq_type(mc->irq_phone_active, IRQ_TYPE_LEVEL_HIGH); pr_info("phone_active_irq_handler : phone_state=%d\n", phone_state); return IRQ_HANDLED; }
static void __init n8x0_cbus_init(void) { const int retu_irq_gpio = 108; if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ")) return; irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING); n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio); i2c_register_board_info(3, n8x0_i2c_board_info_3, ARRAY_SIZE(n8x0_i2c_board_info_3)); platform_device_register(&n8x0_cbus_device); }
static int hi6401_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw) { struct hi6401_irq *irq = d->host_data; irq_set_chip_and_handler_name(virq, &hi6401_irqchip, handle_simple_irq, "hi6401_irq"); irq_set_chip_data(virq, irq); irq_set_irq_type(virq, IRQ_TYPE_NONE); return 0; }
struct pm_irq_chip * pm8xxx_irq_init(struct device *dev, const struct pm8xxx_irq_platform_data *pdata) { struct pm_irq_chip *chip; int devirq, rc; unsigned int pmirq; if (!pdata) { pr_err("No platform data\n"); return ERR_PTR(-EINVAL); } devirq = pdata->devirq; if (devirq < 0) { pr_err("missing devirq\n"); rc = devirq; return ERR_PTR(-EINVAL); } chip = kzalloc(sizeof(struct pm_irq_chip) + sizeof(u8) * pdata->irq_cdata.nirqs, GFP_KERNEL); if (!chip) { pr_err("Cannot alloc pm_irq_chip struct\n"); return ERR_PTR(-EINVAL); } chip->dev = dev; chip->devirq = devirq; chip->irq_base = pdata->irq_base; chip->num_irqs = pdata->irq_cdata.nirqs; chip->num_blocks = DIV_ROUND_UP(chip->num_irqs, 8); chip->num_masters = DIV_ROUND_UP(chip->num_blocks, 8); spin_lock_init(&chip->pm_irq_lock); for (pmirq = 0; pmirq < chip->num_irqs; pmirq++) { irq_set_chip_and_handler(chip->irq_base + pmirq, &pm8xxx_irq_chip, handle_level_irq); irq_set_chip_data(chip->irq_base + pmirq, chip); #ifdef CONFIG_ARM set_irq_flags(chip->irq_base + pmirq, IRQF_VALID); #else irq_set_noprobe(chip->irq_base + pmirq); #endif } irq_set_irq_type(devirq, pdata->irq_trigger_flag); irq_set_handler_data(devirq, chip); irq_set_chained_handler(devirq, pm8xxx_irq_handler); set_irq_wake(devirq, 1); return chip; }
static void wacom_i2c_resume_work(struct work_struct *work) { struct wacom_i2c *wac_i2c = container_of(work, struct wacom_i2c, resume_work.work); #if defined(WACOM_PDCT_WORK_AROUND) irq_set_irq_type(wac_i2c->irq_pdct, IRQ_TYPE_EDGE_BOTH); #endif wacom_enable_irq(wac_i2c, true); printk(KERN_DEBUG "epen:%s\n", __func__); }
/* interrupt happened due to transition/change of near/far proximity state */ irqreturn_t cm3663_irq_thread_fn(int irq, void *data) { struct cm3663_data *ip = data; u8 val = 1; val = gpio_get_value(ip->pdata->irq); if (val < 0) { pr_err("%s: gpio_get_value error %d\n", __func__, val); return IRQ_HANDLED; } if (val) irq_set_irq_type(irq, IRQF_TRIGGER_LOW); else irq_set_irq_type(irq, IRQF_TRIGGER_HIGH); /* 0 is close, 1 is far */ input_report_abs(ip->proximity_input_dev, ABS_DISTANCE, val); input_sync(ip->proximity_input_dev); wake_lock_timeout(&ip->prx_wake_lock, 3*HZ); return IRQ_HANDLED; }
void __init init_IRQ(void) { int irq; mcf_maskimr(0xffffffff); for (irq = 0; (irq < NR_IRQS); irq++) { irq_set_chip(irq, &intc_irq_chip); irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH); irq_set_handler(irq, handle_level_irq); } }
static irqreturn_t sim_detect_irq_handler(int irq, void *_mc) { struct modem_ctl *mc = (struct modem_ctl *)_mc; pr_info("[MSM] <%s> gpio_sim_detect = %d\n", __func__, gpio_get_value(mc->gpio_sim_detect)); #if defined(CONFIG_MACH_GRANDE) if (gpio_get_value(mc->gpio_sim_detect)) irq_set_irq_type(mc->irq_sim_detect, IRQ_TYPE_LEVEL_LOW); else irq_set_irq_type(mc->irq_sim_detect, IRQ_TYPE_LEVEL_HIGH); schedule_delayed_work(&mc->sim_det_dwork, msecs_to_jiffies(1000)); #else if (mc->iod && mc->iod->sim_state_changed) mc->iod->sim_state_changed(mc->iod, !gpio_get_value(mc->gpio_sim_detect)); #endif return IRQ_HANDLED; }
void switch_int_to_host_and_mask(struct musb *musb) { #ifdef ID_PIN_USE_EX_EINT irq_set_irq_type(usb_iddig_number, IRQF_TRIGGER_LOW); disable_irq(usb_iddig_number); #else musb_writel(musb->mregs, USB_L1INTM, (~IDDIG_INT_STATUS)&musb_readl(musb->mregs, USB_L1INTM)); mb(); musb_writel(musb->mregs, USB_L1INTP, IDDIG_INT_STATUS); #endif DBG(0, "swtich_int_to_host_and_mask is done\n"); }
static int gpio_irq_trigger_inversion(int irq) { struct irq_desc *desc = NULL; int trigger_value = 0; int ret = 0; desc = irq_to_desc(irq); if (!desc) { hwlog_err("[%s]irq_desc null!\n", __func__); return IRQ_NONE; } trigger_value = desc->irq_data.state_use_accessors & IRQD_TRIGGER_MASK; if (trigger_value & IRQF_TRIGGER_LOW) { ret = irq_set_irq_type(irq, IRQF_TRIGGER_HIGH); } else { ret = irq_set_irq_type(irq, IRQF_TRIGGER_LOW); } return ret; }
static int lnw_gpio_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw) { struct lnw_gpio *lnw = d->host_data; irq_set_chip_and_handler_name(virq, &lnw_irqchip, handle_simple_irq, "demux"); irq_set_chip_data(virq, lnw); irq_set_irq_type(virq, IRQ_TYPE_NONE); return 0; }
static void modem_link_pm_config_gpio(void) { int ret = 0; unsigned gpio_link_enable = modem_link_pm_data.gpio_link_enable; unsigned gpio_link_active = modem_link_pm_data.gpio_link_active; unsigned gpio_link_hostwake = modem_link_pm_data.gpio_link_hostwake; unsigned gpio_link_slavewake = modem_link_pm_data.gpio_link_slavewake; if (gpio_link_enable) { ret = gpio_request(gpio_link_enable, "LINK_EN"); if (ret) { mif_err("fail to request gpio %s:%d\n", "LINK_EN", ret); } gpio_direction_output(gpio_link_enable, 0); } if (gpio_link_active) { ret = gpio_request(gpio_link_active, "LINK_ACTIVE"); if (ret) { mif_err("fail to request gpio %s:%d\n", "LINK_ACTIVE", ret); } gpio_direction_output(gpio_link_active, 0); } if (gpio_link_hostwake) { ret = gpio_request(gpio_link_hostwake, "HOSTWAKE"); if (ret) { mif_err("fail to request gpio %s:%d\n", "HOSTWAKE", ret); } gpio_direction_input(gpio_link_hostwake); } if (gpio_link_slavewake) { ret = gpio_request(gpio_link_slavewake, "SLAVEWAKE"); if (ret) { mif_err("fail to request gpio %s:%d\n", "SLAVEWAKE", ret); } gpio_direction_output(gpio_link_slavewake, 0); } if (gpio_link_hostwake) irq_set_irq_type(gpio_to_irq(gpio_link_hostwake), IRQ_TYPE_EDGE_BOTH); active_ctl.gpio_initialized = 1; mif_info("modem_link_pm_config_gpio done\n"); }
static int pl061_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw) { struct pl061_gpio *chip = d->host_data; irq_set_chip_and_handler_name(virq, &pl061_irqchip, handle_simple_irq, "pl061"); irq_set_chip_data(virq, chip); irq_set_irq_type(virq, IRQ_TYPE_NONE); return 0; }
static int db1100_mmc1_cd_setup(void *mmc_host, int en) { int ret = 0; if (en) { irq_set_irq_type(AU1100_GPIO20_INT, IRQ_TYPE_EDGE_BOTH); ret = request_irq(AU1100_GPIO20_INT, db1100_mmc_cd, 0, "sd1_cd", mmc_host); } else free_irq(AU1100_GPIO20_INT, mmc_host); return ret; }
static irqreturn_t ea313x_mci_detect_interrupt(int irq, void *data) { struct lpc313x_mci_irq_data *pdata = data; /* select the opposite level senstivity */ int level = mci_get_cd(0) ? IRQ_TYPE_LEVEL_LOW : IRQ_TYPE_LEVEL_HIGH; irq_set_irq_type(pdata->irq, level); /* change the polarity of irq trigger */ return pdata->irq_hdlr(irq, pdata->data); }
static void camera_focus_eint_func(unsigned long data) { bool pressed = false; u8 old_state; #if 1 if(focuskey_eint_type == IRQ_TYPE_LEVEL_LOW) { old_state = (1); } else { old_state = (0); } kpd_print("[Keypad]old_state = %d\n",(int)old_state); if(focuskey_eint_type == IRQ_TYPE_LEVEL_LOW) { pressed=true; irq_set_irq_type(focuskey_irq, IRQ_TYPE_LEVEL_HIGH); focuskey_eint_type = IRQ_TYPE_LEVEL_HIGH; } else { pressed=false; irq_set_irq_type(focuskey_irq, IRQ_TYPE_LEVEL_LOW); focuskey_eint_type = IRQ_TYPE_LEVEL_LOW; } //kpd_info("[Keypad]revert camera_focus_state = %d \n",(int)camera_capture_state); printk(KPD_SAY "(%s) [Keypad] HW keycode = %u\n", pressed ? "pressed" : "released", KPD_CAM_FOCUS_MAP); //kpd_print("[Keypad]pressed = %d\n",(int)pressed); input_report_key(kpd_input_dev, KPD_CAM_FOCUS_MAP, pressed); input_sync(kpd_input_dev); enable_irq(focuskey_irq); #endif }
static void sii9234_cfg_gpio(void) { printk(KERN_INFO "%s()\n", __func__); /* AP_MHL_SDA */ s3c_gpio_cfgpin(GPIO_MHL_SDA_1_8V, S3C_GPIO_SFN(0x0)); s3c_gpio_setpull(GPIO_MHL_SDA_1_8V, S3C_GPIO_PULL_NONE); /* AP_MHL_SCL */ s3c_gpio_cfgpin(GPIO_MHL_SCL_1_8V, S3C_GPIO_SFN(0x1)); s3c_gpio_setpull(GPIO_MHL_SCL_1_8V, S3C_GPIO_PULL_NONE); /* GPH1(6) XEINT 14 */ s3c_gpio_cfgpin(GPIO_MHL_WAKE_UP, S3C_GPIO_INPUT); irq_set_irq_type(MHL_WAKEUP_IRQ, IRQ_TYPE_EDGE_RISING); s3c_gpio_setpull(GPIO_MHL_WAKE_UP, S3C_GPIO_PULL_DOWN); gpio_request(GPIO_MHL_INT, "MHL_INT"); s5p_register_gpio_interrupt(GPIO_MHL_INT); s3c_gpio_setpull(GPIO_MHL_INT, S3C_GPIO_PULL_DOWN); irq_set_irq_type(MHL_INT_IRQ, IRQ_TYPE_EDGE_RISING); s3c_gpio_cfgpin(GPIO_MHL_INT, GPIO_MHL_INT_AF); s3c_gpio_cfgpin(GPIO_HDMI_EN, S3C_GPIO_OUTPUT); /* HDMI_EN */ gpio_set_value(GPIO_HDMI_EN, GPIO_LEVEL_LOW); s3c_gpio_setpull(GPIO_HDMI_EN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_MHL_RST, S3C_GPIO_OUTPUT); s3c_gpio_setpull(GPIO_MHL_RST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_MHL_RST, GPIO_LEVEL_LOW); #if !defined(CONFIG_MACH_C1_KOR_LGT) && !defined(CONFIG_SAMSUNG_MHL_9290) #if !defined(CONFIG_MACH_P4NOTE) && !defined(CONFIG_MACH_T0) && \ !defined(CONFIG_MACH_M3) && !defined(CONFIG_MACH_SLP_T0_LTE) s3c_gpio_cfgpin(GPIO_MHL_SEL, S3C_GPIO_OUTPUT); s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_MHL_SEL, GPIO_LEVEL_LOW); #endif #endif }
static void __init zeus_init_irq(void) { int level; int isa_irq; pxa27x_init_irq(); /* Peripheral IRQs. It would be nice to move those inside driver configuration, but it is not supported at the moment. */ irq_set_irq_type(gpio_to_irq(ZEUS_AC97_GPIO), IRQ_TYPE_EDGE_RISING); irq_set_irq_type(gpio_to_irq(ZEUS_WAKEUP_GPIO), IRQ_TYPE_EDGE_RISING); irq_set_irq_type(gpio_to_irq(ZEUS_PTT_GPIO), IRQ_TYPE_EDGE_RISING); irq_set_irq_type(gpio_to_irq(ZEUS_EXTGPIO_GPIO), IRQ_TYPE_EDGE_FALLING); irq_set_irq_type(gpio_to_irq(ZEUS_CAN_GPIO), IRQ_TYPE_EDGE_FALLING); /* Setup ISA IRQs */ for (level = 0; level < ARRAY_SIZE(zeus_isa_irqs); level++) { isa_irq = zeus_bit_to_irq(level); irq_set_chip_and_handler(isa_irq, &zeus_irq_chip, handle_edge_irq); irq_clear_status_flags(isa_irq, IRQ_NOREQUEST | IRQ_NOPROBE); } irq_set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING); irq_set_chained_handler(gpio_to_irq(ZEUS_ISA_GPIO), zeus_irq_handler); }
static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) { struct mmc_host *host = dev_id; struct mmc_gpio *ctx = host->slot.handler_priv; int status; spin_lock(&host->lock_cd_pin); if (host->cd_pin_depth == 0) { if (enable_detection_workqueue) { disable_irq_nosync(host->slot.cd_irq); queue_delayed_work(enable_detection_workqueue, &host->enable_detect, msecs_to_jiffies(50)); host->cd_pin_depth++; } else pr_err("%s detection workqueue is null\n", mmc_hostname(host)); } spin_unlock(&host->lock_cd_pin); if (!host->ops) goto out; if (host->ops->card_event) host->ops->card_event(host); status = mmc_gpio_get_status(host); if (unlikely(status < 0)) goto out; if (status ^ ctx->status) { pr_info("%s: slot status change detected (%d -> %d), GPIO_ACTIVE_%s\n", mmc_hostname(host), ctx->status, status, (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) ? "HIGH" : "LOW"); irq_set_irq_type(irq, (status == 0 ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING)); ctx->status = status; host->caps |= host->caps_uhs; host->removed_cnt = 0; host->crc_count = 0; if (disable_auto_sd) goto out; mmc_detect_change(host, msecs_to_jiffies(host->extended_debounce + 200)); mmc_gpio_send_uevent(host); } out: return IRQ_HANDLED; }
static irqreturn_t button_irq_handler(int irq, void *dev_id) { int value1, value2; int retry_limit = 10; #ifdef ACCIDENT_EAR_BTN static struct timeval accident_btn_last; static struct timeval accident_btn; #endif if ((switch_get_state(&hi->sdev) == H2W_NO_DEVICE) || (hi->btn_irq_available == 0)) { pr_err("%s: retrun_irq\n", __func__); #ifdef ACCIDENT_EAR_BTN do_gettimeofday(&accident_btn); if(accident_btn.tv_usec - accident_btn_last.tv_usec < ACCIDENT_BTN_DELAY_MAX) { accident_btn_count++; pr_info("[%s] accident_btn_count=%d\n", __func__, accident_btn_count); } if(accident_btn_count > ACCIDENT_BTN_TIME_MAX) { accident_btn_count = 0; disable_irq_nosync(hi->irq_btn); pr_info("[%s] disable_irq(hi->irq_btn)\n", __func__); } accident_btn_last.tv_sec = accident_btn.tv_sec; accident_btn_last.tv_usec = accident_btn.tv_usec; #endif return IRQ_HANDLED; } do { value1 = gpio_get_value(MSM_GPIO_EAR_SEND_END); irq_set_irq_type(hi->irq_btn, value1 ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING); value2 = gpio_get_value(MSM_GPIO_EAR_SEND_END); } while (value1 != value2 && retry_limit-- > 0); if (value1 == value2 && retry_limit > 0) { hi->btn_debounce_time = ktime_set(0, 60000000); hi->button_state = value1; hrtimer_start(&hi->btn_timer, hi->btn_debounce_time, HRTIMER_MODE_REL); } return IRQ_HANDLED; }
static void set_use_dec(void *data) { int i; /* GPIO Pin Falling/Rising Edge Detect Disable */ for (i=0; i < INPUT_PIN_NUM; i++) { irq_set_irq_type(irq_num[i], 0); disable_irq(irq_num[i]); free_irq(irq_num[i], (void *) 0); dprintk(KERN_INFO LIRC_DRIVER_NAME ": freed IRQ %d\n", irq_num[i]); } }
int __init setup_hd64461(void) { int i, nid = cpu_to_node(boot_cpu_data); if (!MACH_HD64461) return 0; printk(KERN_INFO "HD64461 configured at 0x%x on irq %d(mapped into %d to %d)\n", HD64461_IOBASE, CONFIG_HD64461_IRQ, HD64461_IRQBASE, HD64461_IRQBASE + 15); /* Should be at processor specific part.. */ #if defined(CONFIG_CPU_SUBTYPE_SH7709) __raw_writew(0x2240, INTC_ICR1); #endif __raw_writew(0xffff, HD64461_NIMR); /* IRQ 80 -> 95 belongs to HD64461 */ for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) { unsigned int irq; irq = create_irq_nr(i, nid); if (unlikely(irq == 0)) { pr_err("%s: failed hooking irq %d for HD64461\n", __func__, i); return -EBUSY; } if (unlikely(irq != i)) { pr_err("%s: got irq %d but wanted %d, bailing.\n", __func__, irq, i); destroy_irq(irq); return -EINVAL; } irq_set_chip_and_handler(i, &hd64461_irq_chip, handle_level_irq); } irq_set_chained_handler(CONFIG_HD64461_IRQ, hd64461_irq_demux); irq_set_irq_type(CONFIG_HD64461_IRQ, IRQ_TYPE_LEVEL_LOW); #ifdef CONFIG_HD64461_ENABLER printk(KERN_INFO "HD64461: enabling PCMCIA devices\n"); __raw_writeb(0x4c, HD64461_PCC1CSCIER); __raw_writeb(0x00, HD64461_PCC1CSCR); #endif return 0; }
static void detection_work(struct work_struct *work) { unsigned long irq_flags; int cable_in1; int mic_in = 0; /* Disable headset interrupt while detecting.*/ local_irq_save(irq_flags); disable_irq(hs_data->hp_det_irq); local_irq_restore(irq_flags); irq_set_irq_type(hs_data->hook_det_irq, IRQF_TRIGGER_NONE); set_hs_micbias(ON); if (switch_get_state(&hs_data->sdev) != NO_DEVICE) { /* Delay for pin stable when being removed. */ msleep(110); } else { /* Delay for pin stable when plugged. */ msleep(1000); } /* Restore IRQs */ local_irq_save(irq_flags); enable_irq(hs_data->hp_det_irq); local_irq_restore(irq_flags); if (gpio_get_value(JACK_GPIO) != 0) { /* Headset not plugged in */ remove_headset(); goto closed_micbias; } cable_in1 = gpio_get_value(JACK_GPIO); mic_in = gpio_get_value(HS_HOOK_DET); if (cable_in1 == 0) { printk(KERN_INFO "HOOK_GPIO value: %d\n", mic_in); if (switch_get_state(&hs_data->sdev) == NO_DEVICE) insert_headset(); else if (mic_in == 1) goto closed_micbias; } else{ printk(KERN_INFO "HEADSET: Jack-in GPIO is low, but not a headset\n"); goto closed_micbias; } return; closed_micbias: set_hs_micbias(OFF); return; }
static int pi433_start_rx(struct pi433_device *dev) { int retval; /* return without action, if no pending read request */ if (!dev->rx_active) return 0; /* setup for receiving */ retval = rf69_set_rx_cfg(dev, &dev->rx_cfg); if (retval) return retval; /* setup rssi irq */ retval = rf69_set_dio_mapping(dev->spi, DIO0, DIO_RSSI_DIO0); if (retval < 0) return retval; dev->irq_state[DIO0] = DIO_RSSI_DIO0; irq_set_irq_type(dev->irq_num[DIO0], IRQ_TYPE_EDGE_RISING); /* setup fifo level interrupt */ retval = rf69_set_fifo_threshold(dev->spi, FIFO_SIZE - FIFO_THRESHOLD); if (retval < 0) return retval; retval = rf69_set_dio_mapping(dev->spi, DIO1, DIO_FIFO_LEVEL); if (retval < 0) return retval; dev->irq_state[DIO1] = DIO_FIFO_LEVEL; irq_set_irq_type(dev->irq_num[DIO1], IRQ_TYPE_EDGE_RISING); /* set module to receiving mode */ retval = rf69_set_mode(dev->spi, receive); if (retval < 0) return retval; return 0; }
static irqreturn_t detect_irq_handler(int irq, void *dev_id) { int value1, value2; int retry_limit = 10; H2W_DBG(""); irq_set_irq_type(hi->irq_btn, IRQF_TRIGGER_LOW); do { value1 = gpio_get_value(hi->gpio_detect); irq_set_irq_type(hi->irq, value1 ?IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH); value2 = gpio_get_value(hi->gpio_detect); H2W_DBG("value 1 [%d], value2 [%d]retry[%d]",value1,value2,retry_limit); } while (value1 != value2 && retry_limit-- > 0); H2W_DBG("value2 = %d (%d retries)", value2, (10-retry_limit)); wake_lock_timeout(&hi->wake_lock, 2*HZ); // 2 second /*Attached*/ if (switch_get_state(&hi->sdev) == BIT_NO_DEVICE) { hrtimer_start(&hi->timer, hi->debounce_time, HRTIMER_MODE_REL); H2W_DBG("Plug in timer set \n"); } /*Detached*/ else if(switch_get_state(&hi->sdev) == BIT_HEADSET || switch_get_state(&hi->sdev) == BIT_HEADSET_SPEAKER_ONLY ){ //test gpio_set_value(hi->gpio_mic_mode, 0); hrtimer_start(&hi->timer, hi->unplug_debounce_time, HRTIMER_MODE_REL); H2W_DBG("Unplug timer set \n"); } return IRQ_HANDLED; }
static irqreturn_t button_irq_handler(int irq, void *dev_id) { unsigned int irq_mask = IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW; HS_DBG(); hi->key_irq_type ^= irq_mask; irq_set_irq_type(hi->key_irq, hi->key_irq_type); wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT); queue_delayed_work(button_wq, &button_gpio_work, HS_JIFFIES_ZERO); return IRQ_HANDLED; }
static int opb_host_map(struct irq_domain *host, unsigned int virq, irq_hw_number_t hwirq) { struct opb_pic *opb; opb = host->host_data; irq_set_chip_data(virq, opb); irq_set_chip_and_handler(virq, &opb_irq_chip, handle_level_irq); irq_set_irq_type(virq, IRQ_TYPE_NONE); return 0; }
static int davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { struct davinci_gpio_regs __iomem *g = gpio2regs(hw); irq_set_chip_and_handler_name(irq, &gpio_irqchip, handle_simple_irq, "davinci_gpio"); irq_set_irq_type(irq, IRQ_TYPE_NONE); irq_set_chip_data(irq, (__force void *)g); irq_set_handler_data(irq, (void *)__gpio_mask(hw)); return 0; }
static int mpc8xxx_gpio_irq_map(struct irq_host *h, unsigned int virq, irq_hw_number_t hw) { struct mpc8xxx_gpio_chip *mpc8xxx_gc = h->host_data; if (mpc8xxx_gc->of_dev_id_data) mpc8xxx_irq_chip.irq_set_type = mpc8xxx_gc->of_dev_id_data; irq_set_chip_data(virq, h->host_data); irq_set_chip_and_handler(virq, &mpc8xxx_irq_chip, handle_level_irq); irq_set_irq_type(virq, IRQ_TYPE_NONE); return 0; }
static long link_pm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int value; struct link_pm_data *pm_data = file->private_data; struct modem_ctl *mc = if_usb_get_modemctl(pm_data); mif_info("%x\n", cmd); switch (cmd) { case IOCTL_LINK_CONTROL_ENABLE: if (copy_from_user(&value, (const void __user *)arg, sizeof(int))) return -EFAULT; if (pm_data->link_ldo_enable) pm_data->link_ldo_enable(!!value); if (pm_data->gpio_link_enable) gpio_set_value(pm_data->gpio_link_enable, value); break; case IOCTL_LINK_CONTROL_ACTIVE: if (copy_from_user(&value, (const void __user *)arg, sizeof(int))) return -EFAULT; gpio_set_value(pm_data->gpio_link_active, value); break; case IOCTL_LINK_GET_HOSTWAKE: return !gpio_get_value(pm_data->gpio_link_hostwake); case IOCTL_LINK_CONNECTED: return pm_data->usb_ld->if_usb_connected; case IOCTL_LINK_SET_BIAS_CLEAR: if (copy_from_user(&value, (const void __user *)arg, sizeof(int))) return -EFAULT; if (value) { gpio_direction_output(pm_data->gpio_link_slavewake, 0); gpio_direction_output(pm_data->gpio_link_hostwake, 0); } else { gpio_direction_output(pm_data->gpio_link_slavewake, 0); gpio_direction_input(pm_data->gpio_link_hostwake); irq_set_irq_type(pm_data->irq_link_hostwake, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING); } case IOCTL_LINK_GET_PHONEACTIVE: return gpio_get_value(mc->gpio_phone_active); default: break; } return 0; }