dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>, slava.grigorev@amd.com
Subject: [PATCH 22/24] radeon/audio: moved audio caps programming to audio_hotplug() function
Date: Tue, 13 Jan 2015 12:46:51 -0500	[thread overview]
Message-ID: <1421171213-23977-23-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1421171213-23977-1-git-send-email-alexander.deucher@amd.com>

From: Slava Grigorev <slava.grigorev@amd.com>

Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/radeon/radeon_audio.c | 78 +++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index 6c4631b..fc7a975 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -301,38 +301,6 @@ int radeon_audio_init(struct radeon_device *rdev)
 	return 0;
 }
 
-void radeon_audio_detect(struct drm_connector *connector,
-	enum drm_connector_status status)
-{
-	if (!connector || !connector->encoder)
-		return;
-
-	if (status == connector_status_connected) {
-		int sink_type;
-		struct radeon_device *rdev = connector->encoder->dev->dev_private;
-		struct radeon_connector *radeon_connector;
-		struct radeon_encoder *radeon_encoder =
-			to_radeon_encoder(connector->encoder);
-
-		if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) {
-			radeon_encoder->audio = 0;
-			return;
-		}
-
-		radeon_connector = to_radeon_connector(connector);
-		sink_type = radeon_dp_getsinktype(radeon_connector);
-
-		if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
-			sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT)
-			radeon_encoder->audio = rdev->audio.dp_funcs;
-		else
-			radeon_encoder->audio = rdev->audio.hdmi_funcs;
-		/* TODO: set up the sads, etc. and set the audio enable_mask */
-	} else {
-		/* TODO: reset the audio enable_mask */
-	}
-}
-
 u32 radeon_audio_endpoint_rreg(struct radeon_device *rdev, u32 offset, u32 reg)
 {
 	if (rdev->audio.funcs->endpoint_rreg)
@@ -471,6 +439,49 @@ void radeon_audio_enable(struct radeon_device *rdev,
 		rdev->audio.funcs->enable(rdev, pin, enable_mask);
 }
 
+void radeon_audio_detect(struct drm_connector *connector,
+	enum drm_connector_status status)
+{
+	struct radeon_device *rdev;
+	struct radeon_encoder *radeon_encoder;
+	struct radeon_encoder_atom_dig *dig;
+
+	if (!connector || !connector->encoder)
+		return;
+
+	rdev = connector->encoder->dev->dev_private;
+	radeon_encoder = to_radeon_encoder(connector->encoder);
+	dig = radeon_encoder->enc_priv;
+
+	if (status == connector_status_connected) {
+		struct radeon_connector *radeon_connector;
+		int sink_type;
+
+		if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) {
+			radeon_encoder->audio = 0;
+			return;
+		}
+
+		radeon_connector = to_radeon_connector(connector);
+		sink_type = radeon_dp_getsinktype(radeon_connector);
+
+		if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
+			sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT)
+			radeon_encoder->audio = rdev->audio.dp_funcs;
+		else
+			radeon_encoder->audio = rdev->audio.hdmi_funcs;
+
+		radeon_audio_write_speaker_allocation(connector->encoder);
+		radeon_audio_write_sad_regs(connector->encoder);
+		if (connector->encoder->crtc)
+			radeon_audio_write_latency_fields(connector->encoder,
+				&connector->encoder->crtc->mode);
+		radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
+	} else {
+		radeon_audio_enable(rdev, dig->afmt->pin, 0);
+	}
+}
+
 void radeon_audio_fini(struct radeon_device *rdev)
 {
 	int i;
@@ -689,11 +700,8 @@ static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
 	radeon_hdmi_set_color_depth(encoder);
 	radeon_audio_set_mute(encoder, false);
 	radeon_audio_update_acr(encoder, mode->clock);
-	radeon_audio_write_speaker_allocation(encoder);
 	radeon_audio_set_audio_packet(encoder);
 	radeon_audio_select_pin(encoder);
-	radeon_audio_write_sad_regs(encoder);
-	radeon_audio_write_latency_fields(encoder, mode);
 
 	if (radeon_audio_set_avi_packet(encoder, mode) < 0)
 		return;
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-01-13 17:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 17:46 [PATCH 00/24] radeon audio rework Alex Deucher
2015-01-13 17:46 ` [PATCH 01/24] radeon/audio: consolidate audio_init() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 02/24] radeon/audio: defined initial audio interface that gets initialized via detect() call Alex Deucher
2015-01-13 17:46 ` [PATCH 03/24] radeon/audio: consolidate write_sad_regs() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 04/24] radeon/audio: consolidate write_speaker_allocation() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 05/24] radeon/audio: consolidate write_latency_fields() functions Alex Deucher
2015-01-14 14:51   ` Christian König
2015-01-13 17:46 ` [PATCH 06/24] radeon/audio: consolidate audio_get_pin() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 07/24] radeon/audio: consolidate select_pin() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 08/24] radeon/audio: consolidate audio_enable() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 09/24] radeon/audio: consolidate audio_fini() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 10/24] radeon/audio: consolidate audio_set_dto() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 11/24] radeon/audio: consolidate update_avi_infoframe() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 12/24] radeon/audio: consolidate update_acr() functions Alex Deucher
2015-01-14 14:55   ` Christian König
2015-01-13 17:46 ` [PATCH 13/24] radeon/audio: moved VBI packet programming to separate functions Alex Deucher
2015-01-13 17:46 ` [PATCH 14/24] radeon: moved HDMI color depth programming to a separate function Alex Deucher
2015-01-13 17:46 ` [PATCH 15/24] radeon/audio: removed unnecessary CRC control programing Alex Deucher
2015-01-13 17:46 ` [PATCH 16/24] radeon/audio: set_avi_packet() function cleanup Alex Deucher
2015-01-13 17:46 ` [PATCH 17/24] radeon/audio: moved audio packet programming to a separate function Alex Deucher
2015-01-13 17:46 ` [PATCH 18/24] radeon/audio: moved mute " Alex Deucher
2015-01-13 17:46 ` [PATCH 19/24] radeon/audio: removed unnecessary debug settings Alex Deucher
2015-01-13 17:46 ` [PATCH 20/24] radeon/audio: consolidate audio_mode_set() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 21/24] radeon/audio: applied audio_dpms() and audio_mode_set() calls Alex Deucher
2015-01-13 17:46 ` Alex Deucher [this message]
2015-01-13 17:46 ` [PATCH 23/24] radeon/audio: enable DP audio Alex Deucher
2015-01-13 17:46 ` [PATCH 24/24] drm/radeon: whitespace clean up in radeon_audio.c Alex Deucher
2015-01-14 15:01 ` [PATCH 00/24] radeon audio rework Christian König
2015-01-14 21:47   ` Alex Deucher

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=1421171213-23977-23-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=slava.grigorev@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox