aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_dvo.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-25 14:11:14 -0400
committerEric Anholt <eric@anholt.net>2010-03-25 15:27:32 -0400
commit21d40d37eca86872f2bf0af995809ebdef25c9d9 (patch)
treeb9626f936392f223fa7d001de38213a177bfe7fd /drivers/gpu/drm/i915/intel_dvo.c
parent5e64499f3d39c633de49320e399479642c2b1743 (diff)
drm/i915: Rename intel_output to intel_encoder.
The intel_output naming is inherited from the UMS code, which had a structure of screen -> CRTC -> output. The DRM code has an additional notion of encoder/connector, so the structure is screen -> CRTC -> encoder -> connector. This is a useful structure for SDVO encoders which can support multiple connectors (each of which requires different programming in the one encoder and could be connected to different CRTCs), or for DVI-I, where multiple encoders feed into the connector for whether it's used for digital or analog. Most of our code is encoder-related, so transition it to talking about encoders before we start trying to distinguish connectors. This patch is produced by sed s/intel_output/intel_encoder/ over the driver. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_dvo.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index a4d2606de778..62282f34eba9 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -79,8 +79,8 @@ static struct intel_dvo_device intel_dvo_devices[] = {
79static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) 79static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
80{ 80{
81 struct drm_i915_private *dev_priv = encoder->dev->dev_private; 81 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
82 struct intel_output *intel_output = enc_to_intel_output(encoder); 82 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
83 struct intel_dvo_device *dvo = intel_output->dev_priv; 83 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
84 u32 dvo_reg = dvo->dvo_reg; 84 u32 dvo_reg = dvo->dvo_reg;
85 u32 temp = I915_READ(dvo_reg); 85 u32 temp = I915_READ(dvo_reg);
86 86
@@ -98,8 +98,8 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
98static void intel_dvo_save(struct drm_connector *connector) 98static void intel_dvo_save(struct drm_connector *connector)
99{ 99{
100 struct drm_i915_private *dev_priv = connector->dev->dev_private; 100 struct drm_i915_private *dev_priv = connector->dev->dev_private;
101 struct intel_output *intel_output = to_intel_output(connector); 101 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
102 struct intel_dvo_device *dvo = intel_output->dev_priv; 102 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
103 103
104 /* Each output should probably just save the registers it touches, 104 /* Each output should probably just save the registers it touches,
105 * but for now, use more overkill. 105 * but for now, use more overkill.
@@ -114,8 +114,8 @@ static void intel_dvo_save(struct drm_connector *connector)
114static void intel_dvo_restore(struct drm_connector *connector) 114static void intel_dvo_restore(struct drm_connector *connector)
115{ 115{
116 struct drm_i915_private *dev_priv = connector->dev->dev_private; 116 struct drm_i915_private *dev_priv = connector->dev->dev_private;
117 struct intel_output *intel_output = to_intel_output(connector); 117 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
118 struct intel_dvo_device *dvo = intel_output->dev_priv; 118 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
119 119
120 dvo->dev_ops->restore(dvo); 120 dvo->dev_ops->restore(dvo);
121 121
@@ -127,8 +127,8 @@ static void intel_dvo_restore(struct drm_connector *connector)
127static int intel_dvo_mode_valid(struct drm_connector *connector, 127static int intel_dvo_mode_valid(struct drm_connector *connector,
128 struct drm_display_mode *mode) 128 struct drm_display_mode *mode)
129{ 129{
130 struct intel_output *intel_output = to_intel_output(connector); 130 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
131 struct intel_dvo_device *dvo = intel_output->dev_priv; 131 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
132 132
133 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 133 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
134 return MODE_NO_DBLESCAN; 134 return MODE_NO_DBLESCAN;
@@ -149,8 +149,8 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder,
149 struct drm_display_mode *mode, 149 struct drm_display_mode *mode,
150 struct drm_display_mode *adjusted_mode) 150 struct drm_display_mode *adjusted_mode)
151{ 151{
152 struct intel_output *intel_output = enc_to_intel_output(encoder); 152 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
153 struct intel_dvo_device *dvo = intel_output->dev_priv; 153 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
154 154
155 /* If we have timings from the BIOS for the panel, put them in 155 /* If we have timings from the BIOS for the panel, put them in
156 * to the adjusted mode. The CRTC will be set up for this mode, 156 * to the adjusted mode. The CRTC will be set up for this mode,
@@ -185,8 +185,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
185 struct drm_device *dev = encoder->dev; 185 struct drm_device *dev = encoder->dev;
186 struct drm_i915_private *dev_priv = dev->dev_private; 186 struct drm_i915_private *dev_priv = dev->dev_private;
187 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); 187 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
188 struct intel_output *intel_output = enc_to_intel_output(encoder); 188 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
189 struct intel_dvo_device *dvo = intel_output->dev_priv; 189 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
190 int pipe = intel_crtc->pipe; 190 int pipe = intel_crtc->pipe;
191 u32 dvo_val; 191 u32 dvo_val;
192 u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg; 192 u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg;
@@ -240,23 +240,23 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
240 */ 240 */
241static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) 241static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector)
242{ 242{
243 struct intel_output *intel_output = to_intel_output(connector); 243 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
244 struct intel_dvo_device *dvo = intel_output->dev_priv; 244 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
245 245
246 return dvo->dev_ops->detect(dvo); 246 return dvo->dev_ops->detect(dvo);
247} 247}
248 248
249static int intel_dvo_get_modes(struct drm_connector *connector) 249static int intel_dvo_get_modes(struct drm_connector *connector)
250{ 250{
251 struct intel_output *intel_output = to_intel_output(connector); 251 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
252 struct intel_dvo_device *dvo = intel_output->dev_priv; 252 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
253 253
254 /* We should probably have an i2c driver get_modes function for those 254 /* We should probably have an i2c driver get_modes function for those
255 * devices which will have a fixed set of modes determined by the chip 255 * devices which will have a fixed set of modes determined by the chip
256 * (TV-out, for example), but for now with just TMDS and LVDS, 256 * (TV-out, for example), but for now with just TMDS and LVDS,
257 * that's not the case. 257 * that's not the case.
258 */ 258 */
259 intel_ddc_get_modes(intel_output); 259 intel_ddc_get_modes(intel_encoder);
260 if (!list_empty(&connector->probed_modes)) 260 if (!list_empty(&connector->probed_modes))
261 return 1; 261 return 1;
262 262
@@ -274,8 +274,8 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
274 274
275static void intel_dvo_destroy (struct drm_connector *connector) 275static void intel_dvo_destroy (struct drm_connector *connector)
276{ 276{
277 struct intel_output *intel_output = to_intel_output(connector); 277 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
278 struct intel_dvo_device *dvo = intel_output->dev_priv; 278 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
279 279
280 if (dvo) { 280 if (dvo) {
281 if (dvo->dev_ops->destroy) 281 if (dvo->dev_ops->destroy)
@@ -285,13 +285,13 @@ static void intel_dvo_destroy (struct drm_connector *connector)
285 /* no need, in i830_dvoices[] now */ 285 /* no need, in i830_dvoices[] now */
286 //kfree(dvo); 286 //kfree(dvo);
287 } 287 }
288 if (intel_output->i2c_bus) 288 if (intel_encoder->i2c_bus)
289 intel_i2c_destroy(intel_output->i2c_bus); 289 intel_i2c_destroy(intel_encoder->i2c_bus);
290 if (intel_output->ddc_bus) 290 if (intel_encoder->ddc_bus)
291 intel_i2c_destroy(intel_output->ddc_bus); 291 intel_i2c_destroy(intel_encoder->ddc_bus);
292 drm_sysfs_connector_remove(connector); 292 drm_sysfs_connector_remove(connector);
293 drm_connector_cleanup(connector); 293 drm_connector_cleanup(connector);
294 kfree(intel_output); 294 kfree(intel_encoder);
295} 295}
296 296
297#ifdef RANDR_GET_CRTC_INTERFACE 297#ifdef RANDR_GET_CRTC_INTERFACE
@@ -299,8 +299,8 @@ static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector)
299{ 299{
300 struct drm_device *dev = connector->dev; 300 struct drm_device *dev = connector->dev;
301 struct drm_i915_private *dev_priv = dev->dev_private; 301 struct drm_i915_private *dev_priv = dev->dev_private;
302 struct intel_output *intel_output = to_intel_output(connector); 302 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
303 struct intel_dvo_device *dvo = intel_output->dev_priv; 303 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
304 int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT); 304 int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT);
305 305
306 return intel_pipe_to_crtc(pScrn, pipe); 306 return intel_pipe_to_crtc(pScrn, pipe);
@@ -351,8 +351,8 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
351{ 351{
352 struct drm_device *dev = connector->dev; 352 struct drm_device *dev = connector->dev;
353 struct drm_i915_private *dev_priv = dev->dev_private; 353 struct drm_i915_private *dev_priv = dev->dev_private;
354 struct intel_output *intel_output = to_intel_output(connector); 354 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
355 struct intel_dvo_device *dvo = intel_output->dev_priv; 355 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
356 uint32_t dvo_reg = dvo->dvo_reg; 356 uint32_t dvo_reg = dvo->dvo_reg;
357 uint32_t dvo_val = I915_READ(dvo_reg); 357 uint32_t dvo_val = I915_READ(dvo_reg);
358 struct drm_display_mode *mode = NULL; 358 struct drm_display_mode *mode = NULL;
@@ -382,24 +382,24 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
382 382
383void intel_dvo_init(struct drm_device *dev) 383void intel_dvo_init(struct drm_device *dev)
384{ 384{
385 struct intel_output *intel_output; 385 struct intel_encoder *intel_encoder;
386 struct intel_dvo_device *dvo; 386 struct intel_dvo_device *dvo;
387 struct i2c_adapter *i2cbus = NULL; 387 struct i2c_adapter *i2cbus = NULL;
388 int ret = 0; 388 int ret = 0;
389 int i; 389 int i;
390 int encoder_type = DRM_MODE_ENCODER_NONE; 390 int encoder_type = DRM_MODE_ENCODER_NONE;
391 intel_output = kzalloc (sizeof(struct intel_output), GFP_KERNEL); 391 intel_encoder = kzalloc (sizeof(struct intel_encoder), GFP_KERNEL);
392 if (!intel_output) 392 if (!intel_encoder)
393 return; 393 return;
394 394
395 /* Set up the DDC bus */ 395 /* Set up the DDC bus */
396 intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D"); 396 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D");
397 if (!intel_output->ddc_bus) 397 if (!intel_encoder->ddc_bus)
398 goto free_intel; 398 goto free_intel;
399 399
400 /* Now, try to find a controller */ 400 /* Now, try to find a controller */
401 for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { 401 for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) {
402 struct drm_connector *connector = &intel_output->base; 402 struct drm_connector *connector = &intel_encoder->base;
403 int gpio; 403 int gpio;
404 404
405 dvo = &intel_dvo_devices[i]; 405 dvo = &intel_dvo_devices[i];
@@ -434,11 +434,11 @@ void intel_dvo_init(struct drm_device *dev)
434 if (!ret) 434 if (!ret)
435 continue; 435 continue;
436 436
437 intel_output->type = INTEL_OUTPUT_DVO; 437 intel_encoder->type = INTEL_OUTPUT_DVO;
438 intel_output->crtc_mask = (1 << 0) | (1 << 1); 438 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
439 switch (dvo->type) { 439 switch (dvo->type) {
440 case INTEL_DVO_CHIP_TMDS: 440 case INTEL_DVO_CHIP_TMDS:
441 intel_output->clone_mask = 441 intel_encoder->clone_mask =
442 (1 << INTEL_DVO_TMDS_CLONE_BIT) | 442 (1 << INTEL_DVO_TMDS_CLONE_BIT) |
443 (1 << INTEL_ANALOG_CLONE_BIT); 443 (1 << INTEL_ANALOG_CLONE_BIT);
444 drm_connector_init(dev, connector, 444 drm_connector_init(dev, connector,
@@ -447,7 +447,7 @@ void intel_dvo_init(struct drm_device *dev)
447 encoder_type = DRM_MODE_ENCODER_TMDS; 447 encoder_type = DRM_MODE_ENCODER_TMDS;
448 break; 448 break;
449 case INTEL_DVO_CHIP_LVDS: 449 case INTEL_DVO_CHIP_LVDS:
450 intel_output->clone_mask = 450 intel_encoder->clone_mask =
451 (1 << INTEL_DVO_LVDS_CLONE_BIT); 451 (1 << INTEL_DVO_LVDS_CLONE_BIT);
452 drm_connector_init(dev, connector, 452 drm_connector_init(dev, connector,
453 &intel_dvo_connector_funcs, 453 &intel_dvo_connector_funcs,
@@ -462,16 +462,16 @@ void intel_dvo_init(struct drm_device *dev)
462 connector->interlace_allowed = false; 462 connector->interlace_allowed = false;
463 connector->doublescan_allowed = false; 463 connector->doublescan_allowed = false;
464 464
465 intel_output->dev_priv = dvo; 465 intel_encoder->dev_priv = dvo;
466 intel_output->i2c_bus = i2cbus; 466 intel_encoder->i2c_bus = i2cbus;
467 467
468 drm_encoder_init(dev, &intel_output->enc, 468 drm_encoder_init(dev, &intel_encoder->enc,
469 &intel_dvo_enc_funcs, encoder_type); 469 &intel_dvo_enc_funcs, encoder_type);
470 drm_encoder_helper_add(&intel_output->enc, 470 drm_encoder_helper_add(&intel_encoder->enc,
471 &intel_dvo_helper_funcs); 471 &intel_dvo_helper_funcs);
472 472
473 drm_mode_connector_attach_encoder(&intel_output->base, 473 drm_mode_connector_attach_encoder(&intel_encoder->base,
474 &intel_output->enc); 474 &intel_encoder->enc);
475 if (dvo->type == INTEL_DVO_CHIP_LVDS) { 475 if (dvo->type == INTEL_DVO_CHIP_LVDS) {
476 /* For our LVDS chipsets, we should hopefully be able 476 /* For our LVDS chipsets, we should hopefully be able
477 * to dig the fixed panel mode out of the BIOS data. 477 * to dig the fixed panel mode out of the BIOS data.
@@ -489,10 +489,10 @@ void intel_dvo_init(struct drm_device *dev)
489 return; 489 return;
490 } 490 }
491 491
492 intel_i2c_destroy(intel_output->ddc_bus); 492 intel_i2c_destroy(intel_encoder->ddc_bus);
493 /* Didn't find a chip, so tear down. */ 493 /* Didn't find a chip, so tear down. */
494 if (i2cbus != NULL) 494 if (i2cbus != NULL)
495 intel_i2c_destroy(i2cbus); 495 intel_i2c_destroy(i2cbus);
496free_intel: 496free_intel:
497 kfree(intel_output); 497 kfree(intel_encoder);
498} 498}