mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-25 20:00:13 +01:00
Move i2c init back to where it belongs and add i2c unregistration in *_destroy.
This commit is contained in:
parent
258e1cf703
commit
c2fce380c2
2 changed files with 25 additions and 31 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue