diff options
| author | Hemant Hariyani <hemanthariyani@ti.com> | 2011-08-25 03:03:51 -0400 |
|---|---|---|
| committer | Paolo Pisati <paolo.pisati@canonical.com> | 2012-08-17 04:18:43 -0400 |
| commit | 14d35aecf3cdcd21e97c5416eec6a51fa208e880 (patch) | |
| tree | 143cb49de1ef45e2cbf2e335e0cea110d6f73b0e /drivers/gpu | |
| parent | dc0d6af6ded5440745c3e33adb877518c746302c (diff) | |
Subject: [PATCH 4/5] OMAP4:SGX-KM: Adding DRM support to 3PDD
This patch adds DRM support to 3rd party display driver. As a
consequence, omaplfb sysfs entries do not work anymore and need
to be reworked.
Change-Id: I2af145d15138ee441c3708ec40fb8bea7a9a70bd
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/pvr/Makefile | 1 | ||||
| -rw-r--r-- | drivers/gpu/pvr/omaplfb/3rdparty_dc_drm_shared.h | 45 | ||||
| -rw-r--r-- | drivers/gpu/pvr/omaplfb/omaplfb.h | 23 | ||||
| -rw-r--r-- | drivers/gpu/pvr/omaplfb/omaplfb_displayclass.c | 230 | ||||
| -rw-r--r-- | drivers/gpu/pvr/omaplfb/omaplfb_linux.c | 130 |
5 files changed, 336 insertions, 93 deletions
diff --git a/drivers/gpu/pvr/Makefile b/drivers/gpu/pvr/Makefile index bed0ee05159..725688b4666 100644 --- a/drivers/gpu/pvr/Makefile +++ b/drivers/gpu/pvr/Makefile | |||
| @@ -152,7 +152,6 @@ sgx_displayclass-y := \ | |||
| 152 | 152 | ||
| 153 | omaplfb-y := \ | 153 | omaplfb-y := \ |
| 154 | omaplfb/omaplfb_displayclass.o \ | 154 | omaplfb/omaplfb_displayclass.o \ |
| 155 | omaplfb/omaplfb-sysfs.o \ | ||
| 156 | omaplfb/omaplfb_linux.o | 155 | omaplfb/omaplfb_linux.o |
| 157 | 156 | ||
| 158 | dbgdrv-$(CONFIG_SGX_PDUMP) := \ | 157 | dbgdrv-$(CONFIG_SGX_PDUMP) := \ |
diff --git a/drivers/gpu/pvr/omaplfb/3rdparty_dc_drm_shared.h b/drivers/gpu/pvr/omaplfb/3rdparty_dc_drm_shared.h new file mode 100644 index 00000000000..0dee80a8014 --- /dev/null +++ b/drivers/gpu/pvr/omaplfb/3rdparty_dc_drm_shared.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /********************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (C) Imagination Technologies Ltd. All rights reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful but, except | ||
| 10 | * as otherwise stated in writing, without any warranty; without even the | ||
| 11 | * implied warranty of merchantability or fitness for a particular purpose. | ||
| 12 | * See the GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | * The full GNU General Public License is included in this distribution in | ||
| 19 | * the file called "COPYING". | ||
| 20 | * | ||
| 21 | * Contact Information: | ||
| 22 | * Imagination Technologies Ltd. <gpl-support@imgtec.com> | ||
| 23 | * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK | ||
| 24 | * | ||
| 25 | ******************************************************************************/ | ||
| 26 | |||
| 27 | #ifndef __3RDPARTY_DC_DRM_SHARED_H__ | ||
| 28 | #define __3RDPARTY_DC_DRM_SHARED_H__ | ||
| 29 | #if defined(SUPPORT_DRI_DRM) | ||
| 30 | |||
| 31 | #define PVR_DRM_DISP_CMD_ENTER_VT 1 | ||
| 32 | #define PVR_DRM_DISP_CMD_LEAVE_VT 2 | ||
| 33 | |||
| 34 | #define PVR_DRM_DISP_CMD_ON 3 | ||
| 35 | #define PVR_DRM_DISP_CMD_STANDBY 4 | ||
| 36 | #define PVR_DRM_DISP_CMD_SUSPEND 5 | ||
| 37 | #define PVR_DRM_DISP_CMD_OFF 6 | ||
| 38 | |||
| 39 | #define PVR_DRM_DISP_ARG_CMD 0 | ||
| 40 | #define PVR_DRM_DISP_ARG_DEV 1 | ||
| 41 | #define PVR_DRM_DISP_NUM_ARGS 2 | ||
| 42 | |||
| 43 | #endif | ||
| 44 | #endif | ||
| 45 | |||
diff --git a/drivers/gpu/pvr/omaplfb/omaplfb.h b/drivers/gpu/pvr/omaplfb/omaplfb.h index 57620ab0add..5dee3e945b6 100644 --- a/drivers/gpu/pvr/omaplfb/omaplfb.h +++ b/drivers/gpu/pvr/omaplfb/omaplfb.h | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #ifndef __OMAPLFB_H__ | 27 | #ifndef __OMAPLFB_H__ |
| 28 | #define __OMAPLFB_H__ | 28 | #define __OMAPLFB_H__ |
| 29 | 29 | ||
| 30 | /* max number of overlays to which a framebuffer data can be direct */ | ||
| 31 | #define OMAPFB_MAX_OVL_PER_FB 3 | ||
| 32 | |||
| 30 | extern IMG_BOOL PVRGetDisplayClassJTable(PVRSRV_DC_DISP2SRV_KMJTABLE *psJTable); | 33 | extern IMG_BOOL PVRGetDisplayClassJTable(PVRSRV_DC_DISP2SRV_KMJTABLE *psJTable); |
| 31 | 34 | ||
| 32 | typedef void * OMAP_HANDLE; | 35 | typedef void * OMAP_HANDLE; |
| @@ -60,6 +63,7 @@ typedef struct OMAPLFB_FLIP_ITEM_TAG | |||
| 60 | 63 | ||
| 61 | typedef struct PVRPDP_SWAPCHAIN_TAG | 64 | typedef struct PVRPDP_SWAPCHAIN_TAG |
| 62 | { | 65 | { |
| 66 | unsigned int uiSwapChainID; | ||
| 63 | unsigned long ulBufferCount; | 67 | unsigned long ulBufferCount; |
| 64 | OMAPLFB_BUFFER* psBuffer; | 68 | OMAPLFB_BUFFER* psBuffer; |
| 65 | OMAPLFB_FLIP_ITEM* psFlipItems; | 69 | OMAPLFB_FLIP_ITEM* psFlipItems; |
| @@ -90,6 +94,7 @@ typedef struct OMAPLFB_FBINFO_TAG | |||
| 90 | 94 | ||
| 91 | typedef struct OMAPLFB_DEVINFO_TAG | 95 | typedef struct OMAPLFB_DEVINFO_TAG |
| 92 | { | 96 | { |
| 97 | unsigned int uiSwapChainID; | ||
| 93 | IMG_UINT32 uDeviceID; | 98 | IMG_UINT32 uDeviceID; |
| 94 | OMAPLFB_BUFFER sSystemBuffer; | 99 | OMAPLFB_BUFFER sSystemBuffer; |
| 95 | PVRSRV_DC_DISP2SRV_KMJTABLE sPVRJTable; | 100 | PVRSRV_DC_DISP2SRV_KMJTABLE sPVRJTable; |
| @@ -107,9 +112,9 @@ typedef struct OMAPLFB_DEVINFO_TAG | |||
| 107 | DISPLAY_DIMS sDisplayDim; | 112 | DISPLAY_DIMS sDisplayDim; |
| 108 | struct workqueue_struct* sync_display_wq; | 113 | struct workqueue_struct* sync_display_wq; |
| 109 | struct work_struct sync_display_work; | 114 | struct work_struct sync_display_work; |
| 110 | struct kobject kobj; | 115 | #if defined(SUPPORT_DRI_DRM) |
| 111 | OMAP_BOOL ignore_sync; | 116 | OMAP_BOOL bLeaveVT; |
| 112 | 117 | #endif | |
| 113 | } OMAPLFB_DEVINFO; | 118 | } OMAPLFB_DEVINFO; |
| 114 | 119 | ||
| 115 | typedef enum _OMAP_ERROR_ | 120 | typedef enum _OMAP_ERROR_ |
| @@ -126,12 +131,6 @@ typedef enum _OMAP_ERROR_ | |||
| 126 | 131 | ||
| 127 | } OMAP_ERROR; | 132 | } OMAP_ERROR; |
| 128 | 133 | ||
| 129 | struct omaplfb_device { | ||
| 130 | struct device *dev; | ||
| 131 | OMAPLFB_DEVINFO *display_info_list; | ||
| 132 | int display_count; | ||
| 133 | }; | ||
| 134 | |||
| 135 | #define OMAPLFB_PAGE_SIZE 4096 | 134 | #define OMAPLFB_PAGE_SIZE 4096 |
| 136 | #define OMAPLFB_PAGE_MASK (OMAPLFB_PAGE_SIZE - 1) | 135 | #define OMAPLFB_PAGE_MASK (OMAPLFB_PAGE_SIZE - 1) |
| 137 | #define OMAPLFB_PAGE_TRUNC (~OMAPLFB_PAGE_MASK) | 136 | #define OMAPLFB_PAGE_TRUNC (~OMAPLFB_PAGE_MASK) |
| @@ -157,17 +156,17 @@ struct omaplfb_device { | |||
| 157 | #define ERROR_PRINTK(format, ...) printk("ERROR " DRIVER_PREFIX \ | 156 | #define ERROR_PRINTK(format, ...) printk("ERROR " DRIVER_PREFIX \ |
| 158 | " (%s %i): " format "\n", __func__, __LINE__, ## __VA_ARGS__) | 157 | " (%s %i): " format "\n", __func__, __LINE__, ## __VA_ARGS__) |
| 159 | 158 | ||
| 160 | OMAP_ERROR OMAPLFBInit(struct omaplfb_device *omaplfb_dev); | 159 | OMAP_ERROR OMAPLFBInit(void); |
| 161 | OMAP_ERROR OMAPLFBDeinit(void); | 160 | OMAP_ERROR OMAPLFBDeinit(void); |
| 161 | OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo); | ||
| 162 | void *OMAPLFBAllocKernelMem(unsigned long ulSize); | 162 | void *OMAPLFBAllocKernelMem(unsigned long ulSize); |
| 163 | void OMAPLFBFreeKernelMem(void *pvMem); | 163 | void OMAPLFBFreeKernelMem(void *pvMem); |
| 164 | void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, | 164 | void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, |
| 165 | OMAPLFB_FLIP_ITEM *psFlipItem); | 165 | OMAPLFB_FLIP_ITEM *psFlipItem); |
| 166 | void OMAPLFBPresentSyncAddr(OMAPLFB_DEVINFO *psDevInfo, unsigned long aPhyAddr); | ||
| 166 | OMAP_ERROR OMAPLFBGetLibFuncAddr(char *szFunctionName, | 167 | OMAP_ERROR OMAPLFBGetLibFuncAddr(char *szFunctionName, |
| 167 | PFN_DC_GET_PVRJTABLE *ppfnFuncTable); | 168 | PFN_DC_GET_PVRJTABLE *ppfnFuncTable); |
| 168 | void OMAPLFBFlip(OMAPLFB_SWAPCHAIN *psSwapChain, unsigned long aPhyAddr); | 169 | void OMAPLFBFlip(OMAPLFB_SWAPCHAIN *psSwapChain, unsigned long aPhyAddr); |
| 169 | void omaplfb_create_sysfs(struct omaplfb_device *odev); | ||
| 170 | void omaplfb_remove_sysfs(struct omaplfb_device *odev); | ||
| 171 | #ifdef LDM_PLATFORM | 170 | #ifdef LDM_PLATFORM |
| 172 | void OMAPLFBDriverSuspend(void); | 171 | void OMAPLFBDriverSuspend(void); |
| 173 | void OMAPLFBDriverResume(void); | 172 | void OMAPLFBDriverResume(void); |
diff --git a/drivers/gpu/pvr/omaplfb/omaplfb_displayclass.c b/drivers/gpu/pvr/omaplfb/omaplfb_displayclass.c index 76d5ce26cf0..aca3b4de874 100644 --- a/drivers/gpu/pvr/omaplfb/omaplfb_displayclass.c +++ b/drivers/gpu/pvr/omaplfb/omaplfb_displayclass.c | |||
| @@ -45,21 +45,29 @@ | |||
| 45 | #include <../drivers/video/omap2/omapfb/omapfb.h> | 45 | #include <../drivers/video/omap2/omapfb/omapfb.h> |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | #if defined(SUPPORT_DRI_DRM) | ||
| 49 | #include <drm/drmP.h> | ||
| 50 | #else | ||
| 48 | #include <linux/module.h> | 51 | #include <linux/module.h> |
| 52 | #endif | ||
| 53 | |||
| 49 | #include <linux/string.h> | 54 | #include <linux/string.h> |
| 50 | #include <linux/notifier.h> | 55 | #include <linux/notifier.h> |
| 51 | 56 | ||
| 52 | #ifdef CONFIG_TILER_OMAP | ||
| 53 | #include <mach/tiler.h> | ||
| 54 | #define TILER_MIN_PADDR 0x60000000 | ||
| 55 | #define TILER_MAX_PADDR 0x7fffffff | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #include "img_defs.h" | 57 | #include "img_defs.h" |
| 59 | #include "servicesext.h" | 58 | #include "servicesext.h" |
| 60 | #include "kerneldisplay.h" | 59 | #include "kerneldisplay.h" |
| 61 | #include "omaplfb.h" | 60 | #include "omaplfb.h" |
| 62 | 61 | ||
| 62 | #if defined(SUPPORT_DRI_DRM) | ||
| 63 | #include "pvr_drm.h" | ||
| 64 | #include "3rdparty_dc_drm_shared.h" | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #if !defined(PVR_LINUX_USING_WORKQUEUES) | ||
| 68 | #error "PVR_LINUX_USING_WORKQUEUES must be defined" | ||
| 69 | #endif | ||
| 70 | |||
| 63 | #define OMAPLFB_COMMAND_COUNT 1 | 71 | #define OMAPLFB_COMMAND_COUNT 1 |
| 64 | #define MAX_BUFFERS_FLIPPING 4 | 72 | #define MAX_BUFFERS_FLIPPING 4 |
| 65 | /* Put 0 as desired bpp to use the default in the framebuffer */ | 73 | /* Put 0 as desired bpp to use the default in the framebuffer */ |
| @@ -144,6 +152,12 @@ static PVRSRV_ERROR SetDCSrcColourKey(IMG_HANDLE hDevice, | |||
| 144 | */ | 152 | */ |
| 145 | static PVRSRV_ERROR CloseDCDevice(IMG_HANDLE hDevice) | 153 | static PVRSRV_ERROR CloseDCDevice(IMG_HANDLE hDevice) |
| 146 | { | 154 | { |
| 155 | #if defined(SUPPORT_DRI_DRM) | ||
| 156 | OMAPLFB_DEVINFO *psDevInfo = (OMAPLFB_DEVINFO *)hDevice; | ||
| 157 | |||
| 158 | psDevInfo->bLeaveVT = OMAP_FALSE; | ||
| 159 | UnBlankDisplay(psDevInfo); | ||
| 160 | #endif | ||
| 147 | /* Nothing to do */ | 161 | /* Nothing to do */ |
| 148 | return PVRSRV_OK; | 162 | return PVRSRV_OK; |
| 149 | } | 163 | } |
| @@ -289,7 +303,7 @@ static void SetFlushStateExternal(OMAPLFB_DEVINFO* psDevInfo, | |||
| 289 | * Unblank the framebuffer display | 303 | * Unblank the framebuffer display |
| 290 | * in: psDevInfo | 304 | * in: psDevInfo |
| 291 | */ | 305 | */ |
| 292 | static OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo) | 306 | OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo) |
| 293 | { | 307 | { |
| 294 | DEBUG_PRINTK("Executing for display %u", | 308 | DEBUG_PRINTK("Executing for display %u", |
| 295 | psDevInfo->uDeviceID); | 309 | psDevInfo->uDeviceID); |
| @@ -298,7 +312,7 @@ static OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo) | |||
| 298 | if (fb_blank(psDevInfo->psLINFBInfo, FB_BLANK_UNBLANK)) | 312 | if (fb_blank(psDevInfo->psLINFBInfo, FB_BLANK_UNBLANK)) |
| 299 | { | 313 | { |
| 300 | console_unlock(); | 314 | console_unlock(); |
| 301 | WARNING_PRINTK("fb_blank failed"); | 315 | WARNING_PRINTK("fb_blank FB_BLANK_UNBLANK failed"); |
| 302 | return OMAP_ERROR_GENERIC; | 316 | return OMAP_ERROR_GENERIC; |
| 303 | } | 317 | } |
| 304 | console_unlock(); | 318 | console_unlock(); |
| @@ -307,6 +321,29 @@ static OMAP_ERROR UnBlankDisplay(OMAPLFB_DEVINFO *psDevInfo) | |||
| 307 | } | 321 | } |
| 308 | 322 | ||
| 309 | /* | 323 | /* |
| 324 | * Blank the framebuffer display | ||
| 325 | * in: psDevInfo | ||
| 326 | */ | ||
| 327 | #if defined(SUPPORT_DRI_DRM) && defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL) | ||
| 328 | static OMAP_ERROR BlankDisplay(OMAPLFB_DEVINFO *psDevInfo, int blank_cmd) | ||
| 329 | { | ||
| 330 | DEBUG_PRINTK("Executing for display %u", | ||
| 331 | psDevInfo->uDeviceID); | ||
| 332 | |||
| 333 | acquire_console_sem(); | ||
| 334 | if (fb_blank(psDevInfo->psLINFBInfo, blank_cmd)) | ||
| 335 | { | ||
| 336 | release_console_sem(); | ||
| 337 | WARNING_PRINTK("fb_blank %i failed", blank_cmd); | ||
| 338 | return OMAP_ERROR_GENERIC; | ||
| 339 | } | ||
| 340 | release_console_sem(); | ||
| 341 | |||
| 342 | return OMAP_OK; | ||
| 343 | } | ||
| 344 | #endif | ||
| 345 | |||
| 346 | /* | ||
| 310 | * Framebuffer listener | 347 | * Framebuffer listener |
| 311 | * in: psNotif, event, data | 348 | * in: psNotif, event, data |
| 312 | */ | 349 | */ |
| @@ -837,6 +874,14 @@ static PVRSRV_ERROR CreateDCSwapChain(IMG_HANDLE hDevice, | |||
| 837 | goto ErrorUnRegisterDisplayClient; | 874 | goto ErrorUnRegisterDisplayClient; |
| 838 | } | 875 | } |
| 839 | 876 | ||
| 877 | psDevInfo->uiSwapChainID++; | ||
| 878 | if (psDevInfo->uiSwapChainID == 0) | ||
| 879 | { | ||
| 880 | psDevInfo->uiSwapChainID++; | ||
| 881 | } | ||
| 882 | psSwapChain->uiSwapChainID = psDevInfo->uiSwapChainID; | ||
| 883 | *pui32SwapChainID = psDevInfo->uiSwapChainID; | ||
| 884 | |||
| 840 | *phSwapChain = (IMG_HANDLE)psSwapChain; | 885 | *phSwapChain = (IMG_HANDLE)psSwapChain; |
| 841 | 886 | ||
| 842 | return PVRSRV_OK; | 887 | return PVRSRV_OK; |
| @@ -1037,7 +1082,11 @@ static void OMAPLFBSyncIHandler(struct work_struct *work) | |||
| 1037 | mutex_lock(&psDevInfo->sSwapChainLockMutex); | 1082 | mutex_lock(&psDevInfo->sSwapChainLockMutex); |
| 1038 | 1083 | ||
| 1039 | psSwapChain = psDevInfo->psSwapChain; | 1084 | psSwapChain = psDevInfo->psSwapChain; |
| 1040 | if (!psSwapChain || psSwapChain->bFlushCommands) | 1085 | if (!psSwapChain || psSwapChain->bFlushCommands |
| 1086 | #if defined(SUPPORT_DRI_DRM) | ||
| 1087 | || psDevInfo->bLeaveVT | ||
| 1088 | #endif | ||
| 1089 | ) | ||
| 1041 | goto ExitUnlock; | 1090 | goto ExitUnlock; |
| 1042 | 1091 | ||
| 1043 | psFlipItem = &psSwapChain->psFlipItems[psSwapChain->ulRemoveIndex]; | 1092 | psFlipItem = &psSwapChain->psFlipItems[psSwapChain->ulRemoveIndex]; |
| @@ -1123,7 +1172,11 @@ static IMG_BOOL ProcessFlip(IMG_HANDLE hCmdCookie, | |||
| 1123 | 1172 | ||
| 1124 | mutex_lock(&psDevInfo->sSwapChainLockMutex); | 1173 | mutex_lock(&psDevInfo->sSwapChainLockMutex); |
| 1125 | 1174 | ||
| 1126 | if (psDevInfo->bDeviceSuspended) | 1175 | if (psDevInfo->bDeviceSuspended |
| 1176 | #if defined(SUPPORT_DRI_DRM) | ||
| 1177 | || psDevInfo->bLeaveVT == OMAP_TRUE | ||
| 1178 | #endif | ||
| 1179 | ) | ||
| 1127 | { | 1180 | { |
| 1128 | /* If is suspended then assume the commands are completed */ | 1181 | /* If is suspended then assume the commands are completed */ |
| 1129 | psSwapChain->psPVRJTable->pfnPVRSRVCmdComplete( | 1182 | psSwapChain->psPVRJTable->pfnPVRSRVCmdComplete( |
| @@ -1134,7 +1187,7 @@ static IMG_BOOL ProcessFlip(IMG_HANDLE hCmdCookie, | |||
| 1134 | #if defined(SYS_USING_INTERRUPTS) | 1187 | #if defined(SYS_USING_INTERRUPTS) |
| 1135 | 1188 | ||
| 1136 | if( psFlipCmd->ui32SwapInterval == 0 || | 1189 | if( psFlipCmd->ui32SwapInterval == 0 || |
| 1137 | psDevInfo->ignore_sync || | 1190 | |
| 1138 | psSwapChain->bFlushCommands == OMAP_TRUE) | 1191 | psSwapChain->bFlushCommands == OMAP_TRUE) |
| 1139 | { | 1192 | { |
| 1140 | #endif | 1193 | #endif |
| @@ -1249,6 +1302,150 @@ void OMAPLFBDriverResume(void) | |||
| 1249 | } | 1302 | } |
| 1250 | #endif /* defined(LDM_PLATFORM) */ | 1303 | #endif /* defined(LDM_PLATFORM) */ |
| 1251 | 1304 | ||
| 1305 | #if defined(SUPPORT_DRI_DRM) && defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL) | ||
| 1306 | static OMAPLFB_DEVINFO *OMAPLFBPVRDevIDToDevInfo(unsigned uiPVRDevID) | ||
| 1307 | { | ||
| 1308 | int i; | ||
| 1309 | |||
| 1310 | for(i = 0; i < FRAMEBUFFER_COUNT; i++) | ||
| 1311 | { | ||
| 1312 | if (uiPVRDevID == (&pDisplayDevices[i])->uDeviceID) | ||
| 1313 | { | ||
| 1314 | return &pDisplayDevices[i]; | ||
| 1315 | } | ||
| 1316 | } | ||
| 1317 | |||
| 1318 | WARNING_PRINTK("Couldn't find device %u\n", uiPVRDevID); | ||
| 1319 | |||
| 1320 | return NULL; | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Ioctl)(struct drm_device unref__ *dev, void *arg, struct drm_file unref__ *pFile) | ||
| 1324 | { | ||
| 1325 | uint32_t *puiArgs; | ||
| 1326 | uint32_t uiCmd; | ||
| 1327 | unsigned uiPVRDevID; | ||
| 1328 | int ret = 0; | ||
| 1329 | OMAPLFB_DEVINFO *psDevInfo; | ||
| 1330 | |||
| 1331 | if (arg == NULL) | ||
| 1332 | { | ||
| 1333 | return -EFAULT; | ||
| 1334 | } | ||
| 1335 | |||
| 1336 | puiArgs = (uint32_t *)arg; | ||
| 1337 | uiCmd = puiArgs[PVR_DRM_DISP_ARG_CMD]; | ||
| 1338 | uiPVRDevID = puiArgs[PVR_DRM_DISP_ARG_DEV]; | ||
| 1339 | |||
| 1340 | psDevInfo = OMAPLFBPVRDevIDToDevInfo(uiPVRDevID); | ||
| 1341 | if (psDevInfo == NULL) | ||
| 1342 | { | ||
| 1343 | return -EINVAL; | ||
| 1344 | } | ||
| 1345 | |||
| 1346 | |||
| 1347 | switch (uiCmd) | ||
| 1348 | { | ||
| 1349 | case PVR_DRM_DISP_CMD_LEAVE_VT: | ||
| 1350 | case PVR_DRM_DISP_CMD_ENTER_VT: | ||
| 1351 | { | ||
| 1352 | OMAP_BOOL bLeaveVT = (uiCmd == PVR_DRM_DISP_CMD_LEAVE_VT); | ||
| 1353 | DEBUG_PRINTK("PVR Device %u: %s\n", uiPVRDevID, | ||
| 1354 | bLeaveVT ? "Leave VT" : "Enter VT"); | ||
| 1355 | |||
| 1356 | mutex_lock(&psDevInfo->sSwapChainLockMutex); | ||
| 1357 | psDevInfo->bLeaveVT = bLeaveVT; | ||
| 1358 | |||
| 1359 | if (psDevInfo->psSwapChain != NULL) | ||
| 1360 | { | ||
| 1361 | FlushInternalSyncQueue(psDevInfo->psSwapChain); | ||
| 1362 | |||
| 1363 | if (bLeaveVT) | ||
| 1364 | { | ||
| 1365 | OMAPLFBPresentSyncAddr(psDevInfo, | ||
| 1366 | (unsigned long) psDevInfo->sSystemBuffer.sSysAddr.uiAddr); | ||
| 1367 | } | ||
| 1368 | } | ||
| 1369 | |||
| 1370 | mutex_unlock(&psDevInfo->sSwapChainLockMutex); | ||
| 1371 | UnBlankDisplay(psDevInfo); | ||
| 1372 | break; | ||
| 1373 | } | ||
| 1374 | case PVR_DRM_DISP_CMD_ON: | ||
| 1375 | case PVR_DRM_DISP_CMD_STANDBY: | ||
| 1376 | case PVR_DRM_DISP_CMD_SUSPEND: | ||
| 1377 | case PVR_DRM_DISP_CMD_OFF: | ||
| 1378 | { | ||
| 1379 | int iFBMode; | ||
| 1380 | #if defined(DEBUG) | ||
| 1381 | { | ||
| 1382 | const char *pszMode; | ||
| 1383 | switch(uiCmd) | ||
| 1384 | { | ||
| 1385 | case PVR_DRM_DISP_CMD_ON: | ||
| 1386 | pszMode = "On"; | ||
| 1387 | break; | ||
| 1388 | case PVR_DRM_DISP_CMD_STANDBY: | ||
| 1389 | pszMode = "Standby"; | ||
| 1390 | break; | ||
| 1391 | case PVR_DRM_DISP_CMD_SUSPEND: | ||
| 1392 | pszMode = "Suspend"; | ||
| 1393 | break; | ||
| 1394 | case PVR_DRM_DISP_CMD_OFF: | ||
| 1395 | pszMode = "Off"; | ||
| 1396 | break; | ||
| 1397 | default: | ||
| 1398 | pszMode = "(Unknown Mode)"; | ||
| 1399 | break; | ||
| 1400 | } | ||
| 1401 | DEBUG_PRINTK("PVR Device %u: Display %s\n", | ||
| 1402 | uiPVRDevID, pszMode); | ||
| 1403 | } | ||
| 1404 | #endif | ||
| 1405 | switch(uiCmd) | ||
| 1406 | { | ||
| 1407 | case PVR_DRM_DISP_CMD_ON: | ||
| 1408 | iFBMode = FB_BLANK_UNBLANK; | ||
| 1409 | break; | ||
| 1410 | case PVR_DRM_DISP_CMD_STANDBY: | ||
| 1411 | iFBMode = FB_BLANK_HSYNC_SUSPEND; | ||
| 1412 | break; | ||
| 1413 | case PVR_DRM_DISP_CMD_SUSPEND: | ||
| 1414 | iFBMode = FB_BLANK_VSYNC_SUSPEND; | ||
| 1415 | break; | ||
| 1416 | case PVR_DRM_DISP_CMD_OFF: | ||
| 1417 | iFBMode = FB_BLANK_POWERDOWN; | ||
| 1418 | break; | ||
| 1419 | default: | ||
| 1420 | return -EINVAL; | ||
| 1421 | } | ||
| 1422 | |||
| 1423 | mutex_lock(&psDevInfo->sSwapChainLockMutex); | ||
| 1424 | |||
| 1425 | if (psDevInfo->psSwapChain != NULL) | ||
| 1426 | { | ||
| 1427 | FlushInternalSyncQueue(psDevInfo->psSwapChain); | ||
| 1428 | } | ||
| 1429 | |||
| 1430 | mutex_unlock(&psDevInfo->sSwapChainLockMutex); | ||
| 1431 | /* XXX: Internally all the previous ioctl commands are | ||
| 1432 | * implemented the same in omapfb | ||
| 1433 | */ | ||
| 1434 | BlankDisplay(psDevInfo, iFBMode); | ||
| 1435 | |||
| 1436 | break; | ||
| 1437 | } | ||
| 1438 | default: | ||
| 1439 | { | ||
| 1440 | ret = -EINVAL; | ||
| 1441 | break; | ||
| 1442 | } | ||
| 1443 | } | ||
| 1444 | |||
| 1445 | return ret; | ||
| 1446 | } | ||
| 1447 | #endif | ||
| 1448 | |||
| 1252 | /* | 1449 | /* |
| 1253 | * Frees the kernel framebuffer | 1450 | * Frees the kernel framebuffer |
| 1254 | * in: psDevInfo | 1451 | * in: psDevInfo |
| @@ -1465,6 +1662,7 @@ static OMAP_ERROR InitDev(OMAPLFB_DEVINFO *psDevInfo, int fb_idx) | |||
| 1465 | DEBUG_PRINTK("*Stride (bytes): %u", | 1662 | DEBUG_PRINTK("*Stride (bytes): %u", |
| 1466 | (unsigned int)psLINFBInfo->fix.line_length); | 1663 | (unsigned int)psLINFBInfo->fix.line_length); |
| 1467 | 1664 | ||
| 1665 | #ifndef CONFIG_DRM | ||
| 1468 | #ifdef CONFIG_TILER_OMAP | 1666 | #ifdef CONFIG_TILER_OMAP |
| 1469 | /* If TILER is being used, use correct physical stride and FB size */ | 1667 | /* If TILER is being used, use correct physical stride and FB size */ |
| 1470 | if ((psPVRFBInfo->sSysAddr.uiAddr >= TILER_MIN_PADDR) && | 1668 | if ((psPVRFBInfo->sSysAddr.uiAddr >= TILER_MIN_PADDR) && |
| @@ -1484,6 +1682,7 @@ static OMAP_ERROR InitDev(OMAPLFB_DEVINFO *psDevInfo, int fb_idx) | |||
| 1484 | psPVRFBInfo->ulHeight * psPVRFBInfo->ulByteStride; | 1682 | psPVRFBInfo->ulHeight * psPVRFBInfo->ulByteStride; |
| 1485 | } | 1683 | } |
| 1486 | #endif | 1684 | #endif |
| 1685 | #endif | ||
| 1487 | 1686 | ||
| 1488 | /* Get physical display size for DPI calculation */ | 1687 | /* Get physical display size for DPI calculation */ |
| 1489 | if (psLINFBInfo->var.width < 0 || psLINFBInfo->var.height < 0) { | 1688 | if (psLINFBInfo->var.width < 0 || psLINFBInfo->var.height < 0) { |
| @@ -1552,7 +1751,7 @@ static OMAP_ERROR InitDev(OMAPLFB_DEVINFO *psDevInfo, int fb_idx) | |||
| 1552 | /* | 1751 | /* |
| 1553 | * Initialization routine for the 3rd party display driver | 1752 | * Initialization routine for the 3rd party display driver |
| 1554 | */ | 1753 | */ |
| 1555 | OMAP_ERROR OMAPLFBInit(struct omaplfb_device *omaplfb_dev) | 1754 | OMAP_ERROR OMAPLFBInit(void) |
| 1556 | { | 1755 | { |
| 1557 | OMAPLFB_DEVINFO *psDevInfo; | 1756 | OMAPLFB_DEVINFO *psDevInfo; |
| 1558 | PFN_CMD_PROC pfnCmdProcList[OMAPLFB_COMMAND_COUNT]; | 1757 | PFN_CMD_PROC pfnCmdProcList[OMAPLFB_COMMAND_COUNT]; |
| @@ -1592,13 +1791,12 @@ OMAP_ERROR OMAPLFBInit(struct omaplfb_device *omaplfb_dev) | |||
| 1592 | sizeof(OMAPLFB_DEVINFO) * FRAMEBUFFER_COUNT); | 1791 | sizeof(OMAPLFB_DEVINFO) * FRAMEBUFFER_COUNT); |
| 1593 | if(!pDisplayDevices) | 1792 | if(!pDisplayDevices) |
| 1594 | { | 1793 | { |
| 1794 | pDisplayDevices = NULL; | ||
| 1595 | ERROR_PRINTK("Out of memory"); | 1795 | ERROR_PRINTK("Out of memory"); |
| 1596 | return OMAP_ERROR_OUT_OF_MEMORY; | 1796 | return OMAP_ERROR_OUT_OF_MEMORY; |
| 1597 | } | 1797 | } |
| 1598 | memset(pDisplayDevices, 0, sizeof(OMAPLFB_DEVINFO) * | 1798 | memset(pDisplayDevices, 0, sizeof(OMAPLFB_DEVINFO) * |
| 1599 | FRAMEBUFFER_COUNT); | 1799 | FRAMEBUFFER_COUNT); |
| 1600 | omaplfb_dev->display_info_list = pDisplayDevices; | ||
| 1601 | omaplfb_dev->display_count = FRAMEBUFFER_COUNT; | ||
| 1602 | 1800 | ||
| 1603 | /* | 1801 | /* |
| 1604 | * Initialize each display device | 1802 | * Initialize each display device |
| @@ -1637,7 +1835,9 @@ OMAP_ERROR OMAPLFBInit(struct omaplfb_device *omaplfb_dev) | |||
| 1637 | psDevInfo->psSwapChain = 0; | 1835 | psDevInfo->psSwapChain = 0; |
| 1638 | psDevInfo->bFlushCommands = OMAP_FALSE; | 1836 | psDevInfo->bFlushCommands = OMAP_FALSE; |
| 1639 | psDevInfo->bDeviceSuspended = OMAP_FALSE; | 1837 | psDevInfo->bDeviceSuspended = OMAP_FALSE; |
| 1640 | psDevInfo->ignore_sync = OMAP_FALSE; | 1838 | #if defined(SUPPORT_DRI_DRM) |
| 1839 | psDevInfo->bLeaveVT = OMAP_FALSE; | ||
| 1840 | #endif | ||
| 1641 | 1841 | ||
| 1642 | if(psDevInfo->sDisplayInfo.ui32MaxSwapChainBuffers > 1) | 1842 | if(psDevInfo->sDisplayInfo.ui32MaxSwapChainBuffers > 1) |
| 1643 | { | 1843 | { |
diff --git a/drivers/gpu/pvr/omaplfb/omaplfb_linux.c b/drivers/gpu/pvr/omaplfb/omaplfb_linux.c index 2b5d9f3bfe0..35755301296 100644 --- a/drivers/gpu/pvr/omaplfb/omaplfb_linux.c +++ b/drivers/gpu/pvr/omaplfb/omaplfb_linux.c | |||
| @@ -24,8 +24,13 @@ | |||
| 24 | * | 24 | * |
| 25 | ******************************************************************************/ | 25 | ******************************************************************************/ |
| 26 | 26 | ||
| 27 | #include <linux/version.h> | 27 | #if defined(SUPPORT_DRI_DRM) |
| 28 | #include <drm/drmP.h> | ||
| 29 | #else | ||
| 28 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #endif | ||
| 32 | |||
| 33 | #include <linux/version.h> | ||
| 29 | #include <linux/fb.h> | 34 | #include <linux/fb.h> |
| 30 | #include <asm/io.h> | 35 | #include <asm/io.h> |
| 31 | 36 | ||
| @@ -59,13 +64,21 @@ | |||
| 59 | #endif | 64 | #endif |
| 60 | #endif | 65 | #endif |
| 61 | 66 | ||
| 62 | |||
| 63 | #include "img_defs.h" | 67 | #include "img_defs.h" |
| 64 | #include "servicesext.h" | 68 | #include "servicesext.h" |
| 65 | #include "kerneldisplay.h" | 69 | #include "kerneldisplay.h" |
| 66 | #include "omaplfb.h" | 70 | #include "omaplfb.h" |
| 67 | #include "pvrmodule.h" | 71 | #include "pvrmodule.h" |
| 68 | 72 | ||
| 73 | #if defined(SUPPORT_DRI_DRM) | ||
| 74 | #include "pvr_drm.h" | ||
| 75 | #include "3rdparty_dc_drm_shared.h" | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if !defined(PVR_LINUX_USING_WORKQUEUES) | ||
| 79 | #error "PVR_LINUX_USING_WORKQUEUES must be defined" | ||
| 80 | #endif | ||
| 81 | |||
| 69 | MODULE_SUPPORTED_DEVICE(DEVNAME); | 82 | MODULE_SUPPORTED_DEVICE(DEVNAME); |
| 70 | 83 | ||
| 71 | #if defined(CONFIG_OUTER_CACHE) /* Kernel config option */ | 84 | #if defined(CONFIG_OUTER_CACHE) /* Kernel config option */ |
| @@ -236,14 +249,19 @@ void OMAPLFBFlip(OMAPLFB_SWAPCHAIN *psSwapChain, unsigned long aPhyAddr) | |||
| 236 | omapfb_unlock(fbdev); | 249 | omapfb_unlock(fbdev); |
| 237 | } | 250 | } |
| 238 | 251 | ||
| 252 | void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, OMAPLFB_FLIP_ITEM *psFlipItem) | ||
| 253 | { | ||
| 254 | OMAPLFBPresentSyncAddr(psDevInfo, (unsigned long)psFlipItem->sSysAddr->uiAddr); | ||
| 255 | } | ||
| 256 | |||
| 239 | /* | 257 | /* |
| 240 | * Present frame and synchronize with the display to prevent tearing | 258 | * Present frame and synchronize with the display to prevent tearing |
| 241 | * On DSI panels the sync function is used to handle FRAMEDONE IRQ | 259 | * On DSI panels the sync function is used to handle FRAMEDONE IRQ |
| 242 | * On DPI panels the wait_for_vsync is used to handle VSYNC IRQ | 260 | * On DPI panels the wait_for_vsync is used to handle VSYNC IRQ |
| 243 | * in: psDevInfo | 261 | * in: psDevInfo |
| 244 | */ | 262 | */ |
| 245 | void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, | 263 | void OMAPLFBPresentSyncAddr(OMAPLFB_DEVINFO *psDevInfo, |
| 246 | OMAPLFB_FLIP_ITEM *psFlipItem) | 264 | unsigned long paddr) |
| 247 | { | 265 | { |
| 248 | struct fb_info *framebuffer = psDevInfo->psLINFBInfo; | 266 | struct fb_info *framebuffer = psDevInfo->psLINFBInfo; |
| 249 | struct omapfb_info *ofbi = FB2OFB(framebuffer); | 267 | struct omapfb_info *ofbi = FB2OFB(framebuffer); |
| @@ -269,15 +287,13 @@ void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, | |||
| 269 | driver->get_update_mode(display) == OMAP_DSS_UPDATE_MANUAL) { | 287 | driver->get_update_mode(display) == OMAP_DSS_UPDATE_MANUAL) { |
| 270 | /* Wait first for the DSI bus to be released then update */ | 288 | /* Wait first for the DSI bus to be released then update */ |
| 271 | err = driver->sync(display); | 289 | err = driver->sync(display); |
| 272 | OMAPLFBFlipNoLock(psDevInfo->psSwapChain, | 290 | OMAPLFBFlipNoLock(psDevInfo->psSwapChain, paddr); |
| 273 | (unsigned long)psFlipItem->sSysAddr->uiAddr); | ||
| 274 | } else if (manager && manager->wait_for_vsync) { | 291 | } else if (manager && manager->wait_for_vsync) { |
| 275 | /* | 292 | /* |
| 276 | * Update the video pipelines registers then wait until the | 293 | * Update the video pipelines registers then wait until the |
| 277 | * frame is shown with a VSYNC | 294 | * frame is shown with a VSYNC |
| 278 | */ | 295 | */ |
| 279 | OMAPLFBFlipNoLock(psDevInfo->psSwapChain, | 296 | OMAPLFBFlipNoLock(psDevInfo->psSwapChain, paddr); |
| 280 | (unsigned long)psFlipItem->sSysAddr->uiAddr); | ||
| 281 | err = manager->wait_for_vsync(manager); | 297 | err = manager->wait_for_vsync(manager); |
| 282 | } | 298 | } |
| 283 | 299 | ||
| @@ -292,44 +308,6 @@ void OMAPLFBPresentSync(OMAPLFB_DEVINFO *psDevInfo, | |||
| 292 | 308 | ||
| 293 | static volatile OMAP_BOOL bDeviceSuspended; | 309 | static volatile OMAP_BOOL bDeviceSuspended; |
| 294 | 310 | ||
| 295 | static int omaplfb_probe(struct platform_device *pdev) | ||
| 296 | { | ||
| 297 | struct omaplfb_device *odev; | ||
| 298 | |||
| 299 | odev = kzalloc(sizeof(*odev), GFP_KERNEL); | ||
| 300 | |||
| 301 | if (!odev) | ||
| 302 | return -ENOMEM; | ||
| 303 | |||
| 304 | if (OMAPLFBInit(odev) != OMAP_OK) { | ||
| 305 | dev_err(&pdev->dev, "failed to setup omaplfb\n"); | ||
| 306 | kfree(odev); | ||
| 307 | return -ENODEV; | ||
| 308 | } | ||
| 309 | |||
| 310 | odev->dev = &pdev->dev; | ||
| 311 | platform_set_drvdata(pdev, odev); | ||
| 312 | omaplfb_create_sysfs(odev); | ||
| 313 | |||
| 314 | return 0; | ||
| 315 | } | ||
| 316 | |||
| 317 | static int omaplfb_remove(struct platform_device *pdev) | ||
| 318 | { | ||
| 319 | struct omaplfb_device *odev; | ||
| 320 | |||
| 321 | odev = platform_get_drvdata(pdev); | ||
| 322 | |||
| 323 | omaplfb_remove_sysfs(odev); | ||
| 324 | |||
| 325 | if (OMAPLFBDeinit() != OMAP_OK) | ||
| 326 | WARNING_PRINTK("Driver cleanup failed"); | ||
| 327 | |||
| 328 | kfree(odev); | ||
| 329 | |||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | |||
| 333 | /* | 311 | /* |
| 334 | * Common suspend driver function | 312 | * Common suspend driver function |
| 335 | * in: psSwapChain, aPhyAddr | 313 | * in: psSwapChain, aPhyAddr |
| @@ -345,7 +323,6 @@ static void OMAPLFBCommonSuspend(void) | |||
| 345 | OMAPLFBDriverSuspend(); | 323 | OMAPLFBDriverSuspend(); |
| 346 | bDeviceSuspended = OMAP_TRUE; | 324 | bDeviceSuspended = OMAP_TRUE; |
| 347 | } | 325 | } |
| 348 | |||
| 349 | #if 0 | 326 | #if 0 |
| 350 | /* | 327 | /* |
| 351 | * Function called when the driver is requested to release | 328 | * Function called when the driver is requested to release |
| @@ -368,6 +345,8 @@ static struct platform_device omaplfb_device = { | |||
| 368 | 345 | ||
| 369 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) | 346 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) |
| 370 | 347 | ||
| 348 | static struct early_suspend omaplfb_early_suspend; | ||
| 349 | |||
| 371 | /* | 350 | /* |
| 372 | * Android specific, driver is requested to be suspended | 351 | * Android specific, driver is requested to be suspended |
| 373 | * in: ea_event | 352 | * in: ea_event |
| @@ -389,23 +368,18 @@ static void OMAPLFBDriverResume_Entry(struct early_suspend *ea_event) | |||
| 389 | bDeviceSuspended = OMAP_FALSE; | 368 | bDeviceSuspended = OMAP_FALSE; |
| 390 | } | 369 | } |
| 391 | 370 | ||
| 371 | |||
| 372 | #if !defined (SUPPORT_DRI_DRM) | ||
| 392 | static struct platform_driver omaplfb_driver = { | 373 | static struct platform_driver omaplfb_driver = { |
| 393 | .driver = { | 374 | .driver = { |
| 394 | .name = DRVNAME, | 375 | .name = DRVNAME, |
| 395 | .owner = THIS_MODULE, | 376 | } |
| 396 | }, | ||
| 397 | .probe = omaplfb_probe, | ||
| 398 | .remove = omaplfb_remove, | ||
| 399 | }; | ||
| 400 | |||
| 401 | static struct early_suspend omaplfb_early_suspend = { | ||
| 402 | .suspend = OMAPLFBDriverSuspend_Entry, | ||
| 403 | .resume = OMAPLFBDriverResume_Entry, | ||
| 404 | .level = EARLY_SUSPEND_LEVEL_STOP_DRAWING, | ||
| 405 | }; | 377 | }; |
| 378 | #endif | ||
| 406 | 379 | ||
| 407 | #else /* defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) */ | 380 | #else /* defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) */ |
| 408 | 381 | ||
| 382 | #if !defined (SUPPORT_DRI_DRM) | ||
| 409 | /* | 383 | /* |
| 410 | * Function called when the driver is requested to be suspended | 384 | * Function called when the driver is requested to be suspended |
| 411 | * in: pDevice, state | 385 | * in: pDevice, state |
| @@ -444,14 +418,12 @@ static IMG_VOID OMAPLFBDriverShutdown_Entry( | |||
| 444 | static struct platform_driver omaplfb_driver = { | 418 | static struct platform_driver omaplfb_driver = { |
| 445 | .driver = { | 419 | .driver = { |
| 446 | .name = DRVNAME, | 420 | .name = DRVNAME, |
| 447 | .owner = THIS_MODULE, | ||
| 448 | }, | 421 | }, |
| 449 | .probe = omaplfb_probe, | ||
| 450 | .remove = omaplfb_remove, | ||
| 451 | .suspend = OMAPLFBDriverSuspend_Entry, | 422 | .suspend = OMAPLFBDriverSuspend_Entry, |
| 452 | .resume = OMAPLFBDriverResume_Entry, | 423 | .resume = OMAPLFBDriverResume_Entry, |
| 453 | .shutdown = OMAPLFBDriverShutdown_Entry, | 424 | .shutdown = OMAPLFBDriverShutdown_Entry, |
| 454 | }; | 425 | }; |
| 426 | #endif /* !defined (SUPPORT_DRI_DRM)*/ | ||
| 455 | 427 | ||
| 456 | #endif /* defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) */ | 428 | #endif /* defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) */ |
| 457 | 429 | ||
| @@ -460,12 +432,29 @@ static struct platform_driver omaplfb_driver = { | |||
| 460 | /* | 432 | /* |
| 461 | * Driver init function | 433 | * Driver init function |
| 462 | */ | 434 | */ |
| 435 | #if defined(SUPPORT_DRI_DRM) | ||
| 436 | int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Init)(struct drm_device *dev) | ||
| 437 | #else | ||
| 463 | static int __init OMAPLFB_Init(void) | 438 | static int __init OMAPLFB_Init(void) |
| 439 | #endif | ||
| 464 | { | 440 | { |
| 441 | if(OMAPLFBInit() != OMAP_OK) | ||
| 442 | { | ||
| 443 | WARNING_PRINTK("Driver init failed"); | ||
| 444 | return -ENODEV; | ||
| 445 | } | ||
| 446 | |||
| 465 | #if defined(LDM_PLATFORM) | 447 | #if defined(LDM_PLATFORM) |
| 466 | DEBUG_PRINTK("Registering platform driver"); | 448 | DEBUG_PRINTK("Registering platform driver"); |
| 449 | #if !defined(SUPPORT_DRI_DRM) | ||
| 467 | if (platform_driver_register(&omaplfb_driver)) | 450 | if (platform_driver_register(&omaplfb_driver)) |
| 451 | { | ||
| 452 | WARNING_PRINTK("Unable to register platform driver"); | ||
| 453 | if(OMAPLFBDeinit() != OMAP_OK) | ||
| 454 | WARNING_PRINTK("Driver cleanup failed\n"); | ||
| 468 | return -ENODEV; | 455 | return -ENODEV; |
| 456 | } | ||
| 457 | #endif | ||
| 469 | #if 0 | 458 | #if 0 |
| 470 | DEBUG_PRINTK("Registering device driver"); | 459 | DEBUG_PRINTK("Registering device driver"); |
| 471 | if (platform_device_register(&omaplfb_device)) | 460 | if (platform_device_register(&omaplfb_device)) |
| @@ -479,7 +468,10 @@ static int __init OMAPLFB_Init(void) | |||
| 479 | #endif | 468 | #endif |
| 480 | 469 | ||
| 481 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) | 470 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) |
| 482 | register_early_suspend(&omaplfb_early_suspend); | 471 | omaplfb_early_suspend.suspend = OMAPLFBDriverSuspend_Entry; |
| 472 | omaplfb_early_suspend.resume = OMAPLFBDriverResume_Entry; | ||
| 473 | omaplfb_early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; | ||
| 474 | register_early_suspend(&omaplfb_early_suspend); | ||
| 483 | DEBUG_PRINTK("Registered early suspend support"); | 475 | DEBUG_PRINTK("Registered early suspend support"); |
| 484 | #endif | 476 | #endif |
| 485 | 477 | ||
| @@ -490,22 +482,30 @@ static int __init OMAPLFB_Init(void) | |||
| 490 | /* | 482 | /* |
| 491 | * Driver exit function | 483 | * Driver exit function |
| 492 | */ | 484 | */ |
| 485 | #if defined(SUPPORT_DRI_DRM) | ||
| 486 | void PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Cleanup)(struct drm_device unref__ *dev) | ||
| 487 | #else | ||
| 493 | static IMG_VOID __exit OMAPLFB_Cleanup(IMG_VOID) | 488 | static IMG_VOID __exit OMAPLFB_Cleanup(IMG_VOID) |
| 494 | { | 489 | #endif |
| 490 | { | ||
| 495 | #if defined(LDM_PLATFORM) | 491 | #if defined(LDM_PLATFORM) |
| 496 | #if 0 | 492 | #if 0 |
| 497 | DEBUG_PRINTK(format,...)("Removing platform device"); | 493 | DEBUG_PRINTK(format,...)("Removing platform device"); |
| 498 | platform_device_unregister(&omaplfb_device); | 494 | platform_device_unregister(&omaplfb_device); |
| 499 | #endif | 495 | #endif |
| 496 | #if !defined(SUPPORT_DRI_DRM) | ||
| 500 | DEBUG_PRINTK("Removing platform driver"); | 497 | DEBUG_PRINTK("Removing platform driver"); |
| 501 | platform_driver_unregister(&omaplfb_driver); | 498 | platform_driver_unregister(&omaplfb_driver); |
| 499 | #endif | ||
| 502 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) | 500 | #if defined(SGX_EARLYSUSPEND) && defined(CONFIG_HAS_EARLYSUSPEND) |
| 503 | DEBUG_PRINTK("Removed early suspend support"); | 501 | unregister_early_suspend(&omaplfb_early_suspend); |
| 504 | unregister_early_suspend(&omaplfb_early_suspend); | ||
| 505 | #endif | 502 | #endif |
| 506 | #endif | 503 | #endif |
| 504 | if(OMAPLFBDeinit() != OMAP_OK) | ||
| 505 | WARNING_PRINTK("Driver cleanup failed"); | ||
| 507 | } | 506 | } |
| 508 | 507 | ||
| 508 | #if !defined(SUPPORT_DRI_DRM) | ||
| 509 | late_initcall(OMAPLFB_Init); | 509 | late_initcall(OMAPLFB_Init); |
| 510 | module_exit(OMAPLFB_Cleanup); | 510 | module_exit(OMAPLFB_Cleanup); |
| 511 | 511 | #endif | |
