aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-02-14 16:37:19 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-02-29 14:44:48 -0500
commitc2b9152f098e213dc5f2e8a4dbbfe090302c58ed (patch)
tree87ccf8bd7ee97e1ad073dbe7400d4e6af2c6a4c1 /drivers/gpu
parentcaae745a352377f48f6eb43b5040214d803a885f (diff)
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: Eugeni Dodonov <eugeni.dodonov@intel.com> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h13
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c6
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 35833fc350de..3cc2694a2b93 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -298,6 +298,13 @@ enum intel_pch {
298struct intel_fbdev; 298struct intel_fbdev;
299struct intel_fbc_work; 299struct intel_fbc_work;
300 300
301struct intel_gmbus {
302 struct i2c_adapter adapter;
303 struct i2c_adapter *force_bit;
304 u32 reg0;
305 struct drm_i915_private *dev_priv;
306};
307
301typedef struct drm_i915_private { 308typedef struct drm_i915_private {
302 struct drm_device *dev; 309 struct drm_device *dev;
303 310
@@ -315,11 +322,7 @@ typedef struct drm_i915_private {
315 /** gt_lock is also taken in irq contexts. */ 322 /** gt_lock is also taken in irq contexts. */
316 struct spinlock gt_lock; 323 struct spinlock gt_lock;
317 324
318 struct intel_gmbus { 325 struct intel_gmbus *gmbus;
319 struct i2c_adapter adapter;
320 struct i2c_adapter *force_bit;
321 u32 reg0;
322 } *gmbus;
323 326
324 /** gmbus_mutex protects against concurrent usage of the single hw gmbus 327 /** gmbus_mutex protects against concurrent usage of the single hw gmbus
325 * controller on different i2c buses. */ 328 * controller on different i2c buses. */
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 4e4ddd5d1f51..89346cc0bc4b 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -232,7 +232,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
232 struct intel_gmbus *bus = container_of(adapter, 232 struct intel_gmbus *bus = container_of(adapter,
233 struct intel_gmbus, 233 struct intel_gmbus,
234 adapter); 234 adapter);
235 struct drm_i915_private *dev_priv = adapter->algo_data; 235 struct drm_i915_private *dev_priv = bus->dev_priv;
236 int i, reg_offset, ret; 236 int i, reg_offset, ret;
237 237
238 mutex_lock(&dev_priv->gmbus_mutex); 238 mutex_lock(&dev_priv->gmbus_mutex);
@@ -406,7 +406,7 @@ int intel_setup_gmbus(struct drm_device *dev)
406 names[i]); 406 names[i]);
407 407
408 bus->adapter.dev.parent = &dev->pdev->dev; 408 bus->adapter.dev.parent = &dev->pdev->dev;
409 bus->adapter.algo_data = dev_priv; 409 bus->dev_priv = dev_priv;
410 410
411 bus->adapter.algo = &gmbus_algorithm; 411 bus->adapter.algo = &gmbus_algorithm;
412 ret = i2c_add_adapter(&bus->adapter); 412 ret = i2c_add_adapter(&bus->adapter);
@@ -447,7 +447,7 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
447 447
448 if (force_bit) { 448 if (force_bit) {
449 if (bus->force_bit == NULL) { 449 if (bus->force_bit == NULL) {
450 struct drm_i915_private *dev_priv = adapter->algo_data; 450 struct drm_i915_private *dev_priv = bus->dev_priv;
451 bus->force_bit = intel_gpio_create(dev_priv, 451 bus->force_bit = intel_gpio_create(dev_priv,
452 bus->reg0 & 0xff); 452 bus->reg0 & 0xff);
453 } 453 }