static int lcd_power_on(struct lcd_device *ld, int enable)
{
	struct regulator *regulator_1_8;
	struct regulator *regulator_2_8;

	regulator_1_8 = regulator_get(NULL, "vcc_1.8v_lcd");
	regulator_2_8 = regulator_get(NULL, "vcc_2.8v_lcd");

	if (IS_ERR(regulator_1_8))
		printk(KERN_ERR "LCD_1_8: Fail to get regulator!\n");
	if (IS_ERR(regulator_2_8))
		printk(KERN_ERR "LCD_2.8: Fail to get regulator!\n");

	if (enable) {
		/*panel power enable*/
		regulator_enable(regulator_2_8);
		usleep_range(5000, 8000);
		regulator_enable(regulator_1_8);
	} else {
		/*lcd 1.8V disable*/
		if (regulator_is_enabled(regulator_1_8))
				regulator_disable(regulator_1_8);
		if (regulator_is_enabled(regulator_2_8))
				regulator_disable(regulator_2_8);

		/*LCD RESET low*/
		gpio_request_one(EXYNOS5410_GPJ1(0),
				GPIOF_OUT_INIT_LOW, "GPIO_MLCD_RST");
		gpio_free(EXYNOS5410_GPJ1(0));
	}
	regulator_put(regulator_1_8);
	regulator_put(regulator_2_8);

	return 0;
}
static void mipi_lcd_power_control(struct s5p_platform_mipi_dsim *dsim,
				unsigned int power)
{
	struct regulator *regulator;

	regulator = regulator_get(NULL, "touch_1.8v_s");

	if (IS_ERR(regulator))
		printk(KERN_ERR "LCD: Fail to get regulator!\n");

	if (power) {
		/*mipi 1.8v enable*/
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_HIGH, "GPIO_MIPI_18V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));

		/*lcd 1.8V enable*/
		regulator_enable(regulator);
		usleep_range(2000, 3000);

		/*AVDD enable*/
		gpio_request_one(EXYNOS5410_GPJ2(0),
				GPIOF_OUT_INIT_HIGH, "GPIO_LCD_22V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ2(0));
		usleep_range(2000, 3000);

		/*LCD RESET high*/
		gpio_request_one(EXYNOS5410_GPJ1(0),
		GPIOF_OUT_INIT_HIGH, "GPIO_MLCD_RST");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ1(0));
		usleep_range(7000, 8000);
	} else {
		/*LCD RESET low*/
		gpio_request_one(EXYNOS5410_GPJ1(0),
				GPIOF_OUT_INIT_LOW, "GPIO_MLCD_RST");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ1(0));

		/*AVDD disable*/
		gpio_request_one(EXYNOS5410_GPJ2(0),
				GPIOF_OUT_INIT_LOW, "GPIO_LCD_22V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ2(0));

		/*lcd 1.8V disable*/
		if (regulator_is_enabled(regulator))
				regulator_disable(regulator);

		/*mipi 1.8v disable*/
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_LOW, "GPIO_MIPI_18V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));
	}
	regulator_put(regulator);
}
static int reset_lcd(struct lcd_device *ld)
{
	/*LCD RESET high*/
	gpio_request_one(EXYNOS5410_GPJ1(0),
	GPIOF_OUT_INIT_HIGH, "GPIO_MLCD_RST");
	usleep_range(5000, 6000);
	gpio_set_value(EXYNOS5410_GPJ1(0), 0);
	usleep_range(5000, 6000);
	gpio_set_value(EXYNOS5410_GPJ1(0), 1);
	gpio_free(EXYNOS5410_GPJ1(0));

	usleep_range(12000, 12000);

	return 0;
}
void __init exynos5_universal5410_audio_init(void)
{
	int ret;

	exynos5_audio_init();
	universal5410_audio_gpio_init();

#ifdef CONFIG_SND_SOC_WM1811
	exynos5_hs_i2c0_set_platdata(&hs_i2c_data_audio);
	ret = i2c_register_board_info(4, i2c_devs_audio, ARRAY_SIZE(i2c_devs_audio));
#endif

#ifdef CONFIG_SND_SOC_WM5102
	s3c_gpio_cfgpin(EXYNOS5410_GPJ1(4), S3C_GPIO_SFN(0xf));
	s3c_gpio_setpull(EXYNOS5410_GPJ1(4), S3C_GPIO_PULL_NONE);

#ifdef MODE_WM5102_SPI
	ret = exynos_spi_cfg_cs(spi_audio_csi[0].line, 2);
	if (!ret) {
		s3c64xx_spi2_set_platdata(&s3c64xx_spi2_pdata,
			EXYNOS_SPI_SRCCLK_SCLK, ARRAY_SIZE(spi_audio_csi));
	} else
		pr_err(KERN_ERR "Error requesting gpio for SPI-CH2 CS\n");
#endif

#if defined(MODE_WM5102_SPI) || defined(MODE_WM5102_SPI_EMUL)
	ret = spi_register_board_info(spi_board_info,
						ARRAY_SIZE(spi_board_info));
	if (ret)
		pr_err("ERR! spi_register_board_info fail (err %d)\n", ret);
#endif

#ifdef MODE_WM5102_I2C_EMUL
	//i2c_devs12_emul[0].irq = gpio_to_irq(EXYNOS5410_GPJ1(4));
	platform_device_register(&s3c_device_i2c12);
	ret = i2c_register_board_info(12, i2c_devs12_emul,
				ARRAY_SIZE(i2c_devs12_emul));
#endif
#endif

	platform_add_devices(universal5410_audio_devices,
			ARRAY_SIZE(universal5410_audio_devices));

	exynos5_universal5410_2mic_init();
}
static void mipi_lcd_set_power(struct plat_lcd_data *pd,
				unsigned int power)
{
	/* reset */
	if (power) {
		gpio_request_one(GPIO_MLCD_RST,
				GPIOF_OUT_INIT_HIGH, "GPJ1");
		usleep_range(5000, 6000);
		gpio_set_value(EXYNOS5410_GPJ1(0), 0);
		usleep_range(5000, 6000);
		gpio_set_value(EXYNOS5410_GPJ1(0), 1);
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ1(0));
	} else {
		gpio_request_one(EXYNOS5410_GPJ1(0),
				GPIOF_OUT_INIT_LOW, "GPJ1");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ1(0));
	}

	/* enable VCC_2.2V_LCD */
	if (power) {
		gpio_request_one(EXYNOS5410_GPJ2(0),
				GPIOF_OUT_INIT_HIGH, "GPJ2");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ2(0));
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_HIGH, "GPF1");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));
	} else {
		gpio_request_one(EXYNOS5410_GPJ2(0),
				GPIOF_OUT_INIT_LOW, "GPJ2");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ2(0));
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_LOW, "GPF1");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));
	}
}
static void mipi_lcd_set_power(struct plat_lcd_data *pd,
				unsigned int power)
{
	struct regulator *regulator_1_8;
	struct regulator *regulator_2_8;

	regulator_1_8 = regulator_get(NULL, "vcc_1.8v_lcd");
	regulator_2_8 = regulator_get(NULL, "vcc_2.8v_lcd");

	if (IS_ERR(regulator_1_8))
		printk(KERN_ERR "LCD_1_8: Fail to get regulator!\n");
	if (IS_ERR(regulator_2_8))
		printk(KERN_ERR "LCD_2.8: Fail to get regulator!\n");

	if (power) {
		/*mipi 1.8v enable*/
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_HIGH, "GPIO_MIPI_18V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));

		/*panel power enable*/
		regulator_enable(regulator_2_8);

		usleep_range(5000, 8000);
		regulator_enable(regulator_1_8);
		msleep(25);

		/*LCD RESET high*/
		gpio_request_one(EXYNOS5410_GPJ1(0),
		GPIOF_OUT_INIT_HIGH, "GPIO_MLCD_RST");
		usleep_range(5000, 6000);
		gpio_set_value(EXYNOS5410_GPJ1(0), 0);
		usleep_range(5000, 6000);
		gpio_set_value(EXYNOS5410_GPJ1(0), 1);
		gpio_free(EXYNOS5410_GPJ1(0));
		usleep_range(7000, 8000);
	} else {
		/*LCD RESET low*/
		gpio_request_one(EXYNOS5410_GPJ1(0),
				GPIOF_OUT_INIT_LOW, "GPIO_MLCD_RST");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPJ1(0));

		/*lcd 1.8V disable*/
		if (regulator_is_enabled(regulator_1_8))
				regulator_disable(regulator_1_8);
		if (regulator_is_enabled(regulator_2_8))
				regulator_disable(regulator_2_8);

		/*mipi 1.8v disable*/
		gpio_request_one(EXYNOS5410_GPF1(6),
				GPIOF_OUT_INIT_LOW, "GPIO_MIPI_18V_EN");
		usleep_range(5000, 6000);
		gpio_free(EXYNOS5410_GPF1(6));
	}
	regulator_put(regulator_1_8);
	regulator_put(regulator_2_8);

}
#endif

