Commit 46a20c9a authored by Dave Airlie's avatar Dave Airlie

Merge tag 'mediatek-drm-fixes-5.8' of...

Merge tag 'mediatek-drm-fixes-5.8' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes

Mediatek DRM Fixes for Linux 5.8

This include fixup for cmdq, mmsys, visibility checking and some refinement.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707153944.604-1-chunkuang.hu@kernel.org
parents dcb7fd82 5ab546f5
...@@ -6,12 +6,12 @@ config DRM_MEDIATEK ...@@ -6,12 +6,12 @@ config DRM_MEDIATEK
depends on COMMON_CLK depends on COMMON_CLK
depends on HAVE_ARM_SMCCC depends on HAVE_ARM_SMCCC
depends on OF depends on OF
depends on MTK_MMSYS
select DRM_GEM_CMA_HELPER select DRM_GEM_CMA_HELPER
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_MIPI_DSI select DRM_MIPI_DSI
select DRM_PANEL select DRM_PANEL
select MEMORY select MEMORY
select MTK_MMSYS
select MTK_SMI select MTK_SMI
select VIDEOMODE_HELPERS select VIDEOMODE_HELPERS
help help
......
...@@ -193,7 +193,6 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_drm_crtc *mtk_crtc) ...@@ -193,7 +193,6 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_drm_crtc *mtk_crtc)
int ret; int ret;
int i; int i;
DRM_DEBUG_DRIVER("%s\n", __func__);
for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
ret = clk_prepare_enable(mtk_crtc->ddp_comp[i]->clk); ret = clk_prepare_enable(mtk_crtc->ddp_comp[i]->clk);
if (ret) { if (ret) {
...@@ -213,7 +212,6 @@ static void mtk_crtc_ddp_clk_disable(struct mtk_drm_crtc *mtk_crtc) ...@@ -213,7 +212,6 @@ static void mtk_crtc_ddp_clk_disable(struct mtk_drm_crtc *mtk_crtc)
{ {
int i; int i;
DRM_DEBUG_DRIVER("%s\n", __func__);
for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
clk_disable_unprepare(mtk_crtc->ddp_comp[i]->clk); clk_disable_unprepare(mtk_crtc->ddp_comp[i]->clk);
} }
...@@ -258,7 +256,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) ...@@ -258,7 +256,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
int ret; int ret;
int i; int i;
DRM_DEBUG_DRIVER("%s\n", __func__);
if (WARN_ON(!crtc->state)) if (WARN_ON(!crtc->state))
return -EINVAL; return -EINVAL;
...@@ -299,7 +296,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) ...@@ -299,7 +296,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
goto err_mutex_unprepare; goto err_mutex_unprepare;
} }
DRM_DEBUG_DRIVER("mediatek_ddp_ddp_path_setup\n");
for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev, mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
mtk_crtc->ddp_comp[i]->id, mtk_crtc->ddp_comp[i]->id,
...@@ -349,7 +345,6 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) ...@@ -349,7 +345,6 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc)
struct drm_crtc *crtc = &mtk_crtc->base; struct drm_crtc *crtc = &mtk_crtc->base;
int i; int i;
DRM_DEBUG_DRIVER("%s\n", __func__);
for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
mtk_ddp_comp_stop(mtk_crtc->ddp_comp[i]); mtk_ddp_comp_stop(mtk_crtc->ddp_comp[i]);
if (i == 1) if (i == 1)
...@@ -831,7 +826,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, ...@@ -831,7 +826,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
#if IS_REACHABLE(CONFIG_MTK_CMDQ) #if IS_REACHABLE(CONFIG_MTK_CMDQ)
mtk_crtc->cmdq_client = mtk_crtc->cmdq_client =
cmdq_mbox_create(dev, drm_crtc_index(&mtk_crtc->base), cmdq_mbox_create(mtk_crtc->mmsys_dev,
drm_crtc_index(&mtk_crtc->base),
2000); 2000);
if (IS_ERR(mtk_crtc->cmdq_client)) { if (IS_ERR(mtk_crtc->cmdq_client)) {
dev_dbg(dev, "mtk_crtc %d failed to create mailbox client, writing register by CPU now\n", dev_dbg(dev, "mtk_crtc %d failed to create mailbox client, writing register by CPU now\n",
......
...@@ -444,7 +444,6 @@ static int mtk_drm_probe(struct platform_device *pdev) ...@@ -444,7 +444,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
if (!private) if (!private)
return -ENOMEM; return -ENOMEM;
private->data = of_device_get_match_data(dev);
private->mmsys_dev = dev->parent; private->mmsys_dev = dev->parent;
if (!private->mmsys_dev) { if (!private->mmsys_dev) {
dev_err(dev, "Failed to get MMSYS device\n"); dev_err(dev, "Failed to get MMSYS device\n");
...@@ -514,7 +513,8 @@ static int mtk_drm_probe(struct platform_device *pdev) ...@@ -514,7 +513,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
goto err_node; goto err_node;
} }
ret = mtk_ddp_comp_init(dev, node, comp, comp_id, NULL); ret = mtk_ddp_comp_init(dev->parent, node, comp,
comp_id, NULL);
if (ret) { if (ret) {
of_node_put(node); of_node_put(node);
goto err_node; goto err_node;
...@@ -571,7 +571,6 @@ static int mtk_drm_sys_suspend(struct device *dev) ...@@ -571,7 +571,6 @@ static int mtk_drm_sys_suspend(struct device *dev)
int ret; int ret;
ret = drm_mode_config_helper_suspend(drm); ret = drm_mode_config_helper_suspend(drm);
DRM_DEBUG_DRIVER("mtk_drm_sys_suspend\n");
return ret; return ret;
} }
...@@ -583,7 +582,6 @@ static int mtk_drm_sys_resume(struct device *dev) ...@@ -583,7 +582,6 @@ static int mtk_drm_sys_resume(struct device *dev)
int ret; int ret;
ret = drm_mode_config_helper_resume(drm); ret = drm_mode_config_helper_resume(drm);
DRM_DEBUG_DRIVER("mtk_drm_sys_resume\n");
return ret; return ret;
} }
......
...@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, ...@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
true, true); true, true);
} }
static void mtk_plane_atomic_disable(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
state->pending.enable = false;
wmb(); /* Make sure the above parameter is set before update */
state->pending.dirty = true;
}
static void mtk_plane_atomic_update(struct drm_plane *plane, static void mtk_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
...@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, ...@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
if (!crtc || WARN_ON(!fb)) if (!crtc || WARN_ON(!fb))
return; return;
if (!plane->state->visible) {
mtk_plane_atomic_disable(plane, old_state);
return;
}
gem = fb->obj[0]; gem = fb->obj[0];
mtk_gem = to_mtk_gem_obj(gem); mtk_gem = to_mtk_gem_obj(gem);
addr = mtk_gem->dma_addr; addr = mtk_gem->dma_addr;
...@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, ...@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
state->pending.dirty = true; state->pending.dirty = true;
} }
static void mtk_plane_atomic_disable(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
state->pending.enable = false;
wmb(); /* Make sure the above parameter is set before update */
state->pending.dirty = true;
}
static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
.prepare_fb = drm_gem_fb_prepare_fb, .prepare_fb = drm_gem_fb_prepare_fb,
.atomic_check = mtk_plane_atomic_check, .atomic_check = mtk_plane_atomic_check,
......
...@@ -316,10 +316,7 @@ static void mtk_dsi_lane0_ulp_mode_leave(struct mtk_dsi *dsi) ...@@ -316,10 +316,7 @@ static void mtk_dsi_lane0_ulp_mode_leave(struct mtk_dsi *dsi)
static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi)
{ {
u32 tmp_reg1; return readl(dsi->regs + DSI_PHY_LCCON) & LC_HS_TX_EN;
tmp_reg1 = readl(dsi->regs + DSI_PHY_LCCON);
return ((tmp_reg1 & LC_HS_TX_EN) == 1) ? true : false;
} }
static void mtk_dsi_clk_hs_mode(struct mtk_dsi *dsi, bool enter) static void mtk_dsi_clk_hs_mode(struct mtk_dsi *dsi, bool enter)
......
...@@ -1630,8 +1630,6 @@ static int mtk_hdmi_audio_startup(struct device *dev, void *data) ...@@ -1630,8 +1630,6 @@ static int mtk_hdmi_audio_startup(struct device *dev, void *data)
{ {
struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
dev_dbg(dev, "%s\n", __func__);
mtk_hdmi_audio_enable(hdmi); mtk_hdmi_audio_enable(hdmi);
return 0; return 0;
...@@ -1641,8 +1639,6 @@ static void mtk_hdmi_audio_shutdown(struct device *dev, void *data) ...@@ -1641,8 +1639,6 @@ static void mtk_hdmi_audio_shutdown(struct device *dev, void *data)
{ {
struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
dev_dbg(dev, "%s\n", __func__);
mtk_hdmi_audio_disable(hdmi); mtk_hdmi_audio_disable(hdmi);
} }
...@@ -1651,8 +1647,6 @@ mtk_hdmi_audio_digital_mute(struct device *dev, void *data, bool enable) ...@@ -1651,8 +1647,6 @@ mtk_hdmi_audio_digital_mute(struct device *dev, void *data, bool enable)
{ {
struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
dev_dbg(dev, "%s(%d)\n", __func__, enable);
if (enable) if (enable)
mtk_hdmi_hw_aud_mute(hdmi); mtk_hdmi_hw_aud_mute(hdmi);
else else
...@@ -1665,8 +1659,6 @@ static int mtk_hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, ...@@ -1665,8 +1659,6 @@ static int mtk_hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,
{ {
struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
dev_dbg(dev, "%s\n", __func__);
memcpy(buf, hdmi->conn.eld, min(sizeof(hdmi->conn.eld), len)); memcpy(buf, hdmi->conn.eld, min(sizeof(hdmi->conn.eld), len));
return 0; return 0;
...@@ -1766,7 +1758,6 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev) ...@@ -1766,7 +1758,6 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev)
goto err_bridge_remove; goto err_bridge_remove;
} }
dev_dbg(dev, "mediatek hdmi probe success\n");
return 0; return 0;
err_bridge_remove: err_bridge_remove:
...@@ -1789,7 +1780,7 @@ static int mtk_hdmi_suspend(struct device *dev) ...@@ -1789,7 +1780,7 @@ static int mtk_hdmi_suspend(struct device *dev)
struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
mtk_hdmi_clk_disable_audio(hdmi); mtk_hdmi_clk_disable_audio(hdmi);
dev_dbg(dev, "hdmi suspend success!\n");
return 0; return 0;
} }
...@@ -1804,7 +1795,6 @@ static int mtk_hdmi_resume(struct device *dev) ...@@ -1804,7 +1795,6 @@ static int mtk_hdmi_resume(struct device *dev)
return ret; return ret;
} }
dev_dbg(dev, "hdmi resume success!\n");
return 0; return 0;
} }
#endif #endif
......
...@@ -107,60 +107,10 @@ ...@@ -107,60 +107,10 @@
#define RGS_HDMITX_5T1_EDG (0xf << 4) #define RGS_HDMITX_5T1_EDG (0xf << 4)
#define RGS_HDMITX_PLUG_TST BIT(0) #define RGS_HDMITX_PLUG_TST BIT(0)
static const u8 PREDIV[3][4] = {
{0x0, 0x0, 0x0, 0x0}, /* 27Mhz */
{0x1, 0x1, 0x1, 0x1}, /* 74Mhz */
{0x1, 0x1, 0x1, 0x1} /* 148Mhz */
};
static const u8 TXDIV[3][4] = {
{0x3, 0x3, 0x3, 0x2}, /* 27Mhz */
{0x2, 0x1, 0x1, 0x1}, /* 74Mhz */
{0x1, 0x0, 0x0, 0x0} /* 148Mhz */
};
static const u8 FBKSEL[3][4] = {
{0x1, 0x1, 0x1, 0x1}, /* 27Mhz */
{0x1, 0x0, 0x1, 0x1}, /* 74Mhz */
{0x1, 0x0, 0x1, 0x1} /* 148Mhz */
};
static const u8 FBKDIV[3][4] = {
{19, 24, 29, 19}, /* 27Mhz */
{19, 24, 14, 19}, /* 74Mhz */
{19, 24, 14, 19} /* 148Mhz */
};
static const u8 DIVEN[3][4] = {
{0x2, 0x1, 0x1, 0x2}, /* 27Mhz */
{0x2, 0x2, 0x2, 0x2}, /* 74Mhz */
{0x2, 0x2, 0x2, 0x2} /* 148Mhz */
};
static const u8 HTPLLBP[3][4] = {
{0xc, 0xc, 0x8, 0xc}, /* 27Mhz */
{0xc, 0xf, 0xf, 0xc}, /* 74Mhz */
{0xc, 0xf, 0xf, 0xc} /* 148Mhz */
};
static const u8 HTPLLBC[3][4] = {
{0x2, 0x3, 0x3, 0x2}, /* 27Mhz */
{0x2, 0x3, 0x3, 0x2}, /* 74Mhz */
{0x2, 0x3, 0x3, 0x2} /* 148Mhz */
};
static const u8 HTPLLBR[3][4] = {
{0x1, 0x1, 0x0, 0x1}, /* 27Mhz */
{0x1, 0x2, 0x2, 0x1}, /* 74Mhz */
{0x1, 0x2, 0x2, 0x1} /* 148Mhz */
};
static int mtk_hdmi_pll_prepare(struct clk_hw *hw) static int mtk_hdmi_pll_prepare(struct clk_hw *hw)
{ {
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
dev_dbg(hdmi_phy->dev, "%s\n", __func__);
mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_AUTOK_EN); mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_AUTOK_EN);
mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_PLL_POSDIV); mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_PLL_POSDIV);
mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON3, RG_HDMITX_MHLCK_EN); mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON3, RG_HDMITX_MHLCK_EN);
...@@ -178,8 +128,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) ...@@ -178,8 +128,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw)
{ {
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
dev_dbg(hdmi_phy->dev, "%s\n", __func__);
mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_TXDIV_EN); mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_TXDIV_EN);
mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_BIAS_LPF_EN); mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_BIAS_LPF_EN);
usleep_range(100, 150); usleep_range(100, 150);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment