Commit b32962f8 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Handle force_audio correctly in intel_sdvo

Do the same as other connectors, attempt to detect hdmi audio in
the detect() callback, and only use the force_audio property as
override. Compute has_audio in pipe_config, and use that value
instead of the probed value directly.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170501133804.8116-12-maarten.lankhorst@linux.intel.com
parent 7a5ca19f
...@@ -1122,6 +1122,8 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, ...@@ -1122,6 +1122,8 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
struct drm_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
struct intel_sdvo *intel_sdvo = to_sdvo(encoder); struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
struct intel_sdvo_connector *intel_sdvo_connector =
to_intel_sdvo_connector(conn_state->connector);
struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
struct drm_display_mode *mode = &pipe_config->base.mode; struct drm_display_mode *mode = &pipe_config->base.mode;
...@@ -1160,8 +1162,13 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, ...@@ -1160,8 +1162,13 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
pipe_config->pixel_multiplier = pipe_config->pixel_multiplier =
intel_sdvo_get_pixel_multiplier(adjusted_mode); intel_sdvo_get_pixel_multiplier(adjusted_mode);
if (intel_sdvo_connector->force_audio != HDMI_AUDIO_OFF_DVI)
pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor; pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor;
if (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON ||
(intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO && intel_sdvo->has_hdmi_audio))
pipe_config->has_audio = true;
if (intel_sdvo->color_range_auto) { if (intel_sdvo->color_range_auto) {
/* See CEA-861-E - 5.1 Default Encoding Parameters */ /* See CEA-861-E - 5.1 Default Encoding Parameters */
/* FIXME: This bit is only valid when using TMDS encoding and 8 /* FIXME: This bit is only valid when using TMDS encoding and 8
...@@ -1285,7 +1292,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder, ...@@ -1285,7 +1292,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
else else
sdvox |= SDVO_PIPE_SEL(crtc->pipe); sdvox |= SDVO_PIPE_SEL(crtc->pipe);
if (intel_sdvo->has_hdmi_audio) if (crtc_state->has_audio)
sdvox |= SDVO_AUDIO_ENABLE; sdvox |= SDVO_AUDIO_ENABLE;
if (INTEL_GEN(dev_priv) >= 4) { if (INTEL_GEN(dev_priv) >= 4) {
...@@ -1694,12 +1701,6 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) ...@@ -1694,12 +1701,6 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
kfree(edid); kfree(edid);
} }
if (status == connector_status_connected) {
struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
if (intel_sdvo_connector->force_audio != HDMI_AUDIO_AUTO)
intel_sdvo->has_hdmi_audio = (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON);
}
return status; return status;
} }
...@@ -1978,23 +1979,6 @@ static void intel_sdvo_destroy(struct drm_connector *connector) ...@@ -1978,23 +1979,6 @@ static void intel_sdvo_destroy(struct drm_connector *connector)
kfree(intel_sdvo_connector); kfree(intel_sdvo_connector);
} }
static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
{
struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
struct edid *edid;
bool has_audio = false;
if (!intel_sdvo->is_hdmi)
return false;
edid = intel_sdvo_get_edid(connector);
if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
has_audio = drm_detect_monitor_audio(edid);
kfree(edid);
return has_audio;
}
static int static int
intel_sdvo_set_property(struct drm_connector *connector, intel_sdvo_set_property(struct drm_connector *connector,
struct drm_property *property, struct drm_property *property,
...@@ -2013,22 +1997,23 @@ intel_sdvo_set_property(struct drm_connector *connector, ...@@ -2013,22 +1997,23 @@ intel_sdvo_set_property(struct drm_connector *connector,
if (property == dev_priv->force_audio_property) { if (property == dev_priv->force_audio_property) {
int i = val; int i = val;
bool has_audio; bool has_audio, old_audio;
if (i == intel_sdvo_connector->force_audio) if (intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO)
return 0; old_audio = intel_sdvo->has_hdmi_audio;
else
intel_sdvo_connector->force_audio = i; old_audio = intel_sdvo_connector->force_audio == HDMI_AUDIO_ON;
if (i == HDMI_AUDIO_AUTO) if (i == HDMI_AUDIO_AUTO)
has_audio = intel_sdvo_detect_hdmi_audio(connector); has_audio = intel_sdvo->has_hdmi_audio;
else else
has_audio = (i == HDMI_AUDIO_ON); has_audio = (i == HDMI_AUDIO_ON);
if (has_audio == intel_sdvo->has_hdmi_audio) intel_sdvo_connector->force_audio = i;
if (has_audio == old_audio)
return 0; return 0;
intel_sdvo->has_hdmi_audio = has_audio;
goto done; goto done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment