diff options
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_i2c.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c index 88583e7bf651..316a3c7e6eb4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.c +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c | |||
| @@ -254,16 +254,27 @@ struct nouveau_i2c_chan * | |||
| 254 | nouveau_i2c_find(struct drm_device *dev, int index) | 254 | nouveau_i2c_find(struct drm_device *dev, int index) |
| 255 | { | 255 | { |
| 256 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 256 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 257 | struct nvbios *bios = &dev_priv->vbios; | 257 | struct dcb_i2c_entry *i2c = &dev_priv->vbios.dcb.i2c[index]; |
| 258 | 258 | ||
| 259 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) | 259 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) |
| 260 | return NULL; | 260 | return NULL; |
| 261 | 261 | ||
| 262 | if (!bios->dcb.i2c[index].chan) { | 262 | if (dev_priv->chipset >= NV_50 && (i2c->entry & 0x00000100)) { |
| 263 | if (nouveau_i2c_init(dev, &bios->dcb.i2c[index], index)) | 263 | uint32_t reg = 0xe500, val; |
| 264 | return NULL; | 264 | |
| 265 | if (i2c->port_type == 6) { | ||
| 266 | reg += i2c->read * 0x50; | ||
| 267 | val = 0x2002; | ||
| 268 | } else { | ||
| 269 | reg += ((i2c->entry & 0x1e00) >> 9) * 0x50; | ||
| 270 | val = 0xe001; | ||
| 271 | } | ||
| 272 | |||
| 273 | nv_wr32(dev, reg, (nv_rd32(dev, reg) & ~0xf003) | val); | ||
| 265 | } | 274 | } |
| 266 | 275 | ||
| 267 | return bios->dcb.i2c[index].chan; | 276 | if (!i2c->chan && nouveau_i2c_init(dev, i2c, index)) |
| 277 | return NULL; | ||
| 278 | return i2c->chan; | ||
| 268 | } | 279 | } |
| 269 | 280 | ||
