void s3c_setup_keypad_cfg_gpio(void)
{
	unsigned int gpio;
	unsigned int end;

	/* gpio setting for KP_COL0 */
	s3c_gpio_cfgpin(S5PV210_GPJ1(5), S3C_GPIO_SFN(3));
	s3c_gpio_setpull(S5PV210_GPJ1(5), S3C_GPIO_PULL_NONE);

	/* gpio setting for KP_COL1 ~ KP_COL7 and KP_ROW0 */
	end = S5PV210_GPJ2(8);
	for (gpio = S5PV210_GPJ2(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}

	/* gpio setting for KP_ROW1 ~ KP_ROW8 */
	end = S5PV210_GPJ3(8);
	for (gpio = S5PV210_GPJ3(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}

	/* gpio setting for KP_ROW9 ~ KP_ROW13 */
	end = S5PV210_GPJ4(5);
	for (gpio = S5PV210_GPJ4(0); gpio < end; gpio++) {
		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
	}
}
Example #2
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
}
Example #3
0
static void __x210_led_remove(void)
{
	gpio_free(S5PV210_GPJ2(0));
	gpio_free(S5PV210_GPJ2(1));
	gpio_free(S5PV210_GPJ2(2));
	gpio_free(S5PV210_GPJ2(3));
}
Example #4
0
void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
{
	unsigned int gpio;

	switch (width) {
	/* Channel 0 supports 4 and 8-bit bus width */
	case 8:
		/* Set all the necessary GPIO function and pull up/down */
		for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) {
			s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
			s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
			s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_3X);
		}

	case 0:
	case 1:
	case 4:
		/* Set all the necessary GPIO function and pull up/down */
		for (gpio = S5PV210_GPG0(0); gpio <= S5PV210_GPG0(6); gpio++) {
			if (gpio != S5PV210_GPG0(2)) {
				s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
				s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
			}
			s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_3X);
		}
		break;
	default:
		printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width);
	}

	s3c_gpio_cfgpin(S5PV210_GPJ2(7), S3C_GPIO_OUTPUT);
	s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE);
	gpio_set_value(S5PV210_GPJ2(7), 1);
}
Example #5
0
static void __init goni_radio_init(void)
{
	int gpio;

	gpio = S5PV210_GPJ2(4);			/* XMSMDATA_4 */
	gpio_request(gpio, "FM_INT");
	s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
	i2c1_devs[0].irq = gpio_to_irq(gpio);

	gpio = S5PV210_GPJ2(5);			/* XMSMDATA_5 */
	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "FM_RST");
}
Example #6
0
static void __init goni_radio_init(void)
{
	int gpio;

	gpio = S5PV210_GPJ2(4);			/* XMSMDATA_4 */
	gpio_request(gpio, "FM_INT");
	s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
	i2c1_devs[0].irq = gpio_to_irq(gpio);

	gpio = S5PV210_GPJ2(5);			/* XMSMDATA_5 */
	gpio_request(gpio, "FM_RST");
	gpio_direction_output(gpio, 1);
}
Example #7
0
static ssize_t x210_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned long on = simple_strtoul(buf, NULL, 10);
	printk("-----------------heloo2----------------------");
	if(!strcmp(attr->attr.name, "led1"))
	{
		if(on)
		{
			gpio_set_value(S5PV210_GPJ2(0), 0);
			__x210_led_status[0] = 1;
		}
		else
		{
			gpio_set_value(S5PV210_GPJ2(0), 1);
			__x210_led_status[0] = 0;
		}
	}
	else if(!strcmp(attr->attr.name, "led2"))
	{
		if(on)
		{
			gpio_set_value(S5PV210_GPJ2(1), 0);
			__x210_led_status[1] = 1;
		}
		else
		{
			gpio_set_value(S5PV210_GPJ2(1), 1);
			__x210_led_status[1] = 0;
		}
	}
	else if(!strcmp(attr->attr.name, "led3"))
	{
		if(on)
		{
			gpio_set_value(S5PV210_GPJ2(2), 0);
			__x210_led_status[2] = 1;
		}
		else
		{
			gpio_set_value(S5PV210_GPJ2(2), 1);
			__x210_led_status[2] = 0;
		}
	}
	else if(!strcmp(attr->attr.name, "led4"))
	{
		if(on)
		{
			gpio_set_value(S5PV210_GPJ2(3), 0);
			__x210_led_status[3] = 1;
		}
		else
		{
			gpio_set_value(S5PV210_GPJ2(3), 1);
			__x210_led_status[3] = 0;
		}
	}

	return count;
}
Example #8
0
void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
{
	unsigned int gpio;

	switch (width) {
	/* Channel 0 supports 4 and 8-bit bus width */
	case 8:
		/* Set all the necessary GPIO function and pull up/down */
		for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) {
			s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
			s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
		}

		gpio = readl(S5PV210_GPG1DRV);
		writel(gpio | 0x2a80, S5PV210_GPG1DRV);

	case 0:
	case 1:
	case 4:
		/* Set all the necessary GPIO function and pull up/down */
		for (gpio = S5PV210_GPG0(0); gpio <= S5PV210_GPG0(6); gpio++) {
			if(gpio != S5PV210_GPG0(2)) {
				s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
				s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
			}
		}

//		gpio = readl(S5PV210_GPG0DRV);
		writel(0x2aaa, S5PV210_GPG0DRV);

		/* Chip detect pin Pull up -> none*/
		s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_NONE);

		break;
	default:
		printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width);
	}

