nouveau: bring in misc fixes + fermi kms support
This commit is contained in:
parent
74b9092d38
commit
71e9b6763f
|
@ -2308,6 +2308,7 @@ CONFIG_DRM_NOUVEAU=m
|
|||
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
|
||||
CONFIG_DRM_NOUVEAU_DEBUG=y
|
||||
CONFIG_DRM_I2C_CH7006=m
|
||||
CONFIG_DRM_I2C_SIL164=m
|
||||
CONFIG_DRM_VMWGFX=m
|
||||
|
||||
#
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
From 9fa9e790eb301bade8fe4ea0fd9ecb72617f0928 Mon Sep 17 00:00:00 2001
|
||||
From: Francisco Jerez <currojerez@riseup.net>
|
||||
Date: Thu, 5 Aug 2010 22:57:08 +0200
|
||||
Subject: [PATCH 3/5] drm-i2c-ch7006-fix
|
||||
|
||||
drm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.
|
||||
|
||||
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
|
||||
---
|
||||
drivers/gpu/drm/i2c/ch7006_drv.c | 1 +
|
||||
drivers/gpu/drm/i2c/ch7006_mode.c | 5 ++++-
|
||||
drivers/gpu/drm/i2c/ch7006_priv.h | 1 +
|
||||
3 files changed, 6 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
|
||||
index 81681a0..8c760c7 100644
|
||||
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
|
||||
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
|
||||
@@ -454,6 +454,7 @@ static int ch7006_encoder_init(struct i2c_client *client,
|
||||
priv->hmargin = 50;
|
||||
priv->vmargin = 50;
|
||||
priv->last_dpms = -1;
|
||||
+ priv->chip_version = ch7006_read(client, CH7006_VERSION_ID);
|
||||
|
||||
if (ch7006_tv_norm) {
|
||||
for (i = 0; i < NUM_TV_NORMS; i++) {
|
||||
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c
|
||||
index e447dfb..c860f24 100644
|
||||
--- a/drivers/gpu/drm/i2c/ch7006_mode.c
|
||||
+++ b/drivers/gpu/drm/i2c/ch7006_mode.c
|
||||
@@ -316,7 +316,10 @@ void ch7006_setup_power_state(struct drm_encoder *encoder)
|
||||
}
|
||||
|
||||
} else {
|
||||
- *power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF);
|
||||
+ if (priv->chip_version >= 0x20)
|
||||
+ *power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF);
|
||||
+ else
|
||||
+ *power |= bitfs(CH7006_POWER_LEVEL, POWER_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/drivers/gpu/drm/i2c/ch7006_priv.h b/drivers/gpu/drm/i2c/ch7006_priv.h
|
||||
index b06d3d9..9487123 100644
|
||||
--- a/drivers/gpu/drm/i2c/ch7006_priv.h
|
||||
+++ b/drivers/gpu/drm/i2c/ch7006_priv.h
|
||||
@@ -95,6 +95,7 @@ struct ch7006_priv {
|
||||
int flicker;
|
||||
int scale;
|
||||
|
||||
+ int chip_version;
|
||||
int last_dpms;
|
||||
};
|
||||
|
||||
--
|
||||
1.7.2
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
From 6b33cff9cd4f6f26df99e1486d53c91698d133b4 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Skeggs <bskeggs@redhat.com>
|
||||
Date: Fri, 23 Jul 2010 09:06:52 +1000
|
||||
Subject: [PATCH 5/5] drm-nouveau-race-fix
|
||||
|
||||
drm/nouveau: fix race condition when under memory pressure
|
||||
|
||||
rhbz#602663
|
||||
|
||||
When VRAM is running out it's possible that the client's push buffers get
|
||||
evicted to main memory. When they're validated back in, the GPU may
|
||||
be used for the copy back to VRAM, but the existing synchronisation code
|
||||
only deals with inter-channel sync, not sync between PFIFO and PGRAPH on
|
||||
the same channel. This leads to PFIFO fetching from command buffers that
|
||||
haven't quite been copied by PGRAPH yet.
|
||||
|
||||
This patch marks push buffers as so, and forces any GPU-assisted buffer
|
||||
moves to be done on a different channel, which triggers the correct
|
||||
synchronisation to happen before we submit them.
|
||||
|
||||
After discussion with another nouveau developer, it was agreed that while
|
||||
this patch is fine in itself, that we'd prefer to work out a nicer, but
|
||||
likely much more invasive, fix upstream.
|
||||
|
||||
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
|
||||
---
|
||||
drivers/gpu/drm/nouveau/nouveau_bo.c | 15 +++++++++++++
|
||||
drivers/gpu/drm/nouveau/nouveau_drv.h | 1 +
|
||||
drivers/gpu/drm/nouveau/nouveau_gem.c | 36 +++++++++++++++++++++++---------
|
||||
3 files changed, 42 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
|
||||
index f1357f1..f552c76 100644
|
||||
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
|
||||
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
|
||||
@@ -36,6 +36,21 @@
|
||||
#include <linux/log2.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
+int
|
||||
+nouveau_bo_sync_gpu(struct nouveau_bo *nvbo, struct nouveau_channel *chan)
|
||||
+{
|
||||
+ struct nouveau_fence *prev_fence = nvbo->bo.sync_obj;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!prev_fence || nouveau_fence_channel(prev_fence) == chan)
|
||||
+ return 0;
|
||||
+
|
||||
+ spin_lock(&nvbo->bo.lock);
|
||||
+ ret = ttm_bo_wait(&nvbo->bo, false, false, false);
|
||||
+ spin_unlock(&nvbo->bo.lock);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
|
||||
{
|
||||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
|
||||
index c001574..922ef43 100644
|
||||
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
|
||||
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
|
||||
@@ -1165,6 +1165,7 @@ extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index);
|
||||
extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val);
|
||||
extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index);
|
||||
extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val);
|
||||
+extern int nouveau_bo_sync_gpu(struct nouveau_bo *, struct nouveau_channel *);
|
||||
|
||||
/* nouveau_fence.c */
|
||||
struct nouveau_fence;
|
||||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
|
||||
index 547f2c2..a915dcd 100644
|
||||
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
|
||||
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
|
||||
@@ -361,16 +361,11 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
|
||||
|
||||
list_for_each_entry(nvbo, list, entry) {
|
||||
struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index];
|
||||
- struct nouveau_fence *prev_fence = nvbo->bo.sync_obj;
|
||||
|
||||
- if (prev_fence && nouveau_fence_channel(prev_fence) != chan) {
|
||||
- spin_lock(&nvbo->bo.lock);
|
||||
- ret = ttm_bo_wait(&nvbo->bo, false, false, false);
|
||||
- spin_unlock(&nvbo->bo.lock);
|
||||
- if (unlikely(ret)) {
|
||||
- NV_ERROR(dev, "fail wait other chan\n");
|
||||
- return ret;
|
||||
- }
|
||||
+ ret = nouveau_bo_sync_gpu(nvbo, chan);
|
||||
+ if (unlikely(ret)) {
|
||||
+ NV_ERROR(dev, "fail pre-validate sync\n");
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
ret = nouveau_gem_set_domain(nvbo->gem, b->read_domains,
|
||||
@@ -381,7 +376,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- nvbo->channel = chan;
|
||||
+ nvbo->channel = (b->read_domains & (1 << 31)) ? NULL : chan;
|
||||
ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement,
|
||||
false, false, false);
|
||||
nvbo->channel = NULL;
|
||||
@@ -390,6 +385,12 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ ret = nouveau_bo_sync_gpu(nvbo, chan);
|
||||
+ if (unlikely(ret)) {
|
||||
+ NV_ERROR(dev, "fail post-validate sync\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
if (nvbo->bo.offset == b->presumed.offset &&
|
||||
((nvbo->bo.mem.mem_type == TTM_PL_VRAM &&
|
||||
b->presumed.domain & NOUVEAU_GEM_DOMAIN_VRAM) ||
|
||||
@@ -615,6 +616,21 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
||||
+ /* Mark push buffers as being used on PFIFO, the validation code
|
||||
+ * will then make sure that if the pushbuf bo moves, that they
|
||||
+ * happen on the kernel channel, which will in turn cause a sync
|
||||
+ * to happen before we try and submit the push buffer.
|
||||
+ */
|
||||
+ for (i = 0; i < req->nr_push; i++) {
|
||||
+ if (push[i].bo_index >= req->nr_buffers) {
|
||||
+ NV_ERROR(dev, "push %d buffer not in list\n", i);
|
||||
+ ret = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ bo[push[i].bo_index].read_domains |= (1 << 31);
|
||||
+ }
|
||||
+
|
||||
/* Validate buffer list */
|
||||
ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers,
|
||||
req->nr_buffers, &op, &do_reloc);
|
||||
--
|
||||
1.7.2
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,592 @@
|
|||
From f1719f0dcd68ca4de42c7b00ef2b37658007dda7 Mon Sep 17 00:00:00 2001
|
||||
From: Francisco Jerez <currojerez@riseup.net>
|
||||
Date: Thu, 22 Jul 2010 17:06:18 +0200
|
||||
Subject: [PATCH 2/5] drm-sil164-module
|
||||
|
||||
drm: Import driver for the sil164 I2C TMDS transmitter.
|
||||
|
||||
sil164 transmitters are used for DVI outputs on Intel/nvidia and ATI setups.
|
||||
|
||||
So far only nouveau can use this driver.
|
||||
|
||||
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
|
||||
Tested-by: Patrice Mandin <patmandin@gmail.com>
|
||||
Signed-off-by: Dave Airlie <airlied@redhat.com>
|
||||
---
|
||||
drivers/gpu/drm/i2c/Makefile | 3 +
|
||||
drivers/gpu/drm/i2c/sil164_drv.c | 462 ++++++++++++++++++++++++++++++++++++++
|
||||
drivers/gpu/drm/nouveau/Kconfig | 9 +
|
||||
include/drm/i2c/sil164.h | 63 +++++
|
||||
4 files changed, 537 insertions(+), 0 deletions(-)
|
||||
create mode 100644 drivers/gpu/drm/i2c/sil164_drv.c
|
||||
create mode 100644 include/drm/i2c/sil164.h
|
||||
|
||||
diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
|
||||
index 6d2abaf..9286256 100644
|
||||
--- a/drivers/gpu/drm/i2c/Makefile
|
||||
+++ b/drivers/gpu/drm/i2c/Makefile
|
||||
@@ -2,3 +2,6 @@ ccflags-y := -Iinclude/drm
|
||||
|
||||
ch7006-y := ch7006_drv.o ch7006_mode.o
|
||||
obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
|
||||
+
|
||||
+sil164-y := sil164_drv.o
|
||||
+obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
|
||||
diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
|
||||
new file mode 100644
|
||||
index 0000000..0b67732
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/i2c/sil164_drv.c
|
||||
@@ -0,0 +1,462 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010 Francisco Jerez.
|
||||
+ * All Rights Reserved.
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining
|
||||
+ * a copy of this software and associated documentation files (the
|
||||
+ * "Software"), to deal in the Software without restriction, including
|
||||
+ * without limitation the rights to use, copy, modify, merge, publish,
|
||||
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
||||
+ * permit persons to whom the Software is furnished to do so, subject to
|
||||
+ * the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice (including the
|
||||
+ * next paragraph) shall be included in all copies or substantial
|
||||
+ * portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
||||
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include "drmP.h"
|
||||
+#include "drm_crtc_helper.h"
|
||||
+#include "drm_encoder_slave.h"
|
||||
+#include "i2c/sil164.h"
|
||||
+
|
||||
+struct sil164_priv {
|
||||
+ struct sil164_encoder_params config;
|
||||
+ struct i2c_client *duallink_slave;
|
||||
+
|
||||
+ uint8_t saved_state[0x10];
|
||||
+ uint8_t saved_slave_state[0x10];
|
||||
+};
|
||||
+
|
||||
+#define to_sil164_priv(x) \
|
||||
+ ((struct sil164_priv *)to_encoder_slave(x)->slave_priv)
|
||||
+
|
||||
+#define sil164_dbg(client, format, ...) do { \
|
||||
+ if (drm_debug & DRM_UT_KMS) \
|
||||
+ dev_printk(KERN_DEBUG, &client->dev, \
|
||||
+ "%s: " format, __func__, ## __VA_ARGS__); \
|
||||
+ } while (0)
|
||||
+#define sil164_info(client, format, ...) \
|
||||
+ dev_info(&client->dev, format, __VA_ARGS__)
|
||||
+#define sil164_err(client, format, ...) \
|
||||
+ dev_err(&client->dev, format, __VA_ARGS__)
|
||||
+
|
||||
+#define SIL164_I2C_ADDR_MASTER 0x38
|
||||
+#define SIL164_I2C_ADDR_SLAVE 0x39
|
||||
+
|
||||
+/* HW register definitions */
|
||||
+
|
||||
+#define SIL164_VENDOR_LO 0x0
|
||||
+#define SIL164_VENDOR_HI 0x1
|
||||
+#define SIL164_DEVICE_LO 0x2
|
||||
+#define SIL164_DEVICE_HI 0x3
|
||||
+#define SIL164_REVISION 0x4
|
||||
+#define SIL164_FREQ_MIN 0x6
|
||||
+#define SIL164_FREQ_MAX 0x7
|
||||
+#define SIL164_CONTROL0 0x8
|
||||
+# define SIL164_CONTROL0_POWER_ON 0x01
|
||||
+# define SIL164_CONTROL0_EDGE_RISING 0x02
|
||||
+# define SIL164_CONTROL0_INPUT_24BIT 0x04
|
||||
+# define SIL164_CONTROL0_DUAL_EDGE 0x08
|
||||
+# define SIL164_CONTROL0_HSYNC_ON 0x10
|
||||
+# define SIL164_CONTROL0_VSYNC_ON 0x20
|
||||
+#define SIL164_DETECT 0x9
|
||||
+# define SIL164_DETECT_INTR_STAT 0x01
|
||||
+# define SIL164_DETECT_HOTPLUG_STAT 0x02
|
||||
+# define SIL164_DETECT_RECEIVER_STAT 0x04
|
||||
+# define SIL164_DETECT_INTR_MODE_RECEIVER 0x00
|
||||
+# define SIL164_DETECT_INTR_MODE_HOTPLUG 0x08
|
||||
+# define SIL164_DETECT_OUT_MODE_HIGH 0x00
|
||||
+# define SIL164_DETECT_OUT_MODE_INTR 0x10
|
||||
+# define SIL164_DETECT_OUT_MODE_RECEIVER 0x20
|
||||
+# define SIL164_DETECT_OUT_MODE_HOTPLUG 0x30
|
||||
+# define SIL164_DETECT_VSWING_STAT 0x80
|
||||
+#define SIL164_CONTROL1 0xa
|
||||
+# define SIL164_CONTROL1_DESKEW_ENABLE 0x10
|
||||
+# define SIL164_CONTROL1_DESKEW_INCR_SHIFT 5
|
||||
+#define SIL164_GPIO 0xb
|
||||
+#define SIL164_CONTROL2 0xc
|
||||
+# define SIL164_CONTROL2_FILTER_ENABLE 0x01
|
||||
+# define SIL164_CONTROL2_FILTER_SETTING_SHIFT 1
|
||||
+# define SIL164_CONTROL2_DUALLINK_MASTER 0x40
|
||||
+# define SIL164_CONTROL2_SYNC_CONT 0x80
|
||||
+#define SIL164_DUALLINK 0xd
|
||||
+# define SIL164_DUALLINK_ENABLE 0x10
|
||||
+# define SIL164_DUALLINK_SKEW_SHIFT 5
|
||||
+#define SIL164_PLLZONE 0xe
|
||||
+# define SIL164_PLLZONE_STAT 0x08
|
||||
+# define SIL164_PLLZONE_FORCE_ON 0x10
|
||||
+# define SIL164_PLLZONE_FORCE_HIGH 0x20
|
||||
+
|
||||
+/* HW access functions */
|
||||
+
|
||||
+static void
|
||||
+sil164_write(struct i2c_client *client, uint8_t addr, uint8_t val)
|
||||
+{
|
||||
+ uint8_t buf[] = {addr, val};
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
|
||||
+ if (ret < 0)
|
||||
+ sil164_err(client, "Error %d writing to subaddress 0x%x\n",
|
||||
+ ret, addr);
|
||||
+}
|
||||
+
|
||||
+static uint8_t
|
||||
+sil164_read(struct i2c_client *client, uint8_t addr)
|
||||
+{
|
||||
+ uint8_t val;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = i2c_master_send(client, &addr, sizeof(addr));
|
||||
+ if (ret < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ ret = i2c_master_recv(client, &val, sizeof(val));
|
||||
+ if (ret < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ return val;
|
||||
+
|
||||
+fail:
|
||||
+ sil164_err(client, "Error %d reading from subaddress 0x%x\n",
|
||||
+ ret, addr);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_save_state(struct i2c_client *client, uint8_t *state)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0x8; i <= 0xe; i++)
|
||||
+ state[i] = sil164_read(client, i);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_restore_state(struct i2c_client *client, uint8_t *state)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0x8; i <= 0xe; i++)
|
||||
+ sil164_write(client, i, state[i]);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_set_power_state(struct i2c_client *client, bool on)
|
||||
+{
|
||||
+ uint8_t control0 = sil164_read(client, SIL164_CONTROL0);
|
||||
+
|
||||
+ if (on)
|
||||
+ control0 |= SIL164_CONTROL0_POWER_ON;
|
||||
+ else
|
||||
+ control0 &= ~SIL164_CONTROL0_POWER_ON;
|
||||
+
|
||||
+ sil164_write(client, SIL164_CONTROL0, control0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_init_state(struct i2c_client *client,
|
||||
+ struct sil164_encoder_params *config,
|
||||
+ bool duallink)
|
||||
+{
|
||||
+ sil164_write(client, SIL164_CONTROL0,
|
||||
+ SIL164_CONTROL0_HSYNC_ON |
|
||||
+ SIL164_CONTROL0_VSYNC_ON |
|
||||
+ (config->input_edge ? SIL164_CONTROL0_EDGE_RISING : 0) |
|
||||
+ (config->input_width ? SIL164_CONTROL0_INPUT_24BIT : 0) |
|
||||
+ (config->input_dual ? SIL164_CONTROL0_DUAL_EDGE : 0));
|
||||
+
|
||||
+ sil164_write(client, SIL164_DETECT,
|
||||
+ SIL164_DETECT_INTR_STAT |
|
||||
+ SIL164_DETECT_OUT_MODE_RECEIVER);
|
||||
+
|
||||
+ sil164_write(client, SIL164_CONTROL1,
|
||||
+ (config->input_skew ? SIL164_CONTROL1_DESKEW_ENABLE : 0) |
|
||||
+ (((config->input_skew + 4) & 0x7)
|
||||
+ << SIL164_CONTROL1_DESKEW_INCR_SHIFT));
|
||||
+
|
||||
+ sil164_write(client, SIL164_CONTROL2,
|
||||
+ SIL164_CONTROL2_SYNC_CONT |
|
||||
+ (config->pll_filter ? 0 : SIL164_CONTROL2_FILTER_ENABLE) |
|
||||
+ (4 << SIL164_CONTROL2_FILTER_SETTING_SHIFT));
|
||||
+
|
||||
+ sil164_write(client, SIL164_PLLZONE, 0);
|
||||
+
|
||||
+ if (duallink)
|
||||
+ sil164_write(client, SIL164_DUALLINK,
|
||||
+ SIL164_DUALLINK_ENABLE |
|
||||
+ (((config->duallink_skew + 4) & 0x7)
|
||||
+ << SIL164_DUALLINK_SKEW_SHIFT));
|
||||
+ else
|
||||
+ sil164_write(client, SIL164_DUALLINK, 0);
|
||||
+}
|
||||
+
|
||||
+/* DRM encoder functions */
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_set_config(struct drm_encoder *encoder, void *params)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+
|
||||
+ priv->config = *(struct sil164_encoder_params *)params;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_dpms(struct drm_encoder *encoder, int mode)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+ bool on = (mode == DRM_MODE_DPMS_ON);
|
||||
+ bool duallink = (on && encoder->crtc->mode.clock > 165000);
|
||||
+
|
||||
+ sil164_set_power_state(drm_i2c_encoder_get_client(encoder), on);
|
||||
+
|
||||
+ if (priv->duallink_slave)
|
||||
+ sil164_set_power_state(priv->duallink_slave, duallink);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_save(struct drm_encoder *encoder)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+
|
||||
+ sil164_save_state(drm_i2c_encoder_get_client(encoder),
|
||||
+ priv->saved_state);
|
||||
+
|
||||
+ if (priv->duallink_slave)
|
||||
+ sil164_save_state(priv->duallink_slave,
|
||||
+ priv->saved_slave_state);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_restore(struct drm_encoder *encoder)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+
|
||||
+ sil164_restore_state(drm_i2c_encoder_get_client(encoder),
|
||||
+ priv->saved_state);
|
||||
+
|
||||
+ if (priv->duallink_slave)
|
||||
+ sil164_restore_state(priv->duallink_slave,
|
||||
+ priv->saved_slave_state);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+sil164_encoder_mode_fixup(struct drm_encoder *encoder,
|
||||
+ struct drm_display_mode *mode,
|
||||
+ struct drm_display_mode *adjusted_mode)
|
||||
+{
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_encoder_mode_valid(struct drm_encoder *encoder,
|
||||
+ struct drm_display_mode *mode)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+
|
||||
+ if (mode->clock < 32000)
|
||||
+ return MODE_CLOCK_LOW;
|
||||
+
|
||||
+ if (mode->clock > 330000 ||
|
||||
+ (mode->clock > 165000 && !priv->duallink_slave))
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
+
|
||||
+ return MODE_OK;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_mode_set(struct drm_encoder *encoder,
|
||||
+ struct drm_display_mode *mode,
|
||||
+ struct drm_display_mode *adjusted_mode)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+ bool duallink = adjusted_mode->clock > 165000;
|
||||
+
|
||||
+ sil164_init_state(drm_i2c_encoder_get_client(encoder),
|
||||
+ &priv->config, duallink);
|
||||
+
|
||||
+ if (priv->duallink_slave)
|
||||
+ sil164_init_state(priv->duallink_slave,
|
||||
+ &priv->config, duallink);
|
||||
+
|
||||
+ sil164_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
|
||||
+}
|
||||
+
|
||||
+static enum drm_connector_status
|
||||
+sil164_encoder_detect(struct drm_encoder *encoder,
|
||||
+ struct drm_connector *connector)
|
||||
+{
|
||||
+ struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
|
||||
+
|
||||
+ if (sil164_read(client, SIL164_DETECT) & SIL164_DETECT_HOTPLUG_STAT)
|
||||
+ return connector_status_connected;
|
||||
+ else
|
||||
+ return connector_status_disconnected;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_encoder_get_modes(struct drm_encoder *encoder,
|
||||
+ struct drm_connector *connector)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_encoder_create_resources(struct drm_encoder *encoder,
|
||||
+ struct drm_connector *connector)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_encoder_set_property(struct drm_encoder *encoder,
|
||||
+ struct drm_connector *connector,
|
||||
+ struct drm_property *property,
|
||||
+ uint64_t val)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+sil164_encoder_destroy(struct drm_encoder *encoder)
|
||||
+{
|
||||
+ struct sil164_priv *priv = to_sil164_priv(encoder);
|
||||
+
|
||||
+ if (priv->duallink_slave)
|
||||
+ i2c_unregister_device(priv->duallink_slave);
|
||||
+
|
||||
+ kfree(priv);
|
||||
+ drm_i2c_encoder_destroy(encoder);
|
||||
+}
|
||||
+
|
||||
+static struct drm_encoder_slave_funcs sil164_encoder_funcs = {
|
||||
+ .set_config = sil164_encoder_set_config,
|
||||
+ .destroy = sil164_encoder_destroy,
|
||||
+ .dpms = sil164_encoder_dpms,
|
||||
+ .save = sil164_encoder_save,
|
||||
+ .restore = sil164_encoder_restore,
|
||||
+ .mode_fixup = sil164_encoder_mode_fixup,
|
||||
+ .mode_valid = sil164_encoder_mode_valid,
|
||||
+ .mode_set = sil164_encoder_mode_set,
|
||||
+ .detect = sil164_encoder_detect,
|
||||
+ .get_modes = sil164_encoder_get_modes,
|
||||
+ .create_resources = sil164_encoder_create_resources,
|
||||
+ .set_property = sil164_encoder_set_property,
|
||||
+};
|
||||
+
|
||||
+/* I2C driver functions */
|
||||
+
|
||||
+static int
|
||||
+sil164_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
+{
|
||||
+ int vendor = sil164_read(client, SIL164_VENDOR_HI) << 8 |
|
||||
+ sil164_read(client, SIL164_VENDOR_LO);
|
||||
+ int device = sil164_read(client, SIL164_DEVICE_HI) << 8 |
|
||||
+ sil164_read(client, SIL164_DEVICE_LO);
|
||||
+ int rev = sil164_read(client, SIL164_REVISION);
|
||||
+
|
||||
+ if (vendor != 0x1 || device != 0x6) {
|
||||
+ sil164_dbg(client, "Unknown device %x:%x.%x\n",
|
||||
+ vendor, device, rev);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ sil164_info(client, "Detected device %x:%x.%x\n",
|
||||
+ vendor, device, rev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_remove(struct i2c_client *client)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct i2c_client *
|
||||
+sil164_detect_slave(struct i2c_client *client)
|
||||
+{
|
||||
+ struct i2c_adapter *adap = client->adapter;
|
||||
+ struct i2c_msg msg = {
|
||||
+ .addr = SIL164_I2C_ADDR_SLAVE,
|
||||
+ .len = 0,
|
||||
+ };
|
||||
+ const struct i2c_board_info info = {
|
||||
+ I2C_BOARD_INFO("sil164", SIL164_I2C_ADDR_SLAVE)
|
||||
+ };
|
||||
+
|
||||
+ if (i2c_transfer(adap, &msg, 1) != 1) {
|
||||
+ sil164_dbg(adap, "No dual-link slave found.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return i2c_new_device(adap, &info);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sil164_encoder_init(struct i2c_client *client,
|
||||
+ struct drm_device *dev,
|
||||
+ struct drm_encoder_slave *encoder)
|
||||
+{
|
||||
+ struct sil164_priv *priv;
|
||||
+
|
||||
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ encoder->slave_priv = priv;
|
||||
+ encoder->slave_funcs = &sil164_encoder_funcs;
|
||||
+
|
||||
+ priv->duallink_slave = sil164_detect_slave(client);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct i2c_device_id sil164_ids[] = {
|
||||
+ { "sil164", 0 },
|
||||
+ { }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(i2c, sil164_ids);
|
||||
+
|
||||
+static struct drm_i2c_encoder_driver sil164_driver = {
|
||||
+ .i2c_driver = {
|
||||
+ .probe = sil164_probe,
|
||||
+ .remove = sil164_remove,
|
||||
+ .driver = {
|
||||
+ .name = "sil164",
|
||||
+ },
|
||||
+ .id_table = sil164_ids,
|
||||
+ },
|
||||
+ .encoder_init = sil164_encoder_init,
|
||||
+};
|
||||
+
|
||||
+/* Module initialization */
|
||||
+
|
||||
+static int __init
|
||||
+sil164_init(void)
|
||||
+{
|
||||
+ return drm_i2c_encoder_register(THIS_MODULE, &sil164_driver);
|
||||
+}
|
||||
+
|
||||
+static void __exit
|
||||
+sil164_exit(void)
|
||||
+{
|
||||
+ drm_i2c_encoder_unregister(&sil164_driver);
|
||||
+}
|
||||
+
|
||||
+MODULE_AUTHOR("Francisco Jerez <currojerez@riseup.net>");
|
||||
+MODULE_DESCRIPTION("Silicon Image sil164 TMDS transmitter driver");
|
||||
+MODULE_LICENSE("GPL and additional rights");
|
||||
+
|
||||
+module_init(sil164_init);
|
||||
+module_exit(sil164_exit);
|
||||
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
|
||||
index 1175429..6b8967a 100644
|
||||
--- a/drivers/gpu/drm/nouveau/Kconfig
|
||||
+++ b/drivers/gpu/drm/nouveau/Kconfig
|
||||
@@ -41,4 +41,13 @@ config DRM_I2C_CH7006
|
||||
|
||||
This driver is currently only useful if you're also using
|
||||
the nouveau driver.
|
||||
+
|
||||
+config DRM_I2C_SIL164
|
||||
+ tristate "Silicon Image sil164 TMDS transmitter"
|
||||
+ default m if DRM_NOUVEAU
|
||||
+ help
|
||||
+ Support for sil164 and similar single-link (or dual-link
|
||||
+ when used in pairs) TMDS transmitters, used in some nVidia
|
||||
+ video cards.
|
||||
+
|
||||
endmenu
|
||||
diff --git a/include/drm/i2c/sil164.h b/include/drm/i2c/sil164.h
|
||||
new file mode 100644
|
||||
index 0000000..205e273
|
||||
--- /dev/null
|
||||
+++ b/include/drm/i2c/sil164.h
|
||||
@@ -0,0 +1,63 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010 Francisco Jerez.
|
||||
+ * All Rights Reserved.
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining
|
||||
+ * a copy of this software and associated documentation files (the
|
||||
+ * "Software"), to deal in the Software without restriction, including
|
||||
+ * without limitation the rights to use, copy, modify, merge, publish,
|
||||
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
||||
+ * permit persons to whom the Software is furnished to do so, subject to
|
||||
+ * the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice (including the
|
||||
+ * next paragraph) shall be included in all copies or substantial
|
||||
+ * portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
||||
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#ifndef __DRM_I2C_SIL164_H__
|
||||
+#define __DRM_I2C_SIL164_H__
|
||||
+
|
||||
+/**
|
||||
+ * struct sil164_encoder_params
|
||||
+ *
|
||||
+ * Describes how the sil164 is connected to the GPU. It should be used
|
||||
+ * as the @params parameter of its @set_config method.
|
||||
+ *
|
||||
+ * See "http://www.siliconimage.com/docs/SiI-DS-0021-E-164.pdf".
|
||||
+ */
|
||||
+struct sil164_encoder_params {
|
||||
+ enum {
|
||||
+ SIL164_INPUT_EDGE_FALLING = 0,
|
||||
+ SIL164_INPUT_EDGE_RISING
|
||||
+ } input_edge;
|
||||
+
|
||||
+ enum {
|
||||
+ SIL164_INPUT_WIDTH_12BIT = 0,
|
||||
+ SIL164_INPUT_WIDTH_24BIT
|
||||
+ } input_width;
|
||||
+
|
||||
+ enum {
|
||||
+ SIL164_INPUT_SINGLE_EDGE = 0,
|
||||
+ SIL164_INPUT_DUAL_EDGE
|
||||
+ } input_dual;
|
||||
+
|
||||
+ enum {
|
||||
+ SIL164_PLL_FILTER_ON = 0,
|
||||
+ SIL164_PLL_FILTER_OFF,
|
||||
+ } pll_filter;
|
||||
+
|
||||
+ int input_skew; /** < Allowed range [-4, 3], use 0 for no de-skew. */
|
||||
+ int duallink_skew; /** < Allowed range [-4, 3]. */
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
1.7.2
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 74ef65374ae6d0eead4a631aea3aca80d016ff0f Mon Sep 17 00:00:00 2001
|
||||
From: Francisco Jerez <currojerez@riseup.net>
|
||||
Date: Thu, 22 Jul 2010 17:07:38 +0200
|
||||
Subject: [PATCH 1/5] drm-simplify-i2c-config
|
||||
|
||||
drm/kms: Simplify setup of the initial I2C encoder config.
|
||||
|
||||
In most use cases the driver will be using the same static config all
|
||||
the time: interpreting i2c_board_info::platform_data as the default
|
||||
config we can can save the GPU driver a redundant set_config() call.
|
||||
|
||||
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
|
||||
Signed-off-by: Dave Airlie <airlied@redhat.com>
|
||||
---
|
||||
drivers/gpu/drm/drm_encoder_slave.c | 7 +++++++
|
||||
1 files changed, 7 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
|
||||
index f018469..d62c064 100644
|
||||
--- a/drivers/gpu/drm/drm_encoder_slave.c
|
||||
+++ b/drivers/gpu/drm/drm_encoder_slave.c
|
||||
@@ -41,6 +41,9 @@
|
||||
* &drm_encoder_slave. The @slave_funcs field will be initialized with
|
||||
* the hooks provided by the slave driver.
|
||||
*
|
||||
+ * If @info->platform_data is non-NULL it will be used as the initial
|
||||
+ * slave config.
|
||||
+ *
|
||||
* Returns 0 on success or a negative errno on failure, in particular,
|
||||
* -ENODEV is returned when no matching driver is found.
|
||||
*/
|
||||
@@ -85,6 +88,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,
|
||||
if (err)
|
||||
goto fail_unregister;
|
||||
|
||||
+ if (info->platform_data)
|
||||
+ encoder->slave_funcs->set_config(&encoder->base,
|
||||
+ info->platform_data);
|
||||
+
|
||||
return 0;
|
||||
|
||||
fail_unregister:
|
||||
--
|
||||
1.7.2
|
||||
|
14
kernel.spec
14
kernel.spec
|
@ -48,7 +48,7 @@ Summary: The Linux kernel
|
|||
# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
|
||||
# scripts/rebase.sh should be made to do that for you, actually.
|
||||
#
|
||||
%global baserelease 4
|
||||
%global baserelease 5
|
||||
%global fedora_build %{baserelease}
|
||||
|
||||
# base_sublevel is the kernel version we're starting with and patching
|
||||
|
@ -649,8 +649,13 @@ Patch1555: fix_xen_guest_on_old_EC2.patch
|
|||
# DRM
|
||||
Patch1801: drm-revert-drm-fbdev-rework-output-polling-to-be-back-in-core.patch
|
||||
Patch1802: revert-drm-kms-toggle-poll-around-switcheroo.patch
|
||||
# drm fixes nouveau depends on
|
||||
Patch1805: drm-simplify-i2c-config.patch
|
||||
Patch1806: drm-sil164-module.patch
|
||||
Patch1807: drm-i2c-ch7006-fix.patch
|
||||
# nouveau + drm fixes
|
||||
Patch1810: drm-nouveau-updates.patch
|
||||
Patch1811: drm-nouveau-race-fix.patch
|
||||
Patch1819: drm-intel-big-hammer.patch
|
||||
# intel drm is all merged upstream
|
||||
Patch1824: drm-intel-next.patch
|
||||
|
@ -1250,8 +1255,12 @@ ApplyPatch fix_xen_guest_on_old_EC2.patch
|
|||
#ApplyPatch drm-revert-drm-fbdev-rework-output-polling-to-be-back-in-core.patch
|
||||
#ApplyPatch revert-drm-kms-toggle-poll-around-switcheroo.patch
|
||||
|
||||
ApplyPatch drm-simplify-i2c-config.patch
|
||||
ApplyPatch drm-sil164-module.patch
|
||||
ApplyPatch drm-i2c-ch7006-fix.patch
|
||||
# Nouveau DRM + drm fixes
|
||||
ApplyPatch drm-nouveau-updates.patch
|
||||
ApplyPatch drm-nouveau-race-fix.patch
|
||||
ApplyPatch drm-intel-big-hammer.patch
|
||||
ApplyOptionalPatch drm-intel-next.patch
|
||||
ApplyPatch drm-intel-make-lvds-work.patch
|
||||
|
@ -1881,6 +1890,9 @@ fi
|
|||
# and build.
|
||||
|
||||
%changelog
|
||||
* Tue Aug 10 2010 Ben Skeggs <bskeggs@redhat.com> 2.6.35.1-5.rc1
|
||||
- nouveau: bring in patches up to what will be in 2.6.36
|
||||
|
||||
* Sat Aug 07 2010 Chuck Ebbert <cebbert@redhat.com> 2.6.35.1-4.rc1
|
||||
- Linux 2.6.35.1-rc1
|
||||
|
||||
|
|
Loading…
Reference in New Issue