diff options
author | braggle@free.fr <braggle@free.fr> | 2013-05-16 06:57:38 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-20 16:02:49 -0400 |
commit | 98304ad186296dc1e655399e28d5973c21db6a73 (patch) | |
tree | f32bdcbd5a5d2362b7c987880c448664ac5caa79 /drivers/gpu/drm/i915/dvo_ch7xxx.c | |
parent | 328d8e829b9a05814af4722c1091d62c5533c4f8 (diff) |
drm/i915: add support for dvo Chrontel 7010B
This patch add dvo detection for the Chrontel 7010B on some old hardware.
References: https://bugzilla.kernel.org/show_bug.cgi?id=55101
Signed-off-by: Braggle <braggle at free.fr>
[danvet: Fix up whitespace mangling.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/dvo_ch7xxx.c')
-rw-r--r-- | drivers/gpu/drm/i915/dvo_ch7xxx.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c index 3edd981e0770..757e0fa11043 100644 --- a/drivers/gpu/drm/i915/dvo_ch7xxx.c +++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c | |||
@@ -32,12 +32,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
32 | #define CH7xxx_REG_DID 0x4b | 32 | #define CH7xxx_REG_DID 0x4b |
33 | 33 | ||
34 | #define CH7011_VID 0x83 /* 7010 as well */ | 34 | #define CH7011_VID 0x83 /* 7010 as well */ |
35 | #define CH7010B_VID 0x05 | ||
35 | #define CH7009A_VID 0x84 | 36 | #define CH7009A_VID 0x84 |
36 | #define CH7009B_VID 0x85 | 37 | #define CH7009B_VID 0x85 |
37 | #define CH7301_VID 0x95 | 38 | #define CH7301_VID 0x95 |
38 | 39 | ||
39 | #define CH7xxx_VID 0x84 | 40 | #define CH7xxx_VID 0x84 |
40 | #define CH7xxx_DID 0x17 | 41 | #define CH7xxx_DID 0x17 |
42 | #define CH7010_DID 0x16 | ||
41 | 43 | ||
42 | #define CH7xxx_NUM_REGS 0x4c | 44 | #define CH7xxx_NUM_REGS 0x4c |
43 | 45 | ||
@@ -87,11 +89,20 @@ static struct ch7xxx_id_struct { | |||
87 | char *name; | 89 | char *name; |
88 | } ch7xxx_ids[] = { | 90 | } ch7xxx_ids[] = { |
89 | { CH7011_VID, "CH7011" }, | 91 | { CH7011_VID, "CH7011" }, |
92 | { CH7010B_VID, "CH7010B" }, | ||
90 | { CH7009A_VID, "CH7009A" }, | 93 | { CH7009A_VID, "CH7009A" }, |
91 | { CH7009B_VID, "CH7009B" }, | 94 | { CH7009B_VID, "CH7009B" }, |
92 | { CH7301_VID, "CH7301" }, | 95 | { CH7301_VID, "CH7301" }, |
93 | }; | 96 | }; |
94 | 97 | ||
98 | static struct ch7xxx_did_struct { | ||
99 | uint8_t did; | ||
100 | char *name; | ||
101 | } ch7xxx_dids[] = { | ||
102 | { CH7xxx_DID, "CH7XXX" }, | ||
103 | { CH7010_DID, "CH7010B" }, | ||
104 | }; | ||
105 | |||
95 | struct ch7xxx_priv { | 106 | struct ch7xxx_priv { |
96 | bool quiet; | 107 | bool quiet; |
97 | }; | 108 | }; |
@@ -108,6 +119,18 @@ static char *ch7xxx_get_id(uint8_t vid) | |||
108 | return NULL; | 119 | return NULL; |
109 | } | 120 | } |
110 | 121 | ||
122 | static char *ch7xxx_get_did(uint8_t did) | ||
123 | { | ||
124 | int i; | ||
125 | |||
126 | for (i = 0; i < ARRAY_SIZE(ch7xxx_dids); i++) { | ||
127 | if (ch7xxx_dids[i].did == did) | ||
128 | return ch7xxx_dids[i].name; | ||
129 | } | ||
130 | |||
131 | return NULL; | ||
132 | } | ||
133 | |||
111 | /** Reads an 8 bit register */ | 134 | /** Reads an 8 bit register */ |
112 | static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) | 135 | static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch) |
113 | { | 136 | { |
@@ -179,7 +202,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, | |||
179 | /* this will detect the CH7xxx chip on the specified i2c bus */ | 202 | /* this will detect the CH7xxx chip on the specified i2c bus */ |
180 | struct ch7xxx_priv *ch7xxx; | 203 | struct ch7xxx_priv *ch7xxx; |
181 | uint8_t vendor, device; | 204 | uint8_t vendor, device; |
182 | char *name; | 205 | char *name, *devid; |
183 | 206 | ||
184 | ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); | 207 | ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); |
185 | if (ch7xxx == NULL) | 208 | if (ch7xxx == NULL) |
@@ -204,7 +227,8 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo, | |||
204 | if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device)) | 227 | if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device)) |
205 | goto out; | 228 | goto out; |
206 | 229 | ||
207 | if (device != CH7xxx_DID) { | 230 | devid = ch7xxx_get_did(device); |
231 | if (!devid) { | ||
208 | DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s " | 232 | DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s " |
209 | "slave %d.\n", | 233 | "slave %d.\n", |
210 | vendor, adapter->name, dvo->slave_addr); | 234 | vendor, adapter->name, dvo->slave_addr); |