aboutsummaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3288/display.c
diff options
context:
space:
mode:
authorhuang lin <hl@rock-chips.com>2014-09-19 14:51:52 +0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-10 20:50:53 +0200
commit40f558e8f4f77ab70a8a2eb9bdfa850e362cb553 (patch)
tree6ef4fd3fca8bbf8f0e07070b224ba29dccec8021 /src/soc/rockchip/rk3288/display.c
parent1c8f2a6f968bec72a7060ba264f44fbea96d68e9 (diff)
rockchip: support display
Implement VOP and eDP drivers, vop and edp clock configuration, framebuffer allocation and display configuration logic. The eDP driver reads panel EDID to determine panel dimensions and the pixel clock used by the VOP. The pixel clock is generating using the NPLL. BUG=chrome-os-partner:31897 TEST=Booted Veyron Pinky and display normal BRANCH=None Change-Id: I01b5c347a3433a108806aec61aa3a875cab8c129 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: e4f863b0b57f2f5293ea8015db86cf7f8acc5853 Original-Change-Id: I61214f55e96bc1dcda9b0f700e5db11e49e5e533 Original-Signed-off-by: huang lin <hl@rock-chips.com> Original-Reviewed-on: https://chromium-review.googlesource.com/219050 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/9553 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/rockchip/rk3288/display.c')
-rw-r--r--src/soc/rockchip/rk3288/display.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/soc/rockchip/rk3288/display.c b/src/soc/rockchip/rk3288/display.c
new file mode 100644
index 0000000000..a8ba31a129
--- /dev/null
+++ b/src/soc/rockchip/rk3288/display.c
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 Rockchip Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <arch/cache.h>
+#include <arch/io.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <delay.h>
+#include <edid.h>
+#include <gpio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <soc/addressmap.h>
+#include <soc/clock.h>
+#include <soc/display.h>
+#include <soc/edp.h>
+#include <soc/gpio.h>
+#include <soc/grf.h>
+#include <soc/soc.h>
+#include <soc/vop.h>
+
+#include "chip.h"
+
+void rk_display_init(device_t dev, u32 lcdbase,
+ unsigned long fb_size)
+{
+ struct edid edid;
+ struct soc_rockchip_rk3288_config *conf = dev->chip_info;
+ uint32_t lower = ALIGN_DOWN(lcdbase, MiB);
+ uint32_t upper = ALIGN_UP(lcdbase + fb_size, MiB);
+
+ printk(BIOS_SPEW, "LCD framebuffer @%p\n", (void *)(lcdbase));
+ memset((void *)lcdbase, 0, fb_size); /* clear the framebuffer */
+ dcache_clean_invalidate_by_mva((void *)lower, upper - lower);
+ mmu_config_range(lower / MiB, (upper - lower) / MiB, DCACHE_OFF);
+
+ rkclk_configure_edp();
+
+ rkclk_configure_vop_aclk(conf->vop_id, 192 * MHz);
+
+ rk_edp_init(conf->vop_id);
+ udelay(conf->lcd_power_on_udelay);
+
+ if (rk_edp_get_edid(&edid)) {
+ printk(BIOS_WARNING, "can not get edid\n");
+ return;
+ }
+
+ if (rkclk_configure_vop_dclk(conf->vop_id, edid.pixel_clock * KHz)) {
+ printk(BIOS_WARNING, "config vop err\n");
+ return;
+ }
+
+ edid.framebuffer_bits_per_pixel = conf->framebuffer_bits_per_pixel;
+ edid.bytes_per_line = edid.ha * conf->framebuffer_bits_per_pixel / 8;
+ edid.x_resolution = edid.ha;
+ edid.y_resolution = edid.va;
+ rkvop_mode_set(conf->vop_id, &edid);
+
+ rkvop_enable(conf->vop_id, lcdbase, &edid);
+
+ if (rk_edp_enable()) {
+ printk(BIOS_WARNING, "edp enable err\n");
+ return;
+ }
+
+ set_vbe_mode_info_valid(&edid, (uintptr_t)lcdbase);
+ gpio_output(conf->lcd_bl_pwm_gpio, 0);
+ gpio_output(conf->lcd_bl_en_gpio, 1); /* LCD_BL */
+ udelay(conf->bl_power_on_udelay);
+ gpio_output(conf->lcd_bl_pwm_gpio, 1); /* BL_EN */
+}