aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/nvidia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/nvidia')
-rw-r--r--drivers/video/nvidia/nv_i2c.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index e48de3c9fd13..19eef3a09023 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -160,12 +160,51 @@ void nvidia_delete_i2c_busses(struct nvidia_par *par)
160 160
161} 161}
162 162
163static u8 *nvidia_do_probe_i2c_edid(struct nvidia_i2c_chan *chan)
164{
165 u8 start = 0x0;
166 struct i2c_msg msgs[] = {
167 {
168 .addr = 0x50,
169 .len = 1,
170 .buf = &start,
171 }, {
172 .addr = 0x50,
173 .flags = I2C_M_RD,
174 .len = EDID_LENGTH,
175 },
176 };
177 u8 *buf;
178
179 if (!chan->par)
180 return NULL;
181
182 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
183 if (!buf) {
184 dev_warn(&chan->par->pci_dev->dev, "Out of memory!\n");
185 return NULL;
186 }
187 msgs[1].buf = buf;
188
189 if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
190 return buf;
191 dev_dbg(&chan->par->pci_dev->dev, "Unable to read EDID block.\n");
192 kfree(buf);
193 return NULL;
194}
195
163int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid) 196int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
164{ 197{
165 struct nvidia_par *par = info->par; 198 struct nvidia_par *par = info->par;
166 u8 *edid; 199 u8 *edid = NULL;
167 200 int i;
168 edid = fb_ddc_read(&par->chan[conn - 1].adapter); 201
202 for (i = 0; i < 3; i++) {
203 /* Do the real work */
204 edid = nvidia_do_probe_i2c_edid(&par->chan[conn - 1]);
205 if (edid)
206 break;
207 }
169 208
170 if (!edid && conn == 1) { 209 if (!edid && conn == 1) {
171 /* try to get from firmware */ 210 /* try to get from firmware */