EDMA_Status EDMA_registerResource(int lch) { EDMA_Status status = EDMA_OK; int ioctl_status; __D("registerResource: entered - lch=%d\n", lch); if (EDMA_dmaops_fd < 0) { __D("registerResource: /dev/edma not opened\n"); return (EDMA_ENOINIT); } if ((ioctl_status = ioctl(EDMA_dmaops_fd, EDMA_IOCREGUSER | EDMA_IOCMAGIC, (unsigned long)&lch)) < 0) { __E("EDMA_IOCREGUSER error\n"); status = EDMA_EFAIL; } __D("registerResource: exiting, ioctl EDMA_IOCREGUSER returned %d\n", ioctl_status); return (status); }
EDMA_Status EDMA_freeResource(int lch, int nParams) { EDMA_Status status = EDMA_OK; struct EDMA_releaseDmaParams request; int ioctl_status; __D("freeResource: entered - lch=%d, nParams=%d\n", lch, nParams); if (EDMA_dmaops_fd < 0) { __D("freeResource: /dev/edma not opened\n"); return (EDMA_ENOINIT); } request.channel = lch; request.nParam = nParams; if ((ioctl_status = ioctl(EDMA_dmaops_fd, EDMA_IOCRELEASEDMA | EDMA_IOCMAGIC, (unsigned long)&request)) < 0) { __E("EDMA_IOCRELEASEDMA error\n"); status = EDMA_EFAIL; } __D("freeResource: exiting, ioctl EDMA_IOCRELEASEDMA returned %d\n", ioctl_status); return (status); }
/** * @brief Test memory manager * @param none * @return none */ void TestMemMng(void) { VIDEO_BLK_INFO *pVidInfo; MEM_MNG_INFO MemInfo; int tblnum = sizeof(testTbl)/sizeof(testTbl[0]); int cnt = 0; MemMng_Init( &MemInfo ); pVidInfo = &MemInfo.video_info[0]; for( cnt = 0; cnt < tblnum; cnt++ ) { __D("cnt %d start\n",cnt); MemMng_Video_Write( TestData, testTbl[cnt].size, testTbl[cnt].video_flag, pVidInfo); __D("cnt %d end\n",cnt); } __D("MemMng_release \n"); MemMng_release( &MemInfo ); }
int EDMA_getVersion(void) { unsigned int version; int rv; __D("getVersion: entered\n"); if (EDMA_dmaops_fd < 0) { __D("getVersion: /dev/edma not opened\n"); return (EDMA_ENOINIT); } rv = ioctl(EDMA_dmaops_fd, EDMA_IOCGETVERSION | EDMA_IOCMAGIC, &version); if (rv != 0) { __E("getVersion: Failed to retrieve version from driver: %d.\n", rv); return -1; } __D("getVersion: exiting, ioctl EDMA_IOCGETVERSION returned %#x\n", version); return version; }
static int aud_proc_write(struct file* file, const char* buffer, unsigned long count, void* data) { #define MAX_BUFLEN 16 u8 reg; u16 val = MAX_BUFLEN - 1; char *ptr, tmp_buf[MAX_BUFLEN]; struct snd_soc_codec* codec = smdk6400_snd_devdata.codec; __D("\n"); if (!codec || !codec->write) return count; if (count < MAX_BUFLEN) val = count - 1; tmp_buf[val] = 0; if (copy_from_user(tmp_buf, buffer, val)) return -EFAULT; for (ptr = tmp_buf; isspace(*ptr); ++ptr) ; reg = simple_strtoul(ptr, &ptr, 16); if (!(reg < codec->reg_cache_size)) { __D("wrong register no %d, max %d\n", reg, codec->reg_cache_size); return count; } while (isspace(*ptr)) ++ptr; val = simple_strtoul(ptr, &ptr, 16); if (codec->write(codec, reg, val)) ; return count; }
int EDMA_exit() { EDMA_refCount--; if (0 >= EDMA_refCount) { __D("exit: reference count 0\n"); if (-1 != EDMA_dmaops_fd) { __D("exit: closing /dev/edma\n"); close(EDMA_dmaops_fd); } EDMA_dmaops_fd = -1; if (-1 != EDMA_memfd) { __D("exit: closing /dev/mem\n"); close(EDMA_memfd); } EDMA_memfd = -1; //UNMAP EDMA_baseAdddress here } return 0; }
void __exit gpio_exit(void) { __D("In gpio_exit()\n"); /* Remove the /proc entry */ remove_proc_entry("gpio", NULL); #if (USE_UDEV==1) #ifdef USE_CLASS_SIMPLE class_simple_device_remove(MKDEV(gpio_major, 0)); class_simple_destroy(gpio_class); #else #ifdef USE_CLASS_DEVICE class_device_destroy(gpio_class, MKDEV(gpio_major, 0)); #else device_destroy(gpio_class, MKDEV(gpio_major, 0)); #endif // USE_CLASS_DEVICE class_destroy(gpio_class); #endif // USE_CLASS_SIMPLE #endif // USE_UDEV __D("Unregistering character device mem\n"); unregister_chrdev(gpio_major, "gpio"); printk(KERN_INFO "gpio unregistered\n"); }
static int getBlock(int blockid, unsigned long *pphys_base, size_t *psize) { union CMEM_AllocUnion block; int rv; __D("getBlock: entered\n"); if (!validate_init()) { return -1; } block.blockid = blockid; rv = ioctl(cmem_fd, CMEM_IOCGETBLOCK | CMEM_IOCMAGIC, &block); if (rv != 0) { __E("getBlock: Failed to retrieve memory block bounds for block %d " "from driver: %d.\n", blockid, rv); return -1; } *pphys_base = block.get_block_outparams.physp; *psize = block.get_block_outparams.size; __D("getBlock: exiting, ioctl CMEM_IOCGETBLOCK succeeded, " "returning *pphys_base=0x%lx, *psize=0x%x\n", *pphys_base, *psize); return 0; }
int CMEM_exit(void) { int result = 0; __D("exit: entered - ref_count %d, cmem_fd %d\n", ref_count, cmem_fd); if (!validate_init()) { return -1; } __D("exit: decrementing ref_count\n"); ref_count--; if (ref_count == 0) { result = close(cmem_fd); __D("exit: ref_count == 0, closed /dev/cmem (%s)\n", result == -1 ? strerror(errno) : "succeeded"); /* setting -3 allows to distinguish CMEM exit from CMEM failed */ cmem_fd = -3; } __D("exit: exiting, returning %d\n", result); return result; }
static int __init ipera_init(void) { int ret; __D("** " __FILE__ " kernel module built: " __DATE__ " " __TIME__ "\n"); ret = register_chrdev(major, K_DEV, &ipera_fops); if (ret < 0) { __E("Failed to allocate major number.\n"); return -ENODEV; } __D("Allocated major number: %d\n", major); #ifdef USE_UDEV ipera_class = class_create(THIS_MODULE, K_DEV); if (IS_ERR(ipera_class)) { __E("Error creating ipera device class.\n"); return -EIO; } //class_device_create(ipera_class, NULL, MKDEV(major, 0), NULL, K_DEV); #endif // USE_UDEV __D("Successfully initialized module\n"); return 0; }
int s3c_camif_set_clock (unsigned int camclk) { unsigned int camclk_div; //, val, hclkcon; struct clk *src_clk = clk_get(NULL, "hclkx2"); __D("External camera clock is set to %dHz\n", camclk); camclk_div = clk_get_rate(src_clk) / camclk; __D("Parent clk = %ld, CAMDIV = %d\n", clk_get_rate(src_clk), camclk_div); // CAMIF HCLK Enable syscon->HCLK_GATE.HCLK_CAMIF = 1; /* CAMCLK Enable */ syscon->SCLK_GATE.SCLK_CAM = 1; syscon->CLK_DIV0.CAM_RATIO = 0; if(camclk_div > 16) { __D("Can't set to %dHZ, set to %dHZ instead!!!\n", (int)camclk, (int)clk_get_rate(src_clk)/16); camclk_div = 16; } /* CAM CLK DIVider Ratio = (EPLL clk)/(camclk_div) */ syscon->CLK_DIV0.CAM_RATIO = camclk_div - 1; return 0; }
int CMEM_init(void) { int flags; unsigned int version; __D("init: entered - ref_count %d, cmem_fd %d\n", ref_count, cmem_fd); if (cmem_fd >= 0) { ref_count++; __D("init: /dev/cmem already opened, incremented ref_count %d\n", ref_count); return 0; } cmem_fd = open("/dev/cmem", O_RDWR); if (cmem_fd == -1) { __E("init: Failed to open /dev/cmem: '%s'\n", strerror(errno)); return -1; } ref_count++; __D("init: successfully opened /dev/cmem, matching driver version...\n"); version = CMEM_getVersion(); if ((version & 0xffff0000) != (CMEM_VERSION & 0xffff0000)) { __E("init: major version mismatch between interface and driver.\n"); __E(" needs driver version %#x, got %#x\n", CMEM_VERSION, version); CMEM_exit(); return -1; } else if ((version & 0x0000ffff) < (CMEM_VERSION & 0x0000ffff)) { __E("init: minor version mismatch between interface and driver.\n"); __E(" needs driver minor version %#x or greater.\n" " got minor version %#x (full version %#x)\n", CMEM_VERSION & 0x0000ffff, version & 0x0000ffff, version); CMEM_exit(); return -1; } __D("init: ... match good (%#x)\n", version); flags = fcntl(cmem_fd, F_GETFD); if (flags != -1) { fcntl(cmem_fd, F_SETFD, flags | FD_CLOEXEC); } else { __E("init: fcntl(F_GETFD) failed: '%s'\n", strerror(errno)); } __D("init: exiting, returning success\n"); return 0; }
static void __exit ipera_exit(void) { __D("...\n"); #ifdef USE_UDEV //class_device_destroy(ipera_class, MKDEV(major, 0)); class_destroy(ipera_class); #endif // USE_UDEV __D("Unregistering character device ipera\n"); unregister_chrdev(major, K_DEV); __D("ipera unregistered\n"); }
static int release(struct inode *inode, struct file *filp) { struct list_head *u; struct list_head *unext; struct list_head *registeredlistp; struct registered_user *user; int found_user; int i; __D("close: called.\n"); for (i = 0; i < NCHAN; i++) { found_user = 0; if (mutex_lock_interruptible(&edma_mutex)) { return -ERESTARTSYS; } registeredlistp = &channels[i].users; u = registeredlistp->next; while (u != registeredlistp) { unext = u->next; user = list_entry(u, struct registered_user, element); if (user->filp == filp) { __D(" removing registered user from channel %d list\n", i); found_user = 1; list_del(u); kfree(user); } u = unext; } if (found_user) { if (registeredlistp->next == registeredlistp) { __D(" no more registered users, freeing channel %d\n", i); release_channel(i); } } mutex_unlock(&edma_mutex); } __D("close: returning\n"); return 0; }
/** * @brief Get video frame by serial * @param "int serial" : serial no. * @param "VIDEO_BLK_INFO *pVidInfo" * @return frame address ; NULL */ VIDEO_FRAME * MemMng_GetFrameBySerial( int serial , VIDEO_BLK_INFO *pVidInfo) { if( serial < 0 || pVidInfo == NULL || serial > pVidInfo->cur_serial) { //__E("MemMng_GetFrameBySerial: Fail \n"); return NULL; } int cnt = 0; if( serial == pVidInfo->frame[pVidInfo->cur_frame].serial ) { return &(pVidInfo->frame[pVidInfo->cur_frame]); } for( cnt = 0; cnt < pVidInfo->frame_num ; cnt++ ) { if( serial == pVidInfo->frame[cnt].serial ) { if( pVidInfo->frame[cnt].fram_type == DUMMY_FRAME || pVidInfo->frame[cnt].fram_type == EMPTY_FRAME ) { //__E("MemMng_GetFrameBySerial: invalidate frame_type\n"); //return NULL; continue; } return &(pVidInfo->frame[cnt]); } } __D("MemMng_GetFrameBySerial: Search no frame\n"); return NULL; }
/** * @brief Memory manager initialization * @param "MEM_MNG_INFO *pInfo" * @return 0 : success ; -1 : fail */ int MemMng_Init( MEM_MNG_INFO *pInfo ) { int mem_layout = pInfo->mem_layout; memset( pInfo, 0 , sizeof(MEM_MNG_INFO) ); pInfo->totalsize = MemMng_Mem_layout(mem_layout); pInfo->start_addr = (unsigned long)STREAM_CMEM_ALLOC(pInfo->totalsize, 32); if( pInfo->start_addr == 0 ) goto MEM_INIT_FAIL; pInfo->start_phyAddr = CMEM_getPhys((void *)pInfo->start_addr); if(pInfo->start_phyAddr == 0) fprintf(stderr, "Failed to get physical address of %#x\n", (unsigned int) pInfo->start_phyAddr); pInfo->freesize = pInfo->totalsize; pInfo->offset = 0; pInfo->video_info_nums = 0; if(Video_Mem_Malloc( pInfo )==0) __D(" MEM_INIT Success \n"); else return -1; MemMng_memcpy_open(); return 0; MEM_INIT_FAIL: __E(" MEM_INIT_FAIL \n"); return -1; }
static int smdk6400_hifi_hw_free(struct snd_pcm_substream *substream) { __D("\n"); /* disable the PLL */ return 0; }
static int release(struct inode *inode, struct file *filp) { int last_close = 0; __D("close: called.\n"); /* Force free all buffers owned by the 'current' process */ if (atomic_dec_and_test(&reference_count)) { __D("close: all references closed, force freeing all busy buffers.\n"); last_close = 1; } __D("close: returning\n"); return 0; }
static int smdk6400_get_scenario(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { __D("\n"); ucontrol->value.integer.value[0] = smdk6400_scenario; return 0; }
/** * @brief show current time * @param none * @retval none */ void ShowCurTime(void) { #ifdef _SCHED_DEBUG char *wday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; #endif time_t timep; struct tm *p; time(&timep); p = localtime(&timep); __D("current time is \n"); __D("year:%d month:%d day:%d \n", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday); __D("%s wdays:%d hour:%d min:%d sec:%d\n", wday[p->tm_wday], p->tm_wday, p->tm_hour, p->tm_min, p->tm_sec); }
static void *allocFromHeap(int blockid, size_t size, CMEM_AllocParams *params) { void *userp; union CMEM_AllocUnion allocDesc; unsigned long physp; unsigned int cmd; int rv; cmd = CMEM_IOCALLOCHEAP | params->flags; allocDesc.alloc_heap_inparams.size = size; allocDesc.alloc_heap_inparams.align = params->alignment == 0 ? 1 : params->alignment; allocDesc.alloc_heap_inparams.blockid = blockid; rv = ioctl(cmem_fd, cmd | CMEM_IOCMAGIC, &allocDesc); if (rv != 0) { __E("allocHeap: ioctl %s failed: %d\n", cmd == CMEM_IOCALLOCHEAP ? "CMEM_IOCALLOCHEAP" : "CMEM_IOCALLOCHEAPCACHED", rv); return NULL; } physp = allocDesc.physp; __D("allocHeap: allocated phys buffer %#lx\n", physp); /* Map the physical address to user space */ userp = mmap(0, // Preferred start address size, // Length to be mapped PROT_WRITE | PROT_READ, // Read and write access MAP_SHARED, // Shared memory cmem_fd, // File descriptor physp); // The byte offset from fd if (userp == MAP_FAILED) { __E("allocHeap: Failed to mmap buffer at physical address %#lx\n", physp); __E(" Freeing phys buffer %#lx\n", physp); ioctl(cmem_fd, CMEM_IOCFREEHEAPPHYS | CMEM_IOCMAGIC, &physp); return NULL; } __D("allocHeap: mmap succeeded, returning virt buffer %p\n", userp); return userp; }
static int open(struct inode *inode, struct file *filp) { __D("open: called.\n"); atomic_inc(&reference_count); return 0; }
/* RGB Buffer Allocation into frame buffer */ static int camif_pp_preview_msdma(camif_cfg_t *cfg) { int i; u32 cbcr_size = 0; /* Cb+Cr size */ u32 val; //one_p_size, val; u32 area = cfg->cis->source_x * cfg->cis->source_y; __D("\n"); val = readl(S3C_VIDW01ADD0B0); if(!((cfg->dst_fmt & CAMIF_RGB16) || (cfg->dst_fmt & CAMIF_RGB24))) __E("Invalid Format\n"); for ( i = 0; i < 4 ; i++ ) { base->CIPRYSA[i] = val; } if (cfg->src_fmt & CAMIF_YCBCR420) { cbcr_size = area/4; cfg->img_buf[0].virt_cb = cfg->pp_virt_buf + area; cfg->img_buf[0].phys_cb = cfg->pp_phys_buf + area; cfg->img_buf[0].virt_cr = cfg->pp_virt_buf + area + cbcr_size; cfg->img_buf[0].phys_cr = cfg->pp_phys_buf + area + cbcr_size; } else if(cfg->src_fmt & CAMIF_YCBCR422){ area = area * 2; cfg->img_buf[0].virt_cb = 0; cfg->img_buf[0].phys_cb = 0; cfg->img_buf[0].virt_cr = 0; cfg->img_buf[0].phys_cr = 0; } cfg->img_buf[0].virt_y = cfg->pp_virt_buf; cfg->img_buf[0].phys_y = cfg->pp_phys_buf; base->MSPRY0SA = cfg->img_buf[0].phys_y; base->MSPRY0END = cfg->img_buf[0].phys_y+area; base->MSPRCB0SA = cfg->img_buf[0].phys_cb; base->MSPRCB0END = cfg->img_buf[0].phys_cb+cbcr_size; base->MSPRCR0SA = cfg->img_buf[0].phys_cr; base->MSPRCR0END = cfg->img_buf[0].phys_cr+cbcr_size; #ifdef SW_IPC base->MSCOWIDTH.AutoLoadEnable = 0; // AutoLoadDisable #else base->MSCOWIDTH.AutoLoadEnable = 1; // AutoLoadEnable #endif base->MSPRWIDTH.MSPRHEIGHT = cfg->cis->source_y; base->MSPRWIDTH.MSPRHEIGHT = cfg->cis->source_x; return 0; }
void camif_change_flip(camif_cfg_t *cfg) { __D("\n"); if (cfg->dma_type & CAMIF_CODEC ) { /* Clear FLIP Mode */ base->CICOTRGFMT.FlipMd_Co = 0; base->CICOTRGFMT.FlipMd_Co = cfg->flip >> 14; } else {
static void *allocFromPool(int blockid, int poolid, CMEM_AllocParams *params) { union CMEM_AllocUnion allocDesc; unsigned long physp; void *userp; size_t size; unsigned int cmd; int rv; allocDesc.alloc_pool_inparams.poolid = poolid; allocDesc.alloc_pool_inparams.blockid = blockid; cmd = CMEM_IOCALLOC | params->flags; rv = ioctl(cmem_fd, cmd | CMEM_IOCMAGIC, &allocDesc); if (rv != 0) { __E("allocPool: ioctl %s failed from pool %d: %d\n", cmd == CMEM_IOCALLOC ? "CMEM_IOCALLOC" : "CMEM_IOCALLOCCACHED", poolid, rv); return NULL; } physp = allocDesc.alloc_pool_outparams.physp; size = allocDesc.alloc_pool_outparams.size; __D("allocPool: allocated phys buffer %#lx, size %#x\n", physp, size); /* Map the physical address to user space */ userp = mmap(0, // Preferred start address size, // Length to be mapped PROT_WRITE | PROT_READ, // Read and write access MAP_SHARED, // Shared memory cmem_fd, // File descriptor physp); // The byte offset from fd if (userp == MAP_FAILED) { __E("allocPool: Failed to mmap buffer at physical address %#lx\n", physp); __E(" Freeing phys buffer %#lx\n", physp); ioctl(cmem_fd, CMEM_IOCFREEPHYS | CMEM_IOCMAGIC , &physp); return NULL; } __D("allocPool: mmap succeeded, returning virt buffer %p\n", userp); return userp; }
EDMA_Status EDMA_mapBaseAddress(void **pvirtAddr) { int status; int *edmaRegs; int numPaRAM; int numBytes; __D("mapBaseAddress: entered\n"); if (EDMA_dmaops_fd < 0) { __D("mapBaseAddress: /dev/edma not opened\n"); return (EDMA_ENOINIT); } if (EDMA_basePhysAddr == 0) { __D("mapBaseAddress: retrieving base address from EDMA driver ...\n"); if ((status = ioctl(EDMA_dmaops_fd, EDMA_IOCGETBASEPHYSADDR | EDMA_IOCMAGIC, &EDMA_basePhysAddr)) != 0) { __D("mapbaseAddress: ... failed (%d), returning -1\n", status); return -1; } __D("mapbaseAddress: ... got it (%#x)\n", EDMA_basePhysAddr); } else { __D("mapBaseAddress: using stored base address (%#x)\n", EDMA_basePhysAddr); } /* just map enough space to access CCCFG register */ edmaRegs = mmap(0, 8, PROT_READ | PROT_WRITE, MAP_SHARED, EDMA_memfd, (off_t)EDMA_basePhysAddr); numPaRAM = NUMPAENTRY(edmaRegs[CCCFG]); /* toss the mapping */ munmap(edmaRegs, 8); numBytes = 0x4000 + (numPaRAM * 8 * 4); __D("mapping 0x%x bytes to user virtual address ...\n", numBytes); *pvirtAddr = mmap(0, numBytes, PROT_READ | PROT_WRITE, MAP_SHARED, EDMA_memfd, (off_t)EDMA_basePhysAddr); __D("mapbaseAddress: ... got it (%p)\n", *pvirtAddr); return EDMA_OK; }
static int mmap(struct file *filp, struct vm_area_struct *vma) { unsigned long physp; __D("mmap: vma->vm_start = %#lx\n", vma->vm_start); __D("mmap: vma->vm_pgoff = %#lx\n", vma->vm_pgoff); __D("mmap: vma->vm_end = %#lx\n", vma->vm_end); __D("mmap: size = %#lx\n", vma->vm_end - vma->vm_start); physp = vma->vm_pgoff << PAGE_SHIFT; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); vma->vm_flags |= VM_RESERVED | VM_IO; if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { __E("set_noncached: failed remap_pfn_range\n"); return -EAGAIN; } return 0; }
/* RGB Buffer Allocation */ static int camif_pp_preview(camif_cfg_t *cfg) { int i; u32 cbcr_size = 0; /* Cb,Cr size */ u32 area = cfg->target_x * cfg->target_y; __D("\n"); if(cfg->input_channel) { camif_pp_preview_msdma(cfg); return 0; } if (cfg->dst_fmt & CAMIF_YCBCR420) { cbcr_size = area /4; /* To Do */ } else if(cfg->dst_fmt & CAMIF_YCBCR422){ cbcr_size = area /2; /* To Do */ } else if(cfg->dst_fmt & CAMIF_RGB24) { area = area * 4 ; } else if (cfg->dst_fmt & CAMIF_RGB16) { area = area * 2; } else { __E("Invalid format No - %d \n", cfg->dst_fmt); } switch ( cfg->pp_num ) { case 1: for ( i = 0; i < 4 ; i++ ) { cfg->img_buf[i].virt_rgb = cfg->pp_virt_buf ; cfg->img_buf[i].phys_rgb = cfg->pp_phys_buf ; base->CIPRYSA[i] = cfg->img_buf[i].phys_rgb; } break; case 2: for ( i = 0; i < 4 ; i++) { cfg->img_buf[i].virt_rgb = cfg->pp_virt_buf + TRY * area; cfg->img_buf[i].phys_rgb = cfg->pp_phys_buf + TRY * area; base->CIPRYSA[i] = cfg->img_buf[i].phys_rgb; } break; case 4: for ( i = 0; i < 4 ; i++) { cfg->img_buf[i].virt_rgb = cfg->pp_virt_buf + i * area; cfg->img_buf[i].phys_rgb = cfg->pp_phys_buf + i * area; base->CIPRYSA[i] = cfg->img_buf[i].phys_rgb; } break; default: __E("Invalid PingPong Number %d \n", cfg->pp_num); } return 0; }
int __init gbshm_init(void) { int err = 0; /* cut-and-paste above as part of adding support for more than 2 blocks */ gbshm_major = register_chrdev(0, "vidctl", &gbshm_fxns); if (gbshm_major < 0) { __E("Failed to allocate major number.\n"); return -ENODEV; } __D("Allocated major number: %d\n", gbshm_major); #if (USE_UDEV==1) #ifdef USE_CLASS_SIMPLE gbshm_class = class_simple_create(THIS_MODULE, "gbshm"); #else gbshm_class = class_create(THIS_MODULE, "gbshm"); #endif if (IS_ERR(gbshm_class)) { __E("Error creating cmem device class.\n"); err = -EIO; return err; } #ifdef USE_CLASS_SIMPLE class_simple_device_add(gbshm_class, MKDEV(gbshm_major, 0), NULL, "gbshm"); #else #ifdef USE_CLASS_DEVICE class_device_create(gbshm_class, NULL, MKDEV(gbshm_major, 0), NULL, "gbshm"); #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) device_create(gbshm_class, NULL, MKDEV(gbshm_major, 0), NULL, "gbshm"); #else device_create(gbshm_class, NULL, MKDEV(gbshm_major, 0), "gbshm"); #endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) #endif // USE_CLASS_DEVICE #endif // USE_CLASS_SIMPLE #endif // USE_UDEV /* Create the /proc entry */ printk(KERN_INFO "vidctl initialized\n"); //set_reg(); //printk_reg(); //tvp5150_set_input_mux(0); return 0; }
static int camif_setup_memory_output(camif_cfg_t *cfg) { __D("\n"); if (cfg->dma_type & CAMIF_CODEC ) { camif_pp_codec(cfg); } if ( cfg->dma_type & CAMIF_PREVIEW) { camif_pp_preview(cfg); } return 0; }