All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] drm/bridge: dw-hdmi: add better clock disable control
Date: Tue, 30 May 2017 15:23:17 +0100	[thread overview]
Message-ID: <E1dFi3J-0004lo-TU@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20170530142218.GS22219@n2100.armlinux.org.uk>

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.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 966422576c44..58781d4c1034 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -166,6 +166,7 @@ struct dw_hdmi {
 	bool bridge_is_on;		/* indicates the bridge is on */
 	bool rxsense;			/* rxsense state */
 	u8 phy_mask;			/* desired phy int mask settings */
+	u8 mc_clkdis;			/* clock disable register */
 
 	spinlock_t audio_lock;
 	struct mutex audio_mutex;
@@ -1543,8 +1544,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 /* HDMI Initialization Step B.4 */
 static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 {
-	u8 clkdis;
-
 	/* control period minimum duration */
 	hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR);
 	hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR);
@@ -1556,17 +1555,21 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 	hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM);
 
 	/* Enable pixel clock and tmds data path */
-	clkdis = 0x7F;
-	clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE;
-	hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis |= HDMI_MC_CLKDIS_HDCPCLK_DISABLE |
+			   HDMI_MC_CLKDIS_CSCCLK_DISABLE |
+			   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_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE;
+	hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 
 	/* Enable csc path */
 	if (is_color_space_conversion(hdmi)) {
-		clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE;
-		hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+		hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE;
+		hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 	}
 
 	/* Enable color space conversion if needed */
@@ -1580,7 +1583,8 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 
 static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi)
 {
-	hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE;
+	hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 }
 
 /* Workaround to clear the overflow condition */
@@ -2261,6 +2265,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
 	hdmi->disabled = true;
 	hdmi->rxsense = true;
 	hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE);
+	hdmi->mc_clkdis = 0x7f;
 
 	mutex_init(&hdmi->mutex);
 	mutex_init(&hdmi->audio_mutex);
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Russell King <rmk+kernel@armlinux.org.uk>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: David Airlie <airlied@linux.ie>,
	Archit Taneja <architt@codeaurora.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] drm/bridge: dw-hdmi: add better clock disable control
Date: Tue, 30 May 2017 15:23:17 +0100	[thread overview]
Message-ID: <E1dFi3J-0004lo-TU@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20170530142218.GS22219@n2100.armlinux.org.uk>

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.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 966422576c44..58781d4c1034 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -166,6 +166,7 @@ struct dw_hdmi {
 	bool bridge_is_on;		/* indicates the bridge is on */
 	bool rxsense;			/* rxsense state */
 	u8 phy_mask;			/* desired phy int mask settings */
+	u8 mc_clkdis;			/* clock disable register */
 
 	spinlock_t audio_lock;
 	struct mutex audio_mutex;
@@ -1543,8 +1544,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 /* HDMI Initialization Step B.4 */
 static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 {
-	u8 clkdis;
-
 	/* control period minimum duration */
 	hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR);
 	hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR);
@@ -1556,17 +1555,21 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 	hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM);
 
 	/* Enable pixel clock and tmds data path */
-	clkdis = 0x7F;
-	clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE;
-	hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis |= HDMI_MC_CLKDIS_HDCPCLK_DISABLE |
+			   HDMI_MC_CLKDIS_CSCCLK_DISABLE |
+			   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_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE;
+	hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 
 	/* Enable csc path */
 	if (is_color_space_conversion(hdmi)) {
-		clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE;
-		hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS);
+		hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE;
+		hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 	}
 
 	/* Enable color space conversion if needed */
@@ -1580,7 +1583,8 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi)
 
 static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi)
 {
-	hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
+	hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE;
+	hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS);
 }
 
 /* Workaround to clear the overflow condition */
@@ -2261,6 +2265,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
 	hdmi->disabled = true;
 	hdmi->rxsense = true;
 	hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE);
+	hdmi->mc_clkdis = 0x7f;
 
 	mutex_init(&hdmi->mutex);
 	mutex_init(&hdmi->audio_mutex);
