[U-Boot] [PATCH v2 11/12] exynos: Enable the LCD backlight for snow

Minkyu Kang mk7.kang at samsung.com
Thu May 15 08:51:36 CEST 2014


On 03/04/14 08:24, Simon Glass wrote:
> The backlight uses FETs on the TPS65090. Enable this so that the display
> is visible.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Lukasz Majewski <l.majewski at samsung.com>
> ---
> 
> Changes in v2:
> - Only set up the EDP bridge for snow
> - Add a device tree compatibility string for the EDP bridge
> - Check for EDP failure and print an error in that case
> - Return immediately in exynos_backlight_on() if needed
> 
>  board/samsung/smdk5250/exynos5-dt.c | 103 ++++++++++++++++++++++++++++++++++++
>  include/fdtdec.h                    |   1 +
>  lib/fdtdec.c                        |   1 +
>  3 files changed, 105 insertions(+)
> 
> diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
> index 2c1cf8a..73c9a35 100644
> --- a/board/samsung/smdk5250/exynos5-dt.c
> +++ b/board/samsung/smdk5250/exynos5-dt.c
> @@ -183,6 +183,61 @@ int exynos_power_init(void)
>  #endif	/* CONFIG_POWER */
>  
>  #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;

please don't use upper case at local variable.
If need, please define it.

> +	int num_tries, node;
> +
> +	/*
> +	 * TODO(sjg): Use device tree for GPIOs when exynos GPIO
> +	 * numbering patch is in mainline.
> +	 */
> +	debug("%s\n", __func__);
> +	node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_NXP_PTN3460);
> +	if (node < 0) {
> +		debug("%s: No node for DP bridge in device tree\n", __func__);
> +		return -ENODEV;
> +	}
> +
> +	/* 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);

seems to need rebase this patch.

> +
> +	/*
> +	 * 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 =
> @@ -204,4 +259,52 @@ void exynos_set_dp_phy(unsigned int onoff)
>  {
>  	set_dp_phy_ctrl(onoff);
>  }
> +
> +void exynos_backlight_on(unsigned int onoff)

onoff, then value is 1. is it on or off?
How about rename it to "on"?

> +{
> +	debug("%s(%u)\n", __func__, onoff);
> +
> +	if (!onoff)
> +		return;
> +
> +#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)
> +{
> +	int ret;
> +
> +	debug("%s\n", __func__);
> +
> +#ifdef CONFIG_POWER_TPS65090
> +	/* board_dp_lcd_vdd */
> +	tps65090_fet_enable(6); /* Enable FET6, lcd panel */
> +#endif
> +
> +	ret = board_dp_bridge_setup();
> +	if (ret && ret != -ENODEV)
> +		printf("LCD bridge failed to enable: %d\n", ret);
> +}
> +
>  #endif
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 669ab90..ea50d75 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -93,6 +93,7 @@ enum fdt_compat_id {
>  	COMPAT_SANDBOX_HOST_EMULATION,	/* Sandbox emulation of a function */
>  	COMPAT_SANDBOX_LCD_SDL,		/* Sandbox LCD emulation with SDL */
>  	COMPAT_TI_TPS65090,		/* Texas Instrument TPS65090 */
> +	COMPAT_NXP_PTN3460,		/* NXP PTN3460 DP/LVDS bridge */
>  
>  	COMPAT_COUNT,
>  };
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index e15e0ad..13e3f45 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -66,6 +66,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
>  	COMPAT(SANDBOX_HOST_EMULATION, "sandbox,host-emulation"),
>  	COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"),
>  	COMPAT(TI_TPS65090, "ti,tps65090"),
> +	COMPAT(COMPAT_NXP_PTN3460, "nxp,ptn3460"),
>  };
>  
>  const char *fdtdec_get_compatible(enum fdt_compat_id id)
> 

Thanks,
Minkyu Kang.


More information about the U-Boot mailing list