static __init int cam_driver_init(void) { int ret_val; cam_data *cam; printk(KERN_INFO "Driver Module info : "MODULE_NAME "\n"); printk(KERN_INFO "Version info : "VERSION_NO "\n"); cam = kmalloc(sizeof(cam_data), GFP_KERNEL); if (!cam) { printk(KERN_ERR "Mem alloc fail for camera device\n"); return -ENOMEM; } memset(cam, 0, sizeof(cam_data)); ret_val = v4l2_base_struct(&cam, SET_ADDRESS); if(CHECK_IN_FAIL_LIMIT(ret_val)) { printk(KERN_ERR "Failed to register the camera device\n"); TRACE_ERR_AND_RET(FAIL); } if (init_phy_mem()) return -1; cam->omap3isp_driver.probe = isp_probe; cam->omap3isp_driver.remove = isp_remove; cam->omap3isp_driver.driver.name = "omap3isp"; if (platform_driver_register(&cam->omap3isp_driver)) { printk(KERN_ALERT "platform_driver_register failed\n"); return -1; } if (isp_probe_late_init(cam)) { platform_driver_unregister(&cam->omap3isp_driver); v4l2_base_struct(&cam, MAKE_ADDRESS_INVALID); return -1; } return 0; }
static __init INT32 cam_driver_init(INT0) { #if (CONFIG_USE_TI_RESIZER == DISABLE) INT32 plat_ret; #endif FNRESLT ret_val; cam_data *cam = NULL; /* * Print the Tracking information of application */ printk(KERN_INFO "-------------------------------------------------\n"); printk(KERN_INFO "PRODUCT_NAME : %s\n", PRODUCT_NAME); printk(KERN_INFO "SVN_REVISION : %s\n", SVN_REVISION); printk(KERN_INFO "SVN_DATE : %s\n", SVN_DATE); printk(KERN_INFO "SVN_TIME : %s\n", SVN_TIME); printk(KERN_INFO "THS_VERSIONID : %s\n", THS_VERSION_ID); printk(KERN_INFO "Driver Module info : "MODULE_NAME"\n"); printk(KERN_INFO "Build Time stamp : "__TIMESTAMP__"\n"); printk(KERN_INFO "-------------------------------------------------\n"); if ((cam = kmalloc(sizeof(cam_data), GFP_KERNEL)) == NULL) { printk(KERN_ERR "Failed to allocate memory to register the camera device\n"); TRACE_ERR_AND_RET(FAIL); } /* * Clear the memory */ memset(cam, 0, sizeof(cam_data)); ret_val = v4l2_base_struct(&cam,SET_ADDRESS); if(CHECK_IN_FAIL_LIMIT(ret_val)) { printk(KERN_ERR "Failed to register the camera device\n"); TRACE_ERR_AND_RET(FAIL); } /* * init the reserved memory for camera */ ret_val = init_phy_mem(); if(CHECK_IN_FAIL_LIMIT(ret_val)) { goto exit; } #if (CONFIG_USE_TI_RESIZER == DISABLE) cam->omap3isp_driver.probe = isp_probe; cam->omap3isp_driver.remove = isp_remove; cam->omap3isp_driver.driver.name = "omap3isp"; plat_ret = platform_driver_register(&cam->omap3isp_driver); if (plat_ret) { TRACE_ERR_AND_RET(plat_ret); } #endif ret_val = isp_probe_late_init(cam); if(CHECK_IN_FAIL_LIMIT(ret_val)) { goto exit; } return SUCCESS; exit: { platform_driver_unregister(&cam->omap3isp_driver); ret_val = v4l2_base_struct(&cam,MAKE_ADDRESS_INVALID); if(CHECK_IN_FAIL_LIMIT(ret_val)) { printk(KERN_ERR "Failed to register the camera device\n"); TRACE_ERR_AND_RET(FAIL); } TRACE_ERR_AND_RET(FAIL); } }