예제 #1
0
int headset_status(void)
{

	unsigned int	hp_conectd_n = 0;
	unsigned int 	iTmp = 0;
	unsigned int 	iCntr = 0;

	/* set GPN(4) as input to get hp status*/
	s3c_gpio_cfgpin(S3C64XX_GPN(2),S3C64XX_GPN_INPUT(2));
	/* pull-up enable*/
	s3c_gpio_setpull(S3C64XX_GPN(2), S3C_GPIO_PULL_UP);

	/* check 500us to make sure the hotplug is stable */
	while (1) 
	{
		mySleep(2);
		/* get gpn(4) data, 1-> hp not connected; 0-> hp connected*/
		iTmp = gpio_get_value(S3C64XX_GPN(2));
		if (iTmp!=hp_conectd_n)	
		{
			hp_conectd_n = iTmp;
			iCntr = 0;
		}
		else 
		{
			if (iCntr++>=3) 
				break;
		}
	}
	return (!hp_conectd_n);
}
예제 #2
0
static void setup_sdhci0_irq_cd (void)
{
	/* init GPIO as a ext irq */
	s3c_gpio_cfgpin(S3C64XX_GPN(12), S3C_GPIO_SFN(2));
	s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_NONE);

	set_irq_type(S3C_EINT(12), IRQ_TYPE_EDGE_BOTH);
}
예제 #3
0
파일: buddy.c 프로젝트: buddyzhangrenze/i2c
/*
 * key value
 */
static void buddy_get_key(void)
{
	/*
	 * Get value for gpio.
	 */
	printk(KERN_INFO "Key03[%2d]\n",gpio_get_value(S3C64XX_GPN(2)));
	/*
	 * Get irq number for gpio.
	 */
	printk(KERN_INFO "Key03 irq is[%d]\n",gpio_to_irq(S3C64XX_GPN(2)));
}
예제 #4
0
int gpio_to_irq(unsigned gpio)
{
	if ( gpio >= S3C64XX_GPN(0) && gpio <= S3C64XX_GPN(15) )
		return IRQ_EINT(gpio - S3C64XX_GPIO_N_START);
	else if ( gpio >= S3C64XX_GPL(8) && gpio <= S3C64XX_GPL(14) )
		return IRQ_EINT(gpio - S3C64XX_GPL(8) + 16);
	else if ( gpio >= S3C64XX_GPM(0) && gpio <= S3C64XX_GPM(4) )
		return IRQ_EINT(gpio - S3C64XX_GPM(0) + 23);
	
        return -EINVAL;
}
예제 #5
0
/*
 * gpio 设置,配置GPIO功能
 * */
