示例#1
0
void s3c_setup_keypad_cfg_gpio(int rows, int columns)
{
	unsigned int gpio;
	unsigned int end;

	end = S5PC11X_GPH3(rows);

	/* Set all the necessary GPH2 pins to special-function 0 */
	for (gpio = S5PC11X_GPH3(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
		//s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
	}

	end = S5PC11X_GPJ4(4);
	for (gpio = S5PC11X_GPJ2(7); gpio <= end; gpio++) {
		//s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
		
		s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
		//s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		//s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
		s3c_gpio_setpin(gpio, 0);
	}
}
static ssize_t keyshort_test(struct device *dev, struct device_attribute *attr, char *buf)
{
	int count;
	int mask=0;
        u32 col=0,cval=0,rval=0;
        if(!gpio_get_value(S5PC11X_GPH2(6)))//Power Key
        {
         mask |= 0x1;
        }
        if(!gpio_get_value(S5PC11X_GPH3(3)))//Volume Up
        {
         mask |= 0x10;
        }

        if(HWREV >= 0x2) //yhkim change to 0x2 for Verizon ATLAS. 
        {
            if(!gpio_get_value(S5PC11X_GPH3(1)) )  //volume down
           {
               mask |= 0x100;
           } 

        }        
        else 
        {
     //for Volume Down
            col = 1;
            cval = KEYCOL_DMASK & ~((1 << col) | (1 << (col + 8))); // clear that column number and 
    
            writel(cval, key_base+S3C_KEYIFCOL);             // make that Normal output.
               // others shuld be High-Z output.
            udelay(KEYPAD_DELAY);
	
            rval = ~(readl(key_base+S3C_KEYIFROW)) & ((1<<KEYPAD_ROWS)-1) ;
            writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL);
//
           if((rval&0x02))
           {
             mask |=0x100;
           }
        }


    if(/*!gpio_get_value(GPIO_KBR0) || !gpio_get_value(GPIO_KBR1) || !gpio_get_value(GPIO_KBR2) || */ mask)
	{
		count = sprintf(buf,"PRESS\n");
              printk("keyshort_test: PRESS %d\n",mask);
	}
	else
	{
		count = sprintf(buf,"RELEASE\n");
              printk("keyshort_test: RELEASE\n");
	}	

	return count;
}
示例#3
0
s3c_gpio_pull_t s3c_gpio_get_slp_cfgpin(unsigned int pin)
{
        struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
        void __iomem *reg;
        unsigned long flags;
        int offset;
        u32 con;
        int shift;

        if (!chip)
                return -EINVAL;

	if((pin <= S5PC11X_GPH3(7)) && (pin >= S5PC11X_GPH0(0))) {
                return -EINVAL;
        }

        reg = chip->base + 0x10;

        offset = pin - chip->chip.base;
        shift = offset * 2;

        local_irq_save(flags);

        con = __raw_readl(reg);
        con >>= shift;
        con &= 0x3;

        local_irq_restore(flags);

        return (__force s3c_gpio_pull_t)con;
}
示例#4
0
int s3c_gpio_slp_setpull_updown(unsigned int pin, unsigned int config)
{
        struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
        void __iomem *reg;
        unsigned long flags;
        int offset;
        u32 con;
        int shift;

        if (!chip)
                return -EINVAL;

	if((pin <= S5PC11X_GPH3(7)) && (pin >= S5PC11X_GPH0(0))) {
                return -EINVAL;
        }

        if(config > S3C_GPIO_PULL_UP)
        {
                return -EINVAL;
        }
        reg = chip->base + 0x14;

        offset = pin - chip->chip.base;
        shift = offset * 2;

        local_irq_save(flags);

        con = __raw_readl(reg);
        con &= ~(3 << shift);
        con |= config << shift;
        __raw_writel(con, reg);

        local_irq_restore(flags);
                           
	return 0;
}
示例#5
0
static int s3c_keygpio_isr_setup(void *pdev)
{
	int ret;

	//volume down
	s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH);
	ret =
	    request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr,
			IRQF_SAMPLE_RANDOM, "key vol down", (void *)pdev);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n");
		ret = -EIO;
		return ret;
	}
	//volume up
	s3c_gpio_setpull(S5PV210_GPH3(2), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(26), IRQ_TYPE_EDGE_BOTH);
	ret =
	    request_irq(IRQ_EINT(26), s3c_keygpio_vol_up26_isr,
			IRQF_SAMPLE_RANDOM, "key vol up(26)", (void *)pdev);
	if (ret) {
		printk
		    ("request_irq failed (IRQ_KEYPAD (key vol up(26))) !!!\n");
		ret = -EIO;
		return ret;
	}
	//ok key
	s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key ok", (void *)pdev);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
		ret = -EIO;
		return ret;
	}
	//ok key
#if 0
	s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP);
	set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
			  "key ok", (void *)pdev);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
		ret = -EIO;
		return ret;
	}
#endif

	//PWR key
	s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_NONE);

	set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH);

	// stk.lim: Add IRQF_DISABLED to eliminate any possible race
	// regarding key status
	ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key gpio", (void *)pdev);

	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
		ret = -EIO;
	}

	return ret;

}
示例#6
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	= {
			.base	= S5PC11X_GPH3(0),
			.ngpio	= S5PC11X_GPIO_H3_NR,
			.label	= "GPH3",
		},
	}, {
		.base	= S5PC11X_GPI_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PC11X_GPI(0),
			.ngpio	= S5PC11X_GPIO_I_NR,
			.label	= "GPI",
		},
	}, {
		.base	= S5PC11X_GPJ0_BASE,
		.config	= &gpio_cfg,
		.chip	= {
示例#7
0
static int s3c_keygpio_isr_setup(void *pdev)
{
	int ret;
#if defined(CONFIG_BEHOLD3_VER_B0)
	//volume up
	s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_UP);
	set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
		ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
				"key vol up", (void *) pdev);
		if (ret) {
				printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
				ret = -EIO;
		  return ret;
		}
// [[junghyunseok edit for fuel_int interrupt control of fuel_gauge 20100504
#elif defined(CONFIG_T959_VER_B0) || defined(CONFIG_T959_VER_B5) || defined(CONFIG_HAWK_VER_B0)|| defined (CONFIG_S5PC110_VIBRANTPLUS_BOARD)

		//ok key
#if defined(CONFIG_HAWK_VER_B1_REAL_ADDED_FEATURE) //NAGSM_Android_HQ_KERNEL_CLEE_20100908 : Setup Hawk Real Board Rev 0.1
		s3c_gpio_setpull(S5PV210_GPH3(0), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
#else
		s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
#endif
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	  }

#elif defined(CONFIG_S5PC110_KEPLER_BOARD)
	        
#elif defined(CONFIG_S5PC110_FLEMING_BOARD)

	s3c_gpio_cfgpin(S5PV210_GPH3(5),S3C_GPIO_SFN(3));
	s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_UP);		
	set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);

	ret = request_irq(IRQ_EINT(29), s3c_keygpio_isr_cube_home, IRQF_SAMPLE_RANDOM,
                "Cube Home Key", (void *) pdev);
        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
                ret = -EIO;
	return ret;
        }

#else
		//volume down
	s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr, IRQF_SAMPLE_RANDOM,
	                "key vol down", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }
		
		//volume up
	s3c_gpio_setpull(S5PV210_GPH3(2), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(26), IRQ_TYPE_EDGE_BOTH);
				ret = request_irq(IRQ_EINT(26), s3c_keygpio_vol_up26_isr, IRQF_SAMPLE_RANDOM,
				        "key vol up(26)", (void *) pdev);
	        if (ret) {
					printk("request_irq failed (IRQ_KEYPAD (key vol up(26))) !!!\n");
	                ret = -EIO;
			  return ret;
	        }

		//ok key
	s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_DISABLED
				  | IRQF_SAMPLE_RANDOM, "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }

			
		//ok key
		#if 0
		s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }
		 #endif
#endif

#if defined(CONFIG_HAWK_VER_B1_REAL_ADDED_FEATURE) //NAGSM_Android_HQ_KERNEL_CLEE_20100908 : Setup Hawk Real Board Rev 0.1

#else
#if defined (CONFIG_S5PC110_HAWK_BOARD) // NAGSM_Android_HQ_KERNEL_MINJEONGKO_20100806 for hwak temp key ++  

		//NAGSM_Android_SEL_Kernel_Aakash_20101006
		s3c_gpio_setpull(GPIO_MENUKEY_INT, S3C_GPIO_PULL_NONE); 
		set_irq_type(IRQ_MENUKEY_INT, IRQ_TYPE_EDGE_BOTH);
		s3c_gpio_cfgpin(GPIO_MENUKEY_INT, S3C_GPIO_SFN(0xf));

		s3c_gpio_setpull(GPIO_BACKKEY_INT, S3C_GPIO_PULL_NONE); 
		set_irq_type(IRQ_BACKKEY_INT, IRQ_TYPE_EDGE_BOTH);
		s3c_gpio_cfgpin(GPIO_BACKKEY_INT, S3C_GPIO_SFN(0xf));
		//NAGSM_Android_SEL_Kernel_Aakash_20101006
		
		#if defined (CONFIG_HAWK_VER_B0_HW_FIX) // NAGSM_Android_HQ_KERNEL_CLEE_20100830  search key for hak dosirak 0.1  
		s3c_gpio_setpull(GPIO_SEARCHKEY_INT, S3C_GPIO_PULL_UP); 
		set_irq_type(IRQ_SEARCHKEY_INT, IRQ_TYPE_EDGE_BOTH);	
		#endif

		//NAGSM_Android_SEL_Kernel_Aakash_20101006
		gpio_request(GPIO_MENUKEY_INT, "GPIO_MENUKEY_INT");
		gpio_request(GPIO_BACKKEY_INT, "GPIO_BACKKEY_INT");
		//NAGSM_Android_SEL_Kernel_Aakash_20101006

		if (request_irq(IRQ_MENUKEY_INT, menukey_interrupt,  IRQF_SAMPLE_RANDOM, "key menu", (void *) pdev)) {
					printk("%s Can't allocate irq ..\n", __FUNCTION__);
					return -EBUSY;
			}
	
		if (request_irq(IRQ_BACKKEY_INT, backkey_interrupt,  IRQF_SAMPLE_RANDOM, "key back", (void *) pdev)) {
					printk("%s Can't allocate irq ..\n", __FUNCTION__);
					return -EBUSY;
			}		

		#if defined (CONFIG_HAWK_VER_B0_HW_FIX) // NAGSM_Android_HQ_KERNEL_CLEE_20100830  search key for hak dosirak 0.1  
		if (request_irq(IRQ_SEARCHKEY_INT, searchkey_interrupt,  IRQF_SAMPLE_RANDOM, "key search", (void *) pdev)) {
					printk("%s Can't allocate irq ..\n", __FUNCTION__);
					return -EBUSY;
			}	
		#endif
	
#endif // NAGSM_Android_HQ_KERNEL_MINJEONGKO_20100806 for hwak temp key --  
#endif
	//PWR key
#if defined(CONFIG_HAWK_VER_B1_REAL_ADDED_FEATURE) //NAGSM_Android_HQ_KERNEL_CLEE_20100908 : Setup Hawk Real Board Rev 0.1
	s3c_gpio_setpull(S5PV210_GPH3(7), S3C_GPIO_PULL_UP);

	set_irq_type(IRQ_EINT(31), IRQ_TYPE_EDGE_BOTH);
  
        ret = request_irq(IRQ_EINT(31), s3c_keygpio_isr,  IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
                "key gpio", (void *) pdev);
