static int display_postregistered_callback(struct notifier_block *nb, unsigned long event, void *dev) { struct mcde_display_device *ddev = dev; u16 width, height; u16 virtual_height; struct fb_info *fbi; #if defined(CONFIG_COMPDEV) struct mcde_fb *mfb; #endif if (event != MCDE_DSS_EVENT_DISPLAY_REGISTERED) return 0; if (ddev->id < PRIMARY_DISPLAY_ID || ddev->id >= MCDE_NR_OF_DISPLAYS) return 0; mcde_dss_get_native_resolution(ddev, &width, &height); virtual_height = height * 3; /* Create frame buffer */ fbi = mcde_fb_create(ddev, width, height, width, virtual_height, ddev->default_pixel_format, FB_ROTATE_UR); if (IS_ERR(fbi)) { dev_warn(&ddev->dev, "Failed to create fb for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "Framebuffer created (%s)\n", ddev->name); if (ddev->id == PRIMARY_DISPLAY_ID) { primary_fbi = fbi; #if defined (CONFIG_SAMSUNG_USE_GETLOG) sec_getlog_supply_fbinfo(primary_fbi); #endif } } #ifdef CONFIG_COMPDEV mfb = to_mcde_fb(fbi); /* Create a compdev overlay for this display */ if (compdev_create(ddev, mfb->ovlys[0], true, NULL) < 0) { dev_warn(&ddev->dev, "Failed to create compdev for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "compdev created for (%s)\n", ddev->name); } #endif return 0; display_postregistered_callback_err: return -1; }
/* * This function will create the framebuffer for the display that is registered. */ static int display_postregistered_callback(struct notifier_block *nb, unsigned long event, void *dev) { struct mcde_display_device *ddev = dev; u16 width, height; u16 virtual_height; struct fb_info *fbi; #if defined(CONFIG_DISPDEV) || defined(CONFIG_COMPDEV) struct mcde_fb *mfb; #endif if (event != MCDE_DSS_EVENT_DISPLAY_REGISTERED) return 0; if (ddev->id < 0 || ddev->id >= MCDE_NR_OF_DISPLAYS) return 0; mcde_dss_get_native_resolution(ddev, &width, &height); if (ddev->id == PRIMARY_DISPLAY_ID) virtual_height = height * 3; else virtual_height = height * 2; #ifndef CONFIG_MCDE_DISPLAY_HDMI_FB_AUTO_CREATE if (ddev->id == AV8100_DISPLAY_ID) goto out; #endif /* Create frame buffer */ #if defined(CONFIG_MCDE_DISPLAY_BAMBOOK) fbi = mcde_fb_create(ddev, width, height, width, virtual_height, ddev->default_pixel_format, FB_ROTATE_UD); #else fbi = mcde_fb_create(ddev, width, height, width, virtual_height, ddev->default_pixel_format, FB_ROTATE_UR); #endif if (IS_ERR(fbi)) { dev_warn(&ddev->dev, "Failed to create fb for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "Framebuffer created (%s)\n", ddev->name); } #ifdef CONFIG_DISPDEV mfb = to_mcde_fb(fbi); /* Create a dispdev overlay for this display */ if (dispdev_create(ddev, true, mfb->ovlys[0]) < 0) { dev_warn(&ddev->dev, "Failed to create disp for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "Disp dev created for (%s)\n", ddev->name); } #endif #ifdef CONFIG_COMPDEV /* Only create compdev for the main display */ if (ddev->id == PRIMARY_DISPLAY_ID) { bool mcde_rotation = false; /* Use mcde rotation for U8500 only */ if (cpu_is_u8500_family()) mcde_rotation = true; mfb = to_mcde_fb(fbi); /* Create a compdev overlay for this display */ if (compdev_create(ddev, mfb->ovlys[0], mcde_rotation, NULL) < 0) { dev_warn(&ddev->dev, "Failed to create compdev for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "compdev created for (%s)\n", ddev->name); } } #endif out: return 0; display_postregistered_callback_err: return -1; }