#include <linux/workqueue.h>
#include <linux/fb.h>
#include <linux/console.h>
-//#include <linux/omapfb.h>
-#include <linux/ti81xxfb.h>
+// #include <linux/omapfb.h>
#include <linux/mutex.h>
+# include <plat/ti81xx-vpss.h>
+# include <plat/vrfb.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
#define PVR_OMAPFB3_NEEDS_PLAT_VRFB_H
#endif
#undef DEBUG
#endif
//#include <omapfb/omapfb.h>
-#include <../drivers/video/ti81xx/ti81xxfb/fbpriv.h>
#if defined(DEBUG)
#undef DEBUG
#endif
#define OMAP_DSS_MANAGER(man, dev) struct omap_overlay_manager *man = (dev) != NULL ? (dev)->manager : NULL
#define WAIT_FOR_VSYNC(man) ((man)->wait_for_vsync)
#else
-#define OMAP_DSS_DRIVER(drv, dev) struct ti81xxfb_device *drv = (dev)
-#define OMAP_DSS_MANAGER(man, dev) struct ti81xxfb_device *man = (dev)
+#define OMAP_DSS_DRIVER(drv, dev) struct omap_dss_device *drv = (dev)
+#define OMAP_DSS_MANAGER(man, dev) struct omap_dss_device *man = (dev)
#define WAIT_FOR_VSYNC(man) ((man)->wait_vsync)
#endif
#endif
-
-#define OMAP_DSS_DRIVER(drv, dev) struct ti81xxfb_device *drv = (dev)
-#define OMAP_DSS_MANAGER(man, dev) struct ti81xxfb_device *man = (dev)
-#define WAIT_FOR_VSYNC(man) ((man)->wait_vsync)
-
-
-
-
void *OMAPLFBAllocKernelMem(unsigned long ulSize)
{
return kmalloc(ulSize, GFP_KERNEL);
}
OMAPLFB_ERROR OMAPLFBCreateSwapQueue(OMAPLFB_SWAPCHAIN *psSwapChain)
-{
+{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,34))
psSwapChain->psWorkQueue = __create_workqueue(DEVNAME, 1, 1, 1);
-#else
-psSwapChain->psWorkQueue = create_workqueue(DEVNAME);
+#else
+ psSwapChain->psWorkQueue = create_workqueue(DEVNAME);
#endif
if (psSwapChain->psWorkQueue == NULL)
{
res = fb_pan_display(psDevInfo->psLINFBInfo, &sFBVar);
if (res != 0)
{
+ printk (" fb_pan api failed \n");
printk(KERN_INFO DRIVER_PREFIX ": %s: Device %u: fb_pan_display failed (Y Offset: %lu, Error: %d)\n", __FUNCTION__, psDevInfo->uiFBDevID, psBuffer->ulYOffset, res);
}
}
OMAPLFB_UPDATE_MODE OMAPLFBGetUpdateMode(OMAPLFB_DEVINFO *psDevInfo)
{
-
#if 0
-
- // struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
-
- struct ti81xxfb_device *psDSSDev = FB2TFB(psDevInfo->psLINFBInfo);
-
+ struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
OMAP_DSS_DRIVER(psDSSDrv, psDSSDev);
enum omap_dss_update_mode eMode;
return OMAPLFB_UPDATE_MODE_UNDEFINED;
#endif
-
-return OMAPLFB_UPDATE_MODE_AUTO;
+ return OMAPLFB_UPDATE_MODE_AUTO;
}
OMAPLFB_BOOL OMAPLFBSetUpdateMode(OMAPLFB_DEVINFO *psDevInfo, OMAPLFB_UPDATE_MODE eMode)
{
-
#if 0
-// struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
-
- struct ti81xxfb_device *psDSSDev = FB2TFB(psDevInfo->psLINFBInfo);
-
- OMAP_DSS_DRIVER(psDSSDrv, psDSSDev);
+ struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
+ OMAP_DSS_DRIVER(psDSSDrv, psDSSDev);
enum omap_dss_update_mode eDSSMode;
int res;
return (res == 0);
#endif
-return 1;
+ return 1;
}
OMAPLFB_BOOL OMAPLFBWaitForVSync(OMAPLFB_DEVINFO *psDevInfo)
{
-#if 0
-
-// struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
-
- struct ti81xxfb_device *psDSSDev = FB2TFB(psDevInfo->psLINFBInfo);
+#if 0
+ struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
OMAP_DSS_MANAGER(psDSSMan, psDSSDev);
if (psDSSMan != NULL && WAIT_FOR_VSYNC(psDSSMan) != NULL)
return OMAPLFB_FALSE;
}
}
-
#endif
-
+#if 0
struct vps_grpx_ctrl *gctrl;
- int r = 0;
- struct ti81xxfb_info *ofbi;
-
- ofbi = FB2TFB(psDevInfo->psLINFBInfo);
-
- gctrl = ofbi->gctrl;
- r = gctrl->wait_for_vsync(gctrl);
-
- return OMAPLFB_TRUE;
+ int r;
+ gctrl = vps_grpx_get_ctrl(psDevInfo->uiFBDevID);
+ printk (" BVSYNC \n");
+ r = gctrl->wait_for_vsync(gctrl);
+ printk (" AVSYNC: %d\n", vsync_num++);
+ return OMAPLFB_TRUE;
+#endif
+// unsigned long timeout = msecs_to_jiffies(500);
+
+#if FBDEV_PRESENT
+ int r;
+
+ void grpx_irq_wait_handler(void *data)
+ {
+ complete((struct completion *)data);
+ }
+ DECLARE_COMPLETION_ONSTACK(completion);
+
+ if (vps_grpx_register_isr ((vsync_callback_t)grpx_irq_wait_handler, &completion, psDevInfo->uiFBDevID) != 0)
+ {
+ printk (KERN_WARNING DRIVER_PREFIX ": Failed to register for vsync call back\n");
+ return OMAPLFB_FALSE;
+ }
+// timeout = wait_for_completion_interruptible_timeout(&completion, timeout);
+ r = wait_for_completion_interruptible(&completion);
+ if (vps_grpx_unregister_isr((vsync_callback_t)grpx_irq_wait_handler , &completion, psDevInfo->uiFBDevID) != 0)
+ {
+ printk (KERN_WARNING DRIVER_PREFIX ": Failed to un-register for vsync call back\n");
+ return OMAPLFB_FALSE;
+ }
+#endif
+ return OMAPLFB_TRUE;
}
OMAPLFB_BOOL OMAPLFBManualSync(OMAPLFB_DEVINFO *psDevInfo)
{
#if 0
-// struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
- struct ti81xxfb_device *psDSSDev = FB2TFB(psDevInfo->psLINFBInfo);
+ struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
OMAP_DSS_DRIVER(psDSSDrv, psDSSDev);
if (psDSSDrv != NULL && psDSSDrv->sync != NULL)
return OMAPLFB_FALSE;
}
}
-printk (" OMAPLFBManualSync Not Supported \n");
#endif
return OMAPLFB_TRUE;
{
int res;
#ifdef FBDEV_PRESENT
-
acquire_console_sem();
res = fb_blank(psDevInfo->psLINFBInfo, 0);
release_console_sem();
": %s: Device %u: fb_blank failed (%d)\n", __FUNCTION__, psDevInfo->uiFBDevID, res);
return (OMAPLFB_ERROR_GENERIC);
}
-
#endif
+
return (OMAPLFB_OK);
}
return NULL;
}
-int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Ioctl)(struct drm_device unref__ *dev, void *arg, struct drm_file unref__ *pFile)
+int PVR_DRM_MAKENAME(omaplfb, _Ioctl)(struct drm_device unref__ *dev, void *arg, struct drm_file unref__ *pFile)
{
uint32_t *puiArgs;
uint32_t uiCmd;
#endif
#if defined(SUPPORT_DRI_DRM)
-int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Init)(struct drm_device unref__ *dev)
+int PVR_DRM_MAKENAME(omaplfb, _Init)(struct drm_device unref__ *dev)
#else
static int __init OMAPLFB_Init(void)
#endif
}
#if defined(SUPPORT_DRI_DRM)
-void PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Cleanup)(struct drm_device unref__ *dev)
+void PVR_DRM_MAKENAME(omaplfb, _Cleanup)(struct drm_device unref__ *dev)
#else
static void __exit OMAPLFB_Cleanup(void)
#endif