#if defined (CONFIG_MACH_S5PC110_ARIES)
	s3c_gpio_cfgpin(S5PV210_GPJ2(7), S3C_GPIO_OUTPUT);
	s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE);
	gpio_set_value(S5PV210_GPJ2(7), 1);
#endif
}
Example #9
0
static int keypad_scan(void)
{
	u32 col,rval,gpio;

	for (gpio = S5PV210_GPJ1(5); gpio <= S5PV210_GPJ2(6); gpio++)
	{
		s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
	}
	udelay(10);

	for (col=0,gpio = S5PV210_GPJ1(5); col < KEYPAD_COLUMNS; col++,gpio++)
	{
		s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);

		if(s3c_gpio_setpin(gpio, 0) < 0)	// Should skip J1(6) .. GPJ1(5)+1 is not GPJ2(0)...
		{
//			printk("setpin error[%d] \n ",col); 
			s3c_gpio_cfgpin(++gpio, S3C_GPIO_OUTPUT);			
			s3c_gpio_setpin(gpio, 0);
		}

		udelay(KEYPAD_DELAY);

		//rval = ~(readl(key_base+S3C_KEYIFROW)) & ((1<<KEYPAD_ROWS)-1) ;
		rval = ~(readl(S5PV210_GPH3DAT)) & ((1<<KEYPAD_ROWS)-1) ;

		//printk("reg[%d]= %x , ",col, readl(S5PV210_GPH3DAT));

		keymask[col] = rval; 

		s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
// 		s3c_gpio_setpin(gpio,1);
	}
	//printk("\n");

	for (gpio = S5PV210_GPJ1(5); gpio <= S5PV210_GPJ2(6); gpio++)
		{
		s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
		s3c_gpio_setpin(gpio, 0);
		}
	return 0;
}
void s5pv210_ide_setup_gpio(void)
{
	/* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ0(0), 8);

	/* CF_Data[0 - 7] */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ2(0), 8);

	/* CF_Data[8 - 15] */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ3(0), 8);

	/* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ4(0), 4);
}
void s5pv210_ide_setup_gpio(void)
{
	/*                                                                  */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ0(0), 8);

	/*                */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ2(0), 8);

	/*                 */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ3(0), 8);

	/*                                  */
	s5pv210_ide_cfg_gpios(S5PV210_GPJ4(0), 4);
}
Example #12
0
static int keypad_scan(void)
{

	u32 col, rval, gpio;

	DPRINTK("H3C %x J2C %x, J3c %x J4c%x \n", readl(S5PV210_GPH3CON),
		readl(S5PV210_GPJ2CON), readl(S5PV210_GPJ3CON),
		readl(S5PV210_GPJ4CON));
	DPRINTK("keypad_scan() is called\n");

	DPRINTK("row val = %x", readl(key_base + S3C_KEYIFROW));

	for (gpio = S5PV210_GPJ2(7); gpio <= S5PV210_GPJ4(4); gpio++)
		s3c_gpio_setpin(gpio, 1);

	for (col = 0, gpio = S5PV210_GPJ2(7); col < KEYPAD_COLUMNS;
	     col++, gpio++) {

		if (s3c_gpio_setpin(gpio, 0) < 0)
			s3c_gpio_setpin(++gpio, 0);

		//udelay(KEYPAD_DELAY);
		udelay(100);

		//rval = ~(readl(key_base+S3C_KEYIFROW)) & ((1<<KEYPAD_ROWS)-1) ;
		rval = ~(readl(S5PV210_GPH3DAT)) & ((1 << KEYPAD_ROWS) - 1);

		keymask[col] = rval;

		s3c_gpio_setpin(gpio, 1);
	}

	for (gpio = S5PV210_GPJ2(7); gpio <= S5PV210_GPJ4(4); gpio++)
		s3c_gpio_setpin(gpio, 0);

	return 0;
}
Example #13
0
/*
 * ftn for video
 */
