forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/video/fbdev/cirrusfb.c
....@@ -42,7 +42,6 @@
4242 #include <linux/delay.h>
4343 #include <linux/fb.h>
4444 #include <linux/init.h>
45
-#include <asm/pgtable.h>
4645
4746 #ifdef CONFIG_ZORRO
4847 #include <linux/zorro.h>
....@@ -470,7 +469,7 @@
470469 return 0;
471470 }
472471
473
-static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,
472
+static int cirrusfb_check_pixclock(struct fb_var_screeninfo *var,
474473 struct fb_info *info)
475474 {
476475 long freq;
....@@ -479,9 +478,7 @@
479478 unsigned maxclockidx = var->bits_per_pixel >> 3;
480479
481480 /* convert from ps to kHz */
482
- freq = PICOS2KHZ(var->pixclock);
483
-
484
- dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq);
481
+ freq = PICOS2KHZ(var->pixclock ? : 1);
485482
486483 maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx];
487484 cinfo->multiplexing = 0;
....@@ -489,11 +486,13 @@
489486 /* If the frequency is greater than we can support, we might be able
490487 * to use multiplexing for the video mode */
491488 if (freq > maxclock) {
492
- dev_err(info->device,
493
- "Frequency greater than maxclock (%ld kHz)\n",
494
- maxclock);
495
- return -EINVAL;
489
+ var->pixclock = KHZ2PICOS(maxclock);
490
+
491
+ while ((freq = PICOS2KHZ(var->pixclock)) > maxclock)
492
+ var->pixclock++;
496493 }
494
+ dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq);
495
+
497496 /*
498497 * Additional constraint: 8bpp uses DAC clock doubling to allow maximum
499498 * pixel clock
....@@ -1477,11 +1476,11 @@
14771476 mdelay(100);
14781477 /* mode */
14791478 vga_wgfx(cinfo->regbase, CL_GR31, 0x00);
1480
- /* fall through */
1479
+ fallthrough;
14811480 case BT_GD5480:
14821481 /* from Klaus' NetBSD driver: */
14831482 vga_wgfx(cinfo->regbase, CL_GR2F, 0x00);
1484
- /* fall through */
1483
+ fallthrough;
14851484 case BT_ALPINE:
14861485 /* put blitter into 542x compat */
14871486 vga_wgfx(cinfo->regbase, CL_GR33, 0x00);
....@@ -1956,7 +1955,7 @@
19561955 #endif /* CONFIG_ZORRO */
19571956
19581957 /* function table of the above functions */
1959
-static struct fb_ops cirrusfb_ops = {
1958
+static const struct fb_ops cirrusfb_ops = {
19601959 .owner = THIS_MODULE,
19611960 .fb_open = cirrusfb_open,
19621961 .fb_release = cirrusfb_release,
....@@ -2093,7 +2092,6 @@
20932092
20942093 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &pdev->dev);
20952094 if (!info) {
2096
- printk(KERN_ERR "cirrusfb: could not allocate memory\n");
20972095 ret = -ENOMEM;
20982096 goto err_out;
20992097 }
....@@ -2206,10 +2204,8 @@
22062204 struct cirrusfb_info *cinfo;
22072205
22082206 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &z->dev);
2209
- if (!info) {
2210
- printk(KERN_ERR "cirrusfb: could not allocate memory\n");
2207
+ if (!info)
22112208 return -ENOMEM;
2212
- }
22132209
22142210 zcl = (const struct zorrocl *)ent->driver_data;
22152211 btype = zcl->type;