Skip to content

Commit 8388eb0

Browse files
committed
drm/i915/sdvo: Extract intel_sdvo_has_audio()
Pull the SDVO audio state computation into a helper. This is almost identical to intel_hdmi_has_audio(), except the sink capabilities are stored under intel_sdvo rather than intel_hdmi. Might be nice to get rid of this duplication eventually... Cc: Chaitanya Kumar Borah <[email protected]> Cc: Kai Vehmanen <[email protected]> Cc: Takashi Iwai <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Reviewed-by: Kai Vehmanen <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c3c5dc1 commit 8388eb0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

drivers/gpu/drm/i915/display/intel_sdvo.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,13 +1297,28 @@ static bool intel_sdvo_limited_color_range(struct intel_encoder *encoder,
12971297
return intel_hdmi_limited_color_range(crtc_state, conn_state);
12981298
}
12991299

1300+
static bool intel_sdvo_has_audio(struct intel_encoder *encoder,
1301+
const struct intel_crtc_state *crtc_state,
1302+
const struct drm_connector_state *conn_state)
1303+
{
1304+
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
1305+
const struct intel_digital_connector_state *intel_conn_state =
1306+
to_intel_digital_connector_state(conn_state);
1307+
1308+
if (!crtc_state->has_hdmi_sink)
1309+
return false;
1310+
1311+
if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
1312+
return intel_sdvo->has_hdmi_audio;
1313+
else
1314+
return intel_conn_state->force_audio == HDMI_AUDIO_ON;
1315+
}
1316+
13001317
static int intel_sdvo_compute_config(struct intel_encoder *encoder,
13011318
struct intel_crtc_state *pipe_config,
13021319
struct drm_connector_state *conn_state)
13031320
{
13041321
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
1305-
struct intel_sdvo_connector_state *intel_sdvo_state =
1306-
to_intel_sdvo_connector_state(conn_state);
13071322
struct intel_sdvo_connector *intel_sdvo_connector =
13081323
to_intel_sdvo_connector(conn_state->connector);
13091324
struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
@@ -1362,13 +1377,7 @@ static int intel_sdvo_compute_config(struct intel_encoder *encoder,
13621377

13631378
pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_sdvo, conn_state);
13641379

1365-
if (pipe_config->has_hdmi_sink) {
1366-
if (intel_sdvo_state->base.force_audio == HDMI_AUDIO_AUTO)
1367-
pipe_config->has_audio = intel_sdvo->has_hdmi_audio;
1368-
else
1369-
pipe_config->has_audio =
1370-
intel_sdvo_state->base.force_audio == HDMI_AUDIO_ON;
1371-
}
1380+
pipe_config->has_audio = intel_sdvo_has_audio(encoder, pipe_config, conn_state);
13721381

13731382
pipe_config->limited_color_range =
13741383
intel_sdvo_limited_color_range(encoder, pipe_config,

0 commit comments

Comments
 (0)