Skip to contentSkip to conversation

drm/i915: use the new hdmi_force_audio enum more

PATCH Applied Daniel Vetter 4 participants 4 messages Feb 23, 2012 – Feb 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: use the new hdmi_force_audio enum more

While fixing up a merge conflict with drm-next I've noticed that we use the same audio drm connector property also for dp and sdvo outputs.

So put the new enum to some good use and convert these paths, too. The HDMI_AUDIO_ prefix is a bit a misnomer. But at least for sdvo it makes sense (and you can also connect a hdmi monitor with a dp->hdmi cable), so I've decided to stick with it.

---
 drivers/gpu/drm/i915/intel_dp.c   |   10 +++++-----
 drivers/gpu/drm/i915/intel_sdvo.c |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +5 -5
index 39eccf9..110552f 100644
@@ -49,7 +49,7 @@ struct intel_dp {
 	uint32_t DP;
 	uint8_t  link_configuration[DP_LINK_CONFIGURATION_SIZE];
 	bool has_audio;
-	int force_audio;
+	enum hdmi_force_audio force_audio;
 	uint32_t color_range;
 	int dpms_mode;
 	uint8_t link_bw;
@@ -2116,8 +2116,8 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	if (status != connector_status_connected)
 		return status;
 
-	if (intel_dp->force_audio) {
-		intel_dp->has_audio = intel_dp->force_audio > 0;
+	if (intel_dp->force_audio != HDMI_AUDIO_AUTO) {
+		intel_dp->has_audio = (intel_dp->force_audio == HDMI_AUDIO_ON);
 	} else {
 		edid = intel_dp_get_edid(connector, &intel_dp->adapter);
 		if (edid) {
@@ -2217,10 +2217,10 @@ intel_dp_set_property(struct drm_connector *connector,
 
 		intel_dp->force_audio = i;
 
-		if (i == 0)
+		if (i == HDMI_AUDIO_AUTO)
 			has_audio = intel_dp_detect_audio(connector);
 		else
-			has_audio = i > 0;
+			has_audio = (i == HDMI_AUDIO_ON);
 
 		if (has_audio == intel_dp->has_audio)
 			return 0;
drivers/gpu/drm/i915/intel_sdvo.c +5 -5
index 724190e..e36b171 100644
@@ -148,7 +148,7 @@ struct intel_sdvo_connector {
 	/* Mark the type of connector */
 	uint16_t output_flag;
 
-	int force_audio;
+	enum hdmi_force_audio force_audio;
 
 	/* This contains all current supported TV format */
 	u8 tv_format_supported[TV_FORMAT_NUM];
@@ -1309,8 +1309,8 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
 
 	if (status == connector_status_connected) {
 		struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
-		if (intel_sdvo_connector->force_audio)
-			intel_sdvo->has_hdmi_audio = intel_sdvo_connector->force_audio > 0;
+		if (intel_sdvo_connector->force_audio != HDMI_AUDIO_AUTO)
+			intel_sdvo->has_hdmi_audio = (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON);
 	}
 
 	return status;
@@ -1683,10 +1683,10 @@ intel_sdvo_set_property(struct drm_connector *connector,
 
 		intel_sdvo_connector->force_audio = i;
 
-		if (i == 0)
+		if (i == HDMI_AUDIO_AUTO)
 			has_audio = intel_sdvo_detect_hdmi_audio(connector);
 		else
-			has_audio = i > 0;
+			has_audio = (i == HDMI_AUDIO_ON);
 
 		if (has_audio == intel_sdvo->has_hdmi_audio)
 			return 0;
Signature · 1 line
1.7.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Daniel Vetter

While fixing up a merge conflict with drm-next I've noticed that we use the same audio drm connector property also for dp and sdvo outputs.

So put the new enum to some good use and convert these paths, too. The HDMI_AUDIO_ prefix is a bit a misnomer. But at least for sdvo it makes sense (and you can also connect a hdmi monitor with a dp->hdmi cable), so I've decided to stick with it.

Review fail, I should have picked that up earlier.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter
Quoted 11 lines · Daniel Vetter

While fixing up a merge conflict with drm-next I've noticed that we use the same audio drm connector property also for dp and sdvo outputs.

So put the new enum to some good use and convert these paths, too. The HDMI_AUDIO_ prefix is a bit a misnomer. But at least for sdvo it makes sense (and you can also connect a hdmi monitor with a dp->hdmi cable), so I've decided to stick with it.

Thanks!

#3 lore raw
Quoted 10 lines · Wu Fengguang
Quoted 9 lines · Daniel Vetter

While fixing up a merge conflict with drm-next I've noticed that we use the same audio drm connector property also for dp and sdvo outputs.

So put the new enum to some good use and convert these paths, too. The HDMI_AUDIO_ prefix is a bit a misnomer. But at least for sdvo it makes sense (and you can also connect a hdmi monitor with a dp->hdmi cable), so I've decided to stick with it.

Quoted 4 lines
Quoted 2 lines

Queued for -next, thanks for the reviews.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48