Updated OMAP 2 camera driver and N800 platform camera patches
Subsystems (4)
cover Updated OMAP 2 camera driver and N800 platform camera patches
Hi,
Here are the new OMAP 2 camera driver and N800 platform camera patches. I have posted the updates to V4L int if and TCM825x driver to the V4L list already as they have been integrated into V4L tree at <URL:http://linuxtv.org/hg/v4l-dvb> (excluding the new patches, sorry).
The changes since the last update include the following:
- Update to use vidioc_int_g_ifparm.
- VIDIOC_DQBUF fix.
The driver assumed that every slave would return zero from vidioc_int_g_needs_reset. This doesn't hold true for the slaves that do not implement that ioctl at all.
- Small cleanups, remove useless & characters.
Signature · 2 lines
Sakari Ailus [email protected]
PATCH 1/2 ARM: OMAP2: Camera: Add driver.
Add a driver for the OMAP 2 camera block. OMAP 2 is used in e.g. Nokia N800 internet tablet.
This driver uses the new V4L2 internal ioctl interface.
--- drivers/media/video/Kconfig | 8 + drivers/media/video/Makefile | 1 + drivers/media/video/omap24xxcam-dma.c | 603 +++++++++++ drivers/media/video/omap24xxcam.c | 1847 +++++++++++++++++++++++++++++++++ drivers/media/video/omap24xxcam.h | 584 +++++++++++ 5 files changed, 3043 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/omap24xxcam-dma.c create mode 100644 drivers/media/video/omap24xxcam.c create mode 100644 drivers/media/video/omap24xxcam.h
drivers/media/video/Kconfig +8 -0
@@ -700,6 +700,14 @@ config VIDEO_CAFE_CCIC CMOS camera controller. This is the controller found on first- generation OLPC systems. +config VIDEO_OMAP2 + tristate "OMAP 2 Camera support (EXPERIMENTAL)" + select VIDEO_BUF + depends on VIDEO_V4L2 && ARCH_OMAP24XX + ---help--- + Driver for an OMAP 2 camera controller. + + # # USB Multimedia device configuration #
drivers/media/video/Makefile +1 -0
@@ -99,6 +99,7 @@ obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o +obj-$(CONFIG_VIDEO_OMAP2) += omap24xxcam.o omap24xxcam-dma.o obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o obj-$(CONFIG_USB_DABUSB) += dabusb.o
drivers/media/video/omap24xxcam-dma.c new file +603 -0
603 lines not on this page · raw message
drivers/media/video/omap24xxcam.c new file +1847 -0
1,847 lines not on this page · raw message
drivers/media/video/omap24xxcam.h new file +584 -0
529 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.0.6
Part of the diff is not shown here. View the raw message.
PATCH 2/2 ARM: N800: Add hardware dependent parts for camera / sensor.
This patch allows using OMAP 2 camera and TCM825x drivers on Nokia N800.
--- arch/arm/mach-omap2/Kconfig | 4 + arch/arm/mach-omap2/Makefile | 3 +- arch/arm/mach-omap2/board-n800-camera.c | 329 +++++++++++++++++++++++++++++++ arch/arm/mach-omap2/board-n800.c | 119 ++---------- arch/arm/mach-omap2/devices.c | 32 +++ include/asm-arm/arch-omap/board-nokia.h | 1 + include/asm-arm/arch-omap/board.h | 6 - 7 files changed, 386 insertions(+), 108 deletions(-) create mode 100644 arch/arm/mach-omap2/board-n800-camera.c
arch/arm/mach-omap2/Kconfig +4 -0
@@ -33,6 +33,10 @@ config MACH_OMAP_GENERIC config MACH_NOKIA_N800 bool "Nokia N800" depends on ARCH_OMAP24XX + select VIDEO_TCM825X if VIDEO_OMAP2 + select CBUS if VIDEO_TCM825X + select CBUS_RETU if VIDEO_TCM825X + select MENELAUS if VIDEO_TCM825X config MACH_OMAP2_TUSB6010 bool
arch/arm/mach-omap2/Makefile +2 -1
@@ -29,7 +29,8 @@ obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o \ obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o board-n800-flash.o \ board-n800-mmc.o board-n800-bt.o \ board-n800-audio.o board-n800-usb.o \ - board-n800-dsp.o + board-n800-dsp.o \ + board-n800-camera.o # TUSB 6010 chips obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
arch/arm/mach-omap2/board-n800-camera.c new file +329 -0
329 lines not on this page · raw message
arch/arm/mach-omap2/board-n800.c +18 -101
153 lines not on this page · raw message
arch/arm/mach-omap2/devices.c +32 -0
@@ -25,6 +25,37 @@#include <asm/arch/gpio.h> #include <asm/arch/eac.h> +#if defined(CONFIG_VIDEO_OMAP2 ) || defined(CONFIG_VIDEO_OMAP2_MODULE ) + +static struct resource cam_resources[] = { + { + .start =OMAP24XX_CAMERA_BASE , + .end =OMAP24XX_CAMERA_BASE +0xfff , + .flags =IORESOURCE_MEM , + }, + { + .start =INT_24XX_CAM_IRQ , + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device omap_cam_device = { + .name ="omap24xxcam" , + .id =-1 , + .num_resources =ARRAY_SIZE (cam_resources), + .resource = cam_resources, +}; + +static inline void omap_init_camera (void ) +{ +platform_device_register (&omap_cam_device); +} +#else +static inline void omap_init_camera (void ) +{ +} +#endif +#if !defined(CONFIG_ARCH_OMAP243X )#if defined(CONFIG_I2C_OMAP ) || defined(CONFIG_I2C_OMAP_MODULE )
@@ -246,6 +277,7 @@ static int __init omap2_init_devices(void)/* please keep these calls, and their implementations above, * in alphabetical order so they're easier to sort through. */ +omap_init_camera ();if (!cpu_is_omap2430 ()) {omap_init_i2c (); }
include/asm-arm/arch-omap/board-nokia.h +1 -0
@@ -19,6 +19,7 @@ extern void n800_flash_init(void);extern void n800_mmc_init (void );extern void n800_pm_init (void );extern void n800_usb_init (void ); +extern void n800_cam_init (void );extern void n800_audio_init (struct tsc2301_platform_data *);extern int n800_audio_enable (struct dsp_kfunc_device *kdev,int stage);extern int n800_audio_disable (struct dsp_kfunc_device *kdev,int stage);
include/asm-arm/arch-omap/board.h +0 -6
@@ -69,12 +69,6 @@ struct omap_sti_console_config {u8 channel; }; -struct omap_camera_sensor_config { -u16 reset_gpio; -int (*power_on)(void * data); -int (*power_off)(void * data); -}; -struct omap_usb_config {/* Configure drivers according to the connectors on your board: * - "A" connector (rectagular)
Signature · 1 line
1.5.0.6
Hi Sakari,
Quoted 11 lines · Sakari Ailus
Hi,
Here are the new OMAP 2 camera driver and N800 platform camera patches. I have posted the updates to V4L int if and TCM825x driver to the V4L list already as they have been integrated into V4L tree at <URL:http://linuxtv.org/hg/v4l-dvb> (excluding the new patches, sorry).
The changes since the last update include the following:
- Update to use
vidioc_int_g_ifparm.
Quoted 7 lines
-
VIDIOC_DQBUFfix.The driver assumed that every slave would return zero from
vidioc_int_g_needs_reset. This doesn't hold true for the slaves that do not implement that ioctl at all.- Small cleanups, remove useless & characters.
Thanx for the update. I will rebase ov9640 code with above v4l2-int changes and test with this updated omap2 camera driver.
Signature · 1 line
--Trilok Soni
Re: [PATCH 1/2] ARM: OMAP2: Camera: Add driver.
In reply to Sakari AilusHi Sakari,
Quoted 48 lines · Sakari Ailus
Add a driver for the OMAP 2 camera block. OMAP 2 is used in e.g. Nokia N800 internet tablet.
This driver uses the new V4L2 internal ioctl interface.
Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/video/Kconfig | 8 + drivers/media/video/Makefile | 1 + drivers/media/video/omap24xxcam-dma.c | 603 +++++++++++ drivers/media/video/omap24xxcam.c | 1847 +++++++++++++++++++++++++++++++++ drivers/media/video/omap24xxcam.h | 584 +++++++++++ 5 files changed, 3043 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/omap24xxcam-dma.c create mode 100644 drivers/media/video/omap24xxcam.c create mode 100644 drivers/media/video/omap24xxcam.hdrivers/media/video/Kconfig +8
-0@@ -700,6 +700,14 @@ config VIDEO_CAFE_CCIC CMOS camera controller. This is the controller found on first- generation OLPC systems. +config VIDEO_OMAP2 + tristate "OMAP 2 Camera support (EXPERIMENTAL)" + select VIDEO_BUF + depends on VIDEO_V4L2 && ARCH_OMAP24XX + ---help--- + Driver for an OMAP 2 camera controller. + + # # USB Multimedia device configuration #drivers/media/video/Makefile +1
-0@@ -99,6 +99,7 @@ obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o +obj-$(CONFIG_VIDEO_OMAP2) += omap24xxcam.o omap24xxcam-dma.o obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o obj-$(CONFIG_USB_DABUSB) += dabusb.o
...
Quoted 51 lines
drivers/media/video/omap24xxcam.c new file +45
-0@@ -0,0 +1,1847 @@ +/* +* drivers/media/video/omap24xxcam.c +* +* OMAP 2 camera block driver. +* +* Copyright (C) 2004 MontaVista Software, Inc. +* Copyright (C) 2004 Texas Instruments. +* Copyright (C) 2007 Nokia Corporation. +* +* Contact: Sakari Ailus <[email protected]> +* +* Based on code from Andy Lowe <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* 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., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ + +#include <linux/delay.h> +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/videodev2.h> +#include <linux/pci.h> /* needed for videobufs */ +#include <linux/version.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> + +#include <media/v4l2-common.h> + +#include "omap24xxcam.h" + +#define OMAP24XXCAM_VERSION KERNEL_VERSION(0, 0, 0) + +#define RESET_TIMEOUT_NS 10000
...
Quoted 29 lines
drivers/media/video/omap24xxcam.c new file +29
-0+ +} + +/* +* +* Sensor handling. +* +*/ + +/* +* Initialise the sensor hardware. +*/ +static int omap24xxcam_sensor_init (struct omap24xxcam_device *cam) +{ +int err =0 ; +struct v4l2_int_device *sdev = cam->sdev; +u32 xclk; +struct v4l2_ifparm p; + +/* +* Get sensor interface parameters from sensor and prepare +* cc_ctrl value that can be used when enabling camera core. +*/ + cam->cc_ctrl =CC_CTRL_CC_EN ; + + err =vidioc_int_g_ifparm (cam->sdev, &p); +if (err) { +dev_err (cam->dev,"vidioc_int_g_ifparm failed with %d\n" , err); +return err;
drivers/media/video/omap24xxcam.c line 813
Quoted 10 lines
drivers/media/video/omap24xxcam.c new file +10
-0+ } + +switch (p.if_type) { +case V4L2_IF_TYPE_PARALLEL : +if (p.u.parallel.frame_start_on_rising_vs) + cam->cc_ctrl |=CC_CTRL_NOBT_SYNCHRO ; +if (p.u.parallel.bt_sync_correct) + cam->cc_ctrl |=CC_CTRL_BT_CORRECT ; +if (p.u.parallel.swap) + cam->cc_ctrl |=CC_CTRL_PAR_ORDERCAM ;
In case of earlier omap2 camera driver with ov9640 combination above bit was set based on the pixelformat being passed. I am just copying that code here.
-----------------------snip-------------------------------------
switch (pix->pixelformat) {
case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB555:
default:
/* These formats need a 16-bit byte swap */
cam->cc_ctrl |= CC_CTRL_PAR_ORDERCAM;
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_RGB565X:
case V4L2_PIX_FMT_RGB555X:
/* These formats don't need a 16-bit byte swap */
break;
}-----------------------snip-------------------------------------
So, we might need to add support for above also.
drivers/media/video/omap24xxcam.c line 818
Quoted 5 lines
drivers/media/video/omap24xxcam.c new file +5
-0+if (p.u.parallel.latch_clk_inv) + cam->cc_ctrl |=CC_CTRL_PAR_CLK_POL ; +if (p.u.parallel.nobt_hs_inv) + cam->cc_ctrl |=CC_CTRL_NOBT_HS_POL ; +if (p.u.parallel.nobt_hs_inv)
Above should be nobt_vs_inv instead :)
Quoted 21 lines
drivers/media/video/omap24xxcam.c new file +21
-0+ cam->cc_ctrl |=CC_CTRL_NOBT_VS_POL ; + +switch (p.u.parallel.mode) { +case V4L2_IF_TYPE_PARALLEL_MODE_NOBT_8BIT : + cam->cc_ctrl |=CC_CTRL_PAR_MODE_NOBT8 ; +break ; +case V4L2_IF_TYPE_PARALLEL_MODE_NOBT_10BIT : + cam->cc_ctrl |=CC_CTRL_PAR_MODE_NOBT10 ; +break ; +case V4L2_IF_TYPE_PARALLEL_MODE_NOBT_12BIT : + cam->cc_ctrl |=CC_CTRL_PAR_MODE_NOBT12 ; +break ; +case V4L2_IF_TYPE_PARALLEL_MODE_BT_8BIT : + cam->cc_ctrl |=CC_CTRL_PAR_MODE_BT8 ; +break ; +case V4L2_IF_TYPE_PARALLEL_MODE_BT_10BIT : + cam->cc_ctrl |=CC_CTRL_PAR_MODE_BT10 ; +break ; + } +break ; +default :
drivers/media/video/omap24xxcam.c line 849
Quoted 10 lines
drivers/media/video/omap24xxcam.c new file +10
-0+/* FIXME: how about other interfaces? */ +dev_err (cam->dev,"interface type %d not supported\n" , + p.if_type); +return err; + } + +omap24xxcam_clock_on (cam); +vidioc_int_g_ext_clk (sdev, &xclk); +omap24xxcam_core_xclk_set (cam, xclk); +
I have updated ov9640 driver with the changes you have suggested and with new "ifparm" bits, but ov9640 on H4 is still not working. I will post that incremental patches for ov9640, so that someone can debug on H4/OMAP1(once that core gets converted to this new interface).
Signature · 1 line
--Trilok Soni
Re: [PATCH 1/2] ARM: OMAP2: Camera: Add driver.
Quoted 1 line · ext Trilok Soni
Hi Sakari,
Hello Trilok,
Quoted 13 lines
drivers/media/video/omap24xxcam.c line 813
Quoted 8 lines
drivers/media/video/omap24xxcam.c new file +8
-0+switch (p.if_type) { +case V4L2_IF_TYPE_PARALLEL : +if (p.u.parallel.frame_start_on_rising_vs) + cam->cc_ctrl |=CC_CTRL_NOBT_SYNCHRO ; +if (p.u.parallel.bt_sync_correct) + cam->cc_ctrl |=CC_CTRL_BT_CORRECT ; +if (p.u.parallel.swap) + cam->cc_ctrl |=CC_CTRL_PAR_ORDERCAM ;In case of earlier omap2 camera driver with ov9640 combination above bit was set based on the pixelformat being passed. I am just copying that code here.
-----------------------snip-------------------------------------
Quoted 13 lines
switch (pix->pixelformat) {
case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB555:
default:
/* These formats need a 16-bit byte swap */
cam->cc_ctrl |= CC_CTRL_PAR_ORDERCAM;
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_RGB565X:
case V4L2_PIX_FMT_RGB555X:
/* These formats don't need a 16-bit byte swap */
break;
}Ah. I didn't anticipate this... Then probably the camera driver needs to call g_ifparm always after s_fmt_cap.
Quoted 9 lines
So, we might need to add support for above also.
drivers/media/video/omap24xxcam.c line 818
Quoted 5 lines
drivers/media/video/omap24xxcam.c new file +5
-0+if (p.u.parallel.latch_clk_inv) + cam->cc_ctrl |=CC_CTRL_PAR_CLK_POL ; +if (p.u.parallel.nobt_hs_inv) + cam->cc_ctrl |=CC_CTRL_NOBT_HS_POL ; +if (p.u.parallel.nobt_hs_inv)Above should be
nobt_vs_invinstead :)
You got me convinced. :)
Quoted 4 lines
I have updated ov9640 driver with the changes you have suggested and with new "ifparm" bits, but ov9640 on H4 is still not working. I will post that incremental patches for ov9640, so that someone can debug on H4/OMAP1(once that core gets converted to this new interface).
Ok.
Signature · 2 lines
Sakari Ailus [email protected]
Tony Lindgren
maintainerQuoted 16 lines · Trilok Soni
Hi Sakari,
Quoted 13 lines · Sakari Ailus
Hi,
Here are the new OMAP 2 camera driver and N800 platform camera patches. I have posted the updates to V4L int if and TCM825x driver to the V4L list already as they have been integrated into V4L tree at <URL:http://linuxtv.org/hg/v4l-dvb> (excluding the new patches, sorry).
The changes since the last update include the following:
- Update to use
vidioc_int_g_ifparm.-
VIDIOC_DQBUFfix.
Quoted 8 lines
Quoted 5 lines
The driver assumed that every slave would return zero from
vidioc_int_g_needs_reset. This doesn't hold true for the slaves that do not implement that ioctl at all.- Small cleanups, remove useless & characters.
Thanx for the update. I will rebase ov9640 code with above v4l2-int changes and test with this updated omap2 camera driver.
I've pushed Sakari's V4L stuff and other camera patches except for one Trilok's patch which needs refreshing. Can you please check that all the necessary stuff is in the tree now?
Tony