camera: sensor cleanup
PATCH 1/1 camera: sensor cleanup
Jian/Tony,
Attached patch for
o sensor powerup/down cleanup
o camera build infrastructure
o kmalloc -> kzalloc
looks good?
Someone need to test this patch on H3. I have just tried building the kernel for h3 and h2. I don't have access to H3. Sanjiv?
---Komal Shah
http://komalshah.blogspot.com/
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
drivers/media/video/Kconfig +1 -4
@@ -347,9 +347,6 @@ config VIDEO_DECODER Say Y here to compile drivers for SAA7115, SAA7127 and CX25840 video decoders. -config VIDEO_OMAP_CAMERA - tristate "OMAP Video for Linux camera driver" - depends on VIDEO_DEV && ARCH_OMAP16XX - select VIDEO_BUF +source drivers/media/video/omap/Kconfig endmenu
drivers/media/video/omap/Makefile +9 -3
@@ -1,7 +1,13 @@ -# Makefile for camera driver for H2/H3 +# Makefile for OMAP1/2 camera driver -omapCamera-objs := camera_core.o omap16xxcam.o sensor_ov9640.o +obj-$(CONFIG_VIDEO_OMAP_CAMERA) += omapcamera.o +obj-$(CONFIG_VIDEO_CAMERA_SENSOR_OV9640) += sensor_ov9640.o -obj-y += omapCamera.o +objs-yy := camera_core.o + +objs-y$(CONFIG_ARCH_OMAP16XX) += omap16xxcam.o +objs-y$(CONFIG_MACH_OMAP_H3) += h3_sensor_power.o + +omapcamera-objs := $(objs-yy) EXTRA_CFLAGS = -I$(src)/..
drivers/media/video/omap/camera_core.c +1 -2
@@ -1032,12 +1032,11 @@ camera_core_init(void)struct camera_device *cam;struct video_device *vfd; - cam =kmalloc (sizeof (struct camera_device ),GFP_KERNEL ); + cam =kzalloc (sizeof (struct camera_device ),GFP_KERNEL );if (!cam) { printk(KERN_ERR CAM_NAME ": could not allocate memory\n"); goto init_error; } -memset (cam,0 ,sizeof (struct camera_device ));/* Save the pointer to camera device in a global variable */ camera_dev = cam;
drivers/media/video/omap/h3_sensor_power.c new file +63 -0
63 lines not on this page · raw message
drivers/media/video/omap/h3sensorpower.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* drivers/media/video/omap/h3sensorpower.h +* +* Copyright (C) 2005 Texas Instruments. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ + +#ifndef H3SENSORPOWER_H +#define H3SENSORPOWER_H + +int h3_sensor_powerup (void ); +int h3_sensor_powerdown (void ); + +#endif /*H3SENSORPOWER_H*/
drivers/media/video/omap/sensor_ov9640.c +10 -21
@@ -20,10 +20,10 @@#include <media/video-buf.h> #include <linux/delay.h> #include <asm/mach-types.h> -#include <asm/arch/gpioexpander.h> #include "sensor_if.h" #include "ov9640.h" +#include "h3sensorpower.h" #define CAMERA_OV9640 #ifdef CAMERA_OV9640
@@ -669,21 +669,15 @@ ov9640_configure(struct i2c_client *cliestatic int ov9640_powerup (void ) { -unsigned char expa;int err;if (machine_is_omap_h2 ())return 0 ; -/* read the current state of GPIO EXPA output */ -if (( err =read_gpio_expa (&expa,0x27 ))){ -printk (KERN_ERR "Error reading GPIO EXPA \n" ); -return err; - } -/* set GPIO EXPA P7 CAMERA_MOD_EN to power-up sensor */ -if ((err =write_gpio_expa (expa |0x80 ,0x27 ))) { -printk (KERN_ERR "Error writing to GPIO EXPA \n" ); -return err; +if (machine_is_omap_h3 ()) { + err =h3_sensor_powerup (); +if (err) +return err; }return 0 ;
@@ -691,22 +685,17 @@ ov9640_powerup(void)static int ov9640_powerdown (void ) { -unsigned char expa;int err;if (machine_is_omap_h2 ())return 0 ; -/* read the current state of GPIO EXPA output */ -if (( err =read_gpio_expa (&expa,0x27 ))){ -printk (KERN_ERR "Error reading GPIO EXPA \n" ); -return err; - } -/* clear GPIO EXPA P7 CAMERA_MOD_EN to power-up sensor */ -if ((err =write_gpio_expa (expa & ~0x80 ,0x27 ))) { -printk (KERN_ERR "Error writing to GPIO EXPA \n" ); -return err; +if (machine_is_omap_h3 ()) { + err =h3_sensor_powerdown (); +if (err) +return err; } +return 0 ; }
_______________________________________________
Linux-omap-open-source mailing list
[email protected]
http://linux.omap.com/mailman/listinfo/linux-omap-open-source