[Intel-gfx] [PATCH 17/22] drm/i915/sdvo: Extract intel_sdvo_has_audio()
Jani Nikula
jani.nikula at linux.intel.com
Wed Oct 12 15:15:42 UTC 2022
On Tue, 11 Oct 2022, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Pull the SDVO audio state computaiton into a helper.
*computation
Reviewed-by: Jani Nikula <jani.nikula at intel.com>
>
> 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 at intel.com>
> Cc: Kai Vehmanen <kai.vehmanen at linux.intel.com>
> Cc: Takashi Iwai <tiwai at suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_sdvo.c | 27 +++++++++++++++--------
> 1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index cf8e80936d8e..8852564b5fbf 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -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,
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list