aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/Kconfig1
-rw-r--r--drivers/video/nvidia/nv_i2c.c45
2 files changed, 4 insertions, 42 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d498e908f4b7..756ea81e475c 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -701,6 +701,7 @@ config FB_NVIDIA
701 depends on FB && PCI 701 depends on FB && PCI
702 select I2C_ALGOBIT if FB_NVIDIA_I2C 702 select I2C_ALGOBIT if FB_NVIDIA_I2C
703 select I2C if FB_NVIDIA_I2C 703 select I2C if FB_NVIDIA_I2C
704 select FB_DDC if FB_NVIDIA_I2C
704 select FB_MODE_HELPERS 705 select FB_MODE_HELPERS
705 select FB_CFB_FILLRECT 706 select FB_CFB_FILLRECT
706 select FB_CFB_COPYAREA 707 select FB_CFB_COPYAREA
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index 19eef3a09023..e48de3c9fd13 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -160,51 +160,12 @@ 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
196int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid) 163int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
197{ 164{
198 struct nvidia_par *par = info->par; 165 struct nvidia_par *par = info->par;
199 u8 *edid = NULL; 166 u8 *edid;
200 int i; 167
201 168 edid = fb_ddc_read(&par->chan[conn - 1].adapter);
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 }
208 169
209 if (!edid && conn == 1) { 170 if (!edid && conn == 1) {
210 /* try to get from firmware */ 171 /* try to get from firmware */