#else
	s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_NONE);

	set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH);

	// stk.lim: Add IRQF_DISABLED to eliminate any possible race
	// regarding key status
	ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key gpio", (void *)pdev);
#endif
        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
                ret = -EIO;
        }

	return ret;

}
示例#8
0
static int s3c_keygpio_isr_setup(void *pdev)
{
	int ret;
#if defined(CONFIG_BEHOLD3_VER_B0)
	//volume up
	s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_UP);
	set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
		ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
				"key vol up", (void *) pdev);
		if (ret) {
				printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
				ret = -EIO;
		  return ret;
		}
// [[junghyunseok edit for fuel_int interrupt control of fuel_gauge 20100504
#elif defined(CONFIG_T959_VER_B0) || defined(CONFIG_T959_VER_B5)
		//ok key
		s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	  }
#elif defined(CONFIG_S5PC110_SIDEKICK_BOARD)

	//ok key
	s3c_gpio_setpull(S5PV210_GPH3(7), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(31), IRQ_TYPE_EDGE_BOTH);
        ret = request_irq(IRQ_EINT(31), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM, "key ok", (void *) pdev);

        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
                ret = -EIO;
		  return ret;
 	 }
			
	//volume down
	s3c_gpio_setpull(GPIO_VOL_DOWN, S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT14, IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT14, s3c_keygpio_vol_down_isr, IRQF_SAMPLE_RANDOM,
				"key vol down(14)", (void *) pdev);
	
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key vol down(14))) !!!\n");
		ret = -EIO;
		return ret;
	}

	//volume up
	s3c_gpio_setpull(GPIO_VOL_UP, S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(16), IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT(16), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
				"key vol up(16)", (void *) pdev);
	
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key vol up(16))) !!!\n");
		ret = -EIO;
		return ret;
	}

#elif defined(CONFIG_S5PC110_KEPLER_BOARD)
	        
#elif defined(CONFIG_S5PC110_FLEMING_BOARD)

	s3c_gpio_cfgpin(S5PV210_GPH3(5),S3C_GPIO_SFN(3));
  s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_UP);
  set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);

	ret = request_irq(IRQ_EINT(29), s3c_keygpio_isr_cube_home, IRQF_SAMPLE_RANDOM,
                "Cube Home Key", (void *) pdev);
	  if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
			  ret = -EIO;
		return ret;
}

#else
		//volume down
	s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr, IRQF_SAMPLE_RANDOM,
	                "key vol down", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }
		
		//volume up
	s3c_gpio_setpull(S5PV210_GPH3(2), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(26), IRQ_TYPE_EDGE_BOTH);
				ret = request_irq(IRQ_EINT(26), s3c_keygpio_vol_up26_isr, IRQF_SAMPLE_RANDOM,
				        "key vol up(26)", (void *) pdev);
	        if (ret) {
					printk("request_irq failed (IRQ_KEYPAD (key vol up(26))) !!!\n");
	                ret = -EIO;
			  return ret;
	        }

		//ok key
	s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_NONE);
		set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_DISABLED
				  | IRQF_SAMPLE_RANDOM, "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }

			
		//ok key
		#if 0
		s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }
		 #endif
#endif

	//PWR key
	s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_NONE);

	set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH);

	// stk.lim: Add IRQF_DISABLED to eliminate any possible race
	// regarding key status
	ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key gpio", (void *)pdev);

        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
                ret = -EIO;
        }

	return ret;

}
示例#9
0
static int s3c_keygpio_isr_setup(void *pdev)
{
	int ret;
        #ifdef CONFIG_S5PV210_GARNETT_DELTA
          //volume up
                        s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_UP);
                        set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
                        ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
                                "key vol up", (void *) pdev);
                        if (ret) {
                                printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
                                ret = -EIO;
                                  return ret;
                        }

        #else
        if(HWREV >= 0x2) //yhkim change to 0x2 for Verizon ATLAS. 
        {
	     //volume down
	     s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE);
	     set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH);
	     ret = request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr, IRQF_SAMPLE_RANDOM,
		"key vol down", (void *) pdev);
	     if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n");
		ret = -EIO;
		  return ret;
	     }

	     //volume up
	     s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_NONE);
	     set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
	     ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
			"key vol up", (void *) pdev);
	     if (ret) {
			printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
		ret = -EIO;
		  return ret;
	    }
        }
        else
		{
			//volume up
			s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_UP);
			set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
		        ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
		                "key vol up", (void *) pdev);
		        if (ret) {
		                printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
		                ret = -EIO;
				  return ret;
		        }
		} 
       #if 0  //yhkim :: Verizon Atlas did not have OK key. 
	//ok key
	s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key ok", (void *) pdev);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
		ret = -EIO;
		  return ret;
	}

		#endif 	
	//ok key
	#if 0
	s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP);
	set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
		"key ok", (void *) pdev);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
		ret = -EIO;
		  return ret;
	}
	 #endif
        #endif

	//PWR key
	s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_NONE);

	set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH);

	// stk.lim: Add IRQF_DISABLED to eliminate any possible race
	// regarding key status
	ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED
			  | IRQF_SAMPLE_RANDOM, "key gpio", (void *)pdev);

        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
                ret = -EIO;
        }

	return ret;

}
static int s3c_keygpio_isr_setup(void *pdev)
{
	int ret;

//	if(HWREV >= 0xB) //yhkim block it for Verizon ATLAS. 
	{
		if(HWREV >= 0x2) //yhkim change to 0x2 for Verizon ATLAS. 
		{
			//volume down
			s3c_gpio_setpull(S5PC11X_GPH3(1), S3C_GPIO_PULL_UP);
			set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH);
			ret = request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr, IRQF_DISABLED ,
			    "key vol down", (void *) pdev);
			if (ret) {
				printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n");
				ret = -EIO;
				return ret;
			}

            
			//volume up
				printk("\n\n[Keypad] Setup VolUp Key interrupt(%d)!!\n",HWREV);
			s3c_gpio_setpull(S5PC11X_GPH3(3), S3C_GPIO_PULL_UP);
			set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
			ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_DISABLED ,
					"key vol up", (void *) pdev);
			if (ret) {
					printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
					ret = -EIO;
			  return ret;
			}

		}
		else
		{
			//volume up
			s3c_gpio_setpull(S5PC11X_GPH3(3), S3C_GPIO_PULL_UP);
			set_irq_type(IRQ_EINT(27), IRQ_TYPE_EDGE_BOTH);
		        ret = request_irq(IRQ_EINT(27), s3c_keygpio_vol_up_isr, IRQF_SAMPLE_RANDOM,
		                "key vol up", (void *) pdev);
		        if (ret) {
		                printk("request_irq failed (IRQ_KEYPAD (key vol up)) !!!\n");
		                ret = -EIO;
				  return ret;
		        }
		}


		//ok key
		#if 0  //yhkim :: Verizon Atlas did not have OK key. 

		//ok key
		s3c_gpio_setpull(S5PC11X_GPH3(5), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }

		#endif 	
		//ok key
		#if 0
		s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP);
		set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH);
	        ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM,
	                "key ok", (void *) pdev);
	        if (ret) {
	                printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n");
	                ret = -EIO;
			  return ret;
	        }
		 #endif
	}

	//PWR key
	s3c_gpio_setpull(S5PC11X_GPH2(6), S3C_GPIO_PULL_UP);

	set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH);
  
        ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED ,
                "key gpio", (void *) pdev);
        if (ret) {
                printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n");
                ret = -EIO;
        }

	return ret;

}
示例#11
0
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;
}