static void gpio_select(void)
{
#ifdef _DEBUG_GM814X
    printk(KERN_INFO "2.1-----gpio_select\n");
#endif
    //SPI0
    s3c_gpio_cfgpin(S3C64XX_GPC(0), S3C64XX_GPC0_SPI_MISO0);
    s3c_gpio_cfgpin(S3C64XX_GPC(1), S3C64XX_GPC1_SPI_CLK0);
    s3c_gpio_cfgpin(S3C64XX_GPC(2), S3C64XX_GPC2_SPI_MOSI0);
    s3c_gpio_cfgpin(S3C64XX_GPC(3), S3C64XX_GPC3_SPI_nCS0);

    s3c_gpio_setpull(S3C64XX_GPC(0), S3C_GPIO_PULL_NONE);
    s3c_gpio_setpull(S3C64XX_GPC(1), S3C_GPIO_PULL_NONE);
    s3c_gpio_setpull(S3C64XX_GPC(2), S3C_GPIO_PULL_NONE);
    s3c_gpio_setpull(S3C64XX_GPC(3), S3C_GPIO_PULL_NONE);

    //GPL13 SET ----GM8142_RST--------new6410
    if( (gpio_request(S3C64XX_GPL(13), "GPL13_RST") == 0) &&
            (gpio_direction_output(S3C64XX_GPL(13), 1) == 0))
    {
        gpio_export(S3C64XX_GPL(13), 0);
        gpio_set_value(S3C64XX_GPL(13), 0);			//RST LOW
        udelay(400);
        gpio_set_value(S3C64XX_GPL(13), 1);			//RST HIGH
        udelay(400);
    }
    else {
        printk(KERN_ERR "GM8142: cluld not obtain gpio for 'GPK8_RST'\n");
    }

    //GPL14 SET----GM8142_SHDN
    if( (gpio_request(S3C64XX_GPL(14), "GPL14_SHDN") == 0) &&
            (gpio_direction_output(S3C64XX_GPL(14), 1) == 0))
    {
        gpio_export(S3C64XX_GPL(14), 0);
        gpio_set_value(S3C64XX_GPL(14), 1);		//SHDN=1,正常工作模式

        if( gpio_get_value(S3C64XX_GPL(14)) == 0)
        {
            printk(KERN_ERR "GM8142: can't set GPL(14) SHDN = 1\n");
        }
    }
    else {
        printk(KERN_ERR "GM8142: cluld not obtain gpio for 'GPL14_SHDN'\n");
    }

    s3c_gpio_cfgpin(S3C64XX_GPN(4), S3C_GPIO_SFN(2));			//配置GPN4为外中断
    s3c_gpio_setpull(S3C64XX_GPN(4), S3C_GPIO_PULL_NONE);		//不上拉也不下拉,硬件默认拉高
    //set_irq_type(S3C64XX_GPN(4), IRQ_TYPE_EDGE_BOTH);			//发送和接收数据都会触发
    set_irq_type(S3C64XX_GPN(4), IRQ_TYPE_LEVEL_LOW);			//低电平触发
    //set_irq_type(S3C64XX_GPN(4), IRQ_TYPE_EDGE_FALLING);

}
예제 #6
0
static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
				   unsigned int power)
{
	if (power) {
		gpio_direction_output(S3C64XX_GPF(13), 1);

		/* fire nRESET on power up */
		gpio_direction_output(S3C64XX_GPN(5), 0);
		msleep(10);
		gpio_direction_output(S3C64XX_GPN(5), 1);
		msleep(1);
	} else {
		gpio_direction_output(S3C64XX_GPF(13), 0);
	}
}
예제 #7
0
static ssize_t keyshort_test(struct device *dev, struct device_attribute *attr, char *buf)
{
	int count, i;
	int mask=0;
	u32 cval=0,rval=0;

	if( !gpio_get_value(S3C64XX_GPN(5)) ) {
		mask |= 0x1;
	}

	for (i=0; i<KEYPAD_COLUMNS; i++) {
		cval = KEYCOL_DMASK & ~((1 << i) | (1 << (i+ 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) {
			mask |=0x100;
		}
	}

	if(mask) {
		count = sprintf(buf, "PRESS\n");
	}
	else {
		count = sprintf(buf, "RELEASE\n");
	}
	return count;
}
예제 #8
0
파일: misc_key.c 프로젝트: houstar/driver
static void init_gpio(void)
{
	int i;
	for(i =0;i < KEYNUM;i++)
	{
		s3c_gpio_cfgpin(S3C64XX_GPN(i),2);
		irq_set_irq_type(IRQ_EINT(i),dev_info[i].flags);
	}
}
예제 #9
0
int irq_to_gpio(unsigned irq)
{
	if (irq >= IRQ_EINT(0) && irq <= IRQ_EINT(15))
		return S3C64XX_GPN(irq - IRQ_EINT(0));
	else if (irq >= IRQ_EINT(16) && irq <= IRQ_EINT(22))
		return S3C64XX_GPL(irq - IRQ_EINT(16) + 8);
	else if (irq >= IRQ_EINT(23) && irq <= IRQ_EINT(27))
		return S3C64XX_GPM(irq - IRQ_EINT(23));
	
        return -EINVAL;
}
예제 #10
0
static int wm1192_pre_init(struct wm831x *wm831x)
{
	int ret;

	/* Configure the IRQ line */
	s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);

	ret = platform_device_register(&wm1192_pmic_led_dev);
	if (ret != 0)
		dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);

	return 0;
}
예제 #11
0
static void __init ok6410_machine_init(void)
{
	u32 cs1;

	s3c_i2c0_set_platdata(NULL);
	s3c_i2c1_set_platdata(NULL);
	s3c_fb_set_platdata(&ok6410_lcd_pdata);
	s3c_hsotg_set_platdata(&ok6410_hsotg_pdata);

	samsung_keypad_set_platdata(&ok6410_keypad_data);

	s3c_nand_set_platdata(&ok6410_nand_info);
	s3c24xx_ts_set_platdata(NULL);

	/* configure nCS1 width to 16 bits */

	cs1 = __raw_readl(S3C64XX_SROM_BW) &
		    ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
	cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
		(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
		(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
						   S3C64XX_SROM_BW__NCS1__SHIFT;
	__raw_writel(cs1, S3C64XX_SROM_BW);

	/* set timing for nCS1 suitable for ethernet chip */

	__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
		     (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
		     (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
		     (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
		     (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);

	gpio_request(S3C64XX_GPN(5), "LCD power");
	gpio_request(S3C64XX_GPF(13), "LCD power");

	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

	s3c_ide_set_platdata(&ok6410_ide_pdata);

	samsung_bl_set(&ok6410_bl_gpio_info, &ok6410_bl_data);

	platform_add_devices(ok6410_devices, ARRAY_SIZE(ok6410_devices));

	/* enable USB phy clock */
	s5p_usb_phy_init(&s3c_device_usb_hsotg, USB_PHY_TYPE_DEVICE);
}
static void __init smdk6410_machine_init(void)
{
	s3c_i2c0_set_platdata(NULL);
	s3c_i2c1_set_platdata(NULL);
	s3c_fb_set_platdata(&smdk6410_lcd_pdata);

	gpio_request(S3C64XX_GPN(5), "LCD power");
	gpio_request(S3C64XX_GPF(13), "LCD power");
	gpio_request(S3C64XX_GPF(15), "LCD power");

	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
}
예제 #13
0
static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
{
	int i;

	/* Configure the IRQ line */
	s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);

	/* Instantiate the regulators */
	for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
		wm8350_register_regulator(wm8350,
					  wm1190_regulators[i].regulator,
					  wm1190_regulators[i].initdata);

	return 0;
}
예제 #14
0
static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
{
	int i;

	
	s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);

	
	for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
		wm8350_register_regulator(wm8350,
					  wm1190_regulators[i].regulator,
					  wm1190_regulators[i].initdata);

	return 0;
}
예제 #15
0
static void __init smdk6410_machine_init(void)
{
	u32 cs1;

	s3c_i2c0_set_platdata(NULL);
	s3c_i2c1_set_platdata(NULL);
	s3c_fb_set_platdata(&smdk6410_lcd_pdata);
	s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);

	samsung_keypad_set_platdata(&smdk6410_keypad_data);

	s3c24xx_ts_set_platdata(NULL);

	

	cs1 = __raw_readl(S3C64XX_SROM_BW) &
		    ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
	cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
		(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
		(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
						   S3C64XX_SROM_BW__NCS1__SHIFT;
	__raw_writel(cs1, S3C64XX_SROM_BW);

	

	__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
		     (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
		     (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
		     (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
		     (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);

	gpio_request(S3C64XX_GPN(5), "LCD power");
	gpio_request(S3C64XX_GPF(13), "LCD power");

	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

	s3c_ide_set_platdata(&smdk6410_ide_pdata);

	samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);

	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
}
static void __init smdk6410_machine_init(void)
{
	u32 cs1;

	s3c_i2c0_set_platdata(NULL);
	s3c_i2c1_set_platdata(NULL);
	s3c_fb_set_platdata(&smdk6410_lcd_pdata);

	s3c24xx_ts_set_platdata(&s3c_ts_platform);

	/* configure nCS1 width to 16 bits */

	cs1 = __raw_readl(S3C64XX_SROM_BW) &
		    ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
	cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
		(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
		(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
						   S3C64XX_SROM_BW__NCS1__SHIFT;
	__raw_writel(cs1, S3C64XX_SROM_BW);

	/* set timing for nCS1 suitable for ethernet chip */

	__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
		     (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
		     (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
		     (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
		     (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);

	gpio_request(S3C64XX_GPN(5), "LCD power");
	gpio_request(S3C64XX_GPF(13), "LCD power");
	gpio_request(S3C64XX_GPF(15), "LCD power");

	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
}
예제 #17
0
static void __init crag6410_machine_init(void)
{
	/* Open drain IRQs need pullups */
	s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
	s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);

	gpio_request(S3C64XX_GPB(0), "LCD power");
	gpio_direction_output(S3C64XX_GPB(0), 0);

	gpio_request(S3C64XX_GPF(14), "LCD PWM");
	gpio_direction_output(S3C64XX_GPF(14), 0);  /* turn off */

	gpio_request(S3C64XX_GPB(1), "SD power");
	gpio_direction_output(S3C64XX_GPB(1), 0);

	gpio_request(S3C64XX_GPF(10), "nRESETSEL");
	gpio_direction_output(S3C64XX_GPF(10), 1);

	s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
	s3c_sdhci1_set_platdata(&crag6410_hsmmc1_pdata);
	s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);

	s3c_i2c0_set_platdata(&i2c0_pdata);
	s3c_i2c1_set_platdata(NULL);
	s3c_fb_set_platdata(&crag6410_lcd_pdata);

	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));

	samsung_keypad_set_platdata(&crag6410_keypad_data);

	platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));

	regulator_has_full_constraints();

	s3c_pm_init();
}
예제 #18
0
static void __init mini6410_machine_init(void)
{
	u32 cs1;

	s3c_i2c0_set_platdata(NULL);
#ifdef CONFIG_S3C_DEV_I2C1
	s3c_i2c1_set_platdata(NULL);
#endif

	s3c_fb_set_platdata(&mini6410_lcd_pdata);

#ifdef CONFIG_SAMSUNG_DEV_TS
	s3c24xx_ts_set_platdata(&s3c_ts_platform);
#endif
#ifdef CONFIG_TOUCHSCREEN_MINI6410
	s3c_ts_set_platdata(&s3c_ts_platform);
#endif

	s3c_sdhci0_set_platdata(&mini6410_hsmmc0_pdata);
	s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);

#ifdef CONFIG_MTD_NAND_S3C
	s3c_device_nand.name = "s3c6410-nand";
#endif
	s3c_nand_set_platdata(&mini6410_nand_info);

	s3c64xx_ac97_setup_gpio(0);

	/* configure nCS1 width to 16 bits */

	cs1 = __raw_readl(S3C64XX_SROM_BW) &
		    ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
	cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
		(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
		(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
						   S3C64XX_SROM_BW__NCS1__SHIFT;
	__raw_writel(cs1, S3C64XX_SROM_BW);

	/* set timing for nCS1 suitable for ethernet chip */

	__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
		     (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
		     (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
		     (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
		     (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
		     (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);

	gpio_request(S3C64XX_GPN(5), "LCD power");
	gpio_request(S3C64XX_GPF(13), "LCD power");
	gpio_request(S3C64XX_GPF(15), "LCD power");

	if (ARRAY_SIZE(i2c_devs0)) {
		i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
	}
	if (ARRAY_SIZE(i2c_devs1)) {
		i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
	}

#ifdef CONFIG_S3C64XX_DEV_FIMC0
	s3c_fimc0_set_platdata(NULL);
#endif
#ifdef CONFIG_S3C64XX_DEV_FIMC1
	s3c_fimc1_set_platdata(NULL);
#endif

	platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
	platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); //GPIO resource MAP
	if ((platform_device_register(&mini6410_leds))!=0)
		printk( "Failed to register  LEDs.\n");
	else
		printk( "LEDs initialized.\n");

#ifdef CONFIG_VIDEO_SAMSUNG
	create_proc_read_entry("videomem", 0, NULL, s3c_media_read_proc, NULL);
#endif
}
예제 #19
0
#include <mach/regs-gpio.h>

#include <plat/s3c6410.h>
#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/fb.h>
#include <plat/gpio-cfg.h>
#include <plat/regs-fb-v4.h>

#include "mach-smartq.h"

static struct gpio_led smartq7_leds[] = {
	{
		.name			= "smartq7:red",
		.active_low		= 1,
		.gpio			= S3C64XX_GPN(8),
	},
	{
		.name			= "smartq7:green",
		.active_low		= 1,
		.gpio			= S3C64XX_GPN(9),
	},
};

static struct gpio_led_platform_data smartq7_led_data = {
	.num_leds = ARRAY_SIZE(smartq7_leds),
	.leds = smartq7_leds,
};

static struct platform_device smartq7_leds_device = {
	.name			= "leds-gpio",
예제 #20
0
			.ngpio	= S3C64XX_GPIO_I_NR,
			.label	= "GPI",
		},
	}, {
		.base	= S3C64XX_GPJ_BASE,
		.config	= &gpio_2bit_cfg_noint,
		.chip	= {
			.base	= S3C64XX_GPJ(0),
			.ngpio	= S3C64XX_GPIO_J_NR,
			.label	= "GPJ",
		},
	}, {
		.base	= S3C64XX_GPN_BASE,
		.config	= &gpio_2bit_cfg_eint10,
		.chip	= {
			.base	= S3C64XX_GPN(0),
			.ngpio	= S3C64XX_GPIO_N_NR,
			.label	= "GPN",
			.to_irq = s3c64xx_gpio2int_gpn,
		},
	}, {
		.base	= S3C64XX_GPO_BASE,
		.config	= &gpio_2bit_cfg_eint11,
		.chip	= {
			.base	= S3C64XX_GPO(0),
			.ngpio	= S3C64XX_GPIO_O_NR,
			.label	= "GPO",
		},
	}, {
		.base	= S3C64XX_GPP_BASE,
		.config	= &gpio_2bit_cfg_eint11,
예제 #21
0
static ssize_t power_show(struct kobject *kobj, struct kobj_attribute *attr,
			     char *buf)
{
	int value = gpio_get_value(S3C64XX_GPN(1));
		return sprintf(buf,"%d\n",value );
}
	.set_level = gpio_set_value,
	.line = S3C64XX_GPC(3),
};

static struct spi_board_info wm1253_devs[] = {
	[0] = {
		.modalias	= "wm0010",
		.bus_num	= 0,
		.chip_select	= 0,
		.mode		= SPI_MODE_0,
		.controller_data = &wm0010_spi_csinfo,
	},
};

static struct wm5100_pdata wm5100_pdata = {
	.ldo_ena = S3C64XX_GPN(7),
	.irq_flags = IRQF_TRIGGER_HIGH,
	.gpio_base = CODEC_GPIO_BASE,

	.in_mode = {
		WM5100_IN_DIFF,
		WM5100_IN_DIFF,
		WM5100_IN_DIFF,
		WM5100_IN_SE,
	},

	.hp_pol = CODEC_GPIO_BASE + 3,
	.jack_modes = {
		{ WM5100_MICDET_MICBIAS3, 0, 0 },
		{ WM5100_MICDET_MICBIAS2, 1, 1 },
	},
예제 #23
0
static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type)
{
	int offs = eint_offset(data->irq);
	int pin, pin_val;
	int shift;
	u32 ctrl, mask;
	u32 newvalue = 0;
	void __iomem *reg;

	if (offs > 27)
		return -EINVAL;

	if (offs <= 15)
		reg = S3C64XX_EINT0CON0;
	else
		reg = S3C64XX_EINT0CON1;

	switch (type) {
	case IRQ_TYPE_NONE:
		printk(KERN_WARNING "No edge setting!\n");
		break;

	case IRQ_TYPE_EDGE_RISING:
		newvalue = S3C2410_EXTINT_RISEEDGE;
		break;

	case IRQ_TYPE_EDGE_FALLING:
		newvalue = S3C2410_EXTINT_FALLEDGE;
		break;

	case IRQ_TYPE_EDGE_BOTH:
		newvalue = S3C2410_EXTINT_BOTHEDGE;
		break;

	case IRQ_TYPE_LEVEL_LOW:
		newvalue = S3C2410_EXTINT_LOWLEV;
		break;

	case IRQ_TYPE_LEVEL_HIGH:
		newvalue = S3C2410_EXTINT_HILEV;
		break;

	default:
		printk(KERN_ERR "No such irq type %d", type);
		return -1;
	}

	if (offs <= 15)
		shift = (offs / 2) * 4;
	else
		shift = ((offs - 16) / 2) * 4;
	mask = 0x7 << shift;

	ctrl = __raw_readl(reg);
	ctrl &= ~mask;
	ctrl |= newvalue << shift;
	__raw_writel(ctrl, reg);

	/* set the GPIO pin appropriately */

	if (offs < 16) {
		pin = S3C64XX_GPN(offs);
		pin_val = S3C_GPIO_SFN(2);
	} else if (offs < 23) {
		pin = S3C64XX_GPL(offs + 8 - 16);
		pin_val = S3C_GPIO_SFN(3);
	} else {
		pin = S3C64XX_GPM(offs - 23);
		pin_val = S3C_GPIO_SFN(3);
	}

	s3c_gpio_cfgpin(pin, pin_val);

	return 0;
}
예제 #24
0
};

static struct map_desc smdk6410_iodesc[] = {
	{
		/* LCD support */
		.virtual    = (unsigned long)S3C_VA_LCD,
		.pfn        = __phys_to_pfn(S3C_PA_FB),
		.length     = SZ_16K,
		.type       = MT_DEVICE,
	},
};

/* gpio buttons */
static struct gpio_keys_button gpio_buttons[] = {
	{
		.gpio		= S3C64XX_GPN(0),
		//.code		= 25,
		.code		= KEY_UP,
		.desc		= "BUTTON1",
		.active_low	= 1,
		.wakeup		= 0,
	},
	{
		.gpio		= S3C64XX_GPN(1),
		//.code		= 42,
		.code		= KEY_DOWN,
		.desc		= "BUTTON2",
		.active_low	= 1,
		.wakeup		= 0,
	},
	{
예제 #25
0
}

static struct plat_lcd_data mini6410_lcd_power_data = {
	.set_power	= mini6410_lcd_power_set,
};

static struct platform_device mini6410_lcd_powerdev = {
	.name			= "platform-lcd",
	.dev.parent		= &s3c_device_fb.dev,
	.dev.platform_data	= &mini6410_lcd_power_data,
};

static struct s3c_sdhci_platdata mini6410_hsmmc1_pdata = {
	.max_width		= 4,
	.cd_type		= S3C_SDHCI_CD_GPIO,
	.ext_cd_gpio		= S3C64XX_GPN(10),
	.ext_cd_gpio_invert	= true,
};

static struct platform_device *mini6410_devices[] __initdata = {
	&mini6410_device_eth,
	&s3c_device_hsmmc0,
	&s3c_device_hsmmc1,
	&s3c_device_ohci,
	&s3c_device_nand,
	&s3c_device_fb,
	&mini6410_lcd_powerdev,
	&s3c_device_adc,
};

static void __init mini6410_map_io(void)
예제 #26
0
volatile int col_value 	= 0;
volatile int row_value 	= 0;
volatile int key_num 	= 0;

/*struct of irq*/
struct button_irq_desc{
	int 	irq;			//外部中断号
	int 	pin;			//GPIO引脚寄存器
	int 	number;			//引脚号
	char 	*name;			//名称
};

/*IRQ for module*/
static struct button_irq_desc button_irqs[] = {
	{ IRQ_EINT(0),S3C64XX_GPN(0),  0,  "rol1"},
	{ IRQ_EINT(1),S3C64XX_GPN(1),  1,  "rol2"},
	{ IRQ_EINT(2),S3C64XX_GPN(2),  2,  "rol3"},
	{ IRQ_EINT(3),S3C64XX_GPN(3),  3,  "rol4"},
};

void key_delay(void)//按键延时去抖动函数,延时时间为20ms
{
 	unsigned char  i, j;
 	
	for(i=0;i<125;i++)
	  	for(j=0;j<60;j++);
}

/*input_report_key */
static void report_key(int keyno,int report_val)
예제 #27
0
	.keymap_data	= &crag6410_keymap_data,
	.rows		= 2,
	.cols		= 6,
};

static struct gpio_keys_button crag6410_gpio_keys[] = {
	[0] = {
		.code	= KEY_SUSPEND,
		.gpio	= S3C64XX_GPL(10),	/* EINT 18 */
		.type	= EV_KEY,
		.wakeup	= 1,
		.active_low = 1,
	},
	[1] = {
		.code	= SW_FRONT_PROXIMITY,
		.gpio	= S3C64XX_GPN(11),	/* EINT 11 */
		.type	= EV_SW,
	},
};

static struct gpio_keys_platform_data crag6410_gpio_keydata = {
	.buttons	= crag6410_gpio_keys,
	.nbuttons	= ARRAY_SIZE(crag6410_gpio_keys),
};

static struct platform_device crag6410_gpio_keydev = {
	.name		= "gpio-keys",
	.id		= 0,
	.dev.platform_data = &crag6410_gpio_keydata,
};
예제 #28
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;
	void __iomem *reg;

	if (offs > 27)
		return -EINVAL;

	/* fixed by jsgood */
	if (offs > 15)
		reg = S3C64XX_EINT0CON1; /* org: reg = S3C64XX_EINT0CON0; */
	else
		reg = S3C64XX_EINT0CON0; /* org: reg = S3C64XX_EINT0CON1; */

	switch (type) {
	case IRQ_TYPE_NONE:
		printk(KERN_WARNING "No edge setting!\n");
		break;

	case IRQ_TYPE_EDGE_RISING:
		newvalue = S3C2410_EXTINT_RISEEDGE;
		break;

	case IRQ_TYPE_EDGE_FALLING:
		newvalue = S3C2410_EXTINT_FALLEDGE;
		break;

	case IRQ_TYPE_EDGE_BOTH:
		newvalue = S3C2410_EXTINT_BOTHEDGE;
		break;

	case IRQ_TYPE_LEVEL_LOW:
		newvalue = S3C2410_EXTINT_LOWLEV;
		break;

	case IRQ_TYPE_LEVEL_HIGH:
		newvalue = S3C2410_EXTINT_HILEV;
		break;

	default:
		printk(KERN_ERR "No such irq type %d", type);
		return -1;
	}

	/* fixed by jsgood */
	shift = ((offs % 16) / 2) * 4;	/* org: shift = (offs / 2) * 4; */
	mask = 0x7 << shift;

	ctrl = __raw_readl(reg);
	ctrl &= ~mask;
	ctrl |= newvalue << shift;
	__raw_writel(ctrl, reg);

	if (offs < 16)
	s3c_gpio_cfgpin(S3C64XX_GPN(offs), 0x2 << (offs * 2));
	else if (offs < 23)
		s3c_gpio_cfgpin(S3C64XX_GPL(offs - 8), S3C_GPIO_SFN(3));
	else
		s3c_gpio_cfgpin(S3C64XX_GPM(offs - 23), S3C_GPIO_SFN(3));

	return 0;
}
예제 #29
0
	.keymap_data	= &crag6410_keymap_data,
	.rows		= 2,
	.cols		= 6,
};

static struct gpio_keys_button crag6410_gpio_keys[] = {
	[0] = {
		.code	= KEY_SUSPEND,
		.gpio	= S3C64XX_GPL(10),	/* EINT 18 */
		.type	= EV_KEY,
		.wakeup	= 1,
		.active_low = 1,
	},
	[1] = {
		.code	= SW_FRONT_PROXIMITY,
		.gpio	= S3C64XX_GPN(11),	/* EINT 11 */
		.type	= EV_SW,
	},
};

static struct gpio_keys_platform_data crag6410_gpio_keydata = {
	.buttons	= crag6410_gpio_keys,
	.nbuttons	= ARRAY_SIZE(crag6410_gpio_keys),
};

static struct platform_device crag6410_gpio_keydev = {
	.name		= "gpio-keys",
	.id		= 0,
	.dev.platform_data = &crag6410_gpio_keydata,
};
예제 #30
0
static struct platform_device s3c_device_power_supply = {
	.name = "pda-power",
	.id   = -1,
	.dev  = {
		.platform_data = &power_supply_info,
	},
};

/******************************************************************************
 * keypad
 ******************************************************************************/
static struct gpio_keys_button gpio_buttons[] = {
#if 1

	{
		.gpio		= S3C64XX_GPN(1),
		.code		= 158,
		.desc		= "HOME",
		.active_low	= 1,
		.wakeup		= 0,
	},
	{
		.gpio		= S3C64XX_GPL(8),
		.code		= 102,
		.desc		= "BACK",
		.active_low	= 1,
		.wakeup		= 0,
	},
	{
		.gpio		= S3C64XX_GPN(0),
		.code		= 139,