aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_hdmi.c
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2010-03-29 03:57:42 -0400
committerEric Anholt <eric@anholt.net>2010-04-12 12:23:50 -0400
commit674e2d0885e009c078d89f789f28f63374a4f337 (patch)
tree949b46a2eec5994ac73652a3314ad8736155aafb /drivers/gpu/drm/i915/intel_hdmi.c
parentbb8a356088db8a2a50365d417a71ac9e83b9b530 (diff)
drm/i915: convert HDMI driver to new encoder/connector structure
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 5ff580219834..fd9544852d33 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -132,13 +132,14 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
132static enum drm_connector_status 132static enum drm_connector_status
133intel_hdmi_detect(struct drm_connector *connector) 133intel_hdmi_detect(struct drm_connector *connector)
134{ 134{
135 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 135 struct drm_encoder *encoder = intel_attached_encoder(connector);
136 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
136 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv; 137 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
137 struct edid *edid = NULL; 138 struct edid *edid = NULL;
138 enum drm_connector_status status = connector_status_disconnected; 139 enum drm_connector_status status = connector_status_disconnected;
139 140
140 hdmi_priv->has_hdmi_sink = false; 141 hdmi_priv->has_hdmi_sink = false;
141 edid = drm_get_edid(&intel_encoder->base, 142 edid = drm_get_edid(connector,
142 intel_encoder->ddc_bus); 143 intel_encoder->ddc_bus);
143 144
144 if (edid) { 145 if (edid) {
@@ -146,7 +147,7 @@ intel_hdmi_detect(struct drm_connector *connector)
146 status = connector_status_connected; 147 status = connector_status_connected;
147 hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid); 148 hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
148 } 149 }
149 intel_encoder->base.display_info.raw_edid = NULL; 150 connector->display_info.raw_edid = NULL;
150 kfree(edid); 151 kfree(edid);
151 } 152 }
152 153
@@ -155,7 +156,8 @@ intel_hdmi_detect(struct drm_connector *connector)
155 156
156static int intel_hdmi_get_modes(struct drm_connector *connector) 157static int intel_hdmi_get_modes(struct drm_connector *connector)
157{ 158{
158 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 159 struct drm_encoder *encoder = intel_attached_encoder(connector);
160 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
159 161
160 /* We should parse the EDID data and find out if it's an HDMI sink so 162 /* We should parse the EDID data and find out if it's an HDMI sink so
161 * we can send audio to it. 163 * we can send audio to it.
@@ -166,13 +168,9 @@ static int intel_hdmi_get_modes(struct drm_connector *connector)
166 168
167static void intel_hdmi_destroy(struct drm_connector *connector) 169static void intel_hdmi_destroy(struct drm_connector *connector)
168{ 170{
169 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
170
171 if (intel_encoder->i2c_bus)
172 intel_i2c_destroy(intel_encoder->i2c_bus);
173 drm_sysfs_connector_remove(connector); 171 drm_sysfs_connector_remove(connector);
174 drm_connector_cleanup(connector); 172 drm_connector_cleanup(connector);
175 kfree(intel_encoder); 173 kfree(connector);
176} 174}
177 175
178static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = { 176static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
@@ -193,12 +191,17 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
193static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = { 191static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
194 .get_modes = intel_hdmi_get_modes, 192 .get_modes = intel_hdmi_get_modes,
195 .mode_valid = intel_hdmi_mode_valid, 193 .mode_valid = intel_hdmi_mode_valid,
196 .best_encoder = intel_best_encoder, 194 .best_encoder = intel_attached_encoder,
197}; 195};
198 196
199static void intel_hdmi_enc_destroy(struct drm_encoder *encoder) 197static void intel_hdmi_enc_destroy(struct drm_encoder *encoder)
200{ 198{
199 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
200
201 if (intel_encoder->i2c_bus)
202 intel_i2c_destroy(intel_encoder->i2c_bus);
201 drm_encoder_cleanup(encoder); 203 drm_encoder_cleanup(encoder);
204 kfree(intel_encoder);
202} 205}
203 206
204static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { 207static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
@@ -210,15 +213,23 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
210 struct drm_i915_private *dev_priv = dev->dev_private; 213 struct drm_i915_private *dev_priv = dev->dev_private;
211 struct drm_connector *connector; 214 struct drm_connector *connector;
212 struct intel_encoder *intel_encoder; 215 struct intel_encoder *intel_encoder;
216 struct intel_connector *intel_connector;
213 struct intel_hdmi_priv *hdmi_priv; 217 struct intel_hdmi_priv *hdmi_priv;
214 218
215 intel_encoder = kcalloc(sizeof(struct intel_encoder) + 219 intel_encoder = kcalloc(sizeof(struct intel_encoder) +
216 sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL); 220 sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL);
217 if (!intel_encoder) 221 if (!intel_encoder)
218 return; 222 return;
223
224 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
225 if (!intel_connector) {
226 kfree(intel_encoder);
227 return;
228 }
229
219 hdmi_priv = (struct intel_hdmi_priv *)(intel_encoder + 1); 230 hdmi_priv = (struct intel_hdmi_priv *)(intel_encoder + 1);
220 231
221 connector = &intel_encoder->base; 232 connector = &intel_connector->base;
222 drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, 233 drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
223 DRM_MODE_CONNECTOR_HDMIA); 234 DRM_MODE_CONNECTOR_HDMIA);
224 drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs); 235 drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
@@ -264,7 +275,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
264 DRM_MODE_ENCODER_TMDS); 275 DRM_MODE_ENCODER_TMDS);
265 drm_encoder_helper_add(&intel_encoder->enc, &intel_hdmi_helper_funcs); 276 drm_encoder_helper_add(&intel_encoder->enc, &intel_hdmi_helper_funcs);
266 277
267 drm_mode_connector_attach_encoder(&intel_encoder->base, 278 drm_mode_connector_attach_encoder(&intel_connector->base,
268 &intel_encoder->enc); 279 &intel_encoder->enc);
269 drm_sysfs_connector_add(connector); 280 drm_sysfs_connector_add(connector);
270 281
@@ -282,6 +293,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
282err_connector: 293err_connector:
283 drm_connector_cleanup(connector); 294 drm_connector_cleanup(connector);
284 kfree(intel_encoder); 295 kfree(intel_encoder);
296 kfree(intel_connector);
285 297
286 return; 298 return;
287} 299}