예제 #1
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;
}
예제 #2
0
/* S5PV210 machine dependent GPIO help function */
int s3c_gpio_slp_cfgpin(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_SLP_PREV)
		return -EINVAL;

	reg = chip->base + 0x10;

	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;
}
예제 #3
0
void s3cfb_cfg_gpio(struct platform_device *pdev)
{
	int i;

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF0(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF0(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF1(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF1(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF2(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF2(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 4; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF3(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF3(i), S3C_GPIO_PULL_NONE);
	}

	/* mDNIe SEL: why we shall write 0x2 ? */
	writel(0x2, S5P_MDNIE_SEL);

	/* drive strength to max */
	writel(0xffffffff, S5P_VA_GPIO + 0x12c);
	writel(0xffffffff, S5P_VA_GPIO + 0x14c);
	writel(0xffffffff, S5P_VA_GPIO + 0x16c);
	writel(0x000000ff, S5P_VA_GPIO + 0x18c);

	s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(1));
	s3c_gpio_cfgpin(S5PV210_GPB(5), S3C_GPIO_SFN(1));
	s3c_gpio_cfgpin(S5PV210_GPB(6), S3C_GPIO_SFN(1));
	s3c_gpio_cfgpin(S5PV210_GPB(7), S3C_GPIO_SFN(1));

	s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_NONE);
	s3c_gpio_setpull(S5PV210_GPB(5), S3C_GPIO_PULL_NONE);
	s3c_gpio_setpull(S5PV210_GPB(6), S3C_GPIO_PULL_NONE);
	s3c_gpio_setpull(S5PV210_GPB(7), S3C_GPIO_PULL_NONE);

	gpio_request(S5PV210_GPH0(5), "GPH0");
	gpio_direction_output(S5PV210_GPH0(5), 1);
}
예제 #4
0
int s3cfb_lcd_off(struct platform_device *pdev)
{
	printk("LCD.....off");
//	gpio_set_value(S5PV210_GPH0(7), 0);
	gpio_set_value(S5PV210_GPH0(7), 1);
	
	return 0;
}
예제 #5
0
static int smdkv210_cam1_power(int onoff)
{
	int err;

	/* Camera B */
	err = gpio_request(S5PV210_GPH0(3), "GPH0");
	if (err)
		printk(KERN_ERR "#### failed to request GPH0 for CAM_2V8\n");

	s3c_gpio_setpull(S5PV210_GPH0(3), S3C_GPIO_PULL_NONE);
	gpio_direction_output(S5PV210_GPH0(3), 0);
	gpio_direction_output(S5PV210_GPH0(3), 1);
	udelay(1000);
	gpio_free(S5PV210_GPH0(3));

	return 0;
}
예제 #6
0
파일: charregister.c 프로젝트: huaweili/esd
static void charregister_exit(void)
{
	dev_t dev_id;
	
	printk("%s: unregister a char device\n", __FUNCTION__);
	gpio_free(S5PV210_GPH0(0));
	dev_id = MKDEV(major, 0);
	cdev_del(&cdev);
	unregister_chrdev_region(dev_id, CHAR_COUNT);
}
예제 #7
0
파일: charregister.c 프로젝트: huaweili/esd
static ssize_t button_read(struct file *file, char __user *buffer, 
								size_t count, loff_t *ppos)
{
	unsigned char key_value;

	key_value = gpio_get_value(S5PV210_GPH0(0));
	if(copy_to_user(buffer, &key_value, sizeof(key_value))){
		printk("%s: read failed.\n", __FUNCTION__);
		return -EFAULT;
	}
	return count;
}
예제 #8
0
int s3cfb_reset_lcd(struct platform_device *pdev)
{
	int err;

	err = gpio_request(S5PV210_GPH0(1), "GPH0");
	if (err) {
		printk(KERN_ERR "failed to request GPH0 for "
			"lcd reset control\n");
		return err;
	}

	gpio_direction_output(S5PV210_GPH0(1), 1);

	gpio_set_value(S5PV210_GPH0(1), 0);

	gpio_set_value(S5PV210_GPH0(1), 1);

	gpio_free(S5PV210_GPH0(1));

	return 0;
}
예제 #9
0
static int smdkv210_cam1_power(int onoff)
{
	int err;

	/* S/W workaround for the SMDK_CAM4_type board
	 * When SMDK_CAM4 type module is initialized at power reset,
	 * it needs the cam_mclk.
	 *
	 * Now cam_mclk is set as below, need only set the gpio mux.
	 * CAM_SRC1 = 0x0006000, CLK_DIV1 = 0x00070400.
	 * cam_mclk source is SCLKMPLL, and divider value is 8.
	*/

	/* gpio mux select the cam_mclk */
	err = gpio_request(S5PV210_GPJ1(4), "GPJ1");
	if (err)
		printk(KERN_ERR "#### failed to request GPJ1 for CAM_2V8\n");

	s3c_gpio_setpull(S5PV210_GPJ1(4), S3C_GPIO_PULL_NONE);
	s3c_gpio_cfgpin(S5PV210_GPJ1(4), (0x3<<16));


	/* Camera B */
	err = gpio_request(S5PV210_GPH0(3), "GPH0");
	if (err)
		printk(KERN_ERR "#### failed to request GPH0 for CAM_2V8\n");

	s3c_gpio_setpull(S5PV210_GPH0(3), S3C_GPIO_PULL_NONE);
	gpio_direction_output(S5PV210_GPH0(3), 0);
	gpio_direction_output(S5PV210_GPH0(3), 1);

	udelay(1000);

	gpio_free(S5PV210_GPJ1(4));
	gpio_free(S5PV210_GPH0(3));

	return 0;
}
예제 #10
0
파일: charregister.c 프로젝트: huaweili/esd
static int charregister_init(void)
{
	int retval;
	dev_t dev_id;

	printk("%s: register a char device\n", __FUNCTION__);
	if (major) {
		dev_id = MKDEV(major, 0);
		retval = register_chrdev_region(dev_id, CHAR_COUNT, CHAR_NAME);
	} else {
		retval = alloc_chrdev_region(&dev_id, CHAR_BASEMINOR, 
										CHAR_COUNT, CHAR_NAME);
		major = MAJOR(dev_id);
		printk("%s: major = %d\n", __FUNCTION__, major);
	}

	if (retval) {
		printk("%s: Cannot register a char device\n", __FUNCTION__);
		goto failure_register_char;
	}

	cdev_init(&cdev, &button_fops);
	retval = cdev_add(&cdev, dev_id, CHAR_COUNT);
	if (retval < 0) {
		printk("%s: add cdev failed.\n", __FUNCTION__);
		goto failure_add_cdev;
	}

	retval = gpio_request(S5PV210_GPH0(0), "BUTTON");
	if(retval) {
		printk("%s: request gpio for button failed.\n", __FUNCTION__);
		goto failure_request_gpio;
	}
	return 0;
failure_request_gpio:
	cdev_del(&cdev);
failure_add_cdev:
	unregister_chrdev_region(dev_id, CHAR_COUNT);
failure_register_char:
	return retval;
}
예제 #11
0
/* 3.5 pie jack detection DAPM pins */
static struct snd_soc_jack_pin jack_pins[] = {
	{
		.pin = "Headset Mic",
		.mask = SND_JACK_MICROPHONE,
	}, {
		.pin = "Headset Stereophone",
		.mask = SND_JACK_HEADPHONE | SND_JACK_MECHANICAL |
			SND_JACK_AVOUT,
	},
};

/* 3.5 pie jack detection gpios */
static struct snd_soc_jack_gpio jack_gpios[] = {
	{
		.gpio = S5PV210_GPH0(6),
		.name = "DET_3.5",
		.report = SND_JACK_HEADSET | SND_JACK_MECHANICAL |
			SND_JACK_AVOUT,
		.debounce_time = 200,
	},
};

static const struct snd_soc_dapm_widget goni_dapm_widgets[] = {
	SND_SOC_DAPM_SPK("Ext Left Spk", NULL),
	SND_SOC_DAPM_SPK("Ext Right Spk", NULL),
	SND_SOC_DAPM_SPK("Ext Rcv", NULL),
	SND_SOC_DAPM_HP("Headset Stereophone", NULL),
	SND_SOC_DAPM_MIC("Headset Mic", NULL),
	SND_SOC_DAPM_MIC("Main Mic", NULL),
	SND_SOC_DAPM_MIC("2nd Mic", NULL),
예제 #12
0
파일: mach-goni.c 프로젝트: 5victor/linux
	{ MAX8998_LDO12, &goni_ldo12_data },
	{ MAX8998_LDO13, &goni_ldo13_data },
	{ MAX8998_LDO14, &goni_ldo14_data },
	{ MAX8998_LDO15, &goni_ldo15_data },
	{ MAX8998_LDO16, &goni_ldo16_data },
	{ MAX8998_LDO17, &goni_ldo17_data },
	{ MAX8998_BUCK1, &goni_buck1_data },
	{ MAX8998_BUCK2, &goni_buck2_data },
	{ MAX8998_BUCK3, &goni_buck3_data },
	{ MAX8998_BUCK4, &goni_buck4_data },
};

static struct max8998_platform_data goni_max8998_pdata = {
	.num_regulators	= ARRAY_SIZE(goni_regulators),
	.regulators	= goni_regulators,
	.buck1_set1	= S5PV210_GPH0(3),
	.buck1_set2	= S5PV210_GPH0(4),
	.buck2_set3	= S5PV210_GPH0(5),
	.buck1_voltage1	= 1200000,
	.buck1_voltage2	= 1200000,
	.buck1_voltage3	= 1200000,
	.buck1_voltage4	= 1200000,
	.buck2_voltage1	= 1200000,
	.buck2_voltage2	= 1200000,
};
#endif

static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
	REGULATOR_SUPPLY("DBVDD", "5-001a"),
	REGULATOR_SUPPLY("AVDD2", "5-001a"),
	REGULATOR_SUPPLY("CPVDD", "5-001a"),
예제 #13
0
파일: charregister.c 프로젝트: huaweili/esd
static int button_close(struct inode *inode, struct file *file)
{
	printk("%s\n", __FUNCTION__);
	gpio_direction_output(S5PV210_GPH0(0), 0);
	return 0;
}
	.pwm_period_ns	= 2500000,
	.init		= smdkv210_backlight_init,
	.exit		= smdkv210_backlight_exit,
};

static struct platform_device smdkv210_backlight_device = {
	.name		= "pwm-backlight",
	.dev		= {
		.parent		= &s3c_device_timer[3].dev,
		.platform_data	= &smdkv210_backlight_data,
	},
};
static struct gpio_keys_button origen_gpio_keys_table[] = {
        {
                .code = KEY_MENU,
                .gpio = S5PV210_GPH0(4),
                .desc = "gpio-keys: KEY_MENU",
                .type = EV_KEY,
                .active_low = 1,
                .wakeup = 1,
                .debounce_interval = 1,
        },
#if 1
        {
                .code = 26,
                .gpio = S5PV210_GPH3(7),
                .desc = "gpio-keys: KEY_MENU",
                .type = EV_KEY,
                .active_low = 1,
                .wakeup = 1,
                .debounce_interval = 1,
예제 #15
0
static void setup_sdhci0_gpio_wp(void)
{
	s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_INPUT);
	s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_DOWN);
}
예제 #16
0
#endif

#ifdef CONFIG_S5PV210_ADC
static struct s3c_adc_mach_info s3c_adc_platform __initdata = {
	/* s5pc100 supports 12-bit resolution */
	.delay  = 10000,
	.presc  = 49,
	.resolution = 12,
};
#endif

#ifdef CONFIG_KEYBOARD_MANGO
static struct mango_keys_button mango_gpio_keys_table[] = {
	{
		.code			= KEY_BACK,
		.gpio			= S5PV210_GPH0(1),
		.active_low		= 1,
		.desc			= "GPH0",
		.type			= EV_KEY,
		.wakeup			= 1,
//		.debounce_interval	= 5,
		.irq			= IRQ_EINT1,
		.config			= (0xf << 4),
		.pull			= S3C_GPIO_PULL_NONE,
		.active_low		= 1,
		.led_gpio		= S5PV210_GPJ3(7),
		.led_desc		= "GPJ3",
		.led_config		= (0x1 << (4 * 7)),
		.led_active_low		= 1,
	},
	{
예제 #17
0
		.hwport		= 3,
		.flags		= 0,
		.ucon		= SMDKC110_UCON_DEFAULT,
		.ulcon		= SMDKC110_ULCON_DEFAULT,
		.ufcon		= SMDKC110_UFCON_DEFAULT,
	},
};

static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
	.setup_gpio	= s5pv210_ide_setup_gpio,
};

#ifdef CONFIG_S3C_DEV_HSMMC
static struct s3c_sdhci_platdata smdkc110_hsmmc0_pdata __initdata = {
	.cd_type		= S3C_SDHCI_CD_INTERNAL,
	.wp_gpio		= S5PV210_GPH0(7),
	.has_wp_gpio		= true,
#if defined(CONFIG_S5PV210_SD_CH0_8BIT)
	.max_width		= 8,
	.host_caps		= MMC_CAP_8_BIT_DATA,
#endif
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
static struct s3c_sdhci_platdata smdkc110_hsmmc1_pdata __initdata = {
	.cd_type		= S3C_SDHCI_CD_INTERNAL,
	.has_wp_gpio		= false,
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
static struct s3c_sdhci_platdata smdkc110_hsmmc2_pdata __initdata = {
예제 #18
0
	.leds = leds,
};

static struct platform_device tq210_leds = {
	.name = "leds-gpio",
	.dev = {
		.platform_data = &tq210_leds_pdata,
	},
	.id		= -1,
};

/* gpio keys (add by zjh) */
static struct gpio_keys_button buttons[] = {
	[0] = {
		.code = KEY_UP,
		.gpio = S5PV210_GPH0(0),
		.active_low = 1,
		.desc = "up",
		.type = EV_KEY,
		.debounce_interval = 50,
	},
	[1] = {
		.code = KEY_DOWN,
		.gpio = S5PV210_GPH0(1),
		.active_low = 1,
		.desc = "up",
		.type = EV_KEY,
		.debounce_interval = 50,
	},
	[2] = {
		.code = KEY_LEFT,
예제 #19
0
#include <linux/cdev.h>
#include <linux/delay.h>

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


#define DEVICE_NAME "leds"

static int led_gpios[] = {
	S5PV210_GPB(0),
	S5PV210_GPB(2),
	S5PV210_GPB(1),
	S5PV210_GPB(3),
	S5PV210_GPH0(7),
	S5PV210_GPH0(5),
};

#define LED_NUM		ARRAY_SIZE(led_gpios)


static long gzsd210_leds_ioctl(struct file *filp, unsigned int cmd,
		unsigned long arg)
{
	switch(cmd) {
		case 0:
		case 1:
			if (arg > LED_NUM) {
				return -EINVAL;
			}
예제 #20
0
			.ngpio	= S5PV210_GPIO_G2_NR,
			.label	= "GPG2",
		},
	}, {
		.base	= S5PV210_GPG3_BASE,
		.config	= &gpio_cfg,
		.chip	= {
			.base	= S5PV210_GPG3(0),
			.ngpio	= S5PV210_GPIO_G3_NR,
			.label	= "GPG3",
		},
	}, {
		.base	= S5PV210_GPH0_BASE,
		.config	= &gpio_cfg_noint,
		.chip	= {
			.base	= S5PV210_GPH0(0),
			.ngpio	= S5PV210_GPIO_H0_NR,
			.label	= "GPH0",
		},
	}, {
		.base	= S5PV210_GPH1_BASE,
		.config	= &gpio_cfg_noint,
		.chip	= {
			.base	= S5PV210_GPH1(0),
			.ngpio	= S5PV210_GPIO_H1_NR,
			.label	= "GPH1",
		},
	}, {
		.base	= S5PV210_GPH2_BASE,
		.config	= &gpio_cfg_noint,
		.chip	= {
예제 #21
0
static struct max8698_platform_data smdkv210_max8698_pdata = {
	.num_regulators = ARRAY_SIZE(smdkv210_regulators),
	.regulators     = smdkv210_regulators,

	/* 1GHz default voltage */
	.dvsarm1        = 0xa,  /* 1.25v */
	.dvsarm2        = 0x9,  /* 1.20V */
	.dvsarm3        = 0x6,  /* 1.05V */
	.dvsarm4        = 0x4,  /* 0.95V */
	.dvsint1        = 0x7,  /* 1.10v */
	.dvsint2        = 0x5,  /* 1.00V */

	.set1       = S5PV210_GPH1(6),
	.set2       = S5PV210_GPH1(7),
	.set3       = S5PV210_GPH0(4),
};
#endif
static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
	.setup_gpio	= s5pv210_ide_setup_gpio,
};

static uint32_t smdkv210_keymap[] __initdata = {
	/* KEY(row, col, keycode) */
	KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
	KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
	KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
	KEY(1, 6, KEY_D), KEY(1, 7, KEY_E), KEY(7, 1, KEY_LEFTBRACE) 
};

static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
예제 #22
0
};

static struct max8698_platform_data smdkv210_max8698_pdata = {
	.num_regulators = ARRAY_SIZE(smdkv210_regulators),
	.regulators     = smdkv210_regulators,

	/* 1GHz default voltage */
	.dvsarm1        = 0xa,  /* 1.25v */
	.dvsarm2        = 0x9,  /* 1.20V */
	.dvsarm3        = 0x6,  /* 1.05V */
	.dvsarm4        = 0x4,  /* 0.95V */
	.dvsint1        = 0x7,  /* 1.10v */
	.dvsint2        = 0x5,  /* 1.00V */
	.set1       = S5PV210_GPH1(6),
	.set2       = S5PV210_GPH1(7),
	.set3       = S5PV210_GPH0(4),
};
#endif

static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
	.setup_gpio	= s5pv210_ide_setup_gpio,
};

static uint32_t smdkv210_keymap[] __initdata = {
	/* KEY(row, col, keycode) */
	KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
	KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
	KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
	KEY(1, 6, KEY_D), KEY(1, 7, KEY_E), KEY(7, 1, KEY_LEFTBRACE)
};
예제 #23
0
#include <plat/gpio-cfg.h>
#include <mach/utv210-cfg.h>

#define DRIVER_NAME             "utv210-battery"
#define DRIVER_ADC_CHANNEL      0
#define POLL_INTERVAL_IN_SECS   10
#define NUMBER_OF_SAMPLES       16

// namko: To prevent rapidly-varying/spurious battery percentages the
// ADC's value should be integrated over an interval of time. Currently
// this is set to a minute and appears to provide reasonable data.
#define NUMBER_OF_VALUES_AVG    25

// NOTE battery-full is valid only when AC is connected!
static const int nGPIO_AC_Connected = S5PV210_GPH3(6);
static const int nGPIO_Battery_Full = S5PV210_GPH0(2);

static struct wake_lock vbus_wake_lock;
static struct device *dev;
static int utv210_battery_initial;

/* Prototypes */
extern int s3c_adc_get_adc_data(int channel);

static ssize_t utv210_bat_show_property(struct device *dev,
                                       struct device_attribute *attr,
                                       char *buf);

static ssize_t utv210_bat_store(struct device *dev, 
                                struct device_attribute *attr,
                                const char *buf, size_t count);