Commit f2ce9faf authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915/i2c: Track users of GMBUS force-bit

This fixes a regression for SDVO from

commit fbfcc4f3
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Mon Oct 22 16:12:18 2012 +0300

    drm/i915/sdvo: restore i2c adapter config on intel_sdvo_init() failures

As SDVOB and SDVOC are multiplexed on the same pin, if a chipset does
not have the second SDVO encoder, it will then remove the force-bit
setting on the common i2c adapter during teardown. All subsequent
attempts of trying to use GMBUS with SDVOB then fail.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
[danvet: fixup inversion in the debug printout, noticed by Jani
Nikulai.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f94982b0
...@@ -390,7 +390,7 @@ struct intel_fbc_work; ...@@ -390,7 +390,7 @@ struct intel_fbc_work;
struct intel_gmbus { struct intel_gmbus {
struct i2c_adapter adapter; struct i2c_adapter adapter;
bool force_bit; u32 force_bit;
u32 reg0; u32 reg0;
u32 gpio_reg; u32 gpio_reg;
struct i2c_algo_bit_data bit_algo; struct i2c_algo_bit_data bit_algo;
......
...@@ -432,7 +432,7 @@ gmbus_xfer(struct i2c_adapter *adapter, ...@@ -432,7 +432,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
I915_WRITE(GMBUS0 + reg_offset, 0); I915_WRITE(GMBUS0 + reg_offset, 0);
/* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */ /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */
bus->force_bit = true; bus->force_bit = 1;
ret = i2c_bit_algo.master_xfer(adapter, msgs, num); ret = i2c_bit_algo.master_xfer(adapter, msgs, num);
out: out:
...@@ -491,7 +491,7 @@ int intel_setup_gmbus(struct drm_device *dev) ...@@ -491,7 +491,7 @@ int intel_setup_gmbus(struct drm_device *dev)
/* gmbus seems to be broken on i830 */ /* gmbus seems to be broken on i830 */
if (IS_I830(dev)) if (IS_I830(dev))
bus->force_bit = true; bus->force_bit = 1;
intel_gpio_setup(bus, port); intel_gpio_setup(bus, port);
...@@ -532,7 +532,10 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit) ...@@ -532,7 +532,10 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
{ {
struct intel_gmbus *bus = to_intel_gmbus(adapter); struct intel_gmbus *bus = to_intel_gmbus(adapter);
bus->force_bit = force_bit; bus->force_bit += force_bit ? 1 : -1;
DRM_DEBUG_KMS("%sabling bit-banging on %s. force bit now %d\n",
force_bit ? "en" : "dis", adapter->name,
bus->force_bit);
} }
void intel_teardown_gmbus(struct drm_device *dev) void intel_teardown_gmbus(struct drm_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment