Skip to content

Commit

Permalink
drm/i915/sdvo: Extract intel_sdvo_has_audio()
Browse files Browse the repository at this point in the history
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 <chaitanya.kumar.borah@intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026170150.2654-16-ville.syrjala@linux.intel.com
  • Loading branch information
Ville Syrjälä committed Oct 27, 2022
1 parent c3c5dc1 commit 8388eb0
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions drivers/gpu/drm/i915/display/intel_sdvo.c
Original file line number Diff line number Diff line change
@@ -1297,13 +1297,28 @@ static bool intel_sdvo_limited_color_range(struct intel_encoder *encoder,
return intel_hdmi_limited_color_range(crtc_state, conn_state);
}

static bool intel_sdvo_has_audio(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
const struct intel_digital_connector_state *intel_conn_state =
to_intel_digital_connector_state(conn_state);

if (!crtc_state->has_hdmi_sink)
return false;

if (intel_conn_state->force_audio == HDMI_AUDIO_AUTO)
return intel_sdvo->has_hdmi_audio;
else
return intel_conn_state->force_audio == HDMI_AUDIO_ON;
}

static int intel_sdvo_compute_config(struct intel_encoder *encoder,
struct intel_crtc_state *pipe_config,
struct drm_connector_state *conn_state)
{
struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
struct intel_sdvo_connector_state *intel_sdvo_state =
to_intel_sdvo_connector_state(conn_state);
struct intel_sdvo_connector *intel_sdvo_connector =
to_intel_sdvo_connector(conn_state->connector);
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,

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

if (pipe_config->has_hdmi_sink) {
if (intel_sdvo_state->base.force_audio == HDMI_AUDIO_AUTO)
pipe_config->has_audio = intel_sdvo->has_hdmi_audio;
else
pipe_config->has_audio =
intel_sdvo_state->base.force_audio == HDMI_AUDIO_ON;
}
pipe_config->has_audio = intel_sdvo_has_audio(encoder, pipe_config, conn_state);

pipe_config->limited_color_range =
intel_sdvo_limited_color_range(encoder, pipe_config,

0 comments on commit 8388eb0

Please sign in to comment.