Ejemplo n.º 1
0
s3c_setup_keypad_cfg_gpio_sleep(int rows, int columns)
{
	unsigned int gpio;
	unsigned int end;

	/* set KBR */
	end = S5PV210_GPH3(rows);
	for (gpio = S5PV210_GPH3(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}

	/* set KBC */
	/* KEYPAD SCAN/COLUMN */
	columns -= 2 ;	/* except scan[6~7] */
	end = S5PV210_GPH2(columns);
	for (gpio = S5PV210_GPH2(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
	}

	
	s3c_gpio_slp_cfgpin(GPIO_KEYSCAN6, S3C_GPIO_SLP_OUT1);
	s3c_gpio_slp_setpull_updown(GPIO_KEYSCAN6, S3C_GPIO_PULL_NONE);

	s3c_gpio_slp_cfgpin(GPIO_KEYSCAN7, S3C_GPIO_SLP_OUT1);
	s3c_gpio_slp_setpull_updown(GPIO_KEYSCAN7, S3C_GPIO_PULL_NONE);

}
Ejemplo n.º 2
0
int s3cfb_backlight_onoff(struct platform_device *pdev, int onoff)
{
	int err;

	err = gpio_request(S5PV210_GPH3(3), "GPH3");

	if (err) {
		printk(KERN_ERR "failed to request GPH3 for "
			"lcd backlight control\n");
		return err;
	}

	if (onoff) {
		printk("backlight.....on\n");
		
		gpio_direction_output(S5PV210_GPH3(3), 1);
		/* 2009.12.28 by icarus : added for PWM backlight */
	//	s3c_gpio_cfgpin(S5PV210_GPH3(3), S5PV210_GPD_0_0_TOUT_0);

	}
	else {
		printk("backlight.....off\n");
		gpio_direction_output(S5PV210_GPH3(3), 0);
	}
	gpio_free(S5PV210_GPH3(3));
	return 0;
}
Ejemplo n.º 3
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(S5PV210_GPH2(6)))//Power Key
        {
         mask |= 0x1;
        }
        if(!gpio_get_value(S5PV210_GPH3(3)))//Volume Up
        {
         mask |= 0x10;
        }

        if(HWREV >= 0x2) //yhkim change to 0x2 for Verizon ATLAS. 
        {
            if(!gpio_get_value(S5PV210_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\n",mask);
	}
	else
	{
		count = sprintf(buf,"RELEASE\n");
              printk("keyshort_test: RELEASE \n");
	}	

	return count;
}
void universal_sdhci2_cfg_ext_cd(void)
{
	printk(KERN_DEBUG "Universal :SD Detect configuration\n");
#if defined(CONFIG_SAMSUNG_CAPTIVATE) || defined(CONFIG_SAMSUNG_VIBRANT)
    s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_UP);
#else
    s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
#endif
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH);
}
Ejemplo n.º 5
0
void universal_sdhci2_cfg_ext_cd(void)
{
	printk(" Universal :SD Detect configuration \n");

#if defined(CONFIG_MACH_S5PC110_P1)
	s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
#else
	s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
#endif
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH);
}
Ejemplo n.º 6
0
static void gpiokeys_init(void)
{
	s3c_gpio_cfgpin(S5PV210_GPH3(4), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_LEVEL_LOW);

	s3c_gpio_cfgpin(S5PV210_GPH3(3), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(27), IRQ_TYPE_LEVEL_LOW);
#if 0
	s3c_gpio_cfgpin(S5PV210_GPH0(6), 0);
	s3c_gpio_setpull(S5PV210_GPH0(6), 0);
#endif
}
void s3c_sdhci_set_platdata(void)
{
#if defined(CONFIG_S3C_DEV_HSMMC)
	if (machine_is_herring() || machine_is_aries() || machine_is_venturi()) { /* TODO: move to mach-herring.c */
		hsmmc0_platdata.cd_type = S3C_SDHCI_CD_PERMANENT;
	}
	s3c_sdhci0_set_platdata(&hsmmc0_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC1)
	if (machine_is_aries()) {
		hsmmc1_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
		hsmmc1_platdata.ext_cd_init = ext_cd_init_hsmmc1;
		hsmmc1_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc1;
		hsmmc1_platdata.built_in = 1;
	}
	s3c_sdhci1_set_platdata(&hsmmc1_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC2)
	if (machine_is_herring()) {
		if (herring_is_cdma_wimax_dev()) {
			hsmmc2_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
			hsmmc2_platdata.ext_cd_init = ext_cd_init_hsmmc2;
			hsmmc2_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc2;
			hsmmc2_platdata.built_in = 1;
			hsmmc2_platdata.must_maintain_clock = 1;
			hsmmc2_platdata.enable_intr_on_resume = 1;
		} else {
			hsmmc2_platdata.cd_type = S3C_SDHCI_CD_GPIO;
			hsmmc2_platdata.ext_cd_gpio = S5PV210_GPH3(4);
			hsmmc2_platdata.ext_cd_gpio_invert = true;
			universal_sdhci2_cfg_ext_cd();
		}
	}

	if (machine_is_aries() || machine_is_venturi()) {
		hsmmc2_platdata.cd_type = S3C_SDHCI_CD_GPIO;
		hsmmc2_platdata.ext_cd_gpio = S5PV210_GPH3(4);
		hsmmc2_platdata.ext_cd_gpio_invert = true;
		universal_sdhci2_cfg_ext_cd();
	}

	s3c_sdhci2_set_platdata(&hsmmc2_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC3)
	if (machine_is_herring() || machine_is_aries() || machine_is_venturi()) {
		hsmmc3_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
		hsmmc3_platdata.ext_cd_init = ext_cd_init_hsmmc3;
		hsmmc3_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc3;
		hsmmc3_platdata.built_in = 1;
	}
	s3c_sdhci3_set_platdata(&hsmmc3_platdata);
#endif
};
Ejemplo n.º 8
0
void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
{
#if 0
	/* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
	s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3));

	/* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
	s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3));
#else
	unsigned int gpio;  
	unsigned int end; 

	s3c_gpio_cfgpin(S5PV210_GPJ2(7), S3C_GPIO_SFN(3));  
        s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_UP); 

	end = S5PV210_GPJ3(rows -1);
	for (gpio = S5PV210_GPJ3(0); gpio < end; gpio++)
	{  
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));  
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
	}


	
	s3c_gpio_cfgpin(S5PV210_GPJ1(5), S3C_GPIO_SFN(3));  
        s3c_gpio_setpull(S5PV210_GPJ1(5), S3C_GPIO_PULL_NONE); 

	end = S5PV210_GPJ2(cols -1);
	for (gpio = S5PV210_GPJ2(0); gpio < end; gpio++)
	{  
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));  
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}
#endif
}
Ejemplo n.º 9
0
static void
s3c_keygpio_init(struct s3c_keypad * s3c_keypad)
{
	KEYGPIO_INFO * info_tbl = (KEYGPIO_INFO *)&s3c_keypad->keygpio_info_tbl[0];
	int i;

	/* set gpio, irq of gpio keys */
	info_tbl[KEYGPIO_VOLUME_UP].irq 		= IRQ_EINT(24);
	info_tbl[KEYGPIO_VOLUME_UP].gpio		= S5PV210_GPH3(0); 
	info_tbl[KEYGPIO_VOLUME_UP].gpio_data	= (S5PV210_GPH3_BASE + 0x04);
//	info_tbl[KEYGPIO_VOLUME_UP].gpio_data	= S5PV210_GPH3DAT;
	info_tbl[KEYGPIO_VOLUME_UP].gpio_data_mask	= (1 << 0);
	info_tbl[KEYGPIO_VOLUME_UP].keycode = 115;

	info_tbl[KEYGPIO_POWER].irq 		= IRQ_EINT(22);
	info_tbl[KEYGPIO_POWER].gpio 		= S5PV210_GPH2(6);
	info_tbl[KEYGPIO_POWER].gpio_data	= (S5PV210_GPH2_BASE + 0x04);
//	info_tbl[KEYGPIO_POWER].gpio_data	= S5PV210_GPH2DAT;
	info_tbl[KEYGPIO_POWER].gpio_data_mask = (1 << 6);
	info_tbl[KEYGPIO_POWER].keycode		= 116;

	for(i=0; i < KEYGPIO_MAX; i++) {
		KEYGPIO_INFO * info = &info_tbl[i];
		int gpio = info->gpio;

		info->prev_key_status = info->gpio_data_mask;

		s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
	}
}
Ejemplo n.º 10
0
void universal_sdhci2_cfg_ext_cd(void)
{
	printk(" Universal :SD Detect configuration \n");

#if defined(CONFIG_MACH_S5PC110_P1)
	s3c_gpio_cfgpin(GPIO_T_FLASH_DETECT, S3C_GPIO_SFN(GPIO_T_FLASH_DETECT_AF));
	s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH);	
#else
	if(((HWREV >= 7) || (HWREV == 0x3)) && (HWREV !=8))
		s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
	else
		s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_DOWN);
#endif
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH);
}
Ejemplo n.º 11
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 <= S5PV210_GPH3(7)) && (pin >= S5PV210_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;
}
void universal_sdhci2_cfg_ext_cd(void)
{
	printk(KERN_DEBUG "Universal :SD Detect configuration\n");
	s3c_gpio_cfgpin(GPIO_T_FLASH_DETECT, S3C_GPIO_SFN(GPIO_T_FLASH_DETECT_AF));
	s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE);
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH);
}
Ejemplo n.º 13
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 <= S5PV210_GPH3(7)) && (pin >= S5PV210_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;
}
Ejemplo n.º 14
0
static int s3c_keypad_suspend(struct platform_device *dev, pm_message_t state)
{
#if defined(CONFIG_MACH_CHIEF) && !defined(CONFIG_TIKAL_MPCS)
	struct s3c_keypad *s3c_keypad;
#endif
	keyifcon = readl(key_base+S3C_KEYIFCON);
	keyiffc = readl(key_base+S3C_KEYIFFC);
#if defined(CONFIG_TIKAL_MPCS)
	enable_irq_wake(IRQ_KEYPAD);		
        keyled_timer_stop(); /* keypad_led */
#elif defined(CONFIG_MACH_STEALTHV)
        if((during_call==1)&&(volume_key_wakeup==0)){
            enable_irq_wake(IRQ_KEYPAD);
            volume_key_wakeup=1;            
        }
        else if((during_call==0)&&(volume_key_wakeup==1)){
            disable_irq_wake(IRQ_KEYPAD);
            volume_key_wakeup=0;        
        }
#else
	s3c_pm_do_save(s3c_keypad_save, ARRAY_SIZE(s3c_keypad_save));

	//writel(~(0xfffffff), KEYPAD_ROW_GPIOCON);
	//writel(~(0xfffffff), KEYPAD_COL_GPIOCON);

	disable_irq(IRQ_KEYPAD);
	clk_disable(keypad_clock);

#if defined(CONFIG_MACH_CHIEF) && !defined(CONFIG_TIKAL_MPCS)
	
	if((during_call == 1) && (volume_key_wakeup == 0)){
		s3c_keypad= platform_get_drvdata(dev);
		
		if(!s3c_keypad){
			printk(KERN_INFO "failed to get drv data \n ");
			return ;
		}
		volume_key_wakeup = 1;	
		s3c_keygpio_keysense_isr_setup((void * )s3c_keypad);
	}
	else if((during_call == 0) && (volume_key_wakeup == 1)){
		
		disable_irq_wake(gpio_to_irq(S5PV210_GPH3(0)));
		volume_key_wakeup = 0;		
		printk(KERN_INFO "%s:DISABLE IRQ  \n ", __func__);	
		
		/* Set GPIO Port for keypad mode and pull-up disable*/
		s3c_setup_keypad_cfg_gpio(KEYPAD_ROWS, KEYPAD_COLUMNS);
	}
	else{
		//set gpio during normal sleep
		s3c_setup_keypad_cfg_gpio_sleep(KEYPAD_ROWS, KEYPAD_COLUMNS);
		
		}
#endif //#if defined(CONFIG_MACH_CHIEF) && !defined(CONFIG_TIKAL_MPCS)
	in_sleep = 1;
#endif
	return 0;
}
void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
{
	/* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
	s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3));

	/* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
	s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3));
}
Ejemplo n.º 16
0
void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
{
/* hcj: the rows may need pullup */
	/* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
//	s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3));
    s3c_gpio_cfgall_range(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
    
	/* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
	s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3));
}
Ejemplo n.º 17
0
static void __init aquila_sound_init(void)
{
	unsigned int gpio;

	gpio = S5PV210_GPH3(2);		
	gpio_request(gpio, "CODEC_XTAL_EN");
	s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
	s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);

	__raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
}
Ejemplo n.º 18
0
int s3cfb_backlight_off(struct platform_device *pdev)
{
#if defined(CONFIG_BACKLIGHT_PWM)
	int err;
	
	printk("s3cfb_backlight_off.....on\n");

	err = gpio_request(S5PV210_GPH3(3), "GPH3");

	if (err) {
		printk(KERN_ERR "failed to request GPD0 for "
				"lcd backlight control\n");
		return err;
	}

	gpio_direction_output(S5PV210_GPH3(3), 0);
	gpio_free(S5PV210_GPH3(3));
#endif
	return 0;
}
Ejemplo n.º 19
0
void s3c_setup_keypad_cfg_gpio(int rows, int columns)
{
	unsigned int gpio;
	unsigned int end;

	end = S5PV210_GPH3(rows);

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

	end = S5PV210_GPH2(columns);

	/* Set all the necessary GPK pins to special-function 0 */
	for (gpio = S5PV210_GPH2(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}
}
Ejemplo n.º 20
0
static int s3c_keygpio_keysense_isr_setup(void *pdev)
{
    int ret;
    //KEY_SENSE key
    s3c_gpio_setpull(S5PV210_GPH3(0), S3C_GPIO_PULL_NONE);
    set_irq_type(gpio_to_irq(S5PV210_GPH3(0)), IRQ_TYPE_EDGE_BOTH);

    // regarding key status
    ret = request_irq(gpio_to_irq(S5PV210_GPH3(0)), s3c_keygpio_keysense_isr, IRQF_DISABLED
                        | IRQF_SAMPLE_RANDOM, "keysense gpio", (void *)pdev);

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

	ret = enable_irq_wake(gpio_to_irq(S5PV210_GPH3(0)));
	if (ret) {
		printk(KERN_ERR"%s : Failed to enable key_sense wake\n", __func__);
	}

    return ret;
}
Ejemplo n.º 21
0
int s3cfb_backlight_on(struct platform_device *pdev)
{
	int err;
	
	printk("s3cfb_backlight_on.....on\n");

	err = gpio_request(S5PV210_GPH3(3), "GPH3");

	if (err) {
		printk(KERN_ERR "failed to request GPD0 for "
			"lcd backlight control\n");
		return err;
	}

	gpio_direction_output(S5PV210_GPH3(3), 1);

	//s3c_gpio_cfgpin(S5PV210_GPD0(0), 0x1);//S5PV210_GPD_0_0_TOUT_0);
	//gpio_set_value(S5PV210_GPD0(0), 1);
	
	//s3c_gpio_cfgpin(S5PV210_GPD0(0), S5PV210_GPD_0_0_TOUT_0);
	gpio_free(S5PV210_GPH3(3));
	return 0;
}
Ejemplo n.º 22
0
int s3cfb_lcd_on(struct platform_device *pdev)
{
	int err;

	err = gpio_request(S5PV210_GPC1(4), "GPC1");
	if (err) {
		printk(KERN_ERR "failed to request GPC1 for "
			"lcd reset control\n");
		return err;
	}

	gpio_direction_output(S5PV210_GPC1(4), 1);
	mdelay(100);

	gpio_set_value(S5PV210_GPC1(4), 0);
	mdelay(10);

	gpio_set_value(S5PV210_GPC1(4), 1);
	mdelay(10);

	gpio_free(S5PV210_GPC1(4));

#if defined(CONFIG_FB_S3C_LTN101NT05)
	err = gpio_request(S5PV210_GPH3(7), "GPH3");
	if (err) {
		printk(KERN_ERR "failed to request GPH3 for "
			"lcd control\n");
		return err;
	}

	gpio_direction_output(S5PV210_GPH3(7), 1);
	mdelay(10);

	gpio_free(S5PV210_GPH3(7));
#endif
	return 0;
}
Ejemplo n.º 23
0
static int s3c_keypad_resume(struct platform_device *dev)
{
	//struct s3c_keypad          *s3c_keypad = (struct s3c_keypad *) platform_get_drvdata(dev);
    //struct input_dev           *iDev = s3c_keypad->dev;
	//unsigned int key_temp_data=0;
#if defined(CONFIG_MACH_CHIEF) && !defined(CONFIG_TIKAL_MPCS)
	if(volume_key_wakeup == 1){
		disable_irq_wake(gpio_to_irq(S5PV210_GPH3(0)));
		volume_key_wakeup=0;		
		printk(KERN_INFO "%s:DISBALE IRQ \n ", __func__);	
		
		/* Set GPIO Port for keypad mode and pull-up disable*/
		s3c_setup_keypad_cfg_gpio(KEYPAD_ROWS, KEYPAD_COLUMNS);
	}
#endif //#if defined(CONFIG_MACH_CHIEF) && !defined(CONFIG_TIKAL_MPCS)
#if defined(CONFIG_TIKAL_MPCS)
	disable_irq_wake(IRQ_KEYPAD);
#else
	printk(KERN_DEBUG "++++ %s\n", __FUNCTION__ );

	clk_enable(keypad_clock);
#endif
	writel(KEYIFCON_INIT, key_base+S3C_KEYIFCON);
	writel(keyiffc, key_base+S3C_KEYIFFC);
	writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL);

#if 0
	key_temp_data = readl(key_base+S3C_KEYIFROW) & 0x01;
	if (!key_temp_data){
		input_report_key(iDev, 50, 1);
		printk("key data is %d \n", key_temp_data);		
		input_report_key(iDev, 50, 0);
		}
	else {
		/*send some event to android to start the full resume*/
		input_report_key(iDev, KEYCODE_UNKNOWN, 1);//ENDCALL up event
		udelay(5);
		input_report_key(iDev, KEYCODE_UNKNOWN, 0);//ENDCALL down event
		}

	//printk("H3C %x H2C %x \n",readl(S5PC11X_GPH3CON),readl(S5PC11X_GPH2CON));
#endif
#if !defined(CONFIG_MACH_STEALTHV) && !defined(CONFIG_TIKAL_MPCS)
	s3c_pm_do_restore(s3c_keypad_save, ARRAY_SIZE(s3c_keypad_save));
	enable_irq(IRQ_KEYPAD);
	printk(KERN_DEBUG "---- %s\n", __FUNCTION__ );
#endif
	return 0;
}
Ejemplo n.º 24
0
static void gpiokeys_init(void)
{
	s3c_gpio_cfgpin(S5PV210_GPH3(4), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(28), IRQ_TYPE_LEVEL_LOW);

	s3c_gpio_cfgpin(S5PV210_GPH3(3), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(27), IRQ_TYPE_LEVEL_LOW);

	
	//add by luis
	s3c_gpio_cfgpin(S5PV210_GPH1(2), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(10), IRQ_TYPE_LEVEL_LOW);

	s3c_gpio_cfgpin(S5PV210_GPH3(1), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(25), IRQ_TYPE_LEVEL_LOW);

	s3c_gpio_cfgpin(S5PV210_GPH3(6), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(30), IRQ_TYPE_LEVEL_LOW);

	s3c_gpio_cfgpin(S5PV210_GPH3(5), S3C_GPIO_SFN(0xf));
	set_irq_type(IRQ_EINT(29), IRQ_TYPE_LEVEL_LOW);

	//add by luis
}
Ejemplo n.º 25
0
unsigned int universal_sdhci2_detect_ext_cd(void)
{
	unsigned int card_status = 0;

#ifdef CONFIG_MMC_DEBUG
	printk(KERN_DEBUG "Universal :SD Detect function\n");
	printk(KERN_DEBUG "eint conf %x  eint filter conf %x",
		readl(S5P_EINT_CON(3)), readl(S5P_EINT_FLTCON(3, 1)));
	printk(KERN_DEBUG "eint pend %x  eint mask %x",
		readl(S5P_EINT_PEND(3)), readl(S5P_EINT_MASK(3)));
#endif
	card_status = gpio_get_value(S5PV210_GPH3(4));
	printk(KERN_DEBUG "Universal : Card status %d\n", card_status ? 0 : 1);
	return card_status ? 0 : 1;

}
Ejemplo n.º 26
0
static ssize_t keyshort_test(struct device *dev, struct device_attribute *attr,
			     char *buf)
{
	int count;

	if (!gpio_get_value(GPIO_KBR0) || !gpio_get_value(GPIO_KBR1)
	    || !gpio_get_value(GPIO_KBR2) || !gpio_get_value(GPIO_nPOWER)
	    || !gpio_get_value(S5PV210_GPH3(5))) {
		count = sprintf(buf, "PRESS\n");
		printk("keyshort_test: PRESS\n");
	} else {
		count = sprintf(buf, "RELEASE\n");
		printk("keyshort_test: RELEASE\n");
	}

	return count;
}
Ejemplo n.º 27
0
static void __init aquila_sound_init(void)
{
	unsigned int gpio;

	/* CODEC_XTAL_EN
	 *
	 * The Aquila board have a oscillator which provide main clock
	 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
	 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
	 * */
	gpio = S5PV210_GPH3(2);		/* XEINT_26 */
	gpio_request(gpio, "CODEC_XTAL_EN");
	s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
	s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);

	/* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
	 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
	 * because it needs 24MHz clock to operate WM8994 codec.
	 */
	__raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
}
Ejemplo n.º 28
0
static void s3c_keypad_port_sleep(int rows, int columns)
{
	s3c_gpio_cfgpin(S5PV210_GPH3(1), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE);
		
	s3c_gpio_cfgpin(S5PV210_GPH3(2), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH3(2), S3C_GPIO_PULL_NONE);
		
	s3c_gpio_cfgpin(S5PV210_GPH3(3), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH3(3), S3C_GPIO_PULL_NONE);
	
			
	s3c_gpio_cfgpin(S5PV210_GPH2(2), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH2(2), S3C_GPIO_PULL_UP);

			
	s3c_gpio_cfgpin(S5PV210_GPH2(3), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH2(3), S3C_GPIO_PULL_UP);
}
Ejemplo n.º 29
0
			.ngpio	= S5PV210_GPIO_H1_NR,
			.label	= "GPH1",
		},
	}, {
		.base	= S5PV210_GPH2_BASE,
		.config	= &gpio_cfg_noint,
		.chip	= {
			.base	= S5PV210_GPH2(0),
			.ngpio	= S5PV210_GPIO_H2_NR,
			.label	= "GPH2",
		},
	}, {
		.base	= S5PV210_GPH3_BASE,
		.config	= &gpio_cfg_noint,
		.chip	= {
			.base	= S5PV210_GPH3(0),
			.ngpio	= S5PV210_GPIO_H3_NR,
			.label	= "GPH3",
		},
	}, {
		.base	= S5PV210_GPI_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PV210_GPI(0),
			.ngpio	= S5PV210_GPIO_I_NR,
			.label	= "GPI",
		},
	}, {
		.base	= S5PV210_GPJ0_BASE,
		.config	= &gpio_cfg,
		.chip	= {
Ejemplo n.º 30
0
static int __init s3c_keypad_probe(struct platform_device *pdev)
{
	struct resource *res, *keypad_mem, *keypad_irq;
	struct input_dev *input_dev;
	struct s3c_keypad *s3c_keypad;
	int ret, size;
	int key, code;
	struct class *key_class;
    	struct device *keypress;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (res == NULL) {
		dev_err(&pdev->dev,"no memory resource specified\n");
		return -ENOENT;
	}

	size = (res->end - res->start) + 1;

	keypad_mem = request_mem_region(res->start, size, pdev->name);
	if (keypad_mem == NULL) {
		dev_err(&pdev->dev, "failed to get memory region\n");
		ret = -ENOENT;
		goto err_req;
	}

	key_base = ioremap(res->start, size);
	if (key_base == NULL) {
		printk(KERN_ERR "Failed to remap register block\n");
		ret = -ENOMEM;
		goto err_map;
	}

	keypad_clock = clk_get(&pdev->dev, "keypad");
	if (IS_ERR(keypad_clock)) {
		dev_err(&pdev->dev, "failed to find keypad clock source\n");
		ret = PTR_ERR(keypad_clock);
		goto err_clk;
	}

	clk_enable(keypad_clock);
	
	s3c_keypad = kzalloc(sizeof(struct s3c_keypad), GFP_KERNEL);
	input_dev = input_allocate_device();

	g_dev = input_dev;
	if (!s3c_keypad || !input_dev) {
		ret = -ENOMEM;
		goto err_alloc;
	}

	platform_set_drvdata(pdev, s3c_keypad);
	s3c_keypad->dev = input_dev;
	
	/* Set GPIO Port for keypad mode and pull-up disable*/
	s3c_setup_keypad_cfg_gpio(KEYPAD_ROWS, KEYPAD_COLUMNS);

	/* STEALTH-V don't use KBR(0)-GPH3- for keypad */
#ifndef CONFIG_MACH_CHIEF	
	s3c_gpio_cfgpin(S5PV210_GPH3(0), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH3(0), S3C_GPIO_PULL_UP);
#endif

	writel(KEYIFCON_INIT, key_base+S3C_KEYIFCON);
	writel(KEYIFFC_DIV, key_base+S3C_KEYIFFC);
	writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL);
	
#ifdef CONFIG_MACH_CHIEF
   /* GPIO_CONTROL */
    gpio_set_value(GPIO_KEYSCAN6, GPIO_LEVEL_LOW) ;
    gpio_set_value(GPIO_KEYSCAN7, GPIO_LEVEL_LOW) ;
#endif

	/* create and register the input driver */
	set_bit(EV_KEY, input_dev->evbit);
	/*Commenting the generation of repeat events*/
	//set_bit(EV_REP, input_dev->evbit);
	s3c_keypad->nr_rows = KEYPAD_ROWS;
	s3c_keypad->no_cols = KEYPAD_COLUMNS;
	s3c_keypad->total_keys = MAX_KEYPAD_NR;

	for(key = 0; key < s3c_keypad->total_keys; key++){
		code = s3c_keypad->keycodes[key] = keypad_keycode[key];
		if(code<=0)
			continue;
		set_bit(code & KEY_MAX, input_dev->keybit);
	}

	//printk("%s, keypad row number is %d, column is %d",__FUNCTION__, s3c_keypad->nr_rows, s3c_keypad->no_cols);

#ifndef CONFIG_MACH_CHIEF
      set_bit(26 & KEY_MAX, input_dev->keybit);
      set_bit(42 & KEY_MAX, input_dev->keybit);
#endif 
      
#ifdef 	CONFIG_MACH_CHIEF  
   input_set_capability(input_dev, EV_SW, SW_LID); // TODO:FORTE
#endif

	input_dev->name = DEVICE_NAME;
	input_dev->phys = "s3c-keypad/input0";
	
	input_dev->id.bustype = BUS_HOST;
	input_dev->id.vendor = 0x0001;
	input_dev->id.product = 0x0001;
	input_dev->id.version = 0x0001;

	input_dev->keycode = keypad_keycode;

	ret = input_register_device(input_dev);
	if (ret) {
		printk("Unable to register s3c-keypad input device!!!\n");
		goto err_regi;
	}
   /* keypad_led timer init */
#ifdef CONFIG_MACH_CHIEF   
   init_timer(&keyled_timer);
   keyled_timer.function = keyled_timer_handler;
   keyled_timer.data = (unsigned long)s3c_keypad;
   s3c_keygpio_isr_setup((void *)s3c_keypad);
#endif
	/* For IRQ_KEYPAD */
	keypad_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (keypad_irq == NULL) {
		dev_err(&pdev->dev, "no irq resource specified\n");
		ret = -ENOENT;
		goto err_irq;
	}
	ret = request_irq(keypad_irq->start, s3c_keypad_isr, IRQF_SAMPLE_RANDOM,
		DEVICE_NAME, (void *) s3c_keypad);
	if (ret) {
		printk("request_irq failed (IRQ_KEYPAD) !!!\n");
		ret = -EIO;
		goto err_irq;
	}
#if 0 /* gpio key use gpio-event.c */
	s3c_keygpio_init((void *)s3c_keypad);
	s3c_keygpio_isr_register((void *)s3c_keypad);
#endif
	/* for 1-5 applicaion 
	   /sys/devices/virtual/key/key/key 
	 */
	key_class = class_create(THIS_MODULE,"key");
	if(IS_ERR(key_class)){
		printk("failed to keyclass\n");
        goto out;
	}

	keypress = device_create(key_class, NULL, 0 , s3c_keypad, "key");
	if(IS_ERR(keypress))	
		printk("failed to create a keypress device\n");
	else{
		if(device_create_file(keypress, &dev_attr_key)<0)
			printk("failed to create device file key\n");	
	}
	
    if (device_create_file(keypress, &dev_attr_brightness) < 0) {
        printk("fail to create device file brightness\n");
  	}
    
    if (device_create_file(keypress, &dev_attr_keywakeup) < 0) {
        printk("fail to create device file keywakeup\n");
  	}

    printk( DEVICE_NAME " Initialized\n");

	return 0;

out:
	free_irq(keypad_irq->start, input_dev);

err_irq:
err_regi:
	input_free_device(input_dev);
	kfree(s3c_keypad);
	
err_alloc:
	clk_disable(keypad_clock);
	clk_put(keypad_clock);

err_clk:
	iounmap(key_base);

err_map:
	release_resource(keypad_mem);
	kfree(keypad_mem);

err_req:
	return ret;
}