static int __init smdkc110_init(void)
{
	int ret;
	s3cdbg("Entered %s\n", __FUNCTION__);

	s3c_gpio_cfgpin (S5PC11X_GPC1(0), S3C_GPIO_SFN(3));		 //GPC1CON[0] spdif_0_out
	s3c_gpio_setpull(S5PC11X_GPC1(0), S3C_GPIO_PULL_NONE);
	s3c_gpio_setpin (S5PC11X_GPC1(0), S3C_GPIO_PULL_NONE);

	s3c_gpio_cfgpin (S5PC11X_GPC1(1), S3C_GPIO_SFN(3));		 //GPC1CON[1] spdif_extcal
	s3c_gpio_setpull(S5PC11X_GPC1(1), S3C_GPIO_PULL_NONE);	
	s3c_gpio_setpin (S5PC11X_GPC1(1), S3C_GPIO_PULL_NONE);


	//Modified as per 2.6.29
	ret=snd_soc_register_dais(spdif_dai,ARRAY_SIZE(spdif_dai));
	if(ret){
		s3cdbg("spdif_dai registration failed");
		return ret;
	}
	smdkc110_snd_device = platform_device_alloc("soc-audio", 0);
	if (!smdkc110_snd_device){
		s3cdbg("soc-audio allocation failed");
		return -ENOMEM;
	}
	platform_set_drvdata(smdkc110_snd_device, &smdkc110_snd_devdata);
	smdkc110_snd_devdata.dev = &smdkc110_snd_device->dev;
	ret = platform_device_add(smdkc110_snd_device);
	if (ret)
		platform_device_put(smdkc110_snd_device);
	
	return ret;
}
Ejemplo n.º 2
0
static void s3c_cs_set(int pin, int lvl)
{
	if(lvl == CS_HIGH)
	   s3c_gpio_setpin(pin, 1);
	else
	   s3c_gpio_setpin(pin, 0);
}
Ejemplo n.º 3
0
static void s3c_cs_config(int pin, int mode, int pull)
{
        s3c_gpio_cfgpin(pin, mode);

        if(pull == CS_HIGH){
           s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP);
		   s3c_gpio_setpin(pin, 0);
		}
        else{
           s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN);
		   s3c_gpio_setpin(pin, 1);
		}
}
Ejemplo n.º 4
0
void MHL_HW_Reset(void)
{
	
	SII_DEV_DBG("");
	s3c_gpio_cfgpin(GPIO_HDMI_EN1, S3C_GPIO_OUTPUT);
	s3c_gpio_setpin(GPIO_HDMI_EN1, 1);
	mdelay(200);
	s3c_gpio_cfgpin(GPIO_MHL_RST, S3C_GPIO_OUTPUT);
	s3c_gpio_setpin(GPIO_MHL_RST, 1);
	mdelay(5);
	s3c_gpio_setpin(GPIO_MHL_RST, 0);
	mdelay(20);
	s3c_gpio_setpin(GPIO_MHL_RST, 1);  
	mdelay(10);
}
Ejemplo n.º 5
0
static ssize_t detect_cable_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	int count;

	s3c_gpio_cfgpin(GPIO_HDMI_EN1, S3C_GPIO_OUTPUT);
	s3c_gpio_setpin(GPIO_HDMI_EN1, 1);
	s3c_gpio_cfgpin(GPIO_HDMI_EN2, S3C_GPIO_OUTPUT);
	s3c_gpio_setpin(GPIO_HDMI_EN2, 1);

	if(gpio_get_value(GPIO_HD_HPD))
		 count = sprintf(buf,"1\n");
	else
		 count = sprintf(buf,"0\n");
	return count;
}
Ejemplo n.º 6
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);
	}
}
Ejemplo n.º 7
0
static void smdk6400_hsmmc_init (void)
{
	/* jsgood: hsmmc0/1 card detect pin should be high before setup gpio. (GPG6 to Input) */
	writel(readl(S3C_GPGCON) & 0xf0ffffff, S3C_GPGCON);

#if defined(CONFIG_MACH_SANJOSE2)
	/* for hsmmc ch2 */
	writel(0, S3C_GPNPU);
	writel((readl(S3C_GPNCON) & ~(0x3 << 24)) | (0x2 << 24), S3C_GPNCON);	/* GPN12 to EINT */
	writel(readl(S3C_EINT0CON0) | (0x3 << 25), S3C_EINT0CON0);		/* EINT12 to both edge triggered */
	writel(readl(S3C_EINT0MASK) & ~(0x1 << 12), S3C_EINT0MASK);		/* EINT12 unmask */
	writel(readl(S3C_VIC1INTENABLE) | (0x1 << 0), S3C_VIC1INTENABLE);	/* EINT12 enable */

#if 0
	/* smdk6400 */
	writel((readl(S3C_GPNCON) & ~(0x3 << 30)) | (0x2 << 30), S3C_GPNCON);	/* GPN15 to EINT */
	writel(readl(S3C_EINT0CON0) | (0x3 << 29), S3C_EINT0CON0);		/* EINT15 to both edge triggered */
	writel(readl(S3C_EINT0MASK) & ~(0x1 << 15), S3C_EINT0MASK);		/* EINT15 unmask */
	writel(readl(S3C_VIC1INTENABLE) | (0x1 << 4), S3C_VIC1INTENABLE);	/* EINT15 enable */
#endif

	/* GPC7 to high for usb power up */
	s3c_gpio_cfgpin(S3C_GPC7, S3C_GPC7_OUTP);
	s3c_gpio_setpin(S3C_GPC7, 1);
#endif
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
0
Archivo: led.c Proyecto: cwyy/kernel
static int led_ioctl(struct inode *indoe, struct file *file,
		unsigned int cmd, unsigned long arg)
{
	if (arg > 4)
		return -EINVAL;

	switch(cmd)
	{
		case LED_ON:
			s3c_gpio_setpin(led_table[arg], 0);
			printk("led[%d] on\r\n", arg);
			break;
		case LED_OFF:
			s3c_gpio_setpin(led_table[arg], 1);
			printk("led[%d] off\r\n", arg);
			break;
		default:
			break;
	}

	return 0;
}
Ejemplo n.º 10
0
static ssize_t detect_cable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
	int value;
	
	sscanf(buf, "%d", &value);
	if(value==1)
		value = 1;
	else
		value = 0;
#if 0
    	printk(KERN_ERR "detect_cable_store%d\n",value);
	printk(KERN_ERR "HDMI_EN1:%d\n",gpio_get_value(GPIO_HDMI_EN1));

	s3c_gpio_cfgpin(GPIO_HDMI_EN1, S3C_GPIO_OUTPUT);
	s3c_gpio_cfgpin(GPIO_HDMI_EN2, S3C_GPIO_OUTPUT);

	s3c_gpio_setpin(GPIO_HDMI_EN1, value);
	s3c_gpio_setpin(GPIO_HDMI_EN2, value);

	printk(KERN_ERR "recheck,HDMI_EN1:%d\n",gpio_get_value(GPIO_HDMI_EN1));
#endif
	return size;
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
static ssize_t bt_wake_store(struct device *dev,
      						struct device_attribute *attr,      const char *buf, size_t count)
{
	unsigned long wake = simple_strtoul(buf, NULL, 10);
	struct bt_gpio_info *bt_info = dev_get_drvdata(dev);

	if (wake == 1 || wake == 0) {
		mutex_lock(&bt_info->bt_lock);
		bt_info->bt_wake = wake;
		mutex_unlock(&bt_info->bt_lock);
		s3c_gpio_setpin(BT_WAKE, wake ? 1:0 );  
	} else
		dev_warn(dev, "[BT] input error\n");

	return count;
}
Ejemplo n.º 13
0
	/* for hsmmc ch2 */
	writel(0, S3C_GPNPU);
	writel((readl(S3C_GPNCON) & ~(0x3 << 24)) | (0x2 << 24), S3C_GPNCON);	/* GPN12 to EINT */
	writel(readl(S3C_EINT0CON0) | (0x3 << 25), S3C_EINT0CON0);		/* EINT12 to both edge triggered */
	writel(readl(S3C_EINT0MASK) & ~(0x1 << 12), S3C_EINT0MASK);		/* EINT12 unmask */
	writel(readl(S3C_VIC1INTENABLE) | (0x1 << 0), S3C_VIC1INTENABLE);	/* EINT12 enable */
#endif
}

#if 0 /* removed otg reset due to change mmc clock source USB clock to MPLL */
static void smdk6410_usb_otg_reset (void)
{
#if defined(CONFIG_MACH_SANJOSE2)
	/* GPC7 to high for usb power up */
	s3c_gpio_cfgpin(S3C_GPC7, S3C_GPC7_OUTP);
	s3c_gpio_setpin(S3C_GPC7, 1);
#endif

	/* initialize for usb 48m ext clock */
	writel(readl(S3C_OTHERS) | S3C_OTHERS_USB_SIG_MASK, S3C_OTHERS);

	writel(0x0, S3C_USBOTG_PHYPWR);
	writel(0x20, S3C_USBOTG_PHYCLK);
	writel(0x1, S3C_USBOTG_RSTCON);
	udelay(50);
	writel(0x0, S3C_USBOTG_RSTCON);
	udelay(50);
}
Ejemplo n.º 14
0
static ssize_t bt_test_mode_show(struct device *dev,
     							struct device_attribute *attr, char *buf)
{
	struct bt_gpio_info *bt_info = dev_get_drvdata(dev);
	
	int gpio_val1=0;
	int gpio_val2=0;

	mutex_lock(&bt_info->bt_lock);		

	gpio_val1 = gpio_get_value(GPIO_MEIZU_KEY_VOL_UP);   				//voluem+ 

