All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/10] exynos: Enable the LCD backlight for snow
Date: Wed, 26 Mar 2014 11:56:29 -0600	[thread overview]
Message-ID: <1395856590-21917-10-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1395856590-21917-1-git-send-email-sjg@chromium.org>

The backlight uses FETs on the TPS65090. Enable this so that the display
is visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 board/samsung/smdk5250/exynos5-dt.c | 90 +++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
index c83b034..a0ae641 100644
--- a/board/samsung/smdk5250/exynos5-dt.c
+++ b/board/samsung/smdk5250/exynos5-dt.c
@@ -20,6 +20,7 @@
 #include <asm/arch/sromc.h>
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
+#include <power/tps65090_pmic.h>
 #include <tmu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -60,6 +61,52 @@ int checkboard(void)
 #endif
 
 #ifdef CONFIG_LCD
+static int board_dp_bridge_setup(void)
+{
+	struct exynos5_gpio_part1 *gpio1 =
+		(struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1();
+	const int MAX_TRIES = 10;
+	int num_tries;
+
+	debug("%s\n", __func__);
+
+	/* Setup the GPIOs */
+
+	/* PD is ACTIVE_LOW, and initially de-asserted */
+	s5p_gpio_set_pull(&gpio1->y2, 5, GPIO_PULL_NONE);
+	s5p_gpio_direction_output(&gpio1->y2, 5, 1);
+
+	/* Reset is ACTIVE_LOW */
+	s5p_gpio_set_pull(&gpio1->x1, 5, GPIO_PULL_NONE);
+	s5p_gpio_direction_output(&gpio1->x1, 5, 0);
+
+	udelay(10);
+	s5p_gpio_set_value(&gpio1->x1, 5, 1);
+
+	s5p_gpio_direction_input(&gpio1->x0, 7);
+
+	/*
+	 * We need to wait for 90ms after bringing up the bridge since there
+	 * is a phantom "high" on the HPD chip during its bootup.  The phantom
+	 * high comes within 7ms of de-asserting PD and persists for at least
+	 * 15ms.  The real high comes roughly 50ms after PD is de-asserted. The
+	 * phantom high makes it hard for us to know when the NXP chip is up.
+	 */
+	mdelay(90);
+
+	for (num_tries = 0; num_tries < MAX_TRIES; num_tries++) {
+		/* Check HPD.  If it's high, we're all good. */
+		if (s5p_gpio_get_value(&gpio1->x0, 7))
+				return 0;
+
+		debug("%s: eDP bridge failed to come up; try %d of %d\n",
+		      __func__, num_tries, MAX_TRIES);
+	}
+
+	/* Immediately go into bridge reset if the hp line is not high */
+	return -ENODEV;
+}
+
 void exynos_cfg_lcd_gpio(void)
 {
 	struct exynos5_gpio_part1 *gpio1 =
@@ -81,4 +128,47 @@ void exynos_set_dp_phy(unsigned int onoff)
 {
 	set_dp_phy_ctrl(onoff);
 }
+
+void exynos_backlight_on(unsigned int onoff)
+{
+	debug("%s(%u)\n", __func__, onoff);
+
+	if (onoff) {
+#ifdef CONFIG_POWER_TPS65090
+		struct exynos5_gpio_part1 *gpio1 =
+			(struct exynos5_gpio_part1 *)
+					samsung_get_base_gpio_part1();
+		int ret;
+
+		ret = tps65090_fet_enable(1); /* Enable FET1, backlight */
+		if (ret)
+			return;
+
+		/* T5 in the LCD timing spec (defined as > 10ms) */
+		mdelay(10);
+
+		/* board_dp_backlight_pwm */
+		s5p_gpio_direction_output(&gpio1->b2, 0, 1);
+
+		/* T6 in the LCD timing spec (defined as > 10ms) */
+		mdelay(10);
+
+		/* board_dp_backlight_en */
+		s5p_gpio_direction_output(&gpio1->x3, 0, 1);
+#endif
+	}
+}
+
+void exynos_lcd_power_on(void)
+{
+	debug("%s\n", __func__);
+
+#ifdef CONFIG_POWER_TPS65090
+	/* board_dp_lcd_vdd */
+	tps65090_fet_enable(6); /* Enable FET6, lcd panel */
+#endif
+
+	board_dp_bridge_setup();
+}
+
 #endif
-- 
1.9.1.423.g4596e3a

  parent reply	other threads:[~2014-03-26 17:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 17:56 [U-Boot] [PATCH 0/10] Enable LCD display on snow Simon Glass
2014-03-26 17:56 ` [U-Boot] [PATCH 01/10] power: Rename CONFIG_PMIC_... to CONFIG_POWER_ Simon Glass
2014-03-27 16:32   ` Lukasz Majewski
2014-03-26 17:56 ` [U-Boot] [PATCH 02/10] power: Add support for TPS65090 PMU chip Simon Glass
2014-03-27 17:59   ` Lukasz Majewski
2014-03-30  0:14     ` Simon Glass
2014-03-31 14:33       ` Lukasz Majewski
2014-03-31 17:27         ` Simon Glass
2014-03-31 20:59           ` Lukasz Majewski
2014-03-26 17:56 ` [U-Boot] [PATCH 03/10] exynos5: Enable tps65090 on smdk5250 Simon Glass
2014-03-29 22:40   ` Ajay kumar
2014-03-30  0:22     ` Simon Glass
2014-03-26 17:56 ` [U-Boot] [PATCH 04/10] power: Explicitly select pmic device's bus Simon Glass
2014-03-27 17:33   ` Lukasz Majewski
2014-03-30  0:17     ` Simon Glass
2014-03-31  5:17       ` Heiko Schocher
2014-03-31  6:17         ` Lukasz Majewski
2014-04-01  4:58           ` Heiko Schocher
2014-03-31 14:36       ` Lukasz Majewski
2014-04-01  4:59         ` Heiko Schocher
2014-03-26 17:56 ` [U-Boot] [PATCH 05/10] exynos5: support tps65090 pmic Simon Glass
2014-03-27 12:13   ` Minkyu Kang
2014-03-30  0:18     ` Simon Glass
2014-03-27 17:28   ` Lukasz Majewski
2014-03-26 17:56 ` [U-Boot] [PATCH 06/10] exynos: Enable PSHOLD in SPL Simon Glass
2014-03-27 17:13   ` Lukasz Majewski
2014-03-26 17:56 ` [U-Boot] [PATCH 07/10] exynos: dts: Disable cros_ec interrupts due to broken GPIOs Simon Glass
2014-03-26 17:56 ` [U-Boot] [PATCH 08/10] exynos: dts: Enable LCD for snow Simon Glass
2014-03-27 17:23   ` Lukasz Majewski
2014-03-30  0:24     ` Simon Glass
2014-03-26 17:56 ` Simon Glass [this message]
2014-03-27 12:13   ` [U-Boot] [PATCH 09/10] exynos: Enable the LCD backlight " Minkyu Kang
2014-03-27 17:25   ` Lukasz Majewski
2014-03-29 22:35   ` Ajay kumar
2014-03-30  0:06     ` Simon Glass
2014-03-26 17:56 ` [U-Boot] [PATCH 10/10] initcall: Improve debugging support Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395856590-21917-10-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.