Commit c2b9152f authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: add dev_priv to intel_gmbus

This way we can free up the bus->adaptor.algo_data pointer and make it
available for use with the bitbanging fallback algo.
Reviewed-by: default avatarEugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent caae745a
...@@ -298,6 +298,13 @@ enum intel_pch { ...@@ -298,6 +298,13 @@ enum intel_pch {
struct intel_fbdev; struct intel_fbdev;
struct intel_fbc_work; struct intel_fbc_work;
struct intel_gmbus {
struct i2c_adapter adapter;
struct i2c_adapter *force_bit;
u32 reg0;
struct drm_i915_private *dev_priv;
};
typedef struct drm_i915_private { typedef struct drm_i915_private {
struct drm_device *dev; struct drm_device *dev;
...@@ -315,11 +322,7 @@ typedef struct drm_i915_private { ...@@ -315,11 +322,7 @@ typedef struct drm_i915_private {
/** gt_lock is also taken in irq contexts. */ /** gt_lock is also taken in irq contexts. */
struct spinlock gt_lock; struct spinlock gt_lock;
struct intel_gmbus { struct intel_gmbus *gmbus;
struct i2c_adapter adapter;
struct i2c_adapter *force_bit;
u32 reg0;
} *gmbus;
/** gmbus_mutex protects against concurrent usage of the single hw gmbus /** gmbus_mutex protects against concurrent usage of the single hw gmbus
* controller on different i2c buses. */ * controller on different i2c buses. */
......
...@@ -232,7 +232,7 @@ gmbus_xfer(struct i2c_adapter *adapter, ...@@ -232,7 +232,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
struct intel_gmbus *bus = container_of(adapter, struct intel_gmbus *bus = container_of(adapter,
struct intel_gmbus, struct intel_gmbus,
adapter); adapter);
struct drm_i915_private *dev_priv = adapter->algo_data; struct drm_i915_private *dev_priv = bus->dev_priv;
int i, reg_offset, ret; int i, reg_offset, ret;
mutex_lock(&dev_priv->gmbus_mutex); mutex_lock(&dev_priv->gmbus_mutex);
...@@ -406,7 +406,7 @@ int intel_setup_gmbus(struct drm_device *dev) ...@@ -406,7 +406,7 @@ int intel_setup_gmbus(struct drm_device *dev)
names[i]); names[i]);
bus->adapter.dev.parent = &dev->pdev->dev; bus->adapter.dev.parent = &dev->pdev->dev;
bus->adapter.algo_data = dev_priv; bus->dev_priv = dev_priv;
bus->adapter.algo = &gmbus_algorithm; bus->adapter.algo = &gmbus_algorithm;
ret = i2c_add_adapter(&bus->adapter); ret = i2c_add_adapter(&bus->adapter);
...@@ -447,7 +447,7 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit) ...@@ -447,7 +447,7 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
if (force_bit) { if (force_bit) {
if (bus->force_bit == NULL) { if (bus->force_bit == NULL) {
struct drm_i915_private *dev_priv = adapter->algo_data; struct drm_i915_private *dev_priv = bus->dev_priv;
bus->force_bit = intel_gpio_create(dev_priv, bus->force_bit = intel_gpio_create(dev_priv,
bus->reg0 & 0xff); bus->reg0 & 0xff);
} }
......
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