aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/nvidia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/nvidia')
-rw-r--r--drivers/video/nvidia/nv_accel.c35
-rw-r--r--drivers/video/nvidia/nv_hw.c12
-rw-r--r--drivers/video/nvidia/nv_i2c.c13
-rw-r--r--drivers/video/nvidia/nv_local.h11
-rw-r--r--drivers/video/nvidia/nv_of.c3
-rw-r--r--drivers/video/nvidia/nv_proto.h1
-rw-r--r--drivers/video/nvidia/nv_setup.c20
-rw-r--r--drivers/video/nvidia/nv_type.h1
-rw-r--r--drivers/video/nvidia/nvidia.c24
9 files changed, 53 insertions, 67 deletions
diff --git a/drivers/video/nvidia/nv_accel.c b/drivers/video/nvidia/nv_accel.c
index 4aefb8f41637..9efb8a3854e2 100644
--- a/drivers/video/nvidia/nv_accel.c
+++ b/drivers/video/nvidia/nv_accel.c
@@ -261,41 +261,6 @@ void NVResetGraphics(struct fb_info *info)
261 NVDmaKickoff(par); 261 NVDmaKickoff(par);
262} 262}
263 263
264u8 byte_rev[256] = {
265 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
266 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
267 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
268 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
269 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
270 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
271 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
272 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
273 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
274 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
275 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
276 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
277 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
278 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
279 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
280 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
281 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
282 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
283 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
284 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
285 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
286 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
287 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
288 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
289 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
290 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
291 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
292 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
293 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
294 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
295 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
296 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
297};
298
299int nvidiafb_sync(struct fb_info *info) 264int nvidiafb_sync(struct fb_info *info)
300{ 265{
301 struct nvidia_par *par = info->par; 266 struct nvidia_par *par = info->par;
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c
index 9ed640d35728..ea426115c6f9 100644
--- a/drivers/video/nvidia/nv_hw.c
+++ b/drivers/video/nvidia/nv_hw.c
@@ -145,12 +145,18 @@ static void nvGetClocks(struct nvidia_par *par, unsigned int *MClk,
145 145
146 if (par->Architecture >= NV_ARCH_40) { 146 if (par->Architecture >= NV_ARCH_40) {
147 pll = NV_RD32(par->PMC, 0x4020); 147 pll = NV_RD32(par->PMC, 0x4020);
148 P = (pll >> 16) & 0x03; 148 P = (pll >> 16) & 0x07;
149 pll = NV_RD32(par->PMC, 0x4024); 149 pll = NV_RD32(par->PMC, 0x4024);
150 M = pll & 0xFF; 150 M = pll & 0xFF;
151 N = (pll >> 8) & 0xFF; 151 N = (pll >> 8) & 0xFF;
152 MB = (pll >> 16) & 0xFF; 152 if (((par->Chipset & 0xfff0) == 0x0290) ||
153 NB = (pll >> 24) & 0xFF; 153 ((par->Chipset & 0xfff0) == 0x0390)) {
154 MB = 1;
155 NB = 1;
156 } else {
157 MB = (pll >> 16) & 0xFF;
158 NB = (pll >> 24) & 0xFF;
159 }
154 *MClk = ((N * NB * par->CrystalFreqKHz) / (M * MB)) >> P; 160 *MClk = ((N * NB * par->CrystalFreqKHz) / (M * MB)) >> P;
155 161
156 pll = NV_RD32(par->PMC, 0x4000); 162 pll = NV_RD32(par->PMC, 0x4000);
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index 19eef3a09023..8454adf2d178 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -147,15 +147,15 @@ void nvidia_create_i2c_busses(struct nvidia_par *par)
147void nvidia_delete_i2c_busses(struct nvidia_par *par) 147void nvidia_delete_i2c_busses(struct nvidia_par *par)
148{ 148{
149 if (par->chan[0].par) 149 if (par->chan[0].par)
150 i2c_bit_del_bus(&par->chan[0].adapter); 150 i2c_del_adapter(&par->chan[0].adapter);
151 par->chan[0].par = NULL; 151 par->chan[0].par = NULL;
152 152
153 if (par->chan[1].par) 153 if (par->chan[1].par)
154 i2c_bit_del_bus(&par->chan[1].adapter); 154 i2c_del_adapter(&par->chan[1].adapter);
155 par->chan[1].par = NULL; 155 par->chan[1].par = NULL;
156 156
157 if (par->chan[2].par) 157 if (par->chan[2].par)
158 i2c_bit_del_bus(&par->chan[2].adapter); 158 i2c_del_adapter(&par->chan[2].adapter);
159 par->chan[2].par = NULL; 159 par->chan[2].par = NULL;
160 160
161} 161}
@@ -210,11 +210,8 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
210 /* try to get from firmware */ 210 /* try to get from firmware */
211 const u8 *e = fb_firmware_edid(info->device); 211 const u8 *e = fb_firmware_edid(info->device);
212 212
213 if (e != NULL) { 213 if (e != NULL)
214 edid = kmalloc(EDID_LENGTH, GFP_KERNEL); 214 edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
215 if (edid)
216 memcpy(edid, e, EDID_LENGTH);
217 }
218 } 215 }
219 216
220 *out_edid = edid; 217 *out_edid = edid;
diff --git a/drivers/video/nvidia/nv_local.h b/drivers/video/nvidia/nv_local.h
index 4243d7fae972..e009d242ea10 100644
--- a/drivers/video/nvidia/nv_local.h
+++ b/drivers/video/nvidia/nv_local.h
@@ -96,13 +96,16 @@
96#define READ_GET(par) (NV_RD32(&(par)->FIFO[0x0011], 0) >> 2) 96#define READ_GET(par) (NV_RD32(&(par)->FIFO[0x0011], 0) >> 2)
97 97
98#ifdef __LITTLE_ENDIAN 98#ifdef __LITTLE_ENDIAN
99
100#include <linux/bitrev.h>
101
99#define reverse_order(l) \ 102#define reverse_order(l) \
100do { \ 103do { \
101 u8 *a = (u8 *)(l); \ 104 u8 *a = (u8 *)(l); \
102 *a = byte_rev[*a], a++; \ 105 a[0] = bitrev8(a[0]); \
103 *a = byte_rev[*a], a++; \ 106 a[1] = bitrev8(a[1]); \
104 *a = byte_rev[*a], a++; \ 107 a[2] = bitrev8(a[2]); \
105 *a = byte_rev[*a]; \ 108 a[3] = bitrev8(a[3]); \
106} while(0) 109} while(0)
107#else 110#else
108#define reverse_order(l) do { } while(0) 111#define reverse_order(l) do { } while(0)
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c
index d9af88c2b580..181875fe35c6 100644
--- a/drivers/video/nvidia/nv_of.c
+++ b/drivers/video/nvidia/nv_of.c
@@ -72,10 +72,9 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
72 } 72 }
73 } 73 }
74 if (pedid) { 74 if (pedid) {
75 *out_edid = kmalloc(EDID_LENGTH, GFP_KERNEL); 75 *out_edid = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
76 if (*out_edid == NULL) 76 if (*out_edid == NULL)
77 return -1; 77 return -1;
78 memcpy(*out_edid, pedid, EDID_LENGTH);
79 printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn); 78 printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn);
80 return 0; 79 return 0;
81 } 80 }
diff --git a/drivers/video/nvidia/nv_proto.h b/drivers/video/nvidia/nv_proto.h
index 861271017655..43058d0cf5b7 100644
--- a/drivers/video/nvidia/nv_proto.h
+++ b/drivers/video/nvidia/nv_proto.h
@@ -62,7 +62,6 @@ extern void nvidiafb_fillrect(struct fb_info *info,
62extern void nvidiafb_imageblit(struct fb_info *info, 62extern void nvidiafb_imageblit(struct fb_info *info,
63 const struct fb_image *image); 63 const struct fb_image *image);
64extern int nvidiafb_sync(struct fb_info *info); 64extern int nvidiafb_sync(struct fb_info *info);
65extern u8 byte_rev[256];
66 65
67/* in nv_backlight.h */ 66/* in nv_backlight.h */
68#ifdef CONFIG_FB_NVIDIA_BACKLIGHT 67#ifdef CONFIG_FB_NVIDIA_BACKLIGHT
diff --git a/drivers/video/nvidia/nv_setup.c b/drivers/video/nvidia/nv_setup.c
index a18a9aebf05f..eab3e282a4de 100644
--- a/drivers/video/nvidia/nv_setup.c
+++ b/drivers/video/nvidia/nv_setup.c
@@ -262,7 +262,7 @@ static void nv10GetConfig(struct nvidia_par *par)
262#endif 262#endif
263 263
264 dev = pci_find_slot(0, 1); 264 dev = pci_find_slot(0, 1);
265 if ((par->Chipset && 0xffff) == 0x01a0) { 265 if ((par->Chipset & 0xffff) == 0x01a0) {
266 int amt = 0; 266 int amt = 0;
267 267
268 pci_read_config_dword(dev, 0x7c, &amt); 268 pci_read_config_dword(dev, 0x7c, &amt);
@@ -359,6 +359,7 @@ int NVCommonSetup(struct fb_info *info)
359 case 0x0186: 359 case 0x0186:
360 case 0x0187: 360 case 0x0187:
361 case 0x018D: 361 case 0x018D:
362 case 0x0228:
362 case 0x0286: 363 case 0x0286:
363 case 0x028C: 364 case 0x028C:
364 case 0x0316: 365 case 0x0316:
@@ -382,6 +383,10 @@ int NVCommonSetup(struct fb_info *info)
382 case 0x034C: 383 case 0x034C:
383 case 0x0160: 384 case 0x0160:
384 case 0x0166: 385 case 0x0166:
386 case 0x0169:
387 case 0x016B:
388 case 0x016C:
389 case 0x016D:
385 case 0x00C8: 390 case 0x00C8:
386 case 0x00CC: 391 case 0x00CC:
387 case 0x0144: 392 case 0x0144:
@@ -639,12 +644,23 @@ int NVCommonSetup(struct fb_info *info)
639 par->fpHeight = NV_RD32(par->PRAMDAC, 0x0800) + 1; 644 par->fpHeight = NV_RD32(par->PRAMDAC, 0x0800) + 1;
640 par->fpSyncs = NV_RD32(par->PRAMDAC, 0x0848) & 0x30000033; 645 par->fpSyncs = NV_RD32(par->PRAMDAC, 0x0848) & 0x30000033;
641 646
642 printk("Panel size is %i x %i\n", par->fpWidth, par->fpHeight); 647 printk("nvidiafb: Panel size is %i x %i\n", par->fpWidth, par->fpHeight);
643 } 648 }
644 649
645 if (monA) 650 if (monA)
646 info->monspecs = *monA; 651 info->monspecs = *monA;
647 652
653 if (!par->FlatPanel || !par->twoHeads)
654 par->FPDither = 0;
655
656 par->LVDS = 0;
657 if (par->FlatPanel && par->twoHeads) {
658 NV_WR32(par->PRAMDAC0, 0x08B0, 0x00010004);
659 if (par->PRAMDAC0[0x08b4] & 1)
660 par->LVDS = 1;
661 printk("nvidiafb: Panel is %s\n", par->LVDS ? "LVDS" : "TMDS");
662 }
663
648 kfree(edidA); 664 kfree(edidA);
649 kfree(edidB); 665 kfree(edidB);
650done: 666done:
diff --git a/drivers/video/nvidia/nv_type.h b/drivers/video/nvidia/nv_type.h
index acdc26693402..86e65dea60d3 100644
--- a/drivers/video/nvidia/nv_type.h
+++ b/drivers/video/nvidia/nv_type.h
@@ -129,6 +129,7 @@ struct nvidia_par {
129 int fpHeight; 129 int fpHeight;
130 int PanelTweak; 130 int PanelTweak;
131 int paneltweak; 131 int paneltweak;
132 int LVDS;
132 int pm_state; 133 int pm_state;
133 u32 crtcSync_read; 134 u32 crtcSync_read;
134 u32 fpSyncs; 135 u32 fpSyncs;
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index eb24107bcc81..538e947610e1 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -1160,20 +1160,20 @@ static u32 __devinit nvidia_get_arch(struct fb_info *info)
1160 case 0x0340: /* GeForceFX 5700 */ 1160 case 0x0340: /* GeForceFX 5700 */
1161 arch = NV_ARCH_30; 1161 arch = NV_ARCH_30;
1162 break; 1162 break;
1163 case 0x0040: 1163 case 0x0040: /* GeForce 6800 */
1164 case 0x00C0: 1164 case 0x00C0: /* GeForce 6800 */
1165 case 0x0120: 1165 case 0x0120: /* GeForce 6800 */
1166 case 0x0130: 1166 case 0x0130:
1167 case 0x0140: 1167 case 0x0140: /* GeForce 6600 */
1168 case 0x0160: 1168 case 0x0160: /* GeForce 6200 */
1169 case 0x01D0: 1169 case 0x01D0: /* GeForce 7200, 7300, 7400 */
1170 case 0x0090: 1170 case 0x0090: /* GeForce 7800 */
1171 case 0x0210: 1171 case 0x0210: /* GeForce 6800 */
1172 case 0x0220: 1172 case 0x0220: /* GeForce 6200 */
1173 case 0x0230: 1173 case 0x0230:
1174 case 0x0240: 1174 case 0x0240: /* GeForce 6100 */
1175 case 0x0290: 1175 case 0x0290: /* GeForce 7900 */
1176 case 0x0390: 1176 case 0x0390: /* GeForce 7600 */
1177 arch = NV_ARCH_40; 1177 arch = NV_ARCH_40;
1178 break; 1178 break;
1179 case 0x0020: /* TNT, TNT2 */ 1179 case 0x0020: /* TNT, TNT2 */