aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-10-03 04:14:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:09 -0400
commitbf5df0a2c54c2dc0fad619ac25d029119023610a (patch)
treee537a6892aa013a8d00eb8c3cebc9abe0afaf0f0 /drivers/video
parent346bc21026e7a92e1d7a4a1b3792c5e8b686133d (diff)
[PATCH] rivafb: Use generic DDC reading
Update driver to use generic DDC reading Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig1
-rw-r--r--drivers/video/riva/rivafb-i2c.c44
2 files changed, 3 insertions, 42 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 756ea81e475c..6bf3e4169c1e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -740,6 +740,7 @@ config FB_RIVA
740 depends on FB && PCI 740 depends on FB && PCI
741 select I2C_ALGOBIT if FB_RIVA_I2C 741 select I2C_ALGOBIT if FB_RIVA_I2C
742 select I2C if FB_RIVA_I2C 742 select I2C if FB_RIVA_I2C
743 select FB_DDC if FB_RIVA_I2C
743 select FB_MODE_HELPERS 744 select FB_MODE_HELPERS
744 select FB_CFB_FILLRECT 745 select FB_CFB_FILLRECT
745 select FB_CFB_COPYAREA 746 select FB_CFB_COPYAREA
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
index 9751c37c0bfd..c15b259af644 100644
--- a/drivers/video/riva/rivafb-i2c.c
+++ b/drivers/video/riva/rivafb-i2c.c
@@ -25,8 +25,6 @@
25#include "rivafb.h" 25#include "rivafb.h"
26#include "../edid.h" 26#include "../edid.h"
27 27
28#define RIVA_DDC 0x50
29
30static void riva_gpio_setscl(void* data, int state) 28static void riva_gpio_setscl(void* data, int state)
31{ 29{
32 struct riva_i2c_chan *chan = data; 30 struct riva_i2c_chan *chan = data;
@@ -158,50 +156,12 @@ void riva_delete_i2c_busses(struct riva_par *par)
158 par->chan[2].par = NULL; 156 par->chan[2].par = NULL;
159} 157}
160 158
161static u8 *riva_do_probe_i2c_edid(struct riva_i2c_chan *chan)
162{
163 u8 start = 0x0;
164 struct i2c_msg msgs[] = {
165 {
166 .addr = RIVA_DDC,
167 .len = 1,
168 .buf = &start,
169 }, {
170 .addr = RIVA_DDC,
171 .flags = I2C_M_RD,
172 .len = EDID_LENGTH,
173 },
174 };
175 u8 *buf;
176
177 if (!chan->par)
178 return NULL;
179
180 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
181 if (!buf) {
182 dev_warn(&chan->par->pdev->dev, "Out of memory!\n");
183 return NULL;
184 }
185 msgs[1].buf = buf;
186
187 if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
188 return buf;
189 dev_dbg(&chan->par->pdev->dev, "Unable to read EDID block.\n");
190 kfree(buf);
191 return NULL;
192}
193
194int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid) 159int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid)
195{ 160{
196 u8 *edid = NULL; 161 u8 *edid = NULL;
197 int i;
198 162
199 for (i = 0; i < 3; i++) { 163 edid = fb_ddc_read(&par->chan[conn-1].adapter);
200 /* Do the real work */ 164
201 edid = riva_do_probe_i2c_edid(&par->chan[conn-1]);
202 if (edid)
203 break;
204 }
205 if (out_edid) 165 if (out_edid)
206 *out_edid = edid; 166 *out_edid = edid;
207 if (!edid) 167 if (!edid)