diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-05-12 17:17:24 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-06-04 13:41:25 -0400 |
commit | 3f43c48d333777e815ae68d66396cb6dfbc2dd79 (patch) | |
tree | e5e4ac284969b45f912c5d025c7016914c2455bb | |
parent | 4bce2da393dbbc6650a1d62683ef60e03594b4c7 (diff) |
drm/i915: Share the common force-audio property between connectors
Make the audio property creation routine common and share the single
property between the connectors.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_modes.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 14 |
6 files changed, 38 insertions, 37 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 71bd6f559d3..f63ee162f12 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -716,6 +716,7 @@ typedef struct drm_i915_private { | |||
716 | struct intel_fbdev *fbdev; | 716 | struct intel_fbdev *fbdev; |
717 | 717 | ||
718 | struct drm_property *broadcast_rgb_property; | 718 | struct drm_property *broadcast_rgb_property; |
719 | struct drm_property *force_audio_property; | ||
719 | 720 | ||
720 | atomic_t forcewake_count; | 721 | atomic_t forcewake_count; |
721 | } drm_i915_private_t; | 722 | } drm_i915_private_t; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a4d80314e7f..391b55f1cc7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -59,8 +59,6 @@ struct intel_dp { | |||
59 | bool is_pch_edp; | 59 | bool is_pch_edp; |
60 | uint8_t train_set[4]; | 60 | uint8_t train_set[4]; |
61 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | 61 | uint8_t link_status[DP_LINK_STATUS_SIZE]; |
62 | |||
63 | struct drm_property *force_audio_property; | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | /** | 64 | /** |
@@ -1702,7 +1700,7 @@ intel_dp_set_property(struct drm_connector *connector, | |||
1702 | if (ret) | 1700 | if (ret) |
1703 | return ret; | 1701 | return ret; |
1704 | 1702 | ||
1705 | if (property == intel_dp->force_audio_property) { | 1703 | if (property == dev_priv->force_audio_property) { |
1706 | int i = val; | 1704 | int i = val; |
1707 | bool has_audio; | 1705 | bool has_audio; |
1708 | 1706 | ||
@@ -1841,16 +1839,7 @@ bool intel_dpd_is_edp(struct drm_device *dev) | |||
1841 | static void | 1839 | static void |
1842 | intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) | 1840 | intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) |
1843 | { | 1841 | { |
1844 | struct drm_device *dev = connector->dev; | 1842 | intel_attach_force_audio_property(connector); |
1845 | |||
1846 | intel_dp->force_audio_property = | ||
1847 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
1848 | if (intel_dp->force_audio_property) { | ||
1849 | intel_dp->force_audio_property->values[0] = -1; | ||
1850 | intel_dp->force_audio_property->values[1] = 1; | ||
1851 | drm_connector_attach_property(connector, intel_dp->force_audio_property, 0); | ||
1852 | } | ||
1853 | |||
1854 | intel_attach_broadcast_rgb_property(connector); | 1843 | intel_attach_broadcast_rgb_property(connector); |
1855 | } | 1844 | } |
1856 | 1845 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 831d7a4a0d1..9ffa61eb4d7 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -236,6 +236,7 @@ struct intel_unpin_work { | |||
236 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); | 236 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); |
237 | extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus); | 237 | extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus); |
238 | 238 | ||
239 | extern void intel_attach_force_audio_property(struct drm_connector *connector); | ||
239 | extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector); | 240 | extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector); |
240 | 241 | ||
241 | extern void intel_crt_init(struct drm_device *dev); | 242 | extern void intel_crt_init(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 655bbd9ed9e..aa0a8e83142 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -45,7 +45,6 @@ struct intel_hdmi { | |||
45 | bool has_hdmi_sink; | 45 | bool has_hdmi_sink; |
46 | bool has_audio; | 46 | bool has_audio; |
47 | int force_audio; | 47 | int force_audio; |
48 | struct drm_property *force_audio_property; | ||
49 | }; | 48 | }; |
50 | 49 | ||
51 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) | 50 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) |
@@ -287,7 +286,7 @@ intel_hdmi_set_property(struct drm_connector *connector, | |||
287 | if (ret) | 286 | if (ret) |
288 | return ret; | 287 | return ret; |
289 | 288 | ||
290 | if (property == intel_hdmi->force_audio_property) { | 289 | if (property == dev_priv->force_audio_property) { |
291 | int i = val; | 290 | int i = val; |
292 | bool has_audio; | 291 | bool has_audio; |
293 | 292 | ||
@@ -365,16 +364,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { | |||
365 | static void | 364 | static void |
366 | intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) | 365 | intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) |
367 | { | 366 | { |
368 | struct drm_device *dev = connector->dev; | 367 | intel_attach_force_audio_property(connector); |
369 | |||
370 | intel_hdmi->force_audio_property = | ||
371 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
372 | if (intel_hdmi->force_audio_property) { | ||
373 | intel_hdmi->force_audio_property->values[0] = -1; | ||
374 | intel_hdmi->force_audio_property->values[1] = 1; | ||
375 | drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0); | ||
376 | } | ||
377 | |||
378 | intel_attach_broadcast_rgb_property(connector); | 368 | intel_attach_broadcast_rgb_property(connector); |
379 | } | 369 | } |
380 | 370 | ||
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index 9034dd8f33c..3b26a3ba02d 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c | |||
@@ -81,6 +81,36 @@ int intel_ddc_get_modes(struct drm_connector *connector, | |||
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
84 | static const char *force_audio_names[] = { | ||
85 | "off", | ||
86 | "auto", | ||
87 | "on", | ||
88 | }; | ||
89 | |||
90 | void | ||
91 | intel_attach_force_audio_property(struct drm_connector *connector) | ||
92 | { | ||
93 | struct drm_device *dev = connector->dev; | ||
94 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
95 | struct drm_property *prop; | ||
96 | int i; | ||
97 | |||
98 | prop = dev_priv->force_audio_property; | ||
99 | if (prop == NULL) { | ||
100 | prop = drm_property_create(dev, DRM_MODE_PROP_ENUM, | ||
101 | "audio", | ||
102 | ARRAY_SIZE(force_audio_names)); | ||
103 | if (prop == NULL) | ||
104 | return; | ||
105 | |||
106 | for (i = 0; i < ARRAY_SIZE(force_audio_names); i++) | ||
107 | drm_property_add_enum(prop, i, i-1, force_audio_names[i]); | ||
108 | |||
109 | dev_priv->force_audio_property = prop; | ||
110 | } | ||
111 | drm_connector_attach_property(connector, prop, 0); | ||
112 | } | ||
113 | |||
84 | static const char *broadcast_rgb_names[] = { | 114 | static const char *broadcast_rgb_names[] = { |
85 | "Full", | 115 | "Full", |
86 | "Limited 16:235", | 116 | "Limited 16:235", |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 754086f8394..30fe554d893 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -148,8 +148,6 @@ struct intel_sdvo_connector { | |||
148 | int format_supported_num; | 148 | int format_supported_num; |
149 | struct drm_property *tv_format; | 149 | struct drm_property *tv_format; |
150 | 150 | ||
151 | struct drm_property *force_audio_property; | ||
152 | |||
153 | /* add the property for the SDVO-TV */ | 151 | /* add the property for the SDVO-TV */ |
154 | struct drm_property *left; | 152 | struct drm_property *left; |
155 | struct drm_property *right; | 153 | struct drm_property *right; |
@@ -1712,7 +1710,7 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1712 | if (ret) | 1710 | if (ret) |
1713 | return ret; | 1711 | return ret; |
1714 | 1712 | ||
1715 | if (property == intel_sdvo_connector->force_audio_property) { | 1713 | if (property == dev_priv->force_audio_property) { |
1716 | int i = val; | 1714 | int i = val; |
1717 | bool has_audio; | 1715 | bool has_audio; |
1718 | 1716 | ||
@@ -2037,15 +2035,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector) | |||
2037 | { | 2035 | { |
2038 | struct drm_device *dev = connector->base.base.dev; | 2036 | struct drm_device *dev = connector->base.base.dev; |
2039 | 2037 | ||
2040 | connector->force_audio_property = | 2038 | intel_attach_force_audio_property(&connector->base.base); |
2041 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
2042 | if (connector->force_audio_property) { | ||
2043 | connector->force_audio_property->values[0] = -1; | ||
2044 | connector->force_audio_property->values[1] = 1; | ||
2045 | drm_connector_attach_property(&connector->base.base, | ||
2046 | connector->force_audio_property, 0); | ||
2047 | } | ||
2048 | |||
2049 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) | 2039 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) |
2050 | intel_attach_broadcast_rgb_property(&connector->base.base); | 2040 | intel_attach_broadcast_rgb_property(&connector->base.base); |
2051 | } | 2041 | } |