static int s5p_tv_v_open(struct file *file)
{
	int ret = 0,err;

	mutex_lock(mutex_for_fo);

	if (s5ptv_status.tvout_output_enable) {
		BASEPRINTK("tvout drv. already used !!\n");
		ret =  -EBUSY;
		goto drv_used;
	}

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM_PWR_GATING 
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
		BASEPRINTK("tv is turned on\n");
#endif
#if 0
#ifdef CONFIG_CPU_FREQ
#ifdef CONFIG_CPU_MAX_FREQ_1GHZ // 2010.3.9.
		if((s5ptv_status.hpd_status))
			s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 3);    
#else
		if((s5ptv_status.hpd_status))
			s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 2);
#endif
#endif
#endif

#if defined(CONFIG_S5PC110_SIDEKICK_BOARD)	
	err = gpio_request(S5PV210_GPJ3(1),"EAR_SEL");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ3(1),0);
	gpio_set_value(S5PV210_GPJ3(1),0);
	udelay(50);
#elif defined(CONFIG_S5PC110_DEMPSEY_BOARD)
//there is no connected pin
#else
	err = gpio_request(S5PV210_GPJ4(4),"TV_EN");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ4(4),1);
	gpio_set_value(S5PV210_GPJ4(4),1);
	udelay(50);

	err = gpio_request(S5PV210_GPJ2(6),"EAR_SEL");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ2(6),0);
	gpio_set_value(S5PV210_GPJ2(6),0);
	udelay(50);
#endif
	
		s5p_tv_clk_gate( true );
		tv_phy_power( true );
#ifdef CONFIG_PM_PWR_GATING
	}
	else
		BASEPRINTK("tv is off\n");
#endif
#endif
	_s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	mutex_unlock(mutex_for_fo);

	/* c110 test */	//s5ptv_status.hpd_status = true;

  printk("\n\nTV open success\n\n");

#ifdef I2C_BASE
	mutex_lock(mutex_for_i2c);
	/* for ddc(hdcp port) */
	if(s5ptv_status.hpd_status) {
		if (i2c_add_driver(&hdcp_i2c_driver)) 
			BASEPRINTK("HDCP port add failed\n");
		hdcp_i2c_drv_state = true;
	} else 
		hdcp_i2c_drv_state = false;

	mutex_unlock(mutex_for_i2c);
	/* for i2c probing */
	udelay(100);
#endif

	return 0;

drv_used:
	mutex_unlock(mutex_for_fo);
	return ret;
}
Example #14
0
#include <linux/slab.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
#include <linux/delay.h>

#include <mach/gpio.h>
#include <mach/regs-gpio.h>
#include <plat/gpio-cfg.h>

#include <linux/sched.h>
#include <asm/io.h>

MODULE_LICENSE("GPL");

static int led_gpios[] = {
	S5PV210_GPJ2(0),
	S5PV210_GPJ2(1),
	S5PV210_GPJ2(2),
	S5PV210_GPJ2(3),
};

volatile int * pled;

