/* config camif when master-open camera.*/ static void init_camif_config(struct s3c2440camif_fh * fh) { struct s3c2440camif_dev * pdev; pdev = fh->dev; pdev->input = 0; // FIXME, the default input image format, see inputs[] for detail. /* the source image size (input from external camera). */ pdev->srcHsize = 1280; // FIXME, the OV9650's horizontal output pixels. pdev->srcVsize = 1024; // FIXME, the OV9650's verical output pixels. /* the windowed image size. */ pdev->wndHsize = 1280; pdev->wndVsize = 1024; /* codec-path target(output) image size. */ pdev->coTargetHsize = pdev->wndHsize; pdev->coTargetVsize = pdev->wndVsize; /* preview-path target(preview) image size. */ pdev->preTargetHsize = 640; pdev->preTargetVsize = 512; update_camif_config(fh, CAMIF_CMD_STOP); }
/* * camif_open() */ static int camif_open(struct inode *inode, struct file *file) { struct s3c2440camif_dev *pdev; struct s3c2440camif_fh *fh; int ret; if (!has_ov9650) { return -ENODEV; } pdev = &camera; fh = kzalloc(sizeof(*fh),GFP_KERNEL); // alloc memory for filehandle if (NULL == fh) { return -ENOMEM; } fh->dev = pdev; pdev->state = CAMIF_STATE_READY; init_camif_config(fh); ret = init_image_buffer(); // init image buffer. if (ret < 0) { goto error1; } request_irq(IRQ_S3C2440_CAM_C, on_camif_irq_c, IRQF_DISABLED, "CAM_C", pdev); // setup ISRs if (ret < 0) { goto error2; } request_irq(IRQ_S3C2440_CAM_P, on_camif_irq_p, IRQF_DISABLED, "CAM_P", pdev); if (ret < 0) { goto error3; } clk_enable(pdev->clk); // and enable camif clock. soft_reset_camif(); file->private_data = fh; fh->dev = pdev; update_camif_config(fh, 0); return 0; error3: free_irq(IRQ_S3C2440_CAM_C, pdev); error2: free_image_buffer(); error1: kfree(fh); return ret; }
/* config camif when master-open camera.*/ static void init_camif_config(s3c2440camif_dev * pdev) { update_camif_config(pdev, CAMIF_CMD_STOP); }