OMAPLFB_ERROR OMAPLFBInit(void) { unsigned uiMaxFBDevIDPlusOne = OMAPLFBMaxFBDevIDPlusOne(); unsigned i; unsigned uiDevicesFound = 0; if(OMAPLFBGetLibFuncAddr ("PVRGetDisplayClassJTable", &gpfnGetPVRJTable) != OMAPLFB_OK) { return OMAPLFB_ERROR_INIT_FAILURE; } for(i = uiMaxFBDevIDPlusOne; i-- != 0;) { OMAPLFB_DEVINFO *psDevInfo = OMAPLFBInitDev(i); if (psDevInfo != NULL) { OMAPLFBSetDevInfoPtr(psDevInfo->uiFBDevID, psDevInfo); uiDevicesFound++; } } return (uiDevicesFound != 0) ? OMAPLFB_OK : OMAPLFB_ERROR_INIT_FAILURE; }
OMAPLFB_DEVINFO *OMAPLFBGetDevInfoPtr(unsigned uiFBDevID) { WARN_ON(uiFBDevID >= OMAPLFBMaxFBDevIDPlusOne()); if (uiFBDevID >= OMAPLFB_MAX_NUM_DEVICES) { return NULL; } return gapsDevInfo[uiFBDevID]; }
static void OMAPLFBEarlyResumeHandler(struct early_suspend *h) { unsigned uiMaxFBDevIDPlusOne = OMAPLFBMaxFBDevIDPlusOne(); unsigned i; for (i=0; i < uiMaxFBDevIDPlusOne; i++) { OMAPLFB_DEVINFO *psDevInfo = OMAPLFBGetDevInfoPtr(i); if (psDevInfo != NULL) { OMAPLFBUnblankDisplay(psDevInfo); OMAPLFBAtomicBoolSet(&psDevInfo->sEarlySuspendFlag, OMAPLFB_FALSE); } } }
OMAPLFB_ERROR OMAPLFBDeInit(void) { unsigned uiMaxFBDevIDPlusOne = OMAPLFBMaxFBDevIDPlusOne(); unsigned i; OMAPLFB_BOOL bError = OMAPLFB_FALSE; for(i = 0; i < uiMaxFBDevIDPlusOne; i++) { OMAPLFB_DEVINFO *psDevInfo = OMAPLFBGetDevInfoPtr(i); if (psDevInfo != NULL) { bError |= !OMAPLFBDeInitDev(psDevInfo); } } return (bError) ? OMAPLFB_ERROR_INIT_FAILURE : OMAPLFB_OK; }
static OMAPLFB_DEVINFO *OMAPLFBPVRDevIDToDevInfo(unsigned uiPVRDevID) { unsigned uiMaxFBDevIDPlusOne = OMAPLFBMaxFBDevIDPlusOne(); unsigned i; for (i=0; i < uiMaxFBDevIDPlusOne; i++) { OMAPLFB_DEVINFO *psDevInfo = OMAPLFBGetDevInfoPtr(i); if (psDevInfo->uiPVRDevID == uiPVRDevID) { return psDevInfo; } } printk(KERN_ERR DRIVER_PREFIX ": %s: PVR Device %u: Couldn't find device\n", __FUNCTION__, uiPVRDevID); return NULL; }
static PVRSRV_ERROR OpenDCDevice(IMG_UINT32 uiPVRDevID, IMG_HANDLE *phDevice, PVRSRV_SYNC_DATA* psSystemBufferSyncData) { OMAPLFB_DEVINFO *psDevInfo; OMAPLFB_ERROR eError; unsigned uiMaxFBDevIDPlusOne = OMAPLFBMaxFBDevIDPlusOne(); unsigned i; for (i = 0; i < uiMaxFBDevIDPlusOne; i++) { psDevInfo = OMAPLFBGetDevInfoPtr(i); if (psDevInfo != NULL && psDevInfo->uiPVRDevID == uiPVRDevID) { break; } } if (i == uiMaxFBDevIDPlusOne) { DEBUG_PRINTK((KERN_WARNING DRIVER_PREFIX ": %s: PVR Device %u not found\n", __FUNCTION__, uiPVRDevID)); return PVRSRV_ERROR_INVALID_DEVICE; } psDevInfo->sSystemBuffer.psSyncData = psSystemBufferSyncData; eError = OMAPLFBUnblankDisplay(psDevInfo); if (eError != OMAPLFB_OK) { DEBUG_PRINTK((KERN_WARNING DRIVER_PREFIX ": %s: Device %u: OMAPLFBUnblankDisplay failed (%d)\n", __FUNCTION__, psDevInfo->uiFBDevID, eError)); return PVRSRV_ERROR_UNBLANK_DISPLAY_FAILED; } *phDevice = (IMG_HANDLE)psDevInfo; return PVRSRV_OK; }