forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/video/fbdev/imsttfb.c
....@@ -30,9 +30,8 @@
3030 #include <asm/io.h>
3131 #include <linux/uaccess.h>
3232
33
-#if defined(CONFIG_PPC)
33
+#if defined(CONFIG_PPC_PMAC)
3434 #include <linux/nvram.h>
35
-#include <asm/prom.h>
3635 #include "macmodes.h"
3736 #endif
3837
....@@ -327,14 +326,13 @@
327326 TVP = 1
328327 };
329328
330
-#define USE_NV_MODES 1
331329 #define INIT_BPP 8
332330 #define INIT_XRES 640
333331 #define INIT_YRES 480
334332
335333 static int inverse = 0;
336334 static char fontname[40] __initdata = { 0 };
337
-#if defined(CONFIG_PPC)
335
+#if defined(CONFIG_PPC_PMAC)
338336 static signed char init_vmode = -1, init_cmode = -1;
339337 #endif
340338
....@@ -1335,7 +1333,7 @@
13351333 .remove = imsttfb_remove,
13361334 };
13371335
1338
-static struct fb_ops imsttfb_ops = {
1336
+static const struct fb_ops imsttfb_ops = {
13391337 .owner = THIS_MODULE,
13401338 .fb_check_var = imsttfb_check_var,
13411339 .fb_set_par = imsttfb_set_par,
....@@ -1390,8 +1388,8 @@
13901388 }
13911389 }
13921390
1393
-#if USE_NV_MODES && defined(CONFIG_PPC32)
1394
- {
1391
+#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
1392
+ if (IS_REACHABLE(CONFIG_NVRAM) && machine_is(powermac)) {
13951393 int vmode = init_vmode, cmode = init_cmode;
13961394
13971395 if (vmode == -1) {
....@@ -1409,12 +1407,13 @@
14091407 info->var.yres = info->var.yres_virtual = INIT_YRES;
14101408 info->var.bits_per_pixel = INIT_BPP;
14111409 }
1412
- }
1413
-#else
1414
- info->var.xres = info->var.xres_virtual = INIT_XRES;
1415
- info->var.yres = info->var.yres_virtual = INIT_YRES;
1416
- info->var.bits_per_pixel = INIT_BPP;
1410
+ } else
14171411 #endif
1412
+ {
1413
+ info->var.xres = info->var.xres_virtual = INIT_XRES;
1414
+ info->var.yres = info->var.yres_virtual = INIT_YRES;
1415
+ info->var.bits_per_pixel = INIT_BPP;
1416
+ }
14181417
14191418 if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len
14201419 || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) {
....@@ -1473,16 +1472,13 @@
14731472
14741473 dp = pci_device_to_OF_node(pdev);
14751474 if(dp)
1476
- printk(KERN_INFO "%s: OF name %s\n",__func__, dp->name);
1475
+ printk(KERN_INFO "%s: OF name %pOFn\n",__func__, dp);
14771476 else if (IS_ENABLED(CONFIG_OF))
14781477 printk(KERN_ERR "imsttfb: no OF node for pci device\n");
14791478
14801479 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev);
1481
-
1482
- if (!info) {
1483
- printk(KERN_ERR "imsttfb: Can't allocate memory\n");
1480
+ if (!info)
14841481 return -ENOMEM;
1485
- }
14861482
14871483 par = info->par;
14881484
....@@ -1498,8 +1494,8 @@
14981494 switch (pdev->device) {
14991495 case PCI_DEVICE_ID_IMS_TT128: /* IMS,tt128mbA */
15001496 par->ramdac = IBM;
1501
- if (dp && ((strcmp(dp->name, "IMS,tt128mb8") == 0) ||
1502
- (strcmp(dp->name, "IMS,tt128mb8A") == 0)))
1497
+ if (of_node_name_eq(dp, "IMS,tt128mb8") ||
1498
+ of_node_name_eq(dp, "IMS,tt128mb8A"))
15031499 par->ramdac = TVP;
15041500 break;
15051501 case PCI_DEVICE_ID_IMS_TT3D: /* IMS,tt3d */
....@@ -1565,7 +1561,7 @@
15651561 inverse = 1;
15661562 fb_invert_cmaps();
15671563 }
1568
-#if defined(CONFIG_PPC)
1564
+#if defined(CONFIG_PPC_PMAC)
15691565 else if (!strncmp(this_opt, "vmode:", 6)) {
15701566 int vmode = simple_strtoul(this_opt+6, NULL, 0);
15711567 if (vmode > 0 && vmode <= VMODE_MAX)