aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/savage/savagefb-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/savage/savagefb-i2c.c')
-rw-r--r--drivers/video/savage/savagefb-i2c.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index d7d810dbf0bd..3f94223b7f0c 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -213,52 +213,15 @@ void savagefb_delete_i2c_busses(struct fb_info *info)
213 par->chan.par = NULL; 213 par->chan.par = NULL;
214} 214}
215 215
216static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
217{
218 u8 start = 0x0;
219 struct i2c_msg msgs[] = {
220 {
221 .addr = SAVAGE_DDC,
222 .len = 1,
223 .buf = &start,
224 }, {
225 .addr = SAVAGE_DDC,
226 .flags = I2C_M_RD,
227 .len = EDID_LENGTH,
228 },
229 };
230 u8 *buf = NULL;
231
232 if (chan->par) {
233 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
234
235 if (buf) {
236 msgs[1].buf = buf;
237
238 if (i2c_transfer(&chan->adapter, msgs, 2) != 2) {
239 dev_dbg(&chan->par->pcidev->dev,
240 "Unable to read EDID block.\n");
241 kfree(buf);
242 buf = NULL;
243 }
244 }
245 }
246
247 return buf;
248}
249
250int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid) 216int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid)
251{ 217{
252 struct savagefb_par *par = info->par; 218 struct savagefb_par *par = info->par;
253 u8 *edid = NULL; 219 u8 *edid;
254 int i; 220
255 221 if (par->chan.par)
256 for (i = 0; i < 3; i++) { 222 edid = fb_ddc_read(&par->chan.adapter);
257 /* Do the real work */ 223 else
258 edid = savage_do_probe_i2c_edid(&par->chan); 224 edid = NULL;
259 if (edid)
260 break;
261 }
262 225
263 if (!edid) { 226 if (!edid) {
264 /* try to get from firmware */ 227 /* try to get from firmware */