summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/intel_crt.c36
-rw-r--r--linux-core/intel_lvds.c20
2 files changed, 25 insertions, 31 deletions
diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c
index ca7ae7b3..fe846eb8 100644
--- a/linux-core/intel_crt.c
+++ b/linux-core/intel_crt.c
@@ -189,26 +189,19 @@ static enum drm_output_status intel_crt_detect(struct drm_output *output)
return output_status_disconnected;
}
- /* Set up the DDC bus. */
- intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
- if (!intel_output->ddc_bus) {
- dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
- "failed.\n");
- return 0;
- }
-
- if (intel_crt_detect_ddc(output)) {
- intel_i2c_destroy(intel_output->ddc_bus);
+ if (intel_crt_detect_ddc(output))
return output_status_connected;
- }
- intel_i2c_destroy(intel_output->ddc_bus);
/* TODO use load detect */
return output_status_unknown;
}
static void intel_crt_destroy(struct drm_output *output)
{
+ struct intel_output *intel_output = output->driver_private;
+
+ intel_i2c_destroy(intel_output->ddc_bus);
+
if (output->driver_private)
kfree(output->driver_private);
}
@@ -219,17 +212,7 @@ static int intel_crt_get_modes(struct drm_output *output)
struct intel_output *intel_output = output->driver_private;
int ret;
- /* Set up the DDC bus. */
- intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
- if (!intel_output->ddc_bus) {
- dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
- "failed.\n");
- return 0;
- }
-
- ret = intel_ddc_get_modes(output);
- intel_i2c_destroy(intel_output->ddc_bus);
- return ret;
+ return intel_ddc_get_modes(output);
}
/*
@@ -261,6 +244,13 @@ void intel_crt_init(drm_device_t *dev)
drm_output_destroy(output);
return;
}
+ /* Set up the DDC bus. */
+ intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
+ if (!intel_output->ddc_bus) {
+ dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
+ "failed.\n");
+ return;
+ }
intel_output->type = INTEL_OUTPUT_ANALOG;
output->driver_private = intel_output;
diff --git a/linux-core/intel_lvds.c b/linux-core/intel_lvds.c
index e8670adc..d2725e21 100644
--- a/linux-core/intel_lvds.c
+++ b/linux-core/intel_lvds.c
@@ -268,14 +268,7 @@ static int intel_lvds_get_modes(struct drm_output *output)
struct edid *edid_info;
int ret = 0;
- intel_output->ddc_bus = intel_i2c_create(dev, GPIOC, "LVDSDDC_C");
- if (!intel_output->ddc_bus) {
- dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
- "failed.\n");
- return 0;
- }
ret = intel_ddc_get_modes(output);
- intel_i2c_destroy(intel_output->ddc_bus);
if (ret)
return ret;
@@ -312,8 +305,19 @@ out:
return 0;
}
+/**
+ * intel_lvds_destroy - unregister and free LVDS structures
+ * @output: output to free
+ *
+ * Unregister the DDC bus for this output then free the driver private
+ * structure.
+ */
static void intel_lvds_destroy(struct drm_output *output)
{
+ struct intel_output *intel_output = output->driver_private;
+
+ intel_i2c_destroy(intel_output->ddc_bus);
+
if (output->driver_private)
kfree(output->driver_private);
}
@@ -375,7 +379,7 @@ void intel_lvds_init(struct drm_device *dev)
* preferred mode is the right one.
*/
intel_ddc_get_modes(output);
- intel_i2c_destroy(intel_output->ddc_bus);
+
list_for_each_entry(scan, &output->probed_modes, head) {
if (scan->type & DRM_MODE_TYPE_PREFERRED) {
dev_priv->panel_fixed_mode =