static struct arizona_micd_config wm5102_micd[] = {
	{ 0,                  1 << ARIZONA_MICD_BIAS_SRC_SHIFT, 0 },
};

static const struct arizona_micd_range adonisuniv_micd_ranges[] = {
	{ .max =  139, .key = KEY_MEDIA },
	{ .max =  295, .key = KEY_VOLUMEUP },
	{ .max =  752, .key = KEY_VOLUMEDOWN },
	{ .max = 1257, .key = KEY_ESC },
};

static struct arizona_pdata arizona_platform_data = {
	.reset = EXYNOS5410_GPJ2(1),
	.ldoena = EXYNOS5410_GPJ1(5),
	.irq_base = IRQ_BOARD_AUDIO_START,
	.irq_flags = IRQF_TRIGGER_HIGH,
	.micd_configs = wm5102_micd,
	.num_micd_configs = ARRAY_SIZE(wm5102_micd),
	.micd_force_micbias = true,
/*
	.micd_level = {0x3f3f, 0x3f3f, 0x3b3f, 0x2832},
*/
	.micd_ranges = adonisuniv_micd_ranges,
	.num_micd_ranges = ARRAY_SIZE(adonisuniv_micd_ranges),
	.micd_bias_start_time = 0x7,
	.micd_rate = 0x7,
	.micd_dbtime = 0x1,
	.micd_timeout = 300,
	.micbias = {
Ejemplo n.º 8
0
static void vienna_audio_gpio_init(void)
{
	int err;

	if (system_rev < 0x2) {
		/* codec spi_mode */
		err = gpio_request(EXYNOS5410_GPB2(1), "CODEC_SPIMODE");
		if (err) {
			pr_err(KERN_ERR "GPIO_CODEC_SPI_MODE GPIO set error!\n");
			return;
		}
		gpio_direction_output(EXYNOS5410_GPB2(1), 1);
		gpio_set_value(EXYNOS5410_GPB2(1), 0); /* codec spi_mode 0, 3 */
		gpio_free(EXYNOS5410_GPB2(1));
	}

	/* Interrupt from codec jack detection */
	err = gpio_request(EXYNOS5410_GPX2(5), "EAR_SEND_END");
	if (err) {
		pr_err(KERN_ERR "EAR_SEND_END GPIO set error!\n");
		return;
	}
	s3c_gpio_setpull(EXYNOS5410_GPX2(5), S3C_GPIO_PULL_NONE);
	s5p_register_gpio_interrupt(EXYNOS5410_GPX2(5));
	gpio_direction_input(EXYNOS5410_GPX2(5));
	s3c_gpio_cfgpin(EXYNOS5410_GPX2(5), S3C_GPIO_SFN(0xf));

#ifdef CONFIG_SND_USE_YMU831_LDODE_GPIO
	err = gpio_request(GPIO_YMU_LDO_EN, "YMU_LDO_EN");
	if (err) {
		pr_err(KERN_ERR "YMU_LDO_EN GPIO set error!\n");
		return;
	}
	gpio_direction_output(GPIO_YMU_LDO_EN, 1);
	gpio_set_value(GPIO_YMU_LDO_EN, 0);
	gpio_free(GPIO_YMU_LDO_EN);
#endif

	/* Main Microphone BIAS */
	err = gpio_request(EXYNOS5410_GPJ1(2), "MICBIAS");
	if (err) {
		pr_err(KERN_ERR "MICBIAS_EN GPIO set error!\n");
		return;
	}
	gpio_direction_output(EXYNOS5410_GPJ1(2), 1);
	gpio_set_value(EXYNOS5410_GPJ1(2), 0);
	gpio_free(EXYNOS5410_GPJ1(2));

	err = gpio_request(EXYNOS5410_GPJ0(1), "SPK_EN");
	if (err) {
		pr_err(KERN_ERR "SPK_EN GPIO set error!\n");
		return;
	}
	gpio_direction_output(EXYNOS5410_GPJ0(1), 1);
	gpio_set_value(EXYNOS5410_GPJ0(1), 1);
	gpio_free(EXYNOS5410_GPJ0(1));

	err = gpio_request(EXYNOS5410_GPK0(7), "LINEOUT_ON");
	if (err) {
		pr_err(KERN_ERR "LINEOUT_ON GPIO set error!\n");
		return;
	}
	gpio_direction_output(EXYNOS5410_GPK0(7), 1);
	gpio_set_value(EXYNOS5410_GPK0(7), 1);
	gpio_free(EXYNOS5410_GPK0(7));
}
Ejemplo n.º 9
0
static void ymu831_set_micbias(int en)
{
	gpio_set_value(EXYNOS5410_GPJ1(2), en);
}