diff mbox

[4/6] drm/radeon/evergreen: setup HDMI before enabling it

Message ID 1365895584-20999-5-git-send-email-zajec5@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rafał Miłecki April 13, 2013, 11:26 p.m. UTC
Closed source driver fglrx seems to enable infoframes and audio packets
at the end, which makes sense, do the same.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/gpu/drm/radeon/evergreen_hdmi.c |   15 +++++++++++----
 drivers/gpu/drm/radeon/evergreend.h     |    1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

Comments

Paul Menzel April 14, 2013, 10:39 a.m. UTC | #1
Am Sonntag, den 14.04.2013, 01:26 +0200 schrieb Rafa? Mi?ecki:
> Closed source driver fglrx seems to enable infoframes and audio packets
> at the end, which makes sense, do the same.

Any functionality change? Does not sound like it, but being unambiguous
is better.

> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> ---
>  drivers/gpu/drm/radeon/evergreen_hdmi.c |   15 +++++++++++----
>  drivers/gpu/drm/radeon/evergreend.h     |    1 +
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> index 8b64bf1..6b25c1b 100644
> --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
> +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> @@ -116,7 +116,6 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>  	       HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */
>  
>  	WREG32(AFMT_AUDIO_PACKET_CONTROL + offset,
> -	       AFMT_AUDIO_SAMPLE_SEND | /* send audio packets */
>  	       AFMT_60958_CS_UPDATE); /* allow 60958 channel status fields to be updated */
>  
>  	WREG32(HDMI_ACR_PACKET_CONTROL + offset,
> @@ -129,8 +128,6 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>  	       HDMI_GC_CONT); /* send general control packets every frame */
>  
>  	WREG32(HDMI_INFOFRAME_CONTROL0 + offset,
> -	       HDMI_AVI_INFO_SEND | /* enable AVI info frames */
> -	       HDMI_AVI_INFO_CONT | /* send AVI info frames every frame/field */
>  	       HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
>  	       HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */
>  
> @@ -138,7 +135,6 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>  	       AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */
>  
>  	WREG32(HDMI_INFOFRAME_CONTROL1 + offset,
> -	       HDMI_AVI_INFO_LINE(2) | /* anything other than 0 */
>  	       HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */
>  
>  	WREG32(HDMI_GC + offset, 0); /* unset HDMI_GC_AVMUTE */
> @@ -165,6 +161,14 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>  	evergreen_hdmi_update_avi_infoframe(encoder, buffer, sizeof(buffer));
>  	evergreen_hdmi_update_ACR(encoder, mode->clock);
>  
> +	WREG32_OR(HDMI_INFOFRAME_CONTROL0 + offset,
> +		  HDMI_AVI_INFO_SEND | /* enable AVI info frames */
> +		  HDMI_AVI_INFO_CONT); /* required for audio info values to be updated */
> +
> +	WREG32_P(HDMI_INFOFRAME_CONTROL1 + offset,
> +		 HDMI_AVI_INFO_LINE(2), /* anything other than 0 */
> +		 ~HDMI_AVI_INFO_LINE_MASK);
> +
>  	/*
>  	 * At this point fglrx changes following regs:
>  	 * DCE41: 0x7a70
> @@ -172,6 +176,9 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>  	 * Is that something audio related?
>  	 */
>  
> +	WREG32_OR(AFMT_AUDIO_PACKET_CONTROL + offset,
> +		  AFMT_AUDIO_SAMPLE_SEND); /* send audio packets */
> +
>  	/* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
>  	WREG32(AFMT_RAMP_CONTROL0 + offset, 0x00FFFFFF);
>  	WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF);
> diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
> index 982d25a..e39e4f4 100644
> --- a/drivers/gpu/drm/radeon/evergreend.h
> +++ b/drivers/gpu/drm/radeon/evergreend.h
> @@ -197,6 +197,7 @@
>  #       define HDMI_MPEG_INFO_CONT           (1 << 9)
>  #define HDMI_INFOFRAME_CONTROL1              0x7048
>  #       define HDMI_AVI_INFO_LINE(x)         (((x) & 0x3f) << 0)
> +#       define HDMI_AVI_INFO_LINE_MASK       (0x3f << 0)

Is this in a data sheet?

>  #       define HDMI_AUDIO_INFO_LINE(x)       (((x) & 0x3f) << 8)
>  #       define HDMI_MPEG_INFO_LINE(x)        (((x) & 0x3f) << 16)
>  #define HDMI_GENERIC_PACKET_CONTROL          0x704c


Thanks,

Paul
Rafał Miłecki April 14, 2013, 12:58 p.m. UTC | #2
2013/4/14 Paul Menzel <paulepanter@users.sourceforge.net>:
> Am Sonntag, den 14.04.2013, 01:26 +0200 schrieb Rafa? Mi?ecki:
>> Closed source driver fglrx seems to enable infoframes and audio packets
>> at the end, which makes sense, do the same.
>
> Any functionality change? Does not sound like it, but being unambiguous
> is better.

No, just changing the order.


>> diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
>> index 982d25a..e39e4f4 100644
>> --- a/drivers/gpu/drm/radeon/evergreend.h
>> +++ b/drivers/gpu/drm/radeon/evergreend.h
>> @@ -197,6 +197,7 @@
>>  #       define HDMI_MPEG_INFO_CONT           (1 << 9)
>>  #define HDMI_INFOFRAME_CONTROL1              0x7048
>>  #       define HDMI_AVI_INFO_LINE(x)         (((x) & 0x3f) << 0)
>> +#       define HDMI_AVI_INFO_LINE_MASK       (0x3f << 0)
>
> Is this in a data sheet?

We don't have any HDMI related specs released. Just common sense.
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index 8b64bf1..6b25c1b 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -116,7 +116,6 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	       HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */
 
 	WREG32(AFMT_AUDIO_PACKET_CONTROL + offset,
-	       AFMT_AUDIO_SAMPLE_SEND | /* send audio packets */
 	       AFMT_60958_CS_UPDATE); /* allow 60958 channel status fields to be updated */
 
 	WREG32(HDMI_ACR_PACKET_CONTROL + offset,
@@ -129,8 +128,6 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	       HDMI_GC_CONT); /* send general control packets every frame */
 
 	WREG32(HDMI_INFOFRAME_CONTROL0 + offset,
-	       HDMI_AVI_INFO_SEND | /* enable AVI info frames */
-	       HDMI_AVI_INFO_CONT | /* send AVI info frames every frame/field */
 	       HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
 	       HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */
 
@@ -138,7 +135,6 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	       AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */
 
 	WREG32(HDMI_INFOFRAME_CONTROL1 + offset,
-	       HDMI_AVI_INFO_LINE(2) | /* anything other than 0 */
 	       HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */
 
 	WREG32(HDMI_GC + offset, 0); /* unset HDMI_GC_AVMUTE */
@@ -165,6 +161,14 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	evergreen_hdmi_update_avi_infoframe(encoder, buffer, sizeof(buffer));
 	evergreen_hdmi_update_ACR(encoder, mode->clock);
 
+	WREG32_OR(HDMI_INFOFRAME_CONTROL0 + offset,
+		  HDMI_AVI_INFO_SEND | /* enable AVI info frames */
+		  HDMI_AVI_INFO_CONT); /* required for audio info values to be updated */
+
+	WREG32_P(HDMI_INFOFRAME_CONTROL1 + offset,
+		 HDMI_AVI_INFO_LINE(2), /* anything other than 0 */
+		 ~HDMI_AVI_INFO_LINE_MASK);
+
 	/*
 	 * At this point fglrx changes following regs:
 	 * DCE41: 0x7a70
@@ -172,6 +176,9 @@  void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
 	 * Is that something audio related?
 	 */
 
+	WREG32_OR(AFMT_AUDIO_PACKET_CONTROL + offset,
+		  AFMT_AUDIO_SAMPLE_SEND); /* send audio packets */
+
 	/* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
 	WREG32(AFMT_RAMP_CONTROL0 + offset, 0x00FFFFFF);
 	WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF);
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 982d25a..e39e4f4 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -197,6 +197,7 @@ 
 #       define HDMI_MPEG_INFO_CONT           (1 << 9)
 #define HDMI_INFOFRAME_CONTROL1              0x7048
 #       define HDMI_AVI_INFO_LINE(x)         (((x) & 0x3f) << 0)
+#       define HDMI_AVI_INFO_LINE_MASK       (0x3f << 0)
 #       define HDMI_AUDIO_INFO_LINE(x)       (((x) & 0x3f) << 8)
 #       define HDMI_MPEG_INFO_LINE(x)        (((x) & 0x3f) << 16)
 #define HDMI_GENERIC_PACKET_CONTROL          0x704c