hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/video/fbdev/stifb.c
....@@ -922,6 +922,28 @@
922922 /* ------------------- driver specific functions --------------------------- */
923923
924924 static int
925
+stifb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
926
+{
927
+ struct stifb_info *fb = container_of(info, struct stifb_info, info);
928
+
929
+ if (var->xres != fb->info.var.xres ||
930
+ var->yres != fb->info.var.yres ||
931
+ var->bits_per_pixel != fb->info.var.bits_per_pixel)
932
+ return -EINVAL;
933
+
934
+ var->xres_virtual = var->xres;
935
+ var->yres_virtual = var->yres;
936
+ var->xoffset = 0;
937
+ var->yoffset = 0;
938
+ var->grayscale = fb->info.var.grayscale;
939
+ var->red.length = fb->info.var.red.length;
940
+ var->green.length = fb->info.var.green.length;
941
+ var->blue.length = fb->info.var.blue.length;
942
+
943
+ return 0;
944
+}
945
+
946
+static int
925947 stifb_setcolreg(u_int regno, u_int red, u_int green,
926948 u_int blue, u_int transp, struct fb_info *info)
927949 {
....@@ -1145,6 +1167,7 @@
11451167
11461168 static const struct fb_ops stifb_ops = {
11471169 .owner = THIS_MODULE,
1170
+ .fb_check_var = stifb_check_var,
11481171 .fb_setcolreg = stifb_setcolreg,
11491172 .fb_blank = stifb_blank,
11501173 .fb_fillrect = stifb_fillrect,
....@@ -1164,6 +1187,7 @@
11641187 struct stifb_info *fb;
11651188 struct fb_info *info;
11661189 unsigned long sti_rom_address;
1190
+ char modestr[32];
11671191 char *dev_name;
11681192 int bpp, xres, yres;
11691193
....@@ -1342,6 +1366,9 @@
13421366 info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
13431367 info->pseudo_palette = &fb->pseudo_palette;
13441368
1369
+ scnprintf(modestr, sizeof(modestr), "%dx%d-%d", xres, yres, bpp);
1370
+ fb_find_mode(&info->var, info, modestr, NULL, 0, NULL, bpp);
1371
+
13451372 /* This has to be done !!! */
13461373 if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0))
13471374 goto out_err1;
....@@ -1386,6 +1413,7 @@
13861413 iounmap(info->screen_base);
13871414 out_err0:
13881415 kfree(fb);
1416
+ sti->info = NULL;
13891417 return -ENXIO;
13901418 }
13911419