diff options
author | Jani Nikula <jani.nikula@intel.com> | 2012-10-22 16:12:18 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-10-26 10:26:43 +0200 |
commit | fbfcc4f3a0cf8bbde87646b74241faa8e37426bf (patch) | |
tree | b447731b2f5fdcfbcab1d17727e054fbc6029bb8 | |
parent | 6cb1612a7dc4c3d5ed86dba5dd21bb48a5c395af (diff) | |
download | op-kernel-dev-fbfcc4f3a0cf8bbde87646b74241faa8e37426bf.zip op-kernel-dev-fbfcc4f3a0cf8bbde87646b74241faa8e37426bf.tar.gz |
drm/i915/sdvo: restore i2c adapter config on intel_sdvo_init() failures
SDVOB may be multiplexed with HDMIB. If it's not SDVOB, the same i2c
adapter may be used for HDMIB, with the adjusted config (i.e. with GPIO
bit-banging instead of gmbus). Restore i2c adapter config before error
return from intel_sdvo_init(), letting HDMIB enjoy the joys of gmbus.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 9ea545e..30f1752 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -2055,6 +2055,13 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv, intel_gmbus_force_bit(sdvo->i2c, true); } +/* undo any changes intel_sdvo_select_i2c_bus() did to sdvo->i2c */ +static void +intel_sdvo_unselect_i2c_bus(struct intel_sdvo *sdvo) +{ + intel_gmbus_force_bit(sdvo->i2c, false); +} + static bool intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device) { @@ -2630,10 +2637,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) intel_sdvo->is_sdvob = is_sdvob; intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, intel_sdvo) >> 1; intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo, sdvo_reg); - if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev)) { - kfree(intel_sdvo); - return false; - } + if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev)) + goto err_i2c_bus; /* encoder type will be decided later */ intel_encoder = &intel_sdvo->base; @@ -2718,6 +2723,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) err: drm_encoder_cleanup(&intel_encoder->base); i2c_del_adapter(&intel_sdvo->ddc); +err_i2c_bus: + intel_sdvo_unselect_i2c_bus(intel_sdvo); kfree(intel_sdvo); return false; |