int irq_eint(int irq) { if (gpio_get_value(S5PC11X_GPH1(5))) { atomic_set(&hpd_struct.state, HPD_HI); atomic_set(&poll_state, 1); last_hpd_state = HPD_HI; wake_up_interruptible(&hpd_struct.waitq); } else { atomic_set(&hpd_struct.state, HPD_LO); atomic_set(&poll_state, 1); last_hpd_state = HPD_LO; wake_up_interruptible(&hpd_struct.waitq); } if (atomic_read(&hpd_struct.state)) set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING); else set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING); schedule_work(&hpd_work); HPDIFPRINTK("%s\n", atomic_read(&hpd_struct.state) == HPD_HI ? "HPD HI" : "HPD LO"); return IRQ_HANDLED; }
int s5p_hpd_set_eint(void) { /* HDMI -> EINT */ atomic_set(&hdmi_status, HDMI_OFF); s5p_hdmi_clear_pending(HDMI_IRQ_HPD_PLUG); s5p_hdmi_clear_pending(HDMI_IRQ_HPD_UNPLUG); s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_PLUG); s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_UNPLUG); s3c_gpio_cfgpin(S5PC11X_GPH1(5), S5PC11X_GPH1_5_EXT_INT31_5); s3c_gpio_setpull(S5PC11X_GPH1(5), S3C_GPIO_PULL_DOWN); writel(readl(S5PC11X_GPH1DRV)|0x3<<10, S5PC11X_GPH1DRV); 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); atomic_set(&hdmi_status, HDMI_OFF); s3c_gpio_cfgpin(S5PC11X_GPH1(5), S5PC11X_GPH1_5_EXT_INT31_5); s3c_gpio_setpull(S5PC11X_GPH1(5), S3C_GPIO_PULL_DOWN); writel(readl(S5PC11X_GPH1DRV)|0x3<<10, S5PC11X_GPH1DRV); if (gpio_get_value(S5PC11X_GPH1(5))) { atomic_set(&hpd_struct.state, HPD_HI); last_hpd_state = HPD_HI; } else { atomic_set(&hpd_struct.state, HPD_LO); last_hpd_state = HPD_LO; } set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_BOTH); 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; } 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); return 0; }
int s5p_hpd_set_hdmiint(void) { /* EINT -> HDMI */ set_irq_type(IRQ_EINT13, IRQ_TYPE_NONE); s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_PLUG); s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_UNPLUG); atomic_set(&hdmi_status, HDMI_ON); s3c_gpio_cfgpin(S5PC11X_GPH1(5), S5PC11X_GPH1_5_HDMI_HPD); s3c_gpio_setpull(S5PC11X_GPH1(5), S3C_GPIO_PULL_DOWN); writel(readl(S5PC11X_GPH1DRV)|0x3<<10, S5PC11X_GPH1DRV); s5p_hdmi_hpd_gen(); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_PLUG); s5p_hdmi_enable_interrupts(HDMI_IRQ_HPD_UNPLUG); return 0; }
static irqreturn_t __s5p_hpd_irq(int irq, void *dev_id) { if(gpio_get_value(S5PC11X_GPH1(5))) { printk("\n cable inserted \n"); set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING); } else { printk("\n cable removed\n"); set_irq_type(IRQ_EINT13,IRQ_TYPE_EDGE_RISING); } #if 0 spin_lock_irq(&slock_hpd); #ifdef CONFIG_CPU_S5PC110 //mkh: s5ptv_status.hpd_status = gpio_get_value(S5PC11X_GPH0(5)) ? false:true; #else s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) ? false:true; #endif if(s5ptv_status.hpd_status){ set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_RISING); }else{ set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_FALLING); } if (s5ptv_status.hdcp_en) schedule_work(&ws_hpd); spin_unlock_irq(&slock_hpd); BASEPRINTK("hpd_status = %d\n", s5ptv_status.hpd_status); #endif return IRQ_HANDLED; }
.ngpio = S5PC11X_GPIO_G3_NR, .label = "GPG3", }, }, { .base = S5PC11X_GPH0_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PC11X_GPH0(0), .ngpio = S5PC11X_GPIO_H0_NR, .label = "GPH0", }, }, { .base = S5PC11X_GPH1_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PC11X_GPH1(0), .ngpio = S5PC11X_GPIO_H1_NR, .label = "GPH1", }, }, { .base = S5PC11X_GPH2_BASE, .config = &gpio_cfg_noint, .chip = { .base = S5PC11X_GPH2(0), .ngpio = S5PC11X_GPIO_H2_NR, .label = "GPH2", }, }, { .base = S5PC11X_GPH3_BASE, .config = &gpio_cfg_noint, .chip = {
udelay(50); gpio_set_value(S5PC11X_MP03(6), 1); } #if defined(CONFIG_SPI_CNTRLR_2) static struct s3c_spi_pdata s3c_slv_pdata_2[] __initdata = { [0] = { /* Slave-0 */ .cs_level = CS_FLOAT, .cs_pin = S5PC11X_GPH1(0), .cs_mode = S5PC11X_GPH1_OUTPUT(0), .cs_set = s3c_cs_set, .cs_config = s3c_cs_config, .cs_suspend = s3c_cs_suspend, .cs_resume = s3c_cs_resume, }, }; #endif static struct spi_board_info s3c_spi_devs[] __initdata = { #if defined(CONFIG_SPI_CNTRLR_0) [0] = { .modalias = "spidev", /* Test Interface */ .mode = SPI_MODE_0, /* CPOL=0, CPHA=0 */ .max_speed_hz = 100000,
/* * Probe */ static int __init s5p_tv_probe(struct platform_device *pdev) { int irq_num; int ret; int i; int err; ref_count_tv = 0; ref_count_g0 = 0; ref_count_g1 = 0; __s5p_sdout_probe(pdev, 0); __s5p_vp_probe(pdev, 1); __s5p_mixer_probe(pdev, 2); #ifdef CONFIG_CPU_S5PC110 tv_clk_get(pdev, &s5ptv_status); s5p_tv_clk_gate( true ); #endif #ifdef CONFIG_CPU_S5PC110 __s5p_hdmi_probe(pdev, 3, 4); #endif #ifdef CONFIG_CPU_S5PC100 __s5p_hdmi_probe(pdev, 3); __s5p_tvclk_probe(pdev, 4); #endif /* for dev_dbg err. */ /* clock */ #ifdef FIX_27M_UNSTABLE_ISSUE /* for smdkc100 pop */ writel(0x1, S5PC1XX_GPA0_BASE + 0x56c); #endif spin_lock_init(&slock_hpd); /* for bh */ INIT_WORK(&ws_hpd, (void *)set_ddc_port); /* check EINT init state */ #ifdef CONFIG_SMDKC110_BOARD s3c_gpio_cfgpin(S5PC11X_GPH1(5), S5PC11X_GPH1_5_HDMI_HPD); s3c_gpio_setpull(S5PC11X_GPH1(5), S3C_GPIO_PULL_DOWN); s5ptv_status.hpd_status = gpio_get_value(S5PC11X_GPH1(5)) ? false:true; dev_info(&pdev->dev, "hpd status is cable %s\n", s5ptv_status.hpd_status ? "inserted":"removed"); #endif /* interrupt */ TVOUT_IRQ_INIT(irq_num, ret, pdev, 0, out, __s5p_mixer_irq, "mixer"); TVOUT_IRQ_INIT(irq_num, ret, pdev, 1, out_hdmi_irq, __s5p_hdmi_irq , "hdmi"); TVOUT_IRQ_INIT(irq_num, ret, pdev, 2, out_tvenc_irq, s5p_tvenc_irq, "tvenc"); TVOUT_IRQ_INIT(irq_num, ret, pdev, 3, out_hpd_irq, __s5p_hpd_irq, "hpd"); #ifdef CONFIG_S5PC110_JUPITER_BOARD set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING); #endif /* v4l2 video device registration */ for (i = 0;i < S5P_TVMAX_CTRLS;i++) { s5ptv_status.video_dev[i] = &s5p_tvout[i]; if (video_register_device(s5ptv_status.video_dev[i], VFL_TYPE_GRABBER, s5p_tvout[i].minor) != 0) { dev_err(&pdev->dev, "Couldn't register tvout driver.\n"); return 0; } else dev_info(&pdev->dev, "%s registered successfully \n", s5p_tvout[i].name); } //mkh: //__s5p_hdmi_init_hpd_onoff(1); mutex_for_fo = (struct mutex *)kmalloc(sizeof(struct mutex), GFP_KERNEL); if (mutex_for_fo == NULL) { dev_err(&pdev->dev, "failed to create mutex handle\n"); goto out; } mutex_for_i2c= (struct mutex *)kmalloc(sizeof(struct mutex), GFP_KERNEL); if (mutex_for_i2c == NULL) { dev_err(&pdev->dev, "failed to create mutex handle\n"); goto out; } #ifdef CONFIG_CPU_S5PC110 s5p_tv_clk_gate(false); #endif mutex_init(mutex_for_fo); mutex_init(mutex_for_i2c); return 0; out_hpd_irq: free_irq(IRQ_TVENC, pdev); out_tvenc_irq: free_irq(IRQ_HDMI, pdev); out_hdmi_irq: free_irq(IRQ_MIXER, pdev); out: printk(KERN_ERR "not found (%d). \n", ret); return ret; }
static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) { int offs = eint_offset(irq); int shift; u32 ctrl, mask; u32 newvalue = 0; switch (type) { case IRQ_TYPE_NONE: printk(KERN_WARNING "No edge setting!\n"); break; case IRQ_TYPE_EDGE_RISING: newvalue = S5P_EXTINT_RISEEDGE; break; case IRQ_TYPE_EDGE_FALLING: newvalue = S5P_EXTINT_FALLEDGE; break; case IRQ_TYPE_EDGE_BOTH: newvalue = S5P_EXTINT_BOTHEDGE; break; case IRQ_TYPE_LEVEL_LOW: newvalue = S5P_EXTINT_LOWLEV; break; case IRQ_TYPE_LEVEL_HIGH: newvalue = S5P_EXTINT_HILEV; break; default: printk(KERN_ERR "No such irq type %d", type); return -1; } shift = (offs & 0x7) * 4; mask = 0x7 << shift; ctrl = __raw_readl(S5PC11X_EINTCON(eint_conf_reg(irq))); ctrl &= ~mask; ctrl |= newvalue << shift; __raw_writel(ctrl, S5PC11X_EINTCON(eint_conf_reg(irq))); #ifdef S5PC11X_ALIVEGPIO_STORE ctrl = __raw_readl(S5PC11X_EINTCON(eint_conf_reg(irq))); #endif if((0 <= offs) && (offs < 8)) s3c_gpio_cfgpin(S5PC11X_GPH0(offs&0x7), 0xf<<((offs&0x7)*4)); else if((8 <= offs) && (offs < 16)) s3c_gpio_cfgpin(S5PC11X_GPH1(offs&0x7), 0xf<<((offs&0x7)*4)); else if((16 <= offs) && (offs < 24)) s3c_gpio_cfgpin(S5PC11X_GPH2(offs&0x7), 0xf<<((offs&0x7)*4)); else if((24 <= offs) && (offs < 32)) s3c_gpio_cfgpin(S5PC11X_GPH3(offs&0x7), 0xf<<((offs&0x7)*4)); else printk(KERN_ERR "No such irq number %d", offs); return 0; }