static void lcd_gpio_cfg(int onoff)
{
	if (onoff) {
		lcd_gpio_setup(EXYNOS4_GPF0(0), 8, S3C_GPIO_SFN(2), S5P_GPIO_DRVSTR_LV2);
		lcd_gpio_setup(EXYNOS4_GPF1(0), 8, S3C_GPIO_SFN(2), S5P_GPIO_DRVSTR_LV2);
		lcd_gpio_setup(EXYNOS4_GPF2(0), 8, S3C_GPIO_SFN(2), S5P_GPIO_DRVSTR_LV2);
		lcd_gpio_setup(EXYNOS4_GPF3(0), 4, S3C_GPIO_SFN(2), S5P_GPIO_DRVSTR_LV2);
	}
	else {
		s3c_gpio_cfgall_range(EXYNOS4_GPF0(0), 8, S3C_GPIO_INPUT, S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgall_range(EXYNOS4_GPF1(0), 8, S3C_GPIO_INPUT, S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgall_range(EXYNOS4_GPF2(0), 8, S3C_GPIO_INPUT, S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgall_range(EXYNOS4_GPF3(0), 4, S3C_GPIO_INPUT, S3C_GPIO_PULL_DOWN);
	}
}
Пример #2
0
static int lcd_reset(int on)
{
	int rc;

	if (!gpio_lcd_reset) {
		rc = lcd_gpio_setup(1);
		if (rc) {
			pr_err("gpio setup failed , rc=%d\n", rc);
			return -EINVAL;
		}
	}

	if (on) {
		gpio_set_value_cansleep(gpio_lcd_reset, 0);
		gpio_set_value_cansleep(gpio_lcd_reset, 1);
	} else {
		gpio_set_value_cansleep(gpio_lcd_reset, 1);
		gpio_set_value_cansleep(gpio_lcd_reset, 0);
	}
	msleep(LCD_RESET_WAIT_MS);

	return 0;
}
Пример #3
0
static int s6d6aa0_vreg_power(int on)
{
	int rc = 0;

	if (!vreg_lcd_vddio) {
		vreg_lcd_vddio = regulator_get(&msm_mipi_dsi1_device.dev,
			"dsi_vddio");
		if (IS_ERR(vreg_lcd_vddio)) {
			pr_err("%s: Unable to get 8921_l29\n", __func__);
			vreg_lcd_vddio = NULL;
			return -ENODEV;
		}
	}

	if (on) {
		rc = regulator_set_voltage(vreg_lcd_vddio, 1800000, 1800000);
		if (rc) {
			pr_err("%s:%d unable to set L29 voltage to 1.8V\n",
				__func__, rc);
			goto out_put;
		}

		rc = regulator_enable(vreg_lcd_vddio);
		if (rc) {
			pr_err("%s: Enable regulator 8921_l29 failed\n",
				__func__);
			goto out_put;
		}

		rc = lcd_gpio_setup(on);
		if (rc) {
			pr_err("gpio setup failed , rc=%d\n", rc);
			goto out_desable;
		}
		gpio_set_value(LCD_PWR_EN, 1);

		msleep(LCD_POWER_WAIT_MS);

		lcd_reset(on);
	} else {
		lcd_reset(on);

		gpio_set_value(LCD_PWR_EN, 0);
		rc = lcd_gpio_setup(on);
		if (rc) {
			pr_err("gpio setup failed , rc=%d\n", rc);
			return -EINVAL;
		}

		rc = regulator_disable(vreg_lcd_vddio);
		if (rc)
			pr_warning("%s: '%s' regulator disable failed, rc=%d\n",
				__func__, "8921_l29", rc);
		msleep(LCD_POWER_WAIT_MS);
	}

	return 0;
out_desable:
	regulator_disable(vreg_lcd_vddio);
out_put:
	regulator_put(vreg_lcd_vddio);
	vreg_lcd_vddio = NULL;
	return rc;
}
Пример #4
0
static int r63306_vreg_power(int on)
{
	int rc = 0;

	if (!vreg_lcd_vci) {
		vreg_lcd_vci = regulator_get(&msm_mipi_dsi1_device.dev,
			"dsi_vci");
		if (IS_ERR(vreg_lcd_vci)) {
			pr_err("could not get dsi_vci, rc = %ld\n",
				PTR_ERR(vreg_lcd_vci));
			return -ENODEV;
		}
	}

	if (!vreg_lcd_vddio) {
		vreg_lcd_vddio = regulator_get(&msm_mipi_dsi1_device.dev,
			"dsi_vddio");
		if (IS_ERR(vreg_lcd_vddio)) {
			pr_err("%s: Unable to get dsi_vddio\n", __func__);
			vreg_lcd_vddio = NULL;
			goto out_put;
		}
	}

	if (on) {
		rc = regulator_set_voltage(vreg_lcd_vci, 2850000, 2850000);
		if (rc) {
			pr_err("%s:%d unable to set dsi_vci voltage to 2.8V\n",
				__func__, rc);
			goto out_put_all;
		}

		rc = regulator_enable(vreg_lcd_vci);
		if (rc) {
			pr_err("%s: Enable regulator dsi_vci failed\n",
				__func__);
			goto out_put_all;
		}

		rc = regulator_set_voltage(vreg_lcd_vddio, 1800000, 1800000);
		if (rc) {
			pr_err("%s:%d unable to set dsi_vddio voltage to 1.8V\n",
				__func__, rc);
			goto out_disable;
		}

		rc = regulator_enable(vreg_lcd_vddio);
		if (rc) {
			pr_err("%s: Enable regulator dsi_vddio failed\n",
				__func__);
			goto out_disable;
		}

		rc = lcd_gpio_setup(on);
		if (rc) {
			pr_err("gpio setup failed , rc=%d\n", rc);
			goto out_disable_all;
		}

		msleep(LCD_VREG_ON_WAIT_MS);

		lcd_reset(on);
	} else {
		msleep(LCD_RESET_WAIT_MS);
		lcd_reset(on);

		rc = lcd_gpio_setup(on);
		if (rc) {
			pr_err("gpio setup failed , rc=%d\n", rc);
			return -EINVAL;
		}

		rc = regulator_disable(vreg_lcd_vddio);
		if (rc)
			pr_warning("%s: '%s' regulator disable failed, rc=%d\n",
				__func__, "dsi_vddio", rc);
		rc = regulator_disable(vreg_lcd_vci);
		if (rc)
			pr_warning("%s: '%s' regulator disable failed, rc=%d\n",
				__func__, "dsi_vci", rc);
	}

	return 0;
out_disable_all:
	regulator_disable(vreg_lcd_vddio);
out_disable:
	regulator_disable(vreg_lcd_vci);
out_put_all:
	regulator_put(vreg_lcd_vddio);
	vreg_lcd_vddio = NULL;
out_put:
	regulator_put(vreg_lcd_vci);
	vreg_lcd_vci = NULL;
	return rc;
}
Пример #5
0
static int sony_viskan_is_dric_det(void)
{
	int rc = 0;
	static int val = -ENODEV;

	if (val != -ENODEV)
		return val;

	if (!vreg_lcd_vci) {
		vreg_lcd_vci = regulator_get(NULL, "8921_l8");
		if (IS_ERR(vreg_lcd_vci)) {
			pr_err("%s: Unable to get 8921_l8\n", __func__);
			vreg_lcd_vci = NULL;
			return -ENODEV;
		}
	}

	if (!vreg_lcd_vddio) {
		vreg_lcd_vddio = regulator_get(NULL, "8921_l29");
		if (IS_ERR(vreg_lcd_vddio)) {
			pr_err("%s: Unable to get 8921_l29\n", __func__);
			vreg_lcd_vddio = NULL;
			goto out_put_l8;
		}
	}

	rc = regulator_set_voltage(vreg_lcd_vci, 2850000, 2850000);
	if (rc) {
		pr_err("%s:%d unable to set L8 voltage to 2.85V\n",
			__func__, rc);
		goto out_put_l29;
	}

	rc = regulator_set_voltage(vreg_lcd_vddio, 1800000, 1800000);
	if (rc) {
		pr_err("%s:%d unable to set L29 voltage to 1.8V\n",
			__func__, rc);
		goto out_put_l29;
	}

	rc = regulator_enable(vreg_lcd_vci);
	if (rc) {
		pr_err("%s: Enable regulator 8921_l8 failed\n",
			__func__);
		goto out_put_l29;
	}

	rc = regulator_enable(vreg_lcd_vddio);
	if (rc) {
		pr_err("%s: Enable regulator 8921_l29 failed\n",
			__func__);
		goto out_put_l29;
	}

	lcd_gpio_setup(true);

	msleep(LCD_VENDOR_DET_WAIT_MS);

	/* LCD_VENDOR_DET */
	rc = gpio_request(LCD_VENDOR_DET, "lcd vendor detect");
	if (rc) {
		pr_err("%s: GPIO %d: request failed. rc=%d\n",
			__func__, LCD_VENDOR_DET, rc);
		goto out_put_l29;
	}
	rc = gpio_direction_input(LCD_VENDOR_DET);
	if (rc) {
		pr_err("%s: GPIO %d: direction in failed. rc=%d\n",
			__func__, LCD_VENDOR_DET, rc);
		goto out_free;
	}

	val = gpio_get_value(LCD_VENDOR_DET);
	pr_info("%s: GPIO:%d\n", __func__, val);

	rc = regulator_disable(vreg_lcd_vddio);
	if (rc)
		pr_err("%s: Enable regulator 8921_l29 failed\n",
			__func__);
	rc = regulator_disable(vreg_lcd_vci);
	if (rc)
		pr_err("%s: Enable regulator 8921_l8 failed\n",
			__func__);

	lcd_gpio_setup(false);

out_free:
	gpio_free(LCD_VENDOR_DET);
out_put_l29:
	regulator_put(vreg_lcd_vddio);
	vreg_lcd_vddio = NULL;
out_put_l8:
	regulator_put(vreg_lcd_vci);
	vreg_lcd_vci = NULL;

	msleep(LCD_VENDOR_DISABLE_VREG_WAIT_MS);

	return val;
}