static int __init tcx_init(void) { if (fb_get_options("tcxfb", NULL)) return -ENODEV; return platform_driver_register(&tcx_driver); }
int __init chips_init(void) { if (fb_get_options("chipsfb", NULL)) return -ENODEV; return pci_register_driver(&chipsfb_driver); }
int __init tcx_init(void) { if (fb_get_options("tcxfb", NULL)) return -ENODEV; return of_register_driver(&tcx_driver, &of_bus_type); }
static int __init bw2_init(void) { if (fb_get_options("bw2fb", NULL)) return -ENODEV; return platform_driver_register(&bw2_driver); }
static int __init cg14_init(void) { if (fb_get_options("cg14fb", NULL)) return -ENODEV; return of_register_driver(&cg14_driver, &of_bus_type); }
static int __init leo_init(void) { if (fb_get_options("leofb", NULL)) return -ENODEV; return platform_driver_register(&leo_driver); }
/* Get options from kernel paramenter "video=" */ static void hvfb_get_option(struct fb_info *info) { struct hvfb_par *par = info->par; char *opt = NULL, *p; uint x = 0, y = 0; if (fb_get_options(KBUILD_MODNAME, &opt) || !opt || !*opt) return; p = strsep(&opt, "x"); if (!*p || kstrtouint(p, 0, &x) || !opt || !*opt || kstrtouint(opt, 0, &y)) { pr_err("Screen option is invalid: skipped\n"); return; } if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || (par->synthvid_version == SYNTHVID_VERSION_WIN8 && x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || (par->synthvid_version == SYNTHVID_VERSION_WIN7 && (x > SYNTHVID_WIDTH_MAX_WIN7 || y > SYNTHVID_HEIGHT_MAX_WIN7))) { pr_err("Screen resolution option is out of range: skipped\n"); return; } screen_width = x; screen_height = y; return; }
static int __init offb_init(void) { struct device_node *dp = NULL, *boot_disp = NULL; if (fb_get_options("offb", NULL)) return -ENODEV; /* Check if we have a MacOS display without a node spec */ if (of_get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) { /* The old code tried to work out which node was the MacOS * display based on the address. I'm dropping that since the * lack of a node spec only happens with old BootX versions * (users can update) and with this code, they'll still get * a display (just not the palette hacks). */ offb_init_nodriver(of_chosen, 1); } for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (of_get_property(dp, "linux,opened", NULL) && of_get_property(dp, "linux,boot-display", NULL)) { boot_disp = dp; offb_init_nodriver(dp, 0); } } for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (of_get_property(dp, "linux,opened", NULL) && dp != boot_disp) offb_init_nodriver(dp, 0); } return 0; }
int __init chips_init(void) { if (fb_get_options("chipsfb", NULL)) return -ENODEV; return pci_module_init(&chipsfb_driver); }
static int __init bw2_init(void) { if (fb_get_options("bw2fb", NULL)) return -ENODEV; return of_register_driver(&bw2_driver, &of_bus_type); }
static int __init cg14_init(void) { if (fb_get_options("cg14fb", NULL)) return -ENODEV; return platform_driver_register(&cg14_driver); }
static int __init vfb_init(void) { int ret = 0; #ifndef MODULE char *option = NULL; if (fb_get_options("vfb", &option)) return -ENODEV; /* parse all options */ vfb_setup(option); #endif if (!vfb_enab) return -ENXIO; /* registe the driver */ if ((ret = platform_driver_register(&vfb_driver)) == 0) { if ((vfb_device = platform_device_alloc("vfb", 0)) != 0) ret = platform_device_add(vfb_device); else ret = -ENOMEM; if (ret != 0) { platform_device_put(vfb_device); platform_driver_unregister(&vfb_driver); } } return ret; }
static int __init milkymistfb_init(void) { int ret = 0; #ifndef MODULE char *option = NULL; if (fb_get_options("milkymistfb", &option)) return -ENODEV; milkymistfb_setup(option); #endif if (!milkymistfb_enable) return -ENXIO; ret = platform_driver_register(&milkymistfb_driver); if (!ret) { milkymistfb_device = platform_device_alloc("milkymistfb", 0); if (milkymistfb_device) ret = platform_device_add(milkymistfb_device); else ret = -ENOMEM; if (ret) { platform_device_put(milkymistfb_device); platform_driver_unregister(&milkymistfb_driver); } } return ret; }
static int xylonfb_platform_init(void) { int err; #ifndef MODULE char *option = NULL; /* * For kernel boot options (in 'video=xxxfb:<options>' format) */ if (fb_get_options(DRIVER_NAME, &option)) return -ENODEV; /* Set internal module parameters */ xylonfb_get_params(option); #endif err = platform_device_register(&logicvc_0_device); if (err) { pr_err("Error xylonfb device registration\n"); return err; } err = platform_driver_register(&xylonfb_driver); if (err) { pr_err("Error xylonfb driver registration\n"); platform_device_unregister(&logicvc_0_device); return err; } return 0; }
static int __init offb_init(void) { struct device_node *dp = NULL, *boot_disp = NULL; if (fb_get_options("offb", NULL)) return -ENODEV; if (of_get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) { offb_init_nodriver(of_chosen, 1); } for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (of_get_property(dp, "linux,opened", NULL) && of_get_property(dp, "linux,boot-display", NULL)) { boot_disp = dp; offb_init_nodriver(dp, 0); } } for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (of_get_property(dp, "linux,opened", NULL) && dp != boot_disp) offb_init_nodriver(dp, 0); } return 0; }
int __init fm2fb_init(void) { char *option = NULL; if (fb_get_options("fm2fb", &option)) return -ENODEV; fm2fb_setup(option); return zorro_register_driver(&fm2fb_driver); }
static int __init mxc_elcdif_fb_init(void) { char *option = NULL; if (fb_get_options("mxc_elcdif_fb", &option)) return -ENODEV; mxc_elcdif_fb_setup(option); return platform_driver_register(&mxc_elcdif_fb_driver); }
int __init maxinefb_init(void) { unsigned long fboff; unsigned long fb_start; int i; if (fb_get_options("maxinefb", NULL)) return -ENODEV; /* Validate we're on the proper machine type */ if (mips_machtype != MACH_DS5000_XX) { return -EINVAL; } ; ; /* Framebuffer display memory base address */ fb_start = DS5000_xx_ONBOARD_FBMEM_START; /* Clear screen */ for (fboff = fb_start; fboff < fb_start + 0x1ffff; fboff++) *(volatile unsigned char *)fboff = 0x0; maxinefb_fix.smem_start = fb_start; /* erase hardware cursor */ for (i = 0; i < 512; i++) { maxinefb_ims332_write_register(IMS332_REG_CURSOR_RAM + i, 0); /* if (i&0x8 == 0) maxinefb_ims332_write_register (IMS332_REG_CURSOR_RAM + i, 0x0f); else maxinefb_ims332_write_register (IMS332_REG_CURSOR_RAM + i, 0xf0); */ } fb_info.fbops = &maxinefb_ops; fb_info.screen_base = (char *)maxinefb_fix.smem_start; fb_info.var = maxinefb_defined; fb_info.fix = maxinefb_fix; fb_info.flags = FBINFO_DEFAULT; fb_alloc_cmap(&fb_info.cmap, 256, 0); if (register_framebuffer(&fb_info) < 0) return 1; return 0; }
/*! * @brief Initialization */ int __init mx2fb_init(void) { /* * For kernel boot options (in 'video=xxxfb:<options>' format) */ #ifndef MODULE { char *option; if (fb_get_options("mxcfb", &option)) return -ENODEV; mx2fb_setup(option); } #endif return platform_driver_register(&mx2fb_driver); }
static int einkfb_init(void) { #ifndef MODULE char *option = NULL; if (fb_get_options(EINKFB_NAME, &option)) return -ENODEV; einkfb_setup(option); #endif // MODULE if (!einkfb_enable) return -ENXIO; return einkfb_driver_register(); }
int __init q40fb_init(void) { int ret = 0; if (fb_get_options("q40fb", NULL)) return -ENODEV; ret = platform_driver_register(&q40fb_driver); if (!ret) { ret = platform_device_register(&q40fb_device); if (ret) platform_driver_unregister(&q40fb_driver); } return ret; }
static int xylonfb_init(void) { char *option = NULL; /* * Kernel boot options (in 'video=xxxfb:<options>' format) */ if (fb_get_options(XYLONFB_DRIVER_NAME, &option)) return -ENODEV; /* Set internal module parameters */ xylonfb_get_params(option); if (platform_driver_register(&xylonfb_driver)) { pr_err("failed %s driver registration\n", XYLONFB_DRIVER_NAME); return -ENODEV; } return 0; }
static int xylonfb_of_init(void) { #ifndef MODULE char *option = NULL; /* * For kernel boot options (in 'video=xxxfb:<options>' format) */ if (fb_get_options(DRIVER_NAME, &option)) return -ENODEV; /* Set internal module parameters */ xylonfb_get_params(option); #endif if (platform_driver_register(&xylonfb_of_driver)) { pr_err("Error xylonfb driver registration\n"); return -ENODEV; } return 0; }
int __init hpfb_init(void) { unsigned int sid; mm_segment_t fs; unsigned char i; int err; /* Topcats can be on the internal IO bus or real DIO devices. * The internal variant sits at 0x560000; it has primary * and secondary ID registers just like the DIO version. * So we merge the two detection routines. * * Perhaps this #define should be in a global header file: * I believe it's common to all internal fbs, not just topcat. */ #define INTFBVADDR 0xf0560000 #define INTFBPADDR 0x560000 if (!MACH_IS_HP300) return -ENXIO; if (fb_get_options("hpfb", NULL)) return -ENODEV; err = dio_register_driver(&hpfb_driver); if (err) return err; fs = get_fs(); set_fs(KERNEL_DS); err = get_user(i, (unsigned char *)INTFBVADDR + DIO_IDOFF); set_fs(fs); if (!err && (i == DIO_ID_FBUFFER) && topcat_sid_ok(sid = DIO_SECID(INTFBVADDR))) { if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat")) return -EBUSY; printk(KERN_INFO "Internal Topcat found (secondary id %02x)\n", sid); if (hpfb_init_one(INTFBPADDR, INTFBVADDR)) { return -ENOMEM; } } return 0; }
int __init hpfb_init(void) { unsigned int sid; mm_segment_t fs; unsigned char i; int err; /* */ #define INTFBVADDR 0xf0560000 #define INTFBPADDR 0x560000 if (!MACH_IS_HP300) return -ENODEV; if (fb_get_options("hpfb", NULL)) return -ENODEV; err = dio_register_driver(&hpfb_driver); if (err) return err; fs = get_fs(); set_fs(KERNEL_DS); err = get_user(i, (unsigned char *)INTFBVADDR + DIO_IDOFF); set_fs(fs); if (!err && (i == DIO_ID_FBUFFER) && topcat_sid_ok(sid = DIO_SECID(INTFBVADDR))) { if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat")) return -EBUSY; printk(KERN_INFO "Internal Topcat found (secondary id %02x)\n", sid); if (hpfb_init_one(INTFBPADDR, INTFBVADDR)) { return -ENOMEM; } } return 0; }
static int sh_hdmi_read_edid(struct sh_hdmi *hdmi) { struct fb_var_screeninfo tmpvar; struct fb_var_screeninfo *var = &tmpvar; const struct fb_videomode *mode, *found = NULL; struct fb_info *info = hdmi->info; struct fb_modelist *modelist = NULL; unsigned int f_width = 0, f_height = 0, f_refresh = 0; unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */ bool exact_match = false; u8 edid[128]; char *forced; int i; /* Read EDID */ dev_dbg(hdmi->dev, "Read back EDID code:"); for (i = 0; i < 128; i++) { edid[i] = hdmi_read(hdmi, HDMI_EDID_KSV_FIFO_ACCESS_WINDOW); #ifdef DEBUG if ((i % 16) == 0) { printk(KERN_CONT "\n"); printk(KERN_DEBUG "%02X | %02X", i, edid[i]); } else { printk(KERN_CONT " %02X", edid[i]); } #endif } #ifdef DEBUG printk(KERN_CONT "\n"); #endif fb_edid_to_monspecs(edid, &hdmi->monspec); fb_get_options("sh_mobile_lcdc", &forced); if (forced && *forced) { /* Only primitive parsing so far */ i = sscanf(forced, "%ux%u@%u", &f_width, &f_height, &f_refresh); if (i < 2) { f_width = 0; f_height = 0; } dev_dbg(hdmi->dev, "Forced mode %ux%u@%uHz\n", f_width, f_height, f_refresh); } /* Walk monitor modes to find the best or the exact match */ for (i = 0, mode = hdmi->monspec.modedb; f_width && f_height && i < hdmi->monspec.modedb_len && !exact_match; i++, mode++) { unsigned long rate_error = sh_hdmi_rate_error(hdmi, mode); /* No interest in unmatching modes */ if (f_width != mode->xres || f_height != mode->yres) continue; if (f_refresh == mode->refresh || (!f_refresh && !rate_error)) /* * Exact match if either the refresh rate matches or it * hasn't been specified and we've found a mode, for * which we can configure the clock precisely */ exact_match = true; else if (found && found_rate_error <= rate_error) /* * We otherwise search for the closest matching clock * rate - either if no refresh rate has been specified * or we cannot find an exactly matching one */ continue; /* Check if supported: sufficient fb memory, supported clock-rate */ fb_videomode_to_var(var, mode); if (info && info->fbops->fb_check_var && info->fbops->fb_check_var(var, info)) { exact_match = false; continue; } found = mode; found_rate_error = rate_error; } /* * TODO 1: if no ->info is present, postpone running the config until * after ->info first gets registered. * TODO 2: consider registering the HDMI platform device from the LCDC * driver, and passing ->info with HDMI platform data. */ if (info && !found) { modelist = hdmi->info->modelist.next && !list_empty(&hdmi->info->modelist) ? list_entry(hdmi->info->modelist.next, struct fb_modelist, list) : NULL; if (modelist) { found = &modelist->mode; found_rate_error = sh_hdmi_rate_error(hdmi, found); } }
int __init offb_init(void) { struct device_node *dp = NULL, *boot_disp = NULL; #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) struct device_node *macos_display = NULL; #endif if (fb_get_options("offb", NULL)) return -ENODEV; #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) /* If we're booted from BootX... */ if (boot_infos != 0) { unsigned long addr = (unsigned long) boot_infos->dispDeviceBase; /* find the device node corresponding to the macos display */ while ((dp = of_find_node_by_type(dp, "display"))) { int i; /* * Grrr... It looks like the MacOS ATI driver * munges the assigned-addresses property (but * the AAPL,address value is OK). */ if (strncmp(dp->name, "ATY,", 4) == 0 && dp->n_addrs == 1) { unsigned int *ap = (unsigned int *) get_property(dp, "AAPL,address", NULL); if (ap != NULL) { dp->addrs[0].address = *ap; dp->addrs[0].size = 0x01000000; } } /* * The LTPro on the Lombard powerbook has no addresses * on the display nodes, they are on their parent. */ if (dp->n_addrs == 0 && device_is_compatible(dp, "ATY,264LTPro")) { int na; unsigned int *ap = (unsigned int *) get_property(dp, "AAPL,address", &na); if (ap != 0) for (na /= sizeof(unsigned int); na > 0; --na, ++ap) if (*ap <= addr && addr < *ap + 0x1000000) goto foundit; } /* * See if the display address is in one of the address * ranges for this display. */ for (i = 0; i < dp->n_addrs; ++i) { if (dp->addrs[i].address <= addr && addr < dp->addrs[i].address + dp->addrs[i].size) break; } if (i < dp->n_addrs) { foundit: printk(KERN_INFO "MacOS display is %s\n", dp->full_name); macos_display = dp; break; } } /* initialize it */ offb_init_fb(macos_display ? macos_display-> name : "MacOS display", macos_display ? macos_display-> full_name : "MacOS display", boot_infos->dispDeviceRect[2], boot_infos->dispDeviceRect[3], boot_infos->dispDeviceDepth, boot_infos->dispDeviceRowBytes, addr, NULL); } #endif /* defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) */ for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (get_property(dp, "linux,opened", NULL) && get_property(dp, "linux,boot-display", NULL)) { boot_disp = dp; offb_init_nodriver(dp); } } for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { if (get_property(dp, "linux,opened", NULL) && dp != boot_disp) offb_init_nodriver(dp); } return 0; }
static int simplefb_probe(struct platform_device *pdev) { int ret; struct simplefb_params params; struct fb_info *info; struct resource *mem; if (fb_get_options("simplefb", NULL)) return -ENODEV; ret = simplefb_parse_dt(pdev, ¶ms); if (ret) return ret; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); return -EINVAL; } info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev); if (!info) return -ENOMEM; platform_set_drvdata(pdev, info); info->fix = simplefb_fix; info->fix.smem_start = mem->start; info->fix.smem_len = resource_size(mem); info->fix.line_length = params.stride; info->var = simplefb_var; info->var.xres = params.width; info->var.yres = params.height; info->var.xres_virtual = params.width; info->var.yres_virtual = params.height; info->var.bits_per_pixel = params.format->bits_per_pixel; info->var.red = params.format->red; info->var.green = params.format->green; info->var.blue = params.format->blue; info->var.transp = params.format->transp; info->fbops = &simplefb_ops; info->flags = FBINFO_DEFAULT; info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start, info->fix.smem_len); if (!info->screen_base) { framebuffer_release(info); return -ENODEV; } info->pseudo_palette = (void *)(info + 1); ret = register_framebuffer(info); if (ret < 0) { dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); framebuffer_release(info); return ret; } dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); return 0; }