	s3c_gpio_cfgpin(X_POWER_GPIO, S3C_GPIO_INPUT);
	s3c_gpio_setpull(X_POWER_GPIO, S3C_GPIO_PULL_DOWN);  
	gpio_val2 = gpio_get_value(X_POWER_GPIO);  			 			//bb key on

	if( (gpio_val1 ==0) &&(gpio_val2 ==0) ) 
	{
		mdelay(100);
		gpio_val1 = gpio_get_value(GPIO_MEIZU_KEY_VOL_UP);
		gpio_val2 = gpio_get_value(X_POWER_GPIO);

		if( (gpio_val1 ==0) &&(gpio_val2 ==0) ) 
		{
			bt_info->bt_test_mode =1;            							//test mode
			
			s3c_gpio_cfgpin(WIFI_BT_TEST_LED, S3C_GPIO_OUTPUT);
			s3c_gpio_setpull(WIFI_BT_TEST_LED, S3C_GPIO_PULL_NONE);  
			s3c_gpio_setpin(WIFI_BT_TEST_LED, 1);    					 //set led on 
		}
	}
	mutex_unlock(&bt_info->bt_lock);

	return sprintf(buf, "%d\n",  bt_info->bt_test_mode);
	
}
Ejemplo n.º 15
0
static irqreturn_t s3c_camif_do_irq_codec(int irq, void *dev_id)
{
	camif_cfg_t *cfg = (camif_cfg_t *) dev_id;

#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
	s3c_gpio_setpin(S3C_GPN15, 1);
#endif
	s3c_camif_clear_irq(irq);
	s3c_camif_get_fifo_status(cfg);
	s3c_camif_get_frame_num(cfg);

#if defined(FSM_ON_CODEC) && !defined(USE_LAST_IRQ)
	if (s3c_camif_do_fsm_codec(cfg) == INSTANT_SKIP)
		return IRQ_HANDLED;
#endif

#if defined(FSM_ON_CODEC) && defined(USE_LAST_IRQ)
	if (s3c_camif_do_fsm_codec_lastirq(cfg) == INSTANT_SKIP)
		return IRQ_HANDLED;
#endif
	wake_up_interruptible(&cfg->waitq);

	return IRQ_HANDLED;
}
Ejemplo n.º 16
0
static ssize_t MHD_check_read(struct device *dev, struct device_attribute *attr, char *buf)
{
	int count;
	int res=0;
	#if 0

	s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_UP);	//MHL_SEL

	s3c_gpio_setpin(GPIO_MHL_SEL, 1);
	

	//TVout_LDO_ctrl(true);
	
	if(!MHD_HW_IsOn())
	{
		sii9234_tpi_init();
		res = MHD_Read_deviceID();
		MHD_HW_Off();		
	}
	else
	{
		sii9234_tpi_init();
		res = MHD_Read_deviceID();
	}

	I2C_WriteByte(0x72, 0xA5, 0xE1);
	res = 0;
	res = I2C_ReadByte(0x72, 0xA5);

	printk("A5 res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1B);

	printk("Device ID res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1C);

	printk("Device Rev ID res %x",res);

	res = 0;
	res = I2C_ReadByte(0x72, 0x1D);

	printk("Device Reserved ID res %x",res);

	printk("\n####HDMI_EN1 %x MHL_RST %x GPIO_MHL_SEL %x\n",gpio_get_value(GPIO_HDMI_EN1),gpio_get_value(GPIO_MHL_RST),gpio_get_value(GPIO_MHL_SEL));

	res = I2C_ReadByte(0x7A, 0x3D);

	res = I2C_ReadByte(0x7A, 0xFF);
		
	s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_NONE);	//MHL_SEL

	s3c_gpio_setpin(GPIO_MHL_SEL, 0);

#endif
	count = sprintf(buf,"%d\n", res );
	//TVout_LDO_ctrl(false);
	return count;
}
Ejemplo n.º 17
0
int s3c6400_timer_setup (int channel, int usec, unsigned long g_tcnt, unsigned long g_tcmp)
{
	unsigned long tcon;
	unsigned long tcnt;
	unsigned long tcmp;
	unsigned long tcfg1;
	unsigned long tcfg0;
	unsigned long pclk;
	struct clk *clk;

	printk("PWM channel %d set g_tcnt = %ld, g_tcmp = %ld \n", channel, g_tcnt, g_tcmp);

	tcnt = 0xffffffff;  /* default value for tcnt */

	/* read the current timer configuration bits */
	tcon = __raw_readl(S3C_TCON);
	tcfg1 = __raw_readl(S3C_TCFG1);
	tcfg0 = __raw_readl(S3C_TCFG0);

	clk = clk_get(NULL, "timers");
	if (IS_ERR(clk))
		panic("failed to get clock for pwm timer");

	clk_enable(clk);

	pclk = clk_get_rate(clk);

	/* configure clock tick */
	switch(channel)
	{
		case 0:
			/* set gpio as PWM TIMER0 to signal output*/
			s3c_gpio_cfgpin(S3C_GPF14, S3C_GPF14_PWM_TOUT0);
			s3c_gpio_setpin(S3C_GPF14, 0);
			tcfg1 &= ~S3C_TCFG1_MUX0_MASK;
			tcfg1 |= S3C_TCFG1_MUX0_DIV2;

			tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK;
			tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT;
			tcon &= ~(7<<0);
			tcon |= S3C_TCON_T0RELOAD;
			break;

		case 1:
			/* set gpio as PWM TIMER1 to signal output*/
			s3c_gpio_cfgpin(S3C_GPF15, S3C_GPF15_PWM_TOUT1);
			s3c_gpio_setpin(S3C_GPF15, 0);
			tcfg1 &= ~S3C_TCFG1_MUX1_MASK;
			tcfg1 |= S3C_TCFG1_MUX1_DIV2;

			tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK;
			tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT;

			tcon &= ~(7<<8);
			tcon |= S3C_TCON_T1RELOAD;
			break;
		case 2:
			tcfg1 &= ~S3C_TCFG1_MUX2_MASK;
			tcfg1 |= S3C_TCFG1_MUX2_DIV2;

			tcfg0 &= ~S3C_TCFG_PRESCALER1_MASK;
			tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER1_SHIFT;

			tcon &= ~(7<<12);
			tcon |= S3C_TCON_T2RELOAD;
			break;
		case 3:
			tcfg1 &= ~S3C_TCFG1_MUX3_MASK;
			tcfg1 |= S3C_TCFG1_MUX3_DIV2;

			tcfg0 &= ~S3C_TCFG_PRESCALER1_MASK;
			tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER1_SHIFT;
			tcon &= ~(7<<16);
			tcon |= S3C_TCON_T3RELOAD;
			break;
	}

#if 0

	tcnt = (pclk / ((PRESCALER)*DIVIDER)) / usec;

	printk("s3c6400 pwm timer tcnt=0x%08lx, pclk=0x%08lx, PRESCALER=%d, DIVIDER=%d, usec=%d\n",
	       tcnt, pclk, PRESCALER, DIVIDER, usec);

	/* timers reload after counting zero, so reduce the count by 1 */

	tcnt--;
#endif

	__raw_writel(tcfg1, S3C_TCFG1);
	__raw_writel(tcfg0, S3C_TCFG0);


	__raw_writel(tcon, S3C_TCON);
	tcnt = 160;
#if 0
	if (tcnt > 0xffffffff) {
		panic("setup_timer: HZ is too small, cannot configure timer!");
		return 0;
	}
#endif
	__raw_writel(tcnt, S3C_TCNTB(channel));
	tcmp = 110;
	__raw_writel(tcmp, S3C_TCMPB(channel));

	switch(channel)
	{
		case 0:
			tcon |= S3C_TCON_T0MANUALUPD;
			break;
		case 1:
			tcon |= S3C_TCON_T1MANUALUPD;
			break;
		case 2:
			tcon |= S3C_TCON_T2MANUALUPD;
			break;
		case 3:
			tcon |= S3C_TCON_T3MANUALUPD;
			break;
	}
	__raw_writel(tcon, S3C_TCON);

	tcnt = g_tcnt;
	__raw_writel(tcnt, S3C_TCNTB(channel));

	tcmp = g_tcmp;
	__raw_writel(tcmp, S3C_TCMPB(channel));

	/* start the timer running */
	s3c6400_pwm_start ( channel);

	return 0;
}
// gpio help functions
static void _gpio_out(unsigned int pin, bool level)
{
	s3c_gpio_cfgpin(pin, S3C_GPIO_OUTPUT);
	s3c_gpio_setpin(pin, level);
}
Ejemplo n.º 19
0
void EXT_LED_Off(int num){
	////int led_pos[] = {0, 3, 1, 2, 4, 7, 5, 6};	//hw
	//int led_pos[] = {0, 2, 3, 1, 4, 6, 7, 5};	//sw apping
	int gpio_pos[] = {4, 6, 7, 5, 4, 6, 7, 5};	//sw apping
	int pos;

	printk("[LED_DD]==>LED_OFF(%d)\n", num);
	if(num == 8) {
		//led0, led1, led2, led3
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (0x000000F0)));
		s3c_gpio_setpin(LED_D0, 1);
		s3c_gpio_setpin(LED_D1, 1);
		s3c_gpio_setpin(LED_D2, 1);
		s3c_gpio_setpin(LED_D3, 1);
		//low(right) 4 led activate
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  &= (~0x00000004)));
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  |= (0x00000004)));
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  &= (~0x00000004)));
		s3c_gpio_setpin(LED_C1, 0);
		s3c_gpio_setpin(LED_C1, 1);
		s3c_gpio_setpin(LED_C1, 0);

		//led4, led5, led6, led7
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (0x000000F0)));
		s3c_gpio_setpin(LED_D0, 1);
		s3c_gpio_setpin(LED_D1, 1);
		s3c_gpio_setpin(LED_D2, 1);
		s3c_gpio_setpin(LED_D3, 1);
		//high(left) 4 led activate
		//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (0x00000002)));
		//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
		s3c_gpio_setpin(LED_C0, 0);
		s3c_gpio_setpin(LED_C0, 1);
		s3c_gpio_setpin(LED_C0, 0);
		
		return;
	}

	//pos = led_pos[num];
	pos = gpio_pos[num];

	printk("[LED_DD]==>LED_OFF(%d, %d)\n", num, pos);
	if(num < 0 || num > 8) {
		printk("[LED_DD]Invalid Led Num!!\n");
	} else {
		s3c_gpio_setpin(S5PV210_GPB(pos), 1);
		if(num < 4) {
		//led_num off
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (1 << (pos + 4))));

		//low(right) 4 led activate
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  &= (~0x00000004)));
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  |= (0x00000004)));
		//Outp32(GPA0DAT,(Inp32(GPA0DAT)  &= (~0x00000004)));
		s3c_gpio_setpin(LED_C1, 0);
		s3c_gpio_setpin(LED_C1, 1);
		s3c_gpio_setpin(LED_C1, 0);
		} else if(num < 8) {
		//led_num off
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (1 << (pos ))));
		//s3c_gpio_setpin(S5PV210_GPB(pos), 1);

		//high(left) 4 led activate
		//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
		//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (0x00000002)));
		//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
		s3c_gpio_setpin(LED_C0, 0);
		s3c_gpio_setpin(LED_C0, 1);
		s3c_gpio_setpin(LED_C0, 0);
		}
	}
}
Ejemplo n.º 20
0
void EXT_LED_Init(void){
	//GPB_0,1,4,5,6,7 : Output
	//Outp32(GPBCON,(Inp32(GPBCON)  &= (~0xFFFF00FF)));
	//Outp32(GPBCON,(Inp32(GPBCON)  |= 0x11110011));
	//GPB_0,1,4,5,6,7 : Pull-up
	//Outp32(GPBPUD,(Inp32(GPBPUD)  &= (~0x0000FF0F)));
	//Outp32(GPBPUD,(Inp32(GPBPUD)  |= 0x0000AA0A));
	s3c_gpio_cfgpin(LED_D0, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_D0, S3C_GPIO_PULL_NONE);
	s3c_gpio_cfgpin(LED_D1, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_D1, S3C_GPIO_PULL_NONE);
	s3c_gpio_cfgpin(LED_D2, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_D2, S3C_GPIO_PULL_NONE);
	s3c_gpio_cfgpin(LED_D3, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_D3, S3C_GPIO_PULL_NONE);

	s3c_gpio_cfgpin(LED_C0, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_C0, S3C_GPIO_PULL_NONE);


	//GPA0_2 : Output
	//Outp32(GPA0CON,(Inp32(GPA0CON) &= (~0x00000F00)));
	//Outp32(GPA0CON,(Inp32(GPA0CON) |= 0x00000100 ));
	//GPA0_2 : Pull-up
	//Outp32(GPA0PUD,(Inp32(GPA0PUD) &= (~0x00000030)));
	//Outp32(GPA0PUD,(Inp32(GPA0PUD) |= 0x00000020));
	s3c_gpio_cfgpin(LED_C1, S3C_GPIO_SFN(MODE_OUT));
	s3c_gpio_setpull(LED_C1, S3C_GPIO_PULL_NONE);

	//GPB_4,5,6,7 : 0 -> 1
	//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x000000F0)));
	//Outp32(GPBDAT,(Inp32(GPBDAT)  |= 0x000000F0));
	s3c_gpio_setpin(LED_D0, 1);
	s3c_gpio_setpin(LED_D1, 1);
	s3c_gpio_setpin(LED_D2, 1);
	s3c_gpio_setpin(LED_D3, 1);

#if 1
	//GPB_1 : 0 -> 1 -> 0
	//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
	//Outp32(GPBDAT,(Inp32(GPBDAT)  |= (0x00000002)));
	//Outp32(GPBDAT,(Inp32(GPBDAT)  &= (~0x00000002)));
	s3c_gpio_setpin(LED_C0, 0);
	s3c_gpio_setpin(LED_C0, 1);
	s3c_gpio_setpin(LED_C0, 0);

	//GPA0_2 : 0 -> 1 -> 0
	//Outp32(GPA0DAT,(Inp32(GPBDAT)  &= (~0x00000004)));
	//Outp32(GPA0DAT,(Inp32(GPBDAT)  |= (0x00000004)));
	//Outp32(GPA0DAT,(Inp32(GPBDAT)  &= (~0x00000004)));
	s3c_gpio_setpin(LED_C1, 0);
	s3c_gpio_setpin(LED_C1, 1);
	s3c_gpio_setpin(LED_C1, 0);
#endif

#if 1
	//GPB_0 : 1
	//Outp32(GPBDAT,(Inp32(GPBDAT)  |= 0x00000001));
	s3c_gpio_setpin(KEY_CTL, 1);
#endif
}
Ejemplo n.º 21
0
void smdk6400_leds_event(led_event_t evt)
{
	unsigned long flags;

	static u16 led_state, hw_led_state;

	local_irq_save(flags);

	if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
		goto done;

	switch (evt) {
	case led_start:
		led_state |= LED_STATE_ENABLED;
		break;

	case led_stop:
	case led_halted:
		/* all leds off during suspend or shutdown */
		led_state &= ~LED_STATE_ENABLED;
		break;

	case led_claim:
		led_state |= LED_STATE_CLAIMED;
		hw_led_state = 0;
		break;

	case led_release:
		led_state &= ~LED_STATE_CLAIMED;
		break;

#ifdef CONFIG_LEDS_TIMER
	case led_timer:
		led_state ^= LED_TIMER_ON;

		if (led_state & LED_TIMER_ON)
			s3c_gpio_setpin(LED0, 1);
		else {
			s3c_gpio_setpin(LED0, 0);
		}

		break;
#endif

#ifdef CONFIG_LEDS_CPU
	case led_idle_start:
		s3c_gpio_setpin(LED1, 1);
		break;

	case led_idle_end:
		s3c_gpio_setpin(LED1, 0);
		break;
#endif

	case led_green_on:
		break;
	case led_green_off:
		break;

	case led_amber_on:
		break;
	case led_amber_off:
		break;

	case led_red_on:
		break;
	case led_red_off:
		break;

	case led_blue_on:
		break;
	case led_blue_off:
		break;

	default:
		break;
	}

done:
	local_irq_restore(flags);
}