int __init
akae_init(void)
{
	printk("led driver installed\n");

//	gpio_set_value(led_gpios[2], 0);
//	*(volatile int *)0xE0200284 = 0x0;
	pled = ioremap(0xE0200284, 4);
Example #15
0
#define DEVIECE_NAME	"tiny210_leds"		//设备名称
#define DEVICE_COUNT	1					//设备文件数量
#define tiny210_LEDS_MAJOR	0				//默认主设备号
#define tiny210_LEDS_MINOR	234				//默认次设备号
#define PARAM_SIZE	3						//定义数组模块参数大小

static int major = tiny210_LEDS_MAJOR;		//主设备号
static int minor = tiny210_LEDS_MINOR;		//次设备号
static dev_t dev_number;					//设备号
static char *params[] = { "string1", "string2", "string3" };
static int leds_state = 1;
static int param_size = PARAM_SIZE;
static struct class *leds_class = NULL;							//创建class
static struct cdev leds_cdev;									//设备描述

static int led_gpios[] = { S5PV210_GPJ2(0), S5PV210_GPJ2(1), S5PV210_GPJ2(2),
		S5PV210_GPJ2(3), };										//LED的引脚值

static ssize_t word_count_write(struct file *file, const char __user *buf,
		size_t count, loff_t *ppos)
{
	char tmp[4] = { 0x00 }, i, n;
	unsigned long a;
	if (count < 4)
	{
		n = count;
	} else
	{
		n = 4;
	}
	if (a = (copy_from_user(tmp, buf, n)))
Example #16
0
			.ngpio	= S5PV210_GPIO_J0_NR,
			.label	= "GPJ0",
		},
	}, {
		.base	= S5PV210_GPJ1_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PV210_GPJ1(0),
			.ngpio	= S5PV210_GPIO_J1_NR,
			.label	= "GPJ1",
		},
	}, {
		.base	= S5PV210_GPJ2_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PV210_GPJ2(0),
			.ngpio	= S5PV210_GPIO_J2_NR,
			.label	= "GPJ2",
		},
	}, {
		.base	= S5PV210_GPJ3_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PV210_GPJ3(0),
			.ngpio	= S5PV210_GPIO_J3_NR,
			.label	= "GPJ3",
		},
	}, {
		.base	= S5PV210_GPJ4_BASE,
		.config	= &gpio_cfg,
		.chip	= {
Example #17
0
static void __x210_led_probe(void)
{
	int ret;

	ret = gpio_request(S5PV210_GPJ2(0), "GPJ2");
	if(ret)
		printk("x210-led: request gpio GPJ2(0) fail\n");
	s3c_gpio_setpull(S5PV210_GPJ2(0), S3C_GPIO_PULL_UP);
	s3c_gpio_cfgpin(S5PV210_GPJ2(0), S3C_GPIO_SFN(1));
	gpio_set_value(S5PV210_GPJ2(0), 1);

	ret = gpio_request(S5PV210_GPJ2(1), "GPJ2");
	if(ret)
		printk("x210-led: request gpio GPJ2(1) fail\n");
	s3c_gpio_setpull(S5PV210_GPJ2(1), S3C_GPIO_PULL_UP);
	s3c_gpio_cfgpin(S5PV210_GPJ2(1), S3C_GPIO_SFN(1));
	gpio_set_value(S5PV210_GPJ2(1), 1);

	ret = gpio_request(S5PV210_GPJ2(2), "GPJ2");
	if(ret)
		printk("x210-led: request gpio GPJ2(2) fail\n");
	s3c_gpio_setpull(S5PV210_GPJ2(2), S3C_GPIO_PULL_UP);
	s3c_gpio_cfgpin(S5PV210_GPJ2(2), S3C_GPIO_SFN(1));
	gpio_set_value(S5PV210_GPJ2(2), 1);

	ret = gpio_request(S5PV210_GPJ2(3), "GPJ2");
	if(ret)
		printk("x210-led: request gpio GPJ2(3) fail\n");
	s3c_gpio_setpull(S5PV210_GPJ2(3), S3C_GPIO_PULL_UP);
	s3c_gpio_cfgpin(S5PV210_GPJ2(3), S3C_GPIO_SFN(1));
	gpio_set_value(S5PV210_GPJ2(3), 1);

	__x210_led_status[0] = 0;
	__x210_led_status[1] = 0;
	__x210_led_status[2] = 0;
	__x210_led_status[3] = 0;
}