drm/rockchip: Support drm dw-hdmi
Add drm hdmi refer to kernel. Support Synopsys PHY HDMI, RK3399 has been tested. Change-Id: Iaae35ff15333cd1082149e016157c66ec3a6f3a6 Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
This commit is contained in:
parent
21016d27c5
commit
f5e7d25111
|
|
@ -15,6 +15,14 @@ config DRM_ROCKCHIP_PANEL
|
|||
config DRM_ROCKCHIP_DSI_PANEL
|
||||
bool
|
||||
|
||||
config DRM_ROCKCHIP_DW_HDMI
|
||||
bool "Rockchip specific extensions for Synopsys DW HDMI"
|
||||
depends on DRM_ROCKCHIP
|
||||
help
|
||||
This selects support for Rockchip SoC specific extensions
|
||||
for the Synopsys DesignWare HDMI driver. If you want to
|
||||
enable HDMI on, you should selet this option.
|
||||
|
||||
config DRM_ROCKCHIP_MIPI_DSI
|
||||
bool
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ obj-y += rockchip_display.o rockchip_crtc.o rockchip_phy.o \
|
|||
obj-$(CONFIG_DRM_ROCKCHIP_MIPI_DSI) += rockchip_mipi_dsi.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_DW_MIPI_DSI) += rockchip-dw-mipi-dsi.o \
|
||||
rockchip-inno-mipi-dphy.o rockchip_dsi_panel.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_DW_HDMI) += rockchip_dw_hdmi.o dw_hdmi.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_DW_MIPI_DSI) += rockchip-dw-mipi-dsi.o rockchip-inno-mipi-dphy.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_ANALOGIX_DP) += rockchip_analogix_dp.o rockchip_analogix_dp_reg.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_LVDS) += rockchip_lvds.o
|
||||
obj-$(CONFIG_DRM_ROCKCHIP_PANEL) += panel_simple.o
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm/device.h>
|
||||
#include <linux/dw_hdmi.h>
|
||||
#include "rockchip_display.h"
|
||||
#include "rockchip_crtc.h"
|
||||
#include "rockchip_connector.h"
|
||||
#include "dw_hdmi.h"
|
||||
#include "rockchip_dw_hdmi.h"
|
||||
|
||||
#define HDMI_SEL_LCDC(x, bit) ((((x) & 1) << bit) | (1 << (16 + bit)))
|
||||
#define RK3288_GRF_SOC_CON6 0x025C
|
||||
#define RK3288_HDMI_LCDC_SEL BIT(4)
|
||||
#define RK3399_GRF_SOC_CON20 0x6250
|
||||
#define RK3399_HDMI_LCDC_SEL BIT(6)
|
||||
|
||||
static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
|
||||
{
|
||||
30666000, {
|
||||
{ 0x00b3, 0x0000 },
|
||||
{ 0x2153, 0x0000 },
|
||||
{ 0x40f3, 0x0000 },
|
||||
},
|
||||
}, {
|
||||
36800000, {
|
||||
{ 0x00b3, 0x0000 },
|
||||
{ 0x2153, 0x0000 },
|
||||
{ 0x40a2, 0x0001 },
|
||||
},
|
||||
}, {
|
||||
46000000, {
|
||||
{ 0x00b3, 0x0000 },
|
||||
{ 0x2142, 0x0001 },
|
||||
{ 0x40a2, 0x0001 },
|
||||
},
|
||||
}, {
|
||||
61333000, {
|
||||
{ 0x0072, 0x0001 },
|
||||
{ 0x2142, 0x0001 },
|
||||
{ 0x40a2, 0x0001 },
|
||||
},
|
||||
}, {
|
||||
73600000, {
|
||||
{ 0x0072, 0x0001 },
|
||||
{ 0x2142, 0x0001 },
|
||||
{ 0x4061, 0x0002 },
|
||||
},
|
||||
}, {
|
||||
92000000, {
|
||||
{ 0x0072, 0x0001 },
|
||||
{ 0x2145, 0x0002 },
|
||||
{ 0x4061, 0x0002 },
|
||||
},
|
||||
}, {
|
||||
122666000, {
|
||||
{ 0x0051, 0x0002 },
|
||||
{ 0x2145, 0x0002 },
|
||||
{ 0x4061, 0x0002 },
|
||||
},
|
||||
}, {
|
||||
147200000, {
|
||||
{ 0x0051, 0x0002 },
|
||||
{ 0x2145, 0x0002 },
|
||||
{ 0x4064, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
184000000, {
|
||||
{ 0x0051, 0x0002 },
|
||||
{ 0x214c, 0x0003 },
|
||||
{ 0x4064, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
226666000, {
|
||||
{ 0x0040, 0x0003 },
|
||||
{ 0x214c, 0x0003 },
|
||||
{ 0x4064, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
272000000, {
|
||||
{ 0x0040, 0x0003 },
|
||||
{ 0x214c, 0x0003 },
|
||||
{ 0x5a64, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
340000000, {
|
||||
{ 0x0040, 0x0003 },
|
||||
{ 0x3b4c, 0x0003 },
|
||||
{ 0x5a64, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
600000000, {
|
||||
{ 0x1a40, 0x0003 },
|
||||
{ 0x3b4c, 0x0003 },
|
||||
{ 0x5a64, 0x0003 },
|
||||
},
|
||||
}, {
|
||||
~0UL, {
|
||||
{ 0x0000, 0x0000 },
|
||||
{ 0x0000, 0x0000 },
|
||||
{ 0x0000, 0x0000 },
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
|
||||
/* pixelclk bpp8 bpp10 bpp12 */
|
||||
{
|
||||
600000000, { 0x0000, 0x0000, 0x0000 },
|
||||
}, {
|
||||
~0UL, { 0x0000, 0x0000, 0x0000},
|
||||
}
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_phy_config rockchip_phy_config[] = {
|
||||
/*pixelclk symbol term vlev*/
|
||||
{ 74250000, 0x8009, 0x0004, 0x0272},
|
||||
{ 165000000, 0x802b, 0x0004, 0x0209},
|
||||
{ 297000000, 0x8039, 0x0005, 0x028d},
|
||||
{ 594000000, 0x8039, 0x0000, 0x019d},
|
||||
{ ~0UL, 0x0000, 0x0000, 0x0000}
|
||||
};
|
||||
|
||||
static const struct rockchip_connector_funcs rockchip_dw_hdmi_funcs = {
|
||||
.init = rockchip_dw_hdmi_init,
|
||||
.deinit = rockchip_dw_hdmi_deinit,
|
||||
.prepare = rockchip_dw_hdmi_prepare,
|
||||
.enable = rockchip_dw_hdmi_enable,
|
||||
.disable = rockchip_dw_hdmi_disable,
|
||||
.get_timing = rockchip_dw_hdmi_get_timing,
|
||||
.detect = rockchip_dw_hdmi_detect,
|
||||
.get_edid = rockchip_dw_hdmi_get_edid,
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = {
|
||||
.vop_sel_bit = 4,
|
||||
.grf_vop_sel_reg = RK3288_GRF_SOC_CON6,
|
||||
.dev_type = RK3288_HDMI,
|
||||
};
|
||||
|
||||
static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = {
|
||||
.vop_sel_bit = 6,
|
||||
.grf_vop_sel_reg = RK3399_GRF_SOC_CON20,
|
||||
.mpll_cfg = rockchip_mpll_cfg,
|
||||
.cur_ctr = rockchip_cur_ctr,
|
||||
.phy_config = rockchip_phy_config,
|
||||
.dev_type = RK3399_HDMI,
|
||||
};
|
||||
|
||||
static const struct rockchip_connector rk3399_dw_hdmi_data = {
|
||||
.funcs = &rockchip_dw_hdmi_funcs,
|
||||
.data = &rk3399_hdmi_drv_data,
|
||||
};
|
||||
|
||||
static const struct rockchip_connector rk3288_dw_hdmi_data = {
|
||||
.funcs = &rockchip_dw_hdmi_funcs,
|
||||
.data = &rk3288_hdmi_drv_data,
|
||||
};
|
||||
|
||||
static int rockchip_dw_hdmi_probe(struct udevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id rockchip_dw_hdmi_ids[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3399-dw-hdmi",
|
||||
.data = (ulong)&rk3399_dw_hdmi_data,
|
||||
}, {
|
||||
.compatible = "rockchip,rk3288-dw-hdmi",
|
||||
.data = (ulong)&rk3288_dw_hdmi_data,
|
||||
}, {}
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(rockchip_dw_hdmi) = {
|
||||
.name = "rockchip_dw_hdmi",
|
||||
.id = UCLASS_DISPLAY,
|
||||
.of_match = rockchip_dw_hdmi_ids,
|
||||
.probe = rockchip_dw_hdmi_probe,
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#ifndef _ROCKCHIP_DW_HDMI_REG_H_
|
||||
#define _ROCKCHIP_DW_HDMI_REG_H_
|
||||
|
||||
/*
|
||||
* Rockchip connector callbacks.
|
||||
* If you want to know the details, please refer to rockchip_connector.h
|
||||
*/
|
||||
int rockchip_dw_hdmi_init(struct display_state *state);
|
||||
void rockchip_dw_hdmi_deinit(struct display_state *state);
|
||||
int rockchip_dw_hdmi_prepare(struct display_state *state);
|
||||
int rockchip_dw_hdmi_enable(struct display_state *state);
|
||||
int rockchip_dw_hdmi_disable(struct display_state *state);
|
||||
int rockchip_dw_hdmi_get_timing(struct display_state *state);
|
||||
int rockchip_dw_hdmi_detect(struct display_state *state);
|
||||
int rockchip_dw_hdmi_get_edid(struct display_state *state);
|
||||
|
||||
#endif /* _ROCKCHIP_DW_HDMI_REG_H_ */
|
||||
Loading…
Reference in New Issue