summaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3399/display.c
diff options
context:
space:
mode:
authorLin Huang <hl@rock-chips.com>2017-11-22 09:40:50 +0800
committerJulius Werner <jwerner@chromium.org>2017-11-28 19:16:09 +0000
commit25fb09b0684769bd010cde0aa60f1b32eddb2cba (patch)
treedb7ef455bfcb34369603f6513e3eeb8c8b8cd2c4 /src/soc/rockchip/rk3399/display.c
parent45f1b01324ed1712092e80fed7e03fe088452729 (diff)
downloadcoreboot-25fb09b0684769bd010cde0aa60f1b32eddb2cba.tar.xz
rockchip/rk3399: support dual mipi dsi
Refactor the mipi driver, so we can support dual mipi panel. And pass the panel data from mainboard.c, that we can support different panel with different board. Change-Id: Id1286c0ccbe50c89514c8daee66439116d3f1ca4 Signed-off-by: Lin Huang <hl@rock-chips.com> Reviewed-on: https://review.coreboot.org/22471 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/soc/rockchip/rk3399/display.c')
-rw-r--r--src/soc/rockchip/rk3399/display.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/src/soc/rockchip/rk3399/display.c b/src/soc/rockchip/rk3399/display.c
index 379e1bfec8..cc265b2edb 100644
--- a/src/soc/rockchip/rk3399/display.c
+++ b/src/soc/rockchip/rk3399/display.c
@@ -48,27 +48,13 @@ static void reset_edp(void)
printk(BIOS_WARNING, "Retrying epd initialization.\n");
}
-static void rk_get_mipi_mode(struct edid *edid, device_t dev)
-{
- struct soc_rockchip_rk3399_config *conf = dev->chip_info;
-
- edid->mode.pixel_clock = conf->panel_pixel_clock;
- edid->mode.refresh = conf->panel_refresh;
- edid->mode.ha = conf->panel_ha;
- edid->mode.hbl = conf->panel_hbl;
- edid->mode.hso = conf->panel_hso;
- edid->mode.hspw = conf->panel_hspw;
- edid->mode.va = conf->panel_va;
- edid->mode.vbl = conf->panel_vbl;
- edid->mode.vso = conf->panel_vso;
- edid->mode.vspw = conf->panel_vspw;
-}
void rk_display_init(device_t dev)
{
struct edid edid;
struct soc_rockchip_rk3399_config *conf = dev->chip_info;
enum vop_modes detected_mode = VOP_MODE_UNKNOWN;
int retry_count = 0;
+ const struct mipi_panel_data *panel_data = NULL;
/* let's use vop0 in rk3399 */
uint32_t vop_id = 0;
@@ -111,13 +97,42 @@ retry_edp:
rkclk_configure_mipi();
rkclk_configure_vop_aclk(vop_id, 200 * MHz);
- /* disable turnrequest turndisable forcetxstop forcerxmode */
+ /*
+ * disable tx0 turnrequest, turndisable,
+ * forcetxstop, forcerxmode
+ */
write32(&rk3399_grf->soc_con22, RK_CLRBITS(0xffff));
- /* select mipi-dsi0 signal from vop0 */
- write32(&rk3399_grf->soc_con20, RK_CLRBITS(1 << 0));
- rk_get_mipi_mode(&edid, dev);
- detected_mode = VOP_MODE_MIPI;
+ /* disable tx1 turndisable, forcetxstop, forcerxmode */
+ write32(&rk3399_grf->soc_con23, RK_CLRBITS(0xfff0));
+
+ /*
+ * enable dphy_tx1rx1_masterslavez,
+ * clear dphy_tx1rx1_enableclk,
+ * clear dphy_tx1rx1_basedir,
+ * disable tx1 turnrequest
+ */
+ write32(&rk3399_grf->soc_con24,
+ RK_CLRSETBITS(1 << 7 | 1 << 6 | 1 << 5 | 0xf,
+ 1 << 7 | 0 << 6 | 0 << 5 | 0 << 0));
+
+ /* dphy_tx1rx1_enable */
+ write32(&rk3399_grf->soc_con23, RK_SETBITS(0xf));
+
+ /* select mipi-dsi0 and mipi-dsi1 signal from vop0 */
+ write32(&rk3399_grf->soc_con20,
+ RK_CLRBITS((1 << 0) | (1 << 4)));
+
+ panel_data = mainboard_get_mipi_mode(&edid);
+ if (panel_data) {
+ if (panel_data->mipi_num > 1)
+ detected_mode = VOP_MODE_DUAL_MIPI;
+ else
+ detected_mode = VOP_MODE_MIPI;
+ } else {
+ printk(BIOS_WARNING, "Can not get mipi panel data\n");
+ return;
+ }
break;
default:
printk(BIOS_WARNING, "Unsupported vop_mode, aborting.\n");
@@ -138,7 +153,8 @@ retry_edp:
switch (detected_mode) {
case VOP_MODE_MIPI:
- rk_mipi_prepare(&edid, conf->panel_display_on_mdelay, conf->panel_video_mode_mdelay);
+ case VOP_MODE_DUAL_MIPI:
+ rk_mipi_prepare(&edid, panel_data);
break;
case VOP_MODE_EDP:
/* will enable edp in depthcharge */