| .. | .. |
|---|
| 30 | 30 | #include <asm/io.h> |
|---|
| 31 | 31 | #include <linux/uaccess.h> |
|---|
| 32 | 32 | |
|---|
| 33 | | -#if defined(CONFIG_PPC) |
|---|
| 33 | +#if defined(CONFIG_PPC_PMAC) |
|---|
| 34 | 34 | #include <linux/nvram.h> |
|---|
| 35 | | -#include <asm/prom.h> |
|---|
| 36 | 35 | #include "macmodes.h" |
|---|
| 37 | 36 | #endif |
|---|
| 38 | 37 | |
|---|
| .. | .. |
|---|
| 327 | 326 | TVP = 1 |
|---|
| 328 | 327 | }; |
|---|
| 329 | 328 | |
|---|
| 330 | | -#define USE_NV_MODES 1 |
|---|
| 331 | 329 | #define INIT_BPP 8 |
|---|
| 332 | 330 | #define INIT_XRES 640 |
|---|
| 333 | 331 | #define INIT_YRES 480 |
|---|
| 334 | 332 | |
|---|
| 335 | 333 | static int inverse = 0; |
|---|
| 336 | 334 | static char fontname[40] __initdata = { 0 }; |
|---|
| 337 | | -#if defined(CONFIG_PPC) |
|---|
| 335 | +#if defined(CONFIG_PPC_PMAC) |
|---|
| 338 | 336 | static signed char init_vmode = -1, init_cmode = -1; |
|---|
| 339 | 337 | #endif |
|---|
| 340 | 338 | |
|---|
| .. | .. |
|---|
| 1335 | 1333 | .remove = imsttfb_remove, |
|---|
| 1336 | 1334 | }; |
|---|
| 1337 | 1335 | |
|---|
| 1338 | | -static struct fb_ops imsttfb_ops = { |
|---|
| 1336 | +static const struct fb_ops imsttfb_ops = { |
|---|
| 1339 | 1337 | .owner = THIS_MODULE, |
|---|
| 1340 | 1338 | .fb_check_var = imsttfb_check_var, |
|---|
| 1341 | 1339 | .fb_set_par = imsttfb_set_par, |
|---|
| .. | .. |
|---|
| 1390 | 1388 | } |
|---|
| 1391 | 1389 | } |
|---|
| 1392 | 1390 | |
|---|
| 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)) { |
|---|
| 1395 | 1393 | int vmode = init_vmode, cmode = init_cmode; |
|---|
| 1396 | 1394 | |
|---|
| 1397 | 1395 | if (vmode == -1) { |
|---|
| .. | .. |
|---|
| 1409 | 1407 | info->var.yres = info->var.yres_virtual = INIT_YRES; |
|---|
| 1410 | 1408 | info->var.bits_per_pixel = INIT_BPP; |
|---|
| 1411 | 1409 | } |
|---|
| 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 |
|---|
| 1417 | 1411 | #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 | + } |
|---|
| 1418 | 1417 | |
|---|
| 1419 | 1418 | if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len |
|---|
| 1420 | 1419 | || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { |
|---|
| .. | .. |
|---|
| 1473 | 1472 | |
|---|
| 1474 | 1473 | dp = pci_device_to_OF_node(pdev); |
|---|
| 1475 | 1474 | 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); |
|---|
| 1477 | 1476 | else if (IS_ENABLED(CONFIG_OF)) |
|---|
| 1478 | 1477 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); |
|---|
| 1479 | 1478 | |
|---|
| 1480 | 1479 | 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) |
|---|
| 1484 | 1481 | return -ENOMEM; |
|---|
| 1485 | | - } |
|---|
| 1486 | 1482 | |
|---|
| 1487 | 1483 | par = info->par; |
|---|
| 1488 | 1484 | |
|---|
| .. | .. |
|---|
| 1498 | 1494 | switch (pdev->device) { |
|---|
| 1499 | 1495 | case PCI_DEVICE_ID_IMS_TT128: /* IMS,tt128mbA */ |
|---|
| 1500 | 1496 | 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")) |
|---|
| 1503 | 1499 | par->ramdac = TVP; |
|---|
| 1504 | 1500 | break; |
|---|
| 1505 | 1501 | case PCI_DEVICE_ID_IMS_TT3D: /* IMS,tt3d */ |
|---|
| .. | .. |
|---|
| 1565 | 1561 | inverse = 1; |
|---|
| 1566 | 1562 | fb_invert_cmaps(); |
|---|
| 1567 | 1563 | } |
|---|
| 1568 | | -#if defined(CONFIG_PPC) |
|---|
| 1564 | +#if defined(CONFIG_PPC_PMAC) |
|---|
| 1569 | 1565 | else if (!strncmp(this_opt, "vmode:", 6)) { |
|---|
| 1570 | 1566 | int vmode = simple_strtoul(this_opt+6, NULL, 0); |
|---|
| 1571 | 1567 | if (vmode > 0 && vmode <= VMODE_MAX) |
|---|