Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293598
b: refs/heads/master
c: b1d7e4b
h: refs/heads/master
v: v3
  • Loading branch information
Wu Fengguang authored and Daniel Vetter committed Feb 14, 2012
1 parent 657468e commit 3134477
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ac5a6d5b56700c006baa94272b63f2d3fdf6b06
refs/heads/master: b1d7e4b41fd0f72ea8149056778db5d737739305
7 changes: 7 additions & 0 deletions trunk/drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,13 @@ typedef struct drm_i915_private {
struct drm_property *force_audio_property;
} drm_i915_private_t;

enum hdmi_force_audio {
HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */
HDMI_AUDIO_OFF, /* force turn off HDMI audio */
HDMI_AUDIO_AUTO, /* trust EDID */
HDMI_AUDIO_ON, /* force turn on HDMI audio */
};

enum i915_cache_level {
I915_CACHE_NONE,
I915_CACHE_LLC,
Expand Down
21 changes: 12 additions & 9 deletions trunk/drivers/gpu/drm/i915/intel_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct intel_hdmi {
uint32_t color_range;
bool has_hdmi_sink;
bool has_audio;
int force_audio;
enum hdmi_force_audio force_audio;
void (*write_infoframe)(struct drm_encoder *encoder,
struct dip_infoframe *frame);
};
Expand Down Expand Up @@ -339,16 +339,19 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
if (edid) {
if (edid->input & DRM_EDID_INPUT_DIGITAL) {
status = connector_status_connected;
intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI)
intel_hdmi->has_hdmi_sink =
drm_detect_hdmi_monitor(edid);
intel_hdmi->has_audio = drm_detect_monitor_audio(edid);
}
connector->display_info.raw_edid = NULL;
kfree(edid);
}

if (status == connector_status_connected) {
if (intel_hdmi->force_audio)
intel_hdmi->has_audio = intel_hdmi->force_audio > 0;
if (intel_hdmi->force_audio != HDMI_AUDIO_AUTO)
intel_hdmi->has_audio =
(intel_hdmi->force_audio == HDMI_AUDIO_ON);
}

return status;
Expand Down Expand Up @@ -402,21 +405,21 @@ intel_hdmi_set_property(struct drm_connector *connector,
return ret;

if (property == dev_priv->force_audio_property) {
int i = val;
enum hdmi_force_audio i = val;
bool has_audio;

if (i == intel_hdmi->force_audio)
return 0;

intel_hdmi->force_audio = i;

if (i == 0)
if (i == HDMI_AUDIO_AUTO)
has_audio = intel_hdmi_detect_audio(connector);
else
has_audio = i > 0;
has_audio = (i == HDMI_AUDIO_ON);

if (has_audio == intel_hdmi->has_audio)
return 0;
if (i == HDMI_AUDIO_OFF_DVI)
intel_hdmi->has_hdmi_sink = 0;

intel_hdmi->has_audio = has_audio;
goto done;
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/gpu/drm/i915/intel_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ int intel_ddc_get_modes(struct drm_connector *connector,
}

static const char *force_audio_names[] = {
"force-dvi",
"off",
"auto",
"on",
Expand All @@ -106,7 +107,8 @@ intel_attach_force_audio_property(struct drm_connector *connector)
return;

for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
drm_property_add_enum(prop, i, i-2,
force_audio_names[i]);

dev_priv->force_audio_property = prop;
}
Expand Down

0 comments on commit 3134477

Please sign in to comment.