Commit 7cc4ab22 authored by Russell King's avatar Russell King Committed by Archit Taneja

drm/bridge: dw-hdmi: add better clock disable control

The video setup path aways sets the clock disable register to a specific
value, which has the effect of disabling the CEC engine.  When we add the
CEC driver, this becomes a problem.

Fix this by only setting/clearing the bits that the video path needs to.
Reviewed-by: default avatarJose Abreu <joabreu@synopsys.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Tested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/E1dcBha-00088l-DE@rmk-PC.armlinux.org.uk
parent e84b8d75
...@@ -166,6 +166,7 @@ struct dw_hdmi { ...@@ -166,6 +166,7 @@ struct dw_hdmi {
bool bridge_is_on; /* indicates the bridge is on */ bool bridge_is_on; /* indicates the bridge is on */
bool rxsense; /* rxsense state */ bool rxsense; /* rxsense state */
u8 phy_mask; /* desired phy int mask settings */ u8 phy_mask; /* desired phy int mask settings */
u8 mc_clkdis; /* clock disable register */
spinlock_t audio_lock; spinlock_t audio_lock;
struct mutex audio_mutex; struct mutex audio_mutex;
...@@ -551,8 +552,11 @@ EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); ...@@ -551,8 +552,11 @@ EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate);
static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable)
{ {
hdmi_modb(hdmi, enable ? 0 : HDMI_MC_CLKDIS_AUDCLK_DISABLE, if (enable)
HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE;
else
hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE;
hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
} }
static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi)
...@@ -1574,8 +1578,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, ...@@ -1574,8 +1578,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
/* HDMI Initialization Step B.4 */ /* HDMI Initialization Step B.4 */
static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
{ {
u8 clkdis;
/* control period minimum duration */ /* control period minimum duration */
hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR); hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR);
hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR); hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR);
...@@ -1587,17 +1589,21 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) ...@@ -1587,17 +1589,21 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM); hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM);
/* Enable pixel clock and tmds data path */ /* Enable pixel clock and tmds data path */
clkdis = 0x7F; hdmi->mc_clkdis |= HDMI_MC_CLKDIS_HDCPCLK_DISABLE |
clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE; HDMI_MC_CLKDIS_CSCCLK_DISABLE |
hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); HDMI_MC_CLKDIS_AUDCLK_DISABLE |
HDMI_MC_CLKDIS_PREPCLK_DISABLE |
HDMI_MC_CLKDIS_TMDSCLK_DISABLE;
hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE;
hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE; hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE;
hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
/* Enable csc path */ /* Enable csc path */
if (is_color_space_conversion(hdmi)) { if (is_color_space_conversion(hdmi)) {
clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE;
hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
} }
/* Enable color space conversion if needed */ /* Enable color space conversion if needed */
...@@ -2272,6 +2278,7 @@ __dw_hdmi_probe(struct platform_device *pdev, ...@@ -2272,6 +2278,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
hdmi->disabled = true; hdmi->disabled = true;
hdmi->rxsense = true; hdmi->rxsense = true;
hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE);
hdmi->mc_clkdis = 0x7f;
mutex_init(&hdmi->mutex); mutex_init(&hdmi->mutex);
mutex_init(&hdmi->audio_mutex); mutex_init(&hdmi->audio_mutex);
......
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