Skip to content

Commit

Permalink
drm/i915: ensure i2c adapter is all set before adding it
Browse files Browse the repository at this point in the history
i2c_add_adapter() may do i2c transfers on the bus to detect supported
devices. Therefore the adapter needs to be all set before adding it. This
was not the case for the bit-banging fallback, resulting in an oops if the
device detection GMBUS transfers timed out. Fix the issue by calling
i2c_add_adapter() only after intel_gpio_setup().

LKML-Reference: <[email protected]>
Tested-by: Mihai Moldovan <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
  • Loading branch information
jnikula authored and danvet committed Aug 13, 2012
1 parent 4344b81 commit cee2516
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpu/drm/i915/intel_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,6 @@ int intel_setup_gmbus(struct drm_device *dev)
bus->dev_priv = dev_priv;

bus->adapter.algo = &gmbus_algorithm;
ret = i2c_add_adapter(&bus->adapter);
if (ret)
goto err;

/* By default use a conservative clock rate */
bus->reg0 = port | GMBUS_RATE_100KHZ;
Expand All @@ -498,6 +495,10 @@ int intel_setup_gmbus(struct drm_device *dev)
bus->force_bit = true;

intel_gpio_setup(bus, port);

ret = i2c_add_adapter(&bus->adapter);
if (ret)
goto err;
}

intel_i2c_reset(dev_priv->dev);
Expand Down

0 comments on commit cee2516

Please sign in to comment.