aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/sstfb.c60
-rw-r--r--include/video/sstfb.h1
2 files changed, 28 insertions, 33 deletions
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index e0f14df840d9..8a5ce210bb27 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -382,7 +382,7 @@ static void sstfb_clear_screen(struct fb_info *info)
382static int sstfb_check_var(struct fb_var_screeninfo *var, 382static int sstfb_check_var(struct fb_var_screeninfo *var,
383 struct fb_info *info) 383 struct fb_info *info)
384{ 384{
385 struct sstfb_par *par = (struct sstfb_par *) info->par; 385 struct sstfb_par *par = info->par;
386 int hSyncOff = var->xres + var->right_margin + var->left_margin; 386 int hSyncOff = var->xres + var->right_margin + var->left_margin;
387 int vSyncOff = var->yres + var->lower_margin + var->upper_margin; 387 int vSyncOff = var->yres + var->lower_margin + var->upper_margin;
388 int vBackPorch = var->left_margin, yDim = var->yres; 388 int vBackPorch = var->left_margin, yDim = var->yres;
@@ -542,7 +542,7 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
542 */ 542 */
543static int sstfb_set_par(struct fb_info *info) 543static int sstfb_set_par(struct fb_info *info)
544{ 544{
545 struct sstfb_par *par = (struct sstfb_par *) info->par; 545 struct sstfb_par *par = info->par;
546 u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0; 546 u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0;
547 struct pci_dev *sst_dev = par->dev; 547 struct pci_dev *sst_dev = par->dev;
548 unsigned int freq; 548 unsigned int freq;
@@ -748,13 +748,14 @@ static int sstfb_set_par(struct fb_info *info)
748static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 748static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
749 u_int transp, struct fb_info *info) 749 u_int transp, struct fb_info *info)
750{ 750{
751 struct sstfb_par *par = info->par;
751 u32 col; 752 u32 col;
752 753
753 f_dddprintk("sstfb_setcolreg\n"); 754 f_dddprintk("sstfb_setcolreg\n");
754 f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n", 755 f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n",
755 regno, red, green, blue, transp); 756 regno, red, green, blue, transp);
756 if (regno >= 16) 757 if (regno > 15)
757 return -EINVAL; 758 return 0;
758 759
759 red >>= (16 - info->var.red.length); 760 red >>= (16 - info->var.red.length);
760 green >>= (16 - info->var.green.length); 761 green >>= (16 - info->var.green.length);
@@ -765,7 +766,7 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
765 | (blue << info->var.blue.offset) 766 | (blue << info->var.blue.offset)
766 | (transp << info->var.transp.offset); 767 | (transp << info->var.transp.offset);
767 768
768 ((u32 *)info->pseudo_palette)[regno] = col; 769 par->palette[regno] = col;
769 770
770 return 0; 771 return 0;
771} 772}
@@ -773,7 +774,7 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
773static int sstfb_ioctl(struct inode *inode, struct file *file, 774static int sstfb_ioctl(struct inode *inode, struct file *file,
774 u_int cmd, u_long arg, struct fb_info *info ) 775 u_int cmd, u_long arg, struct fb_info *info )
775{ 776{
776 struct sstfb_par *par = (struct sstfb_par *) info->par; 777 struct sstfb_par *par = info->par;
777 struct pci_dev *sst_dev = par->dev; 778 struct pci_dev *sst_dev = par->dev;
778 u32 fbiinit0, tmp, val; 779 u32 fbiinit0, tmp, val;
779 u_long p; 780 u_long p;
@@ -830,7 +831,7 @@ static int sstfb_ioctl(struct inode *inode, struct file *file,
830#if 0 831#if 0
831static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) 832static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
832{ 833{
833 struct sstfb_par *par = (struct sstfb_par *) info->par; 834 struct sstfb_par *par = info->par;
834 u32 stride = info->fix.line_length; 835 u32 stride = info->fix.line_length;
835 836
836 if (!IS_VOODOO2(par)) 837 if (!IS_VOODOO2(par))
@@ -855,7 +856,7 @@ static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
855 */ 856 */
856static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 857static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
857{ 858{
858 struct sstfb_par *par = (struct sstfb_par *) info->par; 859 struct sstfb_par *par = info->par;
859 u32 stride = info->fix.line_length; 860 u32 stride = info->fix.line_length;
860 861
861 if (!IS_VOODOO2(par)) 862 if (!IS_VOODOO2(par))
@@ -925,7 +926,7 @@ static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize)
925 926
926static int __devinit sst_detect_att(struct fb_info *info) 927static int __devinit sst_detect_att(struct fb_info *info)
927{ 928{
928 struct sstfb_par *par = (struct sstfb_par *) info->par; 929 struct sstfb_par *par = info->par;
929 int i, mir, dir; 930 int i, mir, dir;
930 931
931 for (i=0; i<3; i++) { 932 for (i=0; i<3; i++) {
@@ -950,7 +951,7 @@ static int __devinit sst_detect_att(struct fb_info *info)
950 951
951static int __devinit sst_detect_ti(struct fb_info *info) 952static int __devinit sst_detect_ti(struct fb_info *info)
952{ 953{
953 struct sstfb_par *par = (struct sstfb_par *) info->par; 954 struct sstfb_par *par = info->par;
954 int i, mir, dir; 955 int i, mir, dir;
955 956
956 for (i = 0; i<3; i++) { 957 for (i = 0; i<3; i++) {
@@ -986,7 +987,7 @@ static int __devinit sst_detect_ti(struct fb_info *info)
986 */ 987 */
987static int __devinit sst_detect_ics(struct fb_info *info) 988static int __devinit sst_detect_ics(struct fb_info *info)
988{ 989{
989 struct sstfb_par *par = (struct sstfb_par *) info->par; 990 struct sstfb_par *par = info->par;
990 int m_clk0_1, m_clk0_7, m_clk1_b; 991 int m_clk0_1, m_clk0_7, m_clk1_b;
991 int n_clk0_1, n_clk0_7, n_clk1_b; 992 int n_clk0_1, n_clk0_7, n_clk1_b;
992 int i; 993 int i;
@@ -1023,7 +1024,7 @@ static int __devinit sst_detect_ics(struct fb_info *info)
1023static int sst_set_pll_att_ti(struct fb_info *info, 1024static int sst_set_pll_att_ti(struct fb_info *info,
1024 const struct pll_timing *t, const int clock) 1025 const struct pll_timing *t, const int clock)
1025{ 1026{
1026 struct sstfb_par *par = (struct sstfb_par *) info->par; 1027 struct sstfb_par *par = info->par;
1027 u8 cr0, cc; 1028 u8 cr0, cc;
1028 1029
1029 /* enable indexed mode */ 1030 /* enable indexed mode */
@@ -1077,7 +1078,7 @@ static int sst_set_pll_att_ti(struct fb_info *info,
1077static int sst_set_pll_ics(struct fb_info *info, 1078static int sst_set_pll_ics(struct fb_info *info,
1078 const struct pll_timing *t, const int clock) 1079 const struct pll_timing *t, const int clock)
1079{ 1080{
1080 struct sstfb_par *par = (struct sstfb_par *) info->par; 1081 struct sstfb_par *par = info->par;
1081 u8 pll_ctrl; 1082 u8 pll_ctrl;
1082 1083
1083 sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL); 1084 sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL);
@@ -1114,7 +1115,7 @@ static int sst_set_pll_ics(struct fb_info *info,
1114 1115
1115static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) 1116static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp)
1116{ 1117{
1117 struct sstfb_par *par = (struct sstfb_par *) info->par; 1118 struct sstfb_par *par = info->par;
1118 u8 cr0; 1119 u8 cr0;
1119 1120
1120 sst_dac_write(DACREG_WMA, 0); /* backdoor */ 1121 sst_dac_write(DACREG_WMA, 0); /* backdoor */
@@ -1149,7 +1150,7 @@ static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp)
1149 1150
1150static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) 1151static void sst_set_vidmod_ics(struct fb_info *info, const int bpp)
1151{ 1152{
1152 struct sstfb_par *par = (struct sstfb_par *) info->par; 1153 struct sstfb_par *par = info->par;
1153 1154
1154 switch(bpp) { 1155 switch(bpp) {
1155 case 16: 1156 case 16:
@@ -1308,7 +1309,7 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par)
1308 1309
1309static void __devexit sst_shutdown(struct fb_info *info) 1310static void __devexit sst_shutdown(struct fb_info *info)
1310{ 1311{
1311 struct sstfb_par *par = (struct sstfb_par *) info->par; 1312 struct sstfb_par *par = info->par;
1312 struct pci_dev *dev = par->dev; 1313 struct pci_dev *dev = par->dev;
1313 struct pll_timing gfx_timings; 1314 struct pll_timing gfx_timings;
1314 int Fout; 1315 int Fout;
@@ -1394,12 +1395,6 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1394 struct sst_spec *spec; 1395 struct sst_spec *spec;
1395 int err; 1396 int err;
1396 1397
1397 struct all_info {
1398 struct fb_info info;
1399 struct sstfb_par par;
1400 u32 pseudo_palette[16];
1401 } *all;
1402
1403 /* Enable device in PCI config. */ 1398 /* Enable device in PCI config. */
1404 if ((err=pci_enable_device(pdev))) { 1399 if ((err=pci_enable_device(pdev))) {
1405 eprintk("cannot enable device\n"); 1400 eprintk("cannot enable device\n");
@@ -1407,14 +1402,13 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1407 } 1402 }
1408 1403
1409 /* Allocate the fb and par structures. */ 1404 /* Allocate the fb and par structures. */
1410 all = kmalloc(sizeof(*all), GFP_KERNEL); 1405 info = framebuffer_alloc(sizeof(struct sstfb_par), &pdev->dev);
1411 if (!all) 1406 if (!info)
1412 return -ENOMEM; 1407 return -ENOMEM;
1413 memset(all, 0, sizeof(*all)); 1408
1414 pci_set_drvdata(pdev, all); 1409 pci_set_drvdata(pdev, info);
1415 1410
1416 info = &all->info; 1411 par = info->par;
1417 par = info->par = &all->par;
1418 fix = &info->fix; 1412 fix = &info->fix;
1419 1413
1420 par->type = id->driver_data; 1414 par->type = id->driver_data;
@@ -1471,7 +1465,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1471 1465
1472 info->flags = FBINFO_DEFAULT; 1466 info->flags = FBINFO_DEFAULT;
1473 info->fbops = &sstfb_ops; 1467 info->fbops = &sstfb_ops;
1474 info->pseudo_palette = &all->pseudo_palette; 1468 info->pseudo_palette = par->palette;
1475 1469
1476 fix->type = FB_TYPE_PACKED_PIXELS; 1470 fix->type = FB_TYPE_PACKED_PIXELS;
1477 fix->visual = FB_VISUAL_TRUECOLOR; 1471 fix->visual = FB_VISUAL_TRUECOLOR;
@@ -1527,7 +1521,7 @@ fail_mmio_remap:
1527fail_fb_mem: 1521fail_fb_mem:
1528 release_mem_region(fix->mmio_start, info->fix.mmio_len); 1522 release_mem_region(fix->mmio_start, info->fix.mmio_len);
1529fail_mmio_mem: 1523fail_mmio_mem:
1530 kfree(info); 1524 framebuffer_release(info);
1531 return -ENXIO; /* no voodoo detected */ 1525 return -ENXIO; /* no voodoo detected */
1532} 1526}
1533 1527
@@ -1537,7 +1531,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev)
1537 struct fb_info *info; 1531 struct fb_info *info;
1538 1532
1539 info = pci_get_drvdata(pdev); 1533 info = pci_get_drvdata(pdev);
1540 par = (struct sstfb_par *) info->par; 1534 par = info->par;
1541 1535
1542 sst_shutdown(info); 1536 sst_shutdown(info);
1543 unregister_framebuffer(info); 1537 unregister_framebuffer(info);
@@ -1545,7 +1539,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev)
1545 iounmap(par->mmio_vbase); 1539 iounmap(par->mmio_vbase);
1546 release_mem_region(info->fix.smem_start, 0x400000); 1540 release_mem_region(info->fix.smem_start, 0x400000);
1547 release_mem_region(info->fix.mmio_start, info->fix.mmio_len); 1541 release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
1548 kfree(info); 1542 framebuffer_release(info);
1549} 1543}
1550 1544
1551 1545
@@ -1613,7 +1607,7 @@ static int sstfb_dump_regs(struct fb_info *info)
1613 1607
1614 const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); 1608 const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]);
1615 const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); 1609 const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]);
1616 struct sstfb_par *par = (struct sstfb_par *) info->par; 1610 struct sstfb_par *par = info->par;
1617 struct pci_dev *dev = par->dev; 1611 struct pci_dev *dev = par->dev;
1618 u32 pci_res[pci_s]; 1612 u32 pci_res[pci_s];
1619 u32 sst_res[sst_s]; 1613 u32 sst_res[sst_s];
diff --git a/include/video/sstfb.h b/include/video/sstfb.h
index 0d77b5205372..3570f9c9b111 100644
--- a/include/video/sstfb.h
+++ b/include/video/sstfb.h
@@ -334,6 +334,7 @@ struct sst_spec {
334}; 334};
335 335
336struct sstfb_par { 336struct sstfb_par {
337 u32 palette[16];
337 unsigned int yDim; 338 unsigned int yDim;
338 unsigned int hSyncOn; /* hsync_len */ 339 unsigned int hSyncOn; /* hsync_len */
339 unsigned int hSyncOff; /* left_margin + xres + right_margin */ 340 unsigned int hSyncOff; /* left_margin + xres + right_margin */