blob: 1aca9fabd9458d7be1f5d38616d27eade629ba78 [file] [log] [blame]
Rajeshwari Birjee106bd92013-12-26 09:44:24 +05301/*
2 * Copyright (C) 2013 Samsung Electronics
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <fdtdec.h>
9#include <asm/io.h>
10#include <i2c.h>
11#include <lcd.h>
Sjoerd Simonsa7b99202014-12-05 18:12:22 +010012#include <parade.h>
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053013#include <spi.h>
Ajay Kumara99cea02014-09-05 16:53:36 +053014#include <errno.h>
Simon Glass903fd792014-10-20 19:48:37 -060015#include <asm/gpio.h>
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053016#include <asm/arch/board.h>
17#include <asm/arch/cpu.h>
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053018#include <asm/arch/pinmux.h>
Ajay Kumara99cea02014-09-05 16:53:36 +053019#include <asm/arch/system.h>
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053020#include <asm/arch/dp_info.h>
Ajay Kumara99cea02014-09-05 16:53:36 +053021#include <power/tps65090_pmic.h>
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053022
23DECLARE_GLOBAL_DATA_PTR;
24
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053025int exynos_init(void)
26{
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053027 return 0;
28}
29
30#ifdef CONFIG_LCD
Ajay Kumara99cea02014-09-05 16:53:36 +053031static int has_edp_bridge(void)
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053032{
Ajay Kumara99cea02014-09-05 16:53:36 +053033 int node;
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053034
Ajay Kumara99cea02014-09-05 16:53:36 +053035 node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_PARADE_PS8625);
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053036
Ajay Kumara99cea02014-09-05 16:53:36 +053037 /* No node for bridge in device tree. */
38 if (node <= 0)
39 return 0;
40
41 /* Default is with bridge ic */
42 return 1;
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053043}
44
Ajay Kumara99cea02014-09-05 16:53:36 +053045void exynos_lcd_power_on(void)
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053046{
Ajay Kumara99cea02014-09-05 16:53:36 +053047 int ret;
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053048
Ajay Kumara99cea02014-09-05 16:53:36 +053049#ifdef CONFIG_POWER_TPS65090
50 ret = tps65090_init();
51 if (ret < 0) {
52 printf("%s: tps65090_init() failed\n", __func__);
53 return;
54 }
55
56 tps65090_fet_enable(6);
57#endif
58
59 mdelay(5);
60
61 /* TODO(ajaykumar.rs@samsung.com): Use device tree */
Simon Glass7f196102014-10-20 19:48:39 -060062 gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
Ajay Kumara99cea02014-09-05 16:53:36 +053063 gpio_direction_output(EXYNOS5420_GPIO_X35, 1); /* EDP_SLP# */
64 mdelay(10);
Simon Glass7f196102014-10-20 19:48:39 -060065 gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
Ajay Kumara99cea02014-09-05 16:53:36 +053066 gpio_direction_output(EXYNOS5420_GPIO_Y77, 1); /* EDP_RST# */
Simon Glass7f196102014-10-20 19:48:39 -060067 gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
Ajay Kumara99cea02014-09-05 16:53:36 +053068 gpio_direction_input(EXYNOS5420_GPIO_X26); /* EDP_HPD */
69 gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
70
71 if (has_edp_bridge())
72 if (parade_init(gd->fdt_blob))
73 printf("%s: ps8625_init() failed\n", __func__);
74}
75
76void exynos_backlight_on(unsigned int onoff)
77{
78 /* For PWM */
Simon Glass7f196102014-10-20 19:48:39 -060079 gpio_request(EXYNOS5420_GPIO_B20, "backlight_on");
Ajay Kumara99cea02014-09-05 16:53:36 +053080 gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1));
81 gpio_set_value(EXYNOS5420_GPIO_B20, 1);
82
83#ifdef CONFIG_POWER_TPS65090
84 tps65090_fet_enable(1);
85#endif
Rajeshwari Birjee106bd92013-12-26 09:44:24 +053086}
87#endif
88
89int board_get_revision(void)
90{
91 return 0;
92}