int s5p_hpd_open(struct inode *inode, struct file *file) { #ifdef USEEXTINT #else /* adjust the duration of HPD detection */ s5p_tv_clk_gate(true); hdmi_on = true; s5p_hdmi_hpd_gen(); s3c_gpio_cfgpin(S5PV2XX_GPH1(5), S5PV2XX_GPH1_5_HDMI_HPD); s3c_gpio_setpull(S5PV2XX_GPH1(5), S3C_GPIO_PULL_UP); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_PLUG); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_UNPLUG); #endif return 0; }
static int __init s5p_hpd_probe(struct platform_device *pdev) { if (misc_register(&hpd_misc_device)) { printk(KERN_WARNING "Couldn't register device 10, %d.\n" , HPD_MINOR); return -EBUSY; } init_waitqueue_head(&hpd_struct.waitq); spin_lock_init(&hpd_struct.lock); atomic_set(&hpd_struct.state, -1); #ifdef USEEXTINT s3c_gpio_cfgpin(S5PV2XX_GPH1(5), S5PV2XX_GPH1_5_EXT_INT31_5); s3c_gpio_setpull(S5PV2XX_GPH1(5), S3C_GPIO_PULL_UP); if (gpio_get_value(S5PV2XX_GPH1(5))) atomic_set(&hpd_struct.state, HPD_HI); else atomic_set(&hpd_struct.state, HPD_LO); if (request_irq(IRQ_EINT13, s5p_hpd_irq_handler, IRQF_DISABLED, "hpd", s5p_hpd_irq_handler)) { printk(KERN_ERR "failed to install %s irq\n", "hpd"); misc_deregister(&hpd_misc_device); return -EIO; } #else /* must be checked */ s5p_hdmi_register_isr(s5p_hpd_irq_handler, (u8)HDMI_IRQ_HPD_PLUG); s5p_hdmi_register_isr(s5p_hpd_irq_handler, (u8)HDMI_IRQ_HPD_UNPLUG); #endif return 0; }
/* * HPD interrupt handler * * Handles interrupt requests from HPD hardware. * Handler changes value of internal variable and notifies waiting thread. */ irqreturn_t s5p_hpd_irq_handler(int irq) { #ifdef USEEXTINT spin_lock_irq(&hpd_struct.lock); if (gpio_get_value(S5PV2XX_GPH1(5))) atomic_set(&hpd_struct.state, HPD_HI); else atomic_set(&hpd_struct.state, HPD_LO); if (atomic_read(&hpd_struct.state)) set_irq_type(IRQ_EINT13, IRQ_TYPE_LEVEL_LOW); else set_irq_type(IRQ_EINT13, IRQ_TYPE_LEVEL_HIGH); spin_unlock_irq(&hpd_struct.lock); HPDIFPRINTK("hpd_status = %d\n", atomic_read(&hpd_struct.state)); #else u8 flag; int ret = IRQ_HANDLED; /* read flag register */ flag = s5p_hdmi_get_interrupts(); /* is this our interrupt? */ if (!(flag & (1 << HDMI_IRQ_HPD_PLUG | 1 << HDMI_IRQ_HPD_UNPLUG))) { ret = IRQ_NONE; goto out; } /* workaround: ignore HPD IRQ caused by reseting HDCP engine */ if (s5p_hdmi_get_swhpd_status()) { s5p_hdmi_swhpd_disable(); /* clear pending bit */ s5p_hdmi_clear_pending(HDMI_IRQ_HPD_UNPLUG); s5p_hdmi_clear_pending(HDMI_IRQ_HPD_PLUG); ret = IRQ_HANDLED; goto out; } if (flag == (1 << HDMI_IRQ_HPD_PLUG | 1 << HDMI_IRQ_HPD_UNPLUG)) { HPDIFPRINTK("HPD_HI && HPD_LO\n"); if (last_hpd_state == HPD_HI && s5p_hdmi_get_hpd_status()) flag = 1 << HDMI_IRQ_HPD_UNPLUG; else flag = 1 << HDMI_IRQ_HPD_PLUG; } if (flag & (1 << HDMI_IRQ_HPD_PLUG)) { HPDIFPRINTK("HPD_HI\n"); /* clear pending bit */ s5p_hdmi_clear_pending(HDMI_IRQ_HPD_PLUG); s5p_hdmi_clear_pending(HDMI_IRQ_HPD_UNPLUG); atomic_set(&hpd_struct.state, HPD_HI); /* workaround: enable HDMI_IRQ_HPD_UNPLUG interrupt */ s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_PLUG); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_UNPLUG); last_hpd_state = HPD_HI; wake_up_interruptible(&hpd_struct.waitq); } else if (flag & (1 << HDMI_IRQ_HPD_UNPLUG)) { HPDIFPRINTK("HPD_LO\n"); /* clear pending bit */ s5p_hdmi_clear_pending(HDMI_IRQ_HPD_PLUG); s5p_hdmi_clear_pending(HDMI_IRQ_HPD_UNPLUG); atomic_set(&hpd_struct.state, HPD_LO); /* workaround: disable HDMI_IRQ_HPD_UNPLUG interrupt */ last_hpd_state = HPD_LO; s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_UNPLUG); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_PLUG); wake_up_interruptible(&hpd_struct.waitq); } #endif out: return IRQ_HANDLED; }
.ngpio = S5PV2XX_GPIO_G3_NR, .label = "GPG3", }, }, { .base = S5PV2XX_GPH0_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PV2XX_GPH0(0), .ngpio = S5PV2XX_GPIO_H0_NR, .label = "GPH0", }, }, { .base = S5PV2XX_GPH1_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PV2XX_GPH1(0), .ngpio = S5PV2XX_GPIO_H1_NR, .label = "GPH1", }, }, { .base = S5PV2XX_GPH2_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PV2XX_GPH2(0), .ngpio = S5PV2XX_GPIO_H2_NR, .label = "GPH2", }, }, { .base = S5PV2XX_GPH3_BASE, .config = &gpio_cfg_noint, .chip = {