-- 
2.7.4

  parent reply	other threads:[~2017-05-30 14:23 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 14:22 [PATCH 0/4] dw-hdmi CEC support Russell King - ARM Linux
2017-05-30 14:22 ` Russell King - ARM Linux
2017-05-30 14:23 ` [PATCH 1/4] drm/bridge: dw-hdmi: remove CEC engine register definitions Russell King
2017-05-30 14:23   ` Russell King
2017-06-09 14:24   ` Hans Verkuil
2017-06-09 14:24     ` Hans Verkuil
2017-05-30 14:23 ` [PATCH 2/4] drm/bridge: dw-hdmi: add cec notifier support Russell King
2017-05-30 14:23   ` Russell King
2017-06-09 12:59   ` Neil Armstrong
2017-06-09 12:59     ` Neil Armstrong
2017-06-09 13:38     ` Russell King - ARM Linux
2017-06-09 13:38       ` Russell King - ARM Linux
2017-06-09 13:51       ` Hans Verkuil
2017-06-09 13:51         ` Hans Verkuil
2017-06-09 13:56       ` Neil Armstrong
2017-06-09 13:56         ` Neil Armstrong
2017-06-09 14:04         ` Hans Verkuil
2017-06-09 14:04           ` Hans Verkuil
2017-06-09 14:10         ` Russell King - ARM Linux
2017-06-09 14:10           ` Russell King - ARM Linux
2017-06-09 14:38           ` Hans Verkuil
2017-06-09 14:38             ` Hans Verkuil
2017-07-17  8:56           ` Hans Verkuil
2017-07-17  8:56             ` Hans Verkuil
2017-07-17  9:05             ` Russell King - ARM Linux
2017-07-17  9:05               ` Russell King - ARM Linux
2017-07-17 11:19               ` Hans Verkuil
2017-07-17 11:19                 ` Hans Verkuil
2017-07-17 11:39               ` Hans Verkuil
2017-07-17 11:39                 ` Hans Verkuil
2017-07-17 12:05                 ` Russell King - ARM Linux
2017-07-17 12:05                   ` Russell King - ARM Linux
2017-07-17 12:23                   ` Hans Verkuil
2017-07-17 12:23                     ` Hans Verkuil
2017-07-24 12:16                     ` Hans Verkuil
2017-07-24 12:16                       ` Hans Verkuil
2017-07-24 13:07                       ` Russell King - ARM Linux
2017-07-24 13:07                         ` Russell King - ARM Linux
2017-07-24 16:34                         ` Russell King - ARM Linux
2017-07-24 16:34                           ` Russell King - ARM Linux
2017-06-09 14:27   ` Hans Verkuil
2017-06-09 14:27     ` Hans Verkuil
2017-05-30 14:23 ` Russell King [this message]
2017-05-30 14:23   ` [PATCH 3/4] drm/bridge: dw-hdmi: add better clock disable control Russell King
2017-06-01  0:55   ` Jose Abreu
2017-06-01  0:55     ` Jose Abreu
2017-06-09 14:28   ` Hans Verkuil
2017-06-09 14:28     ` Hans Verkuil
2017-05-30 14:23 ` [PATCH 4/4] drm/bridge: dw-hdmi: add cec driver Russell King
2017-05-30 14:23   ` Russell King
2017-06-01  0:53   ` Jose Abreu
2017-06-01  0:53     ` Jose Abreu
2017-06-01 22:30     ` Russell King - ARM Linux
2017-06-01 22:30       ` Russell King - ARM Linux
2017-06-02  5:02       ` Jose Abreu
2017-06-02  5:02         ` Jose Abreu
2017-06-02  9:15         ` Russell King - ARM Linux
2017-06-02  9:15           ` Russell King - ARM Linux
2017-06-02  9:28           ` Hans Verkuil
2017-06-02  9:28             ` Hans Verkuil
2017-06-02  9:36             ` Russell King - ARM Linux
2017-06-02  9:36               ` Russell King - ARM Linux
2017-06-01  8:31   ` Hans Verkuil
2017-06-01  8:31     ` Hans Verkuil
2017-06-01  9:46     ` Russell King - ARM Linux
2017-06-01  9:46       ` Russell King - ARM Linux
2017-06-01 10:44       ` Hans Verkuil
2017-06-01 10:44         ` Hans Verkuil
2017-06-02 12:07     ` Russell King - ARM Linux
2017-06-02 12:07       ` Russell King - ARM Linux
2017-06-02 12:29       ` Hans Verkuil
2017-06-02 12:29         ` Hans Verkuil
2017-06-12  8:42     ` Hans Verkuil
2017-06-12  8:42       ` Hans Verkuil
2017-06-01 13:47   ` Neil Armstrong
2017-06-01 13:47     ` Neil Armstrong
2017-06-02  6:31     ` Hans Verkuil
2017-06-02  6:31       ` Hans Verkuil
2017-06-02  6:43       ` Jose Abreu
2017-06-02  6:43         ` Jose Abreu
2017-06-02  9:06         ` Hans Verkuil
2017-06-02  9:06           ` Hans Verkuil
2017-06-02  9:18           ` Russell King - ARM Linux
2017-06-02  9:18             ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1dFi3J-0004lo-TU@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.