From: <hap...@us...> - 2007-06-11 22:47:40
|
Revision: 1029 http://svn.sourceforge.net/hackndev/?rev=1029&view=rev Author: happy-slapin Date: 2007-06-11 15:47:38 -0700 (Mon, 11 Jun 2007) Log Message: ----------- PXA27x: adding driver template to support PXA camera. Don't even try to use it - I just started flushing my development, otherwise it seems to be endless. I use vivi.c and Motorola 2.4 code + PXA27x spec to implement this, so consider this mostly refactoring work. Modified Paths: -------------- linux4palm/linux/trunk/drivers/media/video/Kconfig linux4palm/linux/trunk/drivers/media/video/Makefile Added Paths: ----------- linux4palm/linux/trunk/drivers/media/video/pxa_camera.c Modified: linux4palm/linux/trunk/drivers/media/video/Kconfig =================================================================== --- linux4palm/linux/trunk/drivers/media/video/Kconfig 2007-06-09 03:12:45 UTC (rev 1028) +++ linux4palm/linux/trunk/drivers/media/video/Kconfig 2007-06-11 22:47:38 UTC (rev 1029) @@ -763,4 +763,10 @@ endmenu # V4L USB devices +config PXACI + depends on VIDEO_DEV + tristate "Camera Interface for PXA27x" + +endchoice + endmenu Modified: linux4palm/linux/trunk/drivers/media/video/Makefile =================================================================== --- linux4palm/linux/trunk/drivers/media/video/Makefile 2007-06-09 03:12:45 UTC (rev 1028) +++ linux4palm/linux/trunk/drivers/media/video/Makefile 2007-06-11 22:47:38 UTC (rev 1029) @@ -111,5 +111,6 @@ obj-$(CONFIG_USB_QUICKCAM_MESSENGER) += usbvideo/ obj-$(CONFIG_VIDEO_VIVI) += vivi.o +obj-$(CONFIG_PXACI) += pxa_camera.o EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core Added: linux4palm/linux/trunk/drivers/media/video/pxa_camera.c =================================================================== --- linux4palm/linux/trunk/drivers/media/video/pxa_camera.c (rev 0) +++ linux4palm/linux/trunk/drivers/media/video/pxa_camera.c 2007-06-11 22:47:38 UTC (rev 1029) @@ -0,0 +1,190 @@ +/* + * pxa_camera.c + * + * Bulverde Processor Camera Interface driver. + * + * Copyright (C) 2003, Intel Corporation + * Copyright (C) 2003, Montavista Software Inc. + * Copyright (C) 2003-2006 Motorola Inc. + * + * Author: Intel Corporation Inc. + * MontaVista Software, Inc. + * so...@mv... + * Motorola Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * V4L2 conversion (C) 2007 Sergey Lapin + */ +#warning "Not finished yet, don't try to use!!!" +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/ioport.h> +#include <linux/init.h> +#include <linux/sched.h> +#include <linux/pci.h> +#include <linux/random.h> +#include <linux/version.h> +#include <linux/videodev2.h> +#include <linux/dma-mapping.h> + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/version.h> +#include <linux/init.h> +#include <linux/fs.h> +#include <linux/vmalloc.h> +#include <linux/delay.h> +#include <linux/slab.h> +#include <linux/proc_fs.h> +#include <linux/ctype.h> +#include <linux/pagemap.h> +#include <linux/wrapper.h> +#include <linux/videodev2.h> +#include <linux/pci.h> +#include <linux/pm.h> +#include <linux/poll.h> +#include <linux/wait.h> + +#include <linux/types.h> +#include <asm/mach-types.h> +#include <asm/io.h> +#include <asm/semaphore.h> +#include <asm/hardware.h> +#include <asm/dma.h> +#include <asm/arch/irqs.h> +#include <asm/irq.h> + +#include <asm/arch/pxa-regs.h> + +#ifdef CONFIG_VIDEO_V4L1_COMPAT +/* Include V4L1 specific functions. Should be removed soon */ +#include <linux/videodev.h> +#endif + +/*********************************************************************************** +* Application interface * +***********************************************************************************/ + +static int pxa_camera_open(struct inode *inode, struct file *file) +{ + return -EIO; +} + +static int pxa_camera_close(struct inode *inode, struct file *file) +{ + return 0; +} + +static ssize_t pxa_camera_read(struct file *file, char __user *buf, + size_t count, loff_t *ppos) +{ + return 0; +} + +static unsigned int pxa_camera_poll(struct file *file, poll_table *wait) +{ + return 0; +} + +static int pxa_camera_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + return 0; +} + +static int pxa_camera_mmap(struct file *file, struct vm_area_struct *vma) +{ + return -EFAULT; +} + +static ssize_t pxa_camera_write(struct file *file, const char __user *data, + size_t count, loff_t *ppos) +{ + return -EINVAL; +} + +static struct file_operations vd_fops = { + .owner = THIS_MODULE, + .open = pxa_camera_open, + .release = pxa_camera_close, + .read = pxa_camera_read, + .poll = pxa_camera_poll, + .ioctl = pxa_camera_ioctl, + .mmap = pxa_camera_mmap, + .llseek = no_llseek, + .write = pxa_camera_write, +}; + +static struct video_device vd = { + .owner = THIS_MODULE, + .name = "PXA camera", + .type = VID_TYPE_CAPTURE, +/* + .hardware = VID_HARDWARE_PXA_CAMERA, /* FIXME */ +*/ + .hardware = 0; + .fops = &vd_fops, + .minor = -1, +}; + + +static irqreturn_t pxa_camera_irq(int irq, void *dev_id, struct pt_regs *regs) +{ + unsigned int cisr; + + disable_irq(IRQ_CAMERA); + cisr = CISR; + + if (cisr & CI_CISR_SOF) + CISR |= CI_CISR_SOF; + + if (cisr & CI_CISR_EOF) + CISR |= CI_CISR_EOF; + + enable_irq(IRQ_CAMERA); + + return IRQ_HANDLED; +} + +static int __init pxa_camera_init(void) +{ + if (request_irq(IRQ_CAMERA, pxa_camera_irq, 0, "PXA Camera", &vd)) { + dbg_print("Camera interrupt register failed failed number \n"); + return -EIO; + } + dbg_print ("Camera interrupt register successful \n"); + + if(video_register_device(&vd, VFL_TYPE_GRABBER, 0) < 0) + { + dbg_print("PXA_CAMERA: video_register_device failed\n"); + return -EIO; + } + + dbg_print("PXA_CAMERA: video_register_device successfully. /dev/video%d \n", 0); + + return 0; +} + +static void __exit pxa_camera_exit(void) +{ + free_irq(IRQ_CAMERA, &vd); + video_unregister_device(&vd); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |