コード例 #1
0
ファイル: sample-board.c プロジェクト: greendrm/pb206x-i2c
static int gpio_configure(void) {
	int ret;

	printk("%s()\n", __func__);
	ret = gpio_request(S5PC1XX_GPH1(1), "GPH1");
	if (ret) {
		printk("%s: gpio(GPH1(2) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPH1(1), S5PC1XX_GPH1_2_WAKEUP_INT_10);
		s3c_gpio_setpull(S5PC1XX_GPH1(1), S3C_GPIO_PULL_NONE);
	}
	
	ret = gpio_request(S5PC1XX_GPH3(7), "GPH3");
	if (ret) {
		printk("%s: gpio(GPH3(7) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPH3(7), S5PC1XX_GPH3_7_WAKEUP_INT_31);
		s3c_gpio_setpull(S5PC1XX_GPH3(7), S3C_GPIO_PULL_NONE);
	}

	ret = gpio_request(S5PC1XX_GPG1(0), "GPG1");
	if (ret) {
		printk("%s: gpio(GPG1(0) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPG1(0), S5PC1XX_GPG1_0_GPIO_INT12_0);
		s3c_gpio_setpull(S5PC1XX_GPG1(0), S3C_GPIO_PULL_NONE);
	}
	
	ret = gpio_request(S5PC1XX_GPA1(1), "GPA1");
	if (ret) {
		printk("%s: gpio(GPA1(1) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPA1(1), S5PC1XX_GPA1_1_GPIO_INT1_1);
		s3c_gpio_setpull(S5PC1XX_GPA1(1), S3C_GPIO_PULL_NONE);
	}

	ret = gpio_request(S5PC1XX_GPA1(0), "GPA1");
	if (ret) {
		printk("%s: gpio(GPA1(0) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPA1(0), S5PC1XX_GPA1_0_GPIO_INT1_0);
		s3c_gpio_setpull(S5PC1XX_GPA1(0), S3C_GPIO_PULL_NONE);
	}

	ret = gpio_request(S5PC1XX_GPB(0), "GPB0");
	if (ret) {
		printk("%s: gpio(GPB0(0) request error: %d\n", __func__, ret);
	}
	else {
		s3c_gpio_cfgpin(S5PC1XX_GPB(0), S5PC1XX_GPB0_GPIO_INT2_0);
		s3c_gpio_setpull(S5PC1XX_GPB(0), S3C_GPIO_PULL_NONE);
	}

	return 0;
}
コード例 #2
0
ファイル: setup-fb.c プロジェクト: wrjght/kernel-for-odroid
int s3cfb_reset_lcd(struct platform_device *pdev)
{
	int err;

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

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

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

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

	gpio_free(S5PC1XX_GPB(4));

	return 0;
}
コード例 #3
0
ファイル: dev-spi.c プロジェクト: wrjght/kernel-for-odroid
/* Since we emulate multi-cs capability, we do not touch the GPC-3,7.
 * The emulated CS is toggled by board specific mechanism, as it can
 * be either some immediate GPIO or some signal out of some other
 * chip in between ... or some yet another way.
 * We simply do not assume anything about CS.
 */
static int s5pc1xx_spi_cfg_gpio(struct platform_device *pdev)
{
	switch (pdev->id) {
	case 0:
		s3c_gpio_cfgpin(S5PC1XX_GPB(0), S5PC1XX_GPB0_SPI_MISO0);
		s3c_gpio_cfgpin(S5PC1XX_GPB(1), S5PC1XX_GPB1_SPI_CLK0);
		s3c_gpio_cfgpin(S5PC1XX_GPB(2), S5PC1XX_GPB2_SPI_MOSI0);
		s3c_gpio_setpull(S5PC1XX_GPB(0), S3C_GPIO_PULL_UP);
		s3c_gpio_setpull(S5PC1XX_GPB(1), S3C_GPIO_PULL_UP);
		s3c_gpio_setpull(S5PC1XX_GPB(2), S3C_GPIO_PULL_UP);
		break;

	case 1:
#if defined(CONFIG_MACH_HKDKC100)
		s3c_gpio_cfgpin(S5PC1XX_GPB(4), S5PC1XX_GPB4_SPI_MISO1);
#endif
		s3c_gpio_cfgpin(S5PC1XX_GPB(5), S5PC1XX_GPB5_SPI_CLK1);
		s3c_gpio_cfgpin(S5PC1XX_GPB(6), S5PC1XX_GPB6_SPI_MOSI1);
#if defined(CONFIG_MACH_HKDKC100)
		s3c_gpio_setpull(S5PC1XX_GPB(4), S3C_GPIO_PULL_UP);
#endif
		s3c_gpio_setpull(S5PC1XX_GPB(5), S3C_GPIO_PULL_UP);
		s3c_gpio_setpull(S5PC1XX_GPB(6), S3C_GPIO_PULL_UP);
		break;

	case 2:
		s3c_gpio_cfgpin(S5PC1XX_GPG3(0), S5PC1XX_GPG3_0_SPI_CLK2);
		s3c_gpio_cfgpin(S5PC1XX_GPG3(2), S5PC1XX_GPG3_2_SPI_MISO2);
		s3c_gpio_cfgpin(S5PC1XX_GPG3(3), S5PC1XX_GPG3_3_SPI_MOSI2);
		s3c_gpio_setpull(S5PC1XX_GPG3(0), S3C_GPIO_PULL_UP);
		s3c_gpio_setpull(S5PC1XX_GPG3(2), S3C_GPIO_PULL_UP);
		s3c_gpio_setpull(S5PC1XX_GPG3(3), S3C_GPIO_PULL_UP);
		break;

	default:
		dev_err(&pdev->dev, "Invalid SPI Controller number!");
		return -EINVAL;
	}

	return 0;
}