Re: Start-up boot problems

2009-06-17 Thread Tobias Knutsson
You should also check that there is no mismatch between kernel and
userspace ABI. For example if your userspace (busybox i presume) is
compiled with a EABI compiler, CONFIG_AEABI should be set. It could
also be the other way around, old userspace with EABI-enabled kernel.
In that case i think you can try CONFIG_OABI_COMPAT.

On Tue, Jun 16, 2009 at 16:35, Nori, Sekhar wrote:
> On Tue, Jun 16, 2009 at 19:55:00, Young, Joseph wrote:
>> Hello all,
>>
>> I am working to port the Davinci Linux kernel to another TI chip,
>> Jacinto2, but am experiencing problems. The two devices are very similar
>> (DSP, ARM core) but have different development boards and some address
>> differences.
>>
>> The J2 Linux boot is very close to completion, but upon executing the
>> 'run_init_process' command ( in 'kernel_execve' , when it executes the
>> arm assembly code), everything freezes. This occurs when the system
>
> Joe,
>
> When you say freezes, does it 'appear' frozen because of lack of activity on 
> the
> serial? If you can connect using an JTAG emulator, do you see any exception?
>
>> executes the specified 'init' program passed by the bootloader and
>> transfers everything to user space.
>>
>> I have tried passing the linuxrc, init, /bin/sh, and /bin/ash programs
>> as the init command. I have also written a 'hello world' type program
>> that would simply print something out (It works like I expect for the
>> Davinci kernel). I am pretty confident I have the different board and
>> device settings, the memory map, and all of the registers correctly set
>> up, but perhaps this is not the case.  The problem is, I'm not sure how
>> to even start debugging it.
>>
>> Has anyone else ever run into anything like this? Does anyone have any
>> suggestions to try?
>
> This can be because the serial interrupt is not working properly. As I recall,
> this stage is the first time serial interrupt is exercised.
>
> Thanks,
> Sekhar
>
> ___
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
>



-- 

Hälsningar/Regards
Tobias Knutsson

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


LKCD for Davinci

2009-06-17 Thread arun thomas whitchurch
Hi,
Has anyone used the Linux Kernel Crash Dump utility on the dm6446. I
downloaded the patch for the 2.6.10 kernel from '
http://sourceforge.net/project/showfiles.php?group_id=2726&package_id=108740'
and applied it to my kernel and tried to follow the instructions given, but
it seems to be missing the patch for some files.
It is missing the patch for some arm specific header files and the patch for
some kconfig files which I need to use, to enable the LKCD option from 'make
xconfig'.
The documentation mentioned that it had ARM support. Is there any other site
which provides instructions on how to use this on the ARM?

Thanks,
Arun
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH] adding support for setting bus parameters in sub device

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

This patch adds support for setting bus parameters such as bus type
(Raw Bayer or Raw YUV image data bus), bus width (example 10 bit raw
image data bus, 10 bit BT.656 etc.), and polarities (vsync, hsync, field
etc) in sub device. This allows bridge driver to configure the sub device
bus for a specific set of bus parameters through s_bus() function call.
This also can be used to define platform specific bus parameters for
host and sub-devices.

Reviewed by: Hans Verkuil 
Signed-off-by: Murali Karicheri 
---
Applies to v4l-dvb repository

 include/media/v4l2-subdev.h |   40 
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 1785608..8532b91 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -37,6 +37,43 @@ struct v4l2_decode_vbi_line {
u32 type;   /* VBI service type (V4L2_SLICED_*). 0 if no 
service found */
 };
 
+/*
+ * Some sub-devices are connected to the host/bridge device through a bus that
+ * carries the clock, vsync, hsync and data. Some interfaces such as BT.656
+ * carries the sync embedded in the data where as others have separate line
+ * carrying the sync signals. The structure below is used to define bus
+ * configuration parameters for host as well as sub-device
+ */
+enum v4l2_bus_type {
+   /* Raw YUV image data bus */
+   V4L2_BUS_RAW_YUV,
+   /* Raw Bayer image data bus */
+   V4L2_BUS_RAW_BAYER
+};
+
+struct v4l2_bus_settings {
+   /* yuv or bayer image data bus */
+   enum v4l2_bus_type type;
+   /* subdev bus width */
+   u8 subdev_width;
+   /* host bus width */
+   u8 host_width;
+   /* embedded sync, set this when sync is embedded in the data stream */
+   unsigned embedded_sync:1;
+   /* master or slave */
+   unsigned host_is_master:1;
+   /* 0 - active low, 1 - active high */
+   unsigned pol_vsync:1;
+   /* 0 - active low, 1 - active high */
+   unsigned pol_hsync:1;
+   /* 0 - low to high , 1 - high to low */
+   unsigned pol_field:1;
+   /* 0 - active low , 1 - active high */
+   unsigned pol_data:1;
+   /* 0 - sample at falling edge , 1 - sample at rising edge */
+   unsigned edge_pclock:1;
+};
+
 /* Sub-devices are devices that are connected somehow to the main bridge
device. These devices are usually audio/video muxers/encoders/decoders or
sensors and webcam controllers.
@@ -199,6 +236,8 @@ struct v4l2_subdev_audio_ops {
 
s_routing: see s_routing in audio_ops, except this version is for video
devices.
+
+   s_bus: set bus parameters in sub device to configure the bus
  */
 struct v4l2_subdev_video_ops {
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 
config);
@@ -219,6 +258,7 @@ struct v4l2_subdev_video_ops {
int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum 
*fsize);
int (*enum_frameintervals)(struct v4l2_subdev *sd, struct 
v4l2_frmivalenum *fival);
+   int (*s_bus)(struct v4l2_subdev *sd, const struct v4l2_bus_settings 
*bus);
 };
 
 struct v4l2_subdev_ops {
-- 
1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH - V3] TVP514x: Migration to sub-device framework

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

This patch converts TVP514x driver to sub-device framework
from V4L2-int framework. 

NOTE: Please note that this patch was tested on DM355 and DM6446
and not tested on OMAP platform

Changes from v2 based on review comments (Taken over this work from
Vaibhav)

- removed __exit for tvp514x_remove
- removed v4l2_i2c_driver_data and use new model similar to ths7303
- changed state to streaming

TODO:
- Add support for some basic video/core functionality like,
  .g_chip_ident
  .reset
  .g_input_status
- Migration of OMAP master driver to validate this driver
- validate on OMAP boards

Reviewed by :Hans Verkuil 

Signed-off-by: Brijesh Jadav 
Signed-off-by: Hardik Shah 
Signed-off-by: Vaibhav Hiremath 
Signed-off-by: Murali Karicheri 
---
Applies to v4l-dvb repository
 
 drivers/media/video/tvp514x.c  |  875 ++--
 drivers/media/video/tvp514x_regs.h |   10 -
 include/media/tvp514x.h|4 -
 3 files changed, 349 insertions(+), 540 deletions(-)

diff --git a/drivers/media/video/tvp514x.c b/drivers/media/video/tvp514x.c
index 3750f7f..6063b57 100644
--- a/drivers/media/video/tvp514x.c
+++ b/drivers/media/video/tvp514x.c
@@ -31,7 +31,10 @@
 #include 
 #include 
 #include 
-#include 
+
+#include 
+#include 
+#include 
 #include 
 
 #include "tvp514x_regs.h"
@@ -49,13 +52,11 @@ static int debug;
 module_param(debug, bool, 0644);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
-#define dump_reg(client, reg, val) \
-   do {\
-   val = tvp514x_read_reg(client, reg);\
-   v4l_info(client, "Reg(0x%.2X): 0x%.2X\n", reg, val); \
-   } while (0)
+MODULE_AUTHOR("Texas Instruments");
+MODULE_DESCRIPTION("TVP514X linux decoder driver");
+MODULE_LICENSE("GPL");
 
-/**
+/*
  * enum tvp514x_std - enum for supported standards
  */
 enum tvp514x_std {
@@ -64,15 +65,7 @@ enum tvp514x_std {
STD_INVALID
 };
 
-/**
- * enum tvp514x_state - enum for different decoder states
- */
-enum tvp514x_state {
-   STATE_NOT_DETECTED,
-   STATE_DETECTED
-};
-
-/**
+/*
  * struct tvp514x_std_info - Structure to store standard informations
  * @width: Line width in pixels
  * @height:Number of active lines
@@ -87,35 +80,29 @@ struct tvp514x_std_info {
 };
 
 static struct tvp514x_reg tvp514x_reg_list_default[0x40];
-/**
+/*
  * struct tvp514x_decoder - TVP5146/47 decoder object
- * @v4l2_int_device: Slave handle
- * @tvp514x_slave: Slave pointer which is used by @v4l2_int_device
+ * @sd: Subdevice Slave handle
  * @tvp514x_regs: copy of hw's regs with preset values.
  * @pdata: Board specific
- * @client: I2C client data
- * @id: Entry from I2C table
  * @ver: Chip version
- * @state: TVP5146/47 decoder state - detected or not-detected
+ * @streaming: TVP5146/47 decoder streaming - enabled or disabled.
  * @pix: Current pixel format
  * @num_fmts: Number of formats
  * @fmt_list: Format list
  * @current_std: Current standard
  * @num_stds: Number of standards
  * @std_list: Standards list
- * @route: input and output routing at chip level
+ * @input: Input routing at chip level
+ * @output: Output routing at chip level
  */
 struct tvp514x_decoder {
-   struct v4l2_int_device v4l2_int_device;
-   struct v4l2_int_slave tvp514x_slave;
+   struct v4l2_subdev sd;
struct tvp514x_reg tvp514x_regs[ARRAY_SIZE(tvp514x_reg_list_default)];
const struct tvp514x_platform_data *pdata;
-   struct i2c_client *client;
-
-   struct i2c_device_id *id;
 
int ver;
-   enum tvp514x_state state;
+   int streaming;
 
struct v4l2_pix_format pix;
int num_fmts;
@@ -124,8 +111,11 @@ struct tvp514x_decoder {
enum tvp514x_std current_std;
int num_stds;
struct tvp514x_std_info *std_list;
-
-   struct v4l2_routing route;
+   /*
+* Input and Output Routing parameters
+*/
+   u32 input;
+   u32 output;
 };
 
 /* TVP514x default register values */
@@ -191,7 +181,8 @@ static struct tvp514x_reg tvp514x_reg_list_default[] = {
{TOK_TERM, 0, 0},
 };
 
-/* List of image formats supported by TVP5146/47 decoder
+/*
+ * List of image formats supported by TVP5146/47 decoder
  * Currently we are using 8 bit mode only, but can be
  * extended to 10/20 bit mode.
  */
@@ -240,35 +231,29 @@ static struct tvp514x_std_info tvp514x_std_list[] = {
},
/* Standard: need to add for additional standard */
 };
-/*
- * Control structure for Auto Gain
- * This is temporary data, will get replaced once
- * v4l2_ctrl_query_fill supports it.
- */
-static const struct v4l2_queryctrl tvp514x_autogain_ctrl = {
-   .id = V4L2_CID_AUTOGAIN,
-   .name = "Gain, Automatic",
-   .type = V4L2_CTRL_TYPE_BOOLEAN,
-   .minimum = 0,
-   .maximum = 1,
-   .step 

[PATCH 9/11 - v3] common vpss module for video drivers

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

common voss module for video drivers

This is a new module added for vpss library functions that are
used for configuring vpss system module. All video drivers will
include vpss.h header file and call functions defined in this
module to configure vpss system module.

Following are the updates:-
1) added module owner, description and GPL macros
2) some error conditions addressed in the probe

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 
Reviewed by: Alexey Klimov 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 drivers/media/video/davinci/vpss.c |  301 
 include/media/davinci/vpss.h   |   69 
 2 files changed, 370 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/vpss.c
 create mode 100644 include/media/davinci/vpss.h

diff --git a/drivers/media/video/davinci/vpss.c 
b/drivers/media/video/davinci/vpss.c
new file mode 100644
index 000..6d709ca
--- /dev/null
+++ b/drivers/media/video/davinci/vpss.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2009 Texas Instruments.
+ *
+ * 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.
+ *
+ * common vpss driver for all video drivers.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("VPSS Driver");
+MODULE_AUTHOR("Texas Instruments");
+
+/* DM644x defines */
+#define DM644X_SBL_PCR_VPSS(4)
+
+/* vpss BL register offsets */
+#define DM355_VPSSBL_CCDCMUX   0x1c
+/* vpss CLK register offsets */
+#define DM355_VPSSCLK_CLKCTRL  0x04
+/* masks and shifts */
+#define VPSS_HSSISEL_SHIFT 4
+
+/*
+ * vpss operations. Depends on platform. Not all functions are available
+ * on all platforms. The api, first check if a functio is available before
+ * invoking it. In the probe, the function ptrs are intialized based on
+ * vpss name. vpss name can be "dm355_vpss", "dm644x_vpss" etc.
+ */
+struct vpss_hw_ops {
+   /* enable clock */
+   int (*enable_clock)(enum vpss_clock_sel clock_sel, int en);
+   /* select input to ccdc */
+   void (*select_ccdc_source)(enum vpss_ccdc_source_sel src_sel);
+   /* clear wbl overlflow bit */
+   int (*clear_wbl_overflow)(enum vpss_wbl_sel wbl_sel);
+};
+
+/* vpss configuration */
+struct vpss_oper_config {
+   __iomem void *vpss_bl_regs_base;
+   __iomem void *vpss_regs_base;
+   struct resource *r1;
+   resource_size_t len1;
+   struct resource *r2;
+   resource_size_t len2;
+   char vpss_name[32];
+   spinlock_t vpss_lock;
+   struct vpss_hw_ops hw_ops;
+};
+
+static struct vpss_oper_config oper_cfg;
+
+/* register access routines */
+static inline u32 bl_regr(u32 offset)
+{
+   return __raw_readl(oper_cfg.vpss_bl_regs_base + offset);
+}
+
+static inline void bl_regw(u32 val, u32 offset)
+{
+   __raw_writel(val, oper_cfg.vpss_bl_regs_base + offset);
+}
+
+static inline u32 vpss_regr(u32 offset)
+{
+   return __raw_readl(oper_cfg.vpss_regs_base + offset);
+}
+
+static inline void vpss_regw(u32 val, u32 offset)
+{
+   __raw_writel(val, oper_cfg.vpss_regs_base + offset);
+}
+
+static void dm355_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
+{
+   bl_regw(src_sel << VPSS_HSSISEL_SHIFT, DM355_VPSSBL_CCDCMUX);
+}
+
+int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
+{
+   if (!oper_cfg.hw_ops.select_ccdc_source)
+   return -1;
+
+   dm355_select_ccdc_source(src_sel);
+   return 0;
+}
+EXPORT_SYMBOL(vpss_select_ccdc_source);
+
+static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
+{
+   u32 mask = 1, val;
+
+   if (wbl_sel < VPSS_PCR_AEW_WBL_0 ||
+   wbl_sel > VPSS_PCR_CCDC_WBL_O)
+   return -1;
+
+   /* writing a 0 clear the overflow */
+   mask = ~(mask << wbl_sel);
+   val = bl_regr(DM644X_SBL_PCR_VPSS) & mask;
+   bl_regw(val, DM644X_SBL_PCR_VPSS);
+   return 0;
+}
+
+int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
+{
+   if (!oper_cfg.hw_ops.clear_wbl_overflow)
+   return -1;
+
+   return oper_cfg.hw_ops.clear_wbl_overflow(wbl_sel);
+}
+EXPORT_SYMBOL(vpss

[PATCH 6/11 - v3] Makefile and config files for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

Makefile and config files for the driver

This adds Makefile and Kconfig changes to build vpfe capture driver.

No change in this version

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 drivers/media/video/Kconfig  |   49 ++
 drivers/media/video/Makefile |2 +
 drivers/media/video/davinci/Makefile |9 ++
 3 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/Makefile

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 94f4405..8a1bd1c 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -497,6 +497,55 @@ config VIDEO_VIVI
  Say Y here if you want to test video apps or debug V4L devices.
  In doubt, say N.
 
+config VIDEO_VPSS_SYSTEM
+   tristate "VPSS System module driver"
+   depends on ARCH_DAVINCI
+   help
+ Support for vpss system module for video driver
+   default y
+
+config VIDEO_VPFE_CAPTURE
+   tristate "VPFE Video Capture Driver"
+   depends on VIDEO_V4L2 && ARCH_DAVINCI
+   select VIDEOBUF_DMA_CONTIG
+   help
+ Support for DM VPFE based frame grabber. This is the
+ common V4L2 module for following DMXXX SoCs from Texas
+ Instruments:- DM6446 & DM355.
+
+ To compile this driver as a module, choose M here: the
+ module will be called vpfe-capture.
+
+config VIDEO_DM6446_CCDC
+   tristate "DM6446 CCDC HW module"
+   depends on ARCH_DAVINCI_DM644x && VIDEO_VPFE_CAPTURE
+   select VIDEO_VPSS_SYSTEM
+   default y
+   help
+  Enables DaVinci CCD hw module. DaVinci CCDC hw interfaces
+  with decoder modules such as TVP5146 over BT656 or
+  sensor module such as MT9T001 over a raw interface. This
+  module configures the interface and CCDC/ISIF to do
+  video frame capture from slave decoders.
+
+  To compile this driver as a module, choose M here: the
+  module will be called vpfe.
+
+config VIDEO_DM355_CCDC
+   tristate "DM355 CCDC HW module"
+   depends on ARCH_DAVINCI_DM355 && VIDEO_VPFE_CAPTURE
+   select VIDEO_VPSS_SYSTEM
+   default y
+   help
+  Enables DM355 CCD hw module. DM355 CCDC hw interfaces
+  with decoder modules such as TVP5146 over BT656 or
+  sensor module such as MT9T001 over a raw interface. This
+  module configures the interface and CCDC/ISIF to do
+  video frame capture from a slave decoders
+
+  To compile this driver as a module, choose M here: the
+  module will be called vpfe.
+
 source "drivers/media/video/bt8xx/Kconfig"
 
 config VIDEO_PMS
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 7fb3add..1f28495 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -153,6 +153,8 @@ obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
 obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
 obj-$(CONFIG_VIDEO_SH_MOBILE_CEU)  += sh_mobile_ceu_camera.o
 
+obj-$(CONFIG_ARCH_DAVINCI) += davinci/
+
 obj-$(CONFIG_VIDEO_AU0828) += au0828/
 
 obj-$(CONFIG_USB_VIDEO_CLASS)  += uvc/
diff --git a/drivers/media/video/davinci/Makefile 
b/drivers/media/video/davinci/Makefile
new file mode 100644
index 000..b84a405
--- /dev/null
+++ b/drivers/media/video/davinci/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for the davinci video device drivers.
+#
+
+# Capture: DM6446 and DM355
+obj-$(CONFIG_VIDEO_VPSS_SYSTEM) += vpss.o
+obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o
+obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o
+obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o
-- 
1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH 2/11 - v3] ccdc hw device header file for vpfe capture

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

CCDC hw device header file

Adds ccdc hw device header for vpfe capture driver

No change from last version

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 drivers/media/video/davinci/ccdc_hw_device.h |  110 ++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/ccdc_hw_device.h

diff --git a/drivers/media/video/davinci/ccdc_hw_device.h 
b/drivers/media/video/davinci/ccdc_hw_device.h
new file mode 100644
index 000..86b9b35
--- /dev/null
+++ b/drivers/media/video/davinci/ccdc_hw_device.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2008-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ccdc device API
+ */
+#ifndef _CCDC_HW_DEVICE_H
+#define _CCDC_HW_DEVICE_H
+
+#ifdef __KERNEL__
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * ccdc hw operations
+ */
+struct ccdc_hw_ops {
+   /* Pointer to initialize function to initialize ccdc device */
+   int (*open) (struct device *dev);
+   /* Pointer to deinitialize function */
+   int (*close) (struct device *dev);
+   /* set ccdc base address */
+   void (*set_ccdc_base)(void *base, int size);
+   /* Pointer to function to enable or disable ccdc */
+   void (*enable) (int en);
+   /* reset sbl. only for 6446 */
+   void (*reset) (void);
+   /* enable output to sdram */
+   void (*enable_out_to_sdram) (int en);
+   /* Pointer to function to set hw parameters */
+   int (*set_hw_if_params) (struct vpfe_hw_if_param *param);
+   /* get interface parameters */
+   int (*get_hw_if_params) (struct vpfe_hw_if_param *param);
+   /*
+* Pointer to function to set parameters. Used
+* for implementing VPFE_S_CCDC_PARAMS
+*/
+   int (*set_params) (void *params);
+   /*
+* Pointer to function to get parameter. Used
+* for implementing VPFE_G_CCDC_PARAMS
+*/
+   int (*get_params) (void *params);
+   /* Pointer to function to configure ccdc */
+   int (*configure) (void);
+
+   /* Pointer to function to set buffer type */
+   int (*set_buftype) (enum ccdc_buftype buf_type);
+   /* Pointer to function to get buffer type */
+   enum ccdc_buftype (*get_buftype) (void);
+   /* Pointer to function to set frame format */
+   int (*set_frame_format) (enum ccdc_frmfmt frm_fmt);
+   /* Pointer to function to get frame format */
+   enum ccdc_frmfmt (*get_frame_format) (void);
+   /* enumerate hw pix formats */
+   int (*enum_pix)(u32 *hw_pix, int i);
+   /* Pointer to function to set buffer type */
+   u32 (*get_pixel_format) (void);
+   /* Pointer to function to get pixel format. */
+   int (*set_pixel_format) (u32 pixfmt);
+   /* Pointer to function to set image window */
+   int (*set_image_window) (struct v4l2_rect *win);
+   /* Pointer to function to set image window */
+   void (*get_image_window) (struct v4l2_rect *win);
+   /* Pointer to function to get line length */
+   unsigned int (*get_line_length) (void);
+
+   /* Query CCDC control IDs */
+   int (*queryctrl)(struct v4l2_queryctrl *qctrl);
+   /* Set CCDC control */
+   int (*set_control)(struct v4l2_control *ctrl);
+   /* Get CCDC control */
+   int (*get_control)(struct v4l2_control *ctrl);
+
+   /* Pointer to function to set frame buffer address */
+   void (*setfbaddr) (unsigned long addr);
+   /* Pointer to function to get field id */
+   int (*getfid) (void);
+};
+
+struct ccdc_hw_device {
+   /* ccdc device name */
+   char name[32];
+   /* module owner */
+   struct module *owner;
+   /* hw ops */
+   struct ccdc_hw_ops hw_ops;
+};
+
+/* Used by CCDC module to register & unregister with vpfe capture driver */
+int vpfe_register_ccdc_device(struct ccdc_hw_device *dev);
+void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev);
+
+#endif
+#endif
-- 
1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-op

[PATCH 11/11 - v3] Makefile and config file changes for davinci git tree

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

Makefile and config files for vpfe capture driver that applies
to DaVinci GIT tree only. This is added to help in applying this
patch to DaVinci GIT tree since the tree has some obsolete davinci
drivers that is being removed by this patch. These files are not
available in upstream kernel. Please use this patch instead of 
Patch #6 of this series for DaVinci GIT tree.

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 
Reviewed by: Kevin Hilman 

Signed-off-by: Muralidharan Karicheri 
---
Applies to DaVinci GIT tree

 drivers/media/video/Kconfig  |   57 +
 drivers/media/video/Makefile |6 +---
 drivers/media/video/davinci/Makefile |9 +
 3 files changed, 53 insertions(+), 19 deletions(-)
 create mode 100644 drivers/media/video/davinci/Makefile

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index e037e3f..ee6806c 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -479,25 +479,54 @@ config VIDEO_VIVI
  Say Y here if you want to test video apps or debug V4L devices.
  In doubt, say N.
 
-config VIDEO_TVP5146
-   tristate "TVP5146 video decoder"
-   depends on I2C && ARCH_DAVINCI
+config VIDEO_VPSS_SYSTEM
+   tristate "VPSS System module driver"
+   depends on ARCH_DAVINCI
help
- Support for I2C bus based TVP5146 configuration.
-
- To compile this driver as a module, choose M here: the
- module will be called tvp5146.
+ Support for vpss system module for video driver
+   default y
 
-config VIDEO_DAVINCI
-   tristate "Davinci Video Capture"
-   depends on VIDEO_DEV && VIDEO_TVP5146 && ARCH_DAVINCI
-   select VIDEOBUF_GEN
-   select VIDEOBUF_DMA_SG
+config VIDEO_VPFE_CAPTURE
+   tristate "VPFE Video Capture Driver"
+   depends on VIDEO_V4L2 && ARCH_DAVINCI
+   select VIDEOBUF_DMA_CONTIG
help
- Support for Davinci based frame grabber through CCDC.
+ Support for DM VPFE based frame grabber. This is the
+ common V4L2 module for following DMXXX SoCs from Texas
+ Instruments:- DM6446 & DM355.
 
  To compile this driver as a module, choose M here: the
- module will be called vpfe.
+ module will be called vpfe-capture.
+
+config VIDEO_DM6446_CCDC
+   tristate "DM6446 CCDC HW module"
+   depends on ARCH_DAVINCI_DM644x && VIDEO_VPFE_CAPTURE
+   select VIDEO_VPSS_SYSTEM
+   default y
+   help
+  Enables DaVinci CCD hw module. DaVinci CCDC hw interfaces
+  with decoder modules such as TVP5146 over BT656 or
+  sensor module such as MT9T001 over a raw interface. This
+  module configures the interface and CCDC/ISIF to do
+  video frame capture from slave decoders.
+
+  To compile this driver as a module, choose M here: the
+  module will be called vpfe.
+
+config VIDEO_DM355_CCDC
+   tristate "DM355 CCDC HW module"
+   depends on ARCH_DAVINCI_DM355 && VIDEO_VPFE_CAPTURE
+   select VIDEO_VPSS_SYSTEM
+   default y
+   help
+  Enables DM355 CCD hw module. DM355 CCDC hw interfaces
+  with decoder modules such as TVP5146 over BT656 or
+  sensor module such as MT9T001 over a raw interface. This
+  module configures the interface and CCDC/ISIF to do
+  video frame capture from a slave decoders
+
+  To compile this driver as a module, choose M here: the
+  module will be called vpfe.
 
 source "drivers/media/video/bt8xx/Kconfig"
 
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 12ddb9a..76db635 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -10,8 +10,6 @@ stkwebcam-objs:=  stk-webcam.o stk-sensor.o
 
 omap2cam-objs  :=  omap24xxcam.o omap24xxcam-dma.o
 
-davinci-vpfe-objs   :=  ccdc_davinci.o davinci_vpfe.o
-
 videodev-objs  :=  v4l2-dev.o v4l2-ioctl.o v4l2-device.o
 
 obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o
@@ -133,9 +131,6 @@ obj-$(CONFIG_USB_S2255) += s2255drv.o
 obj-$(CONFIG_VIDEO_IVTV) += ivtv/
 obj-$(CONFIG_VIDEO_CX18) += cx18/
 
-obj-$(CONFIG_VIDEO_DAVINCI) += davinci-vpfe.o
-obj-$(CONFIG_VIDEO_TVP5146) += tvp5146.o
-
 obj-$(CONFIG_VIDEO_VIVI) += vivi.o
 obj-$(CONFIG_VIDEO_CX23885) += cx23885/
 
@@ -152,6 +147,7 @@ obj-$(CONFIG_SOC_CAMERA_MT9V022)+= mt9v022.o
 obj-$(CONFIG_SOC_CAMERA_OV772X)+= ov772x.o
 obj-$(CONFIG_SOC_CAMERA_PLATFORM)  += soc_camera_platform.o
 obj-$(CONFIG_SOC_CAMERA_TW9910)+= tw9910.o
+obj-$(CONFIG_ARCH_DAVINCI) += davinci/
 
 obj-$(CONFIG_VIDEO_AU0828) += au0828/
 
diff --git a/drivers/media/video/davinci/Makefile 
b/drivers/media/video/davinci/Makefile
new file mode 100644
index 000..b84a405
--- /dev/null
+++ b/drivers/media/video/davinci/Makefile
@@ -0,0 +1,9 @@
+#
+

[PATCH 3/11 - v3] dm355 ccdc module for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

DM355 CCDC hw module

Adds ccdc hw module for DM355 CCDC. This registers with the bridge
driver a set of hw_ops for configuring the CCDC for a specific
decoder device connected to vpfe.

The module description and owner information added

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 drivers/media/video/davinci/dm355_ccdc.c  | 1163 +
 drivers/media/video/davinci/dm355_ccdc_regs.h |  310 +++
 include/media/davinci/dm355_ccdc.h|  336 +++
 3 files changed, 1809 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/dm355_ccdc.c
 create mode 100644 drivers/media/video/davinci/dm355_ccdc_regs.h
 create mode 100644 include/media/davinci/dm355_ccdc.h

diff --git a/drivers/media/video/davinci/dm355_ccdc.c 
b/drivers/media/video/davinci/dm355_ccdc.c
new file mode 100644
index 000..69e38d0
--- /dev/null
+++ b/drivers/media/video/davinci/dm355_ccdc.c
@@ -0,0 +1,1163 @@
+/*
+ * Copyright (C) 2005-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * CCDC hardware module for DM355
+ * --
+ *
+ * This module is for configuring DM355 CCD controller of VPFE to capture
+ * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules
+ * such as Defect Pixel Correction, Color Space Conversion etc to
+ * pre-process the Bayer RGB data, before writing it to SDRAM. This
+ * module also allows application to configure individual
+ * module parameters through VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL.
+ * To do so, application include dm355_ccdc.h and vpfe_capture.h header
+ * files. The setparams() API is called by vpfe_capture driver
+ * to configure module parameters
+ *
+ * TODO: 1) Raw bayer parameter settings and bayer capture
+ *  2) Split module parameter structure to module specific ioctl structs
+ *  3) add support for lense shading correction
+ *  4) investigate if enum used for user space type definition
+ * to be replaced by #defines or integer
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "dm355_ccdc_regs.h"
+#include "ccdc_hw_device.h"
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("CCDC Driver for DM355");
+MODULE_AUTHOR("Texas Instruments");
+
+static struct device *dev;
+
+/* Object for CCDC raw mode */
+static struct ccdc_params_raw ccdc_hw_params_raw = {
+   .pix_fmt = CCDC_PIXFMT_RAW,
+   .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
+   .win = CCDC_WIN_VGA,
+   .fid_pol = VPFE_PINPOL_POSITIVE,
+   .vd_pol = VPFE_PINPOL_POSITIVE,
+   .hd_pol = VPFE_PINPOL_POSITIVE,
+   .gain = {
+   .r_ye = 256,
+   .gb_g = 256,
+   .gr_cy = 256,
+   .b_mg = 256
+   },
+   .config_params = {
+   .datasft = 2,
+   .data_sz = CCDC_DATA_10BITS,
+   .mfilt1 = CCDC_NO_MEDIAN_FILTER1,
+   .mfilt2 = CCDC_NO_MEDIAN_FILTER2,
+   .alaw = {
+   .gama_wd = 2,
+   },
+   .blk_clamp = {
+   .sample_pixel = 1,
+   .dc_sub = 25
+   },
+   .col_pat_field0 = {
+   .olop = CCDC_GREEN_BLUE,
+   .olep = CCDC_BLUE,
+   .elop = CCDC_RED,
+   .elep = CCDC_GREEN_RED
+   },
+   .col_pat_field1 = {
+   .olop = CCDC_GREEN_BLUE,
+   .olep = CCDC_BLUE,
+   .elop = CCDC_RED,
+   .elep = CCDC_GREEN_RED
+   },
+   },
+};
+
+
+/* Object for CCDC ycbcr mode */
+static struct ccdc_params_ycbcr ccdc_hw_params_ycbcr = {
+   .win = CCDC_WIN_PAL,
+   .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
+   .frm_fmt = CCDC_FRMFMT_INTERLACED,
+   .fid_pol = VPFE_PINPOL_POSITIVE,
+   .vd_pol = VPFE_PINPOL_POSITIVE,
+   .hd_pol = VPFE_PINPOL_POSITIVE,
+   .bt656_enable = 1,
+   .pix_order = CCDC_PIXORDER_CBYCRY,
+   .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
+};
+
+static struct v4l2_queryctrl ccdc_control_info[] = {
+   {
+   .id = CCDC_CID_R_GAIN,

[PATCH 5/11 - v3] ccdc types used across ccdc modules for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

common types used across CCDC modules

No change from last version

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 include/media/davinci/ccdc_types.h |   43 
 1 files changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 include/media/davinci/ccdc_types.h

diff --git a/include/media/davinci/ccdc_types.h 
b/include/media/davinci/ccdc_types.h
new file mode 100644
index 000..5773874
--- /dev/null
+++ b/include/media/davinci/ccdc_types.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ **/
+#ifndef _CCDC_TYPES_H
+#define _CCDC_TYPES_H
+enum ccdc_pixfmt {
+   CCDC_PIXFMT_RAW,
+   CCDC_PIXFMT_YCBCR_16BIT,
+   CCDC_PIXFMT_YCBCR_8BIT
+};
+
+enum ccdc_frmfmt {
+   CCDC_FRMFMT_PROGRESSIVE,
+   CCDC_FRMFMT_INTERLACED
+};
+
+/* PIXEL ORDER IN MEMORY from LSB to MSB */
+/* only applicable for 8-bit input mode  */
+enum ccdc_pixorder {
+   CCDC_PIXORDER_YCBYCR,
+   CCDC_PIXORDER_CBYCRY,
+};
+
+enum ccdc_buftype {
+   CCDC_BUFTYPE_FLD_INTERLEAVED,
+   CCDC_BUFTYPE_FLD_SEPARATED
+};
+#endif
-- 
1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH 7/11 - v3] DM355 platform changes for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

DM355 platform and board setup

This has platform and board setup changes to support vpfe capture
driver for DM355 EVMs.

summary of changes
1) replaced v4l2_routing structure with vpfe structure for route
2) ccdc bus parameter settings added
3) input name string changed to Composite and S-Video
 
Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 
Reviewed by: Kevin Hilman 
Reviewed by: David Brownell 

Signed-off-by: Muralidharan Karicheri 
---
Applies to Davinci GIT Tree

 arch/arm/mach-davinci/board-dm355-evm.c|   76 -
 arch/arm/mach-davinci/dm355.c  |   83 
 arch/arm/mach-davinci/include/mach/dm355.h |2 +
 arch/arm/mach-davinci/include/mach/mux.h   |9 +++
 4 files changed, 167 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c 
b/arch/arm/mach-davinci/board-dm355-evm.c
index 5ac2f56..513be53 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -134,12 +136,22 @@ static void dm355evm_mmcsd_gpios(unsigned gpio)
dm355evm_mmc_gpios = gpio;
 }
 
+static struct tvp514x_platform_data tvp5146_pdata = {
+   .clk_polarity = 0,
+   .hs_polarity = 1,
+   .vs_polarity = 1
+};
+
 static struct i2c_board_info dm355evm_i2c_info[] = {
-   { I2C_BOARD_INFO("dm355evm_msp", 0x25),
+   {   I2C_BOARD_INFO("dm355evm_msp", 0x25),
.platform_data = dm355evm_mmcsd_gpios,
-   /* plus irq */ },
+   },
+   {
+   I2C_BOARD_INFO("tvp5146", 0x5d),
+   .platform_data = &tvp5146_pdata,
+   },
+   /* { plus irq  }, */
/* { I2C_BOARD_INFO("tlv320aic3x", 0x1b), }, */
-   /* { I2C_BOARD_INFO("tvp5146", 0x5d), }, */
 };
 
 static void __init evm_init_i2c(void)
@@ -178,6 +190,62 @@ static struct platform_device dm355evm_dm9000 = {
.num_resources  = ARRAY_SIZE(dm355evm_dm9000_rsrc),
 };
 
+#define TVP514X_STD_ALL(V4L2_STD_NTSC | V4L2_STD_PAL)
+/* Inputs available at the TVP5146 */
+static struct v4l2_input tvp5146_inputs[] = {
+   {
+   .index = 0,
+   .name = "Composite",
+   .type = V4L2_INPUT_TYPE_CAMERA,
+   .std = TVP514X_STD_ALL,
+   },
+   {
+   .index = 1,
+   .name = "S-Video",
+   .type = V4L2_INPUT_TYPE_CAMERA,
+   .std = TVP514X_STD_ALL,
+   },
+};
+
+/*
+ * this is the route info for connecting each input to decoder
+ * ouput that goes to vpfe. There is a one to one correspondence
+ * with tvp5146_inputs
+ */
+static struct vpfe_route tvp5146_routes[] = {
+   {
+   .input = INPUT_CVBS_VI2B,
+   .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+   },
+   {
+   .input = INPUT_SVIDEO_VI2C_VI1C,
+   .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+   },
+};
+
+static struct vpfe_subdev_info vpfe_sub_devs[] = {
+   {
+   .name = "tvp5146",
+   .grp_id = 0,
+   .num_inputs = ARRAY_SIZE(tvp5146_inputs),
+   .inputs = tvp5146_inputs,
+   .routes = tvp5146_routes,
+   .can_route = 1,
+   .ccdc_if_params = {
+   .if_type = VPFE_BT656,
+   .hdpol = VPFE_PINPOL_POSITIVE,
+   .vdpol = VPFE_PINPOL_POSITIVE,
+   },
+   }
+};
+
+static struct vpfe_config vpfe_cfg = {
+   .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
+   .sub_devs = vpfe_sub_devs,
+   .card_name = "DM355 EVM",
+   .ccdc = "DM355 CCDC",
+};
+
 static struct platform_device *davinci_evm_devices[] __initdata = {
&dm355evm_dm9000,
&davinci_nand_device,
@@ -189,6 +257,8 @@ static struct davinci_uart_config uart_config __initdata = {
 
 static void __init dm355_evm_map_io(void)
 {
+   /* setup input configuration for VPFE input devices */
+   dm355_set_vpfe_config(&vpfe_cfg);
dm355_init();
 }
 
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index f0b10b4..7a7b020 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -481,6 +481,14 @@ INT_CFG(DM355,  INT_EDMA_TC1_ERR, 4,1,1, 
false)
 EVT_CFG(DM355,  EVT8_ASP1_TX,0,1,0, false)
 EVT_CFG(DM355,  EVT9_ASP1_RX,1,1,0, false)
 EVT_CFG(DM355,  EVT26_MMC0_RX,   2,1,0, false)
+
+MUX_CFG(DM355, VIN_PCLK,   0,   14,1,1, false)
+MUX_CFG(DM355, VIN_CAM_WEN,0,   13,1,1, false)
+MUX_CFG(DM355, VIN_CAM_VD, 0,   12,1,1, false)
+MUX_CFG(DM355, VIN_CAM_HD, 0,   11,1,1, false)
+MUX_CFG(DM355, VIN_YIN_EN, 0,   10,1,1, false)
+MUX_CFG(DM355, VIN_CINL_EN,  

[PATCH 8/11 - v3] DM6446 platform changes for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

DM644x platform and board setup

This adds plarform and board setup changes required to support
vpfe capture driver on DM644x

summary of changes:-
1) replaced v4l2_routing structure with vpfe structure
2) input names changed to Composite and S-Video
3) bus parameters defined for ccdc

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 
Reviewed by: Kevin Hilman 
Reviewed by: David Brownell 

Signed-off-by: Muralidharan Karicheri 
---
Applies to Davinci GIT Tree

 arch/arm/mach-davinci/board-dm644x-evm.c|   72 ++-
 arch/arm/mach-davinci/dm644x.c  |   56 +
 arch/arm/mach-davinci/include/mach/dm644x.h |2 +
 3 files changed, 128 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
b/arch/arm/mach-davinci/board-dm644x-evm.c
index d9d4045..54f084b 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -28,7 +28,8 @@
 #include 
 #include 
 #include 
-
+#include 
+#include 
 #include 
 #include 
 
@@ -195,6 +196,62 @@ static struct platform_device davinci_fb_device = {
.num_resources = 0,
 };
 
+#define TVP514X_STD_ALL(V4L2_STD_NTSC | V4L2_STD_PAL)
+/* Inputs available at the TVP5146 */
+static struct v4l2_input tvp5146_inputs[] = {
+   {
+   .index = 0,
+   .name = "Composite",
+   .type = V4L2_INPUT_TYPE_CAMERA,
+   .std = TVP514X_STD_ALL,
+   },
+   {
+   .index = 1,
+   .name = "S-Video",
+   .type = V4L2_INPUT_TYPE_CAMERA,
+   .std = TVP514X_STD_ALL,
+   },
+};
+
+/*
+ * this is the route info for connecting each input to decoder
+ * ouput that goes to vpfe. There is a one to one correspondence
+ * with tvp5146_inputs
+ */
+static struct vpfe_route tvp5146_routes[] = {
+   {
+   .input = INPUT_CVBS_VI2B,
+   .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+   },
+   {
+   .input = INPUT_SVIDEO_VI2C_VI1C,
+   .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+   },
+};
+
+static struct vpfe_subdev_info vpfe_sub_devs[] = {
+   {
+   .name = "tvp5146",
+   .grp_id = 0,
+   .num_inputs = ARRAY_SIZE(tvp5146_inputs),
+   .inputs = tvp5146_inputs,
+   .routes = tvp5146_routes,
+   .can_route = 1,
+   .ccdc_if_params = {
+   .if_type = VPFE_BT656,
+   .hdpol = VPFE_PINPOL_POSITIVE,
+   .vdpol = VPFE_PINPOL_POSITIVE,
+   },
+   },
+};
+
+static struct vpfe_config vpfe_cfg = {
+   .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
+   .sub_devs = vpfe_sub_devs,
+   .card_name = "DM6446 EVM",
+   .ccdc = "DM6446 CCDC",
+};
+
 static struct platform_device rtc_dev = {
.name   = "rtc_davinci_evm",
.id = -1,
@@ -447,6 +504,12 @@ static struct at24_platform_data eeprom_info = {
.context= (void *)0x7f00,
 };
 
+static struct tvp514x_platform_data tvp5146_pdata = {
+   .clk_polarity = 0,
+   .hs_polarity = 1,
+   .vs_polarity = 1
+};
+
 /*
  * MSP430 supports RTC, card detection, input from IR remote, and
  * a bit more.  It triggers interrupts on GPIO(7) from pressing
@@ -558,9 +621,12 @@ static struct i2c_board_info __initdata i2c_info[] =  {
I2C_BOARD_INFO("24c256", 0x50),
.platform_data  = &eeprom_info,
},
+   {
+   I2C_BOARD_INFO("tvp5146", 0x5d),
+   .platform_data = &tvp5146_pdata,
+   },
/* ALSO:
 * - tvl320aic33 audio codec (0x1b)
-* - tvp5146 video decoder (0x5d)
 */
 };
 
@@ -591,6 +657,8 @@ static struct davinci_uart_config uart_config __initdata = {
 static void __init
 davinci_evm_map_io(void)
 {
+   /* setup input configuration for VPFE input devices */
+   dm644x_set_vpfe_config(&vpfe_cfg);
dm644x_init();
 }
 
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index dd58f08..09993cc 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -549,6 +549,59 @@ static struct platform_device dm644x_edma_device = {
.resource   = edma_resources,
 };
 
+static struct resource dm644x_vpss_resources[] = {
+   {
+   /* VPSS Base address */
+   .name   = "vpss",
+   .start  = 0x01c73400,
+   .end= 0x01c73400 + 0xff,
+   .flags  = IORESOURCE_MEM,
+   },
+};
+
+static struct platform_device dm644x_vpss_device = {
+   .name   = "vpss",
+   .id = -1,
+   .dev.platform_data  = "dm644x_vpss",
+   .num_resources  = ARRAY_SIZE(dm644x_vpss_resources),
+   .resource

[PATCH 0/11 - v3] ARM: DaVinci: Video: DM355/DM6446 VPFE Capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

Big Thanks to all reviewers who have contributed to this driver
by reviewing and offering valuable comments.

VPFE Capture driver for DaVinci Media SOCs :- DM355 and DM6446

This is the version v3 of the patch series. This is the reworked
version of the driver based on comments received against the last
version (v2) of the patch and is expected to be final version
candidate for merge to upstream kernel

+++
These patches add support for VPFE (Video Processing Front End) based
video capture on DM355 and DM6446 EVMs. For more details on the hardware
configuration and capabilities, please refer the vpfe_capture.c header.
This patch set consists of following:- 

Patch 1: VPFE Capture bridge driver
Patch 2: CCDC hw device header file
Patch 3: DM355 CCDC hw module
Patch 4: DM644x CCDC hw module
Patch 5: ccdc types used across CCDC modules
Patch 6: Makefile and config files for the driver
Patch 7: DM355 platform and board setup
Patch 8: DM644x platform and board setup
Patch 9: common vpss hw module for video drivers
Patch 10: Remove outdated driver files from davinci git tree
Patch 11: Makefile and config files for the davinci git tree (New
from v2)

NOTE:

1. Patches 10-11 are only for DaVinci GIT tree. Others applies to
DaVinci GIT and v4l-dvb

2. Dependent on the TVP514x decoder driver patch for migrating the
driver to sub device model from Vaibhav Hiremath. I am sending the
reworked version of this patch instead of Vaibhav.

Following tests are performed.
1) Capture and display video (PAL & NTSC) from tvp5146 decoder.
   Displayed using fbdev device driver available on davinci git tree
2) Tested with driver built statically and dynamically

Muralidhara Karicheri

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 
Reviewed by: Alexey Klimov 
Reviewed by: Kevin Hilman 
Reviewed by: David Brownell 

Signed-off-by: Muralidharan Karicheri 
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[PATCH 4/11 - v3] dm644x ccdc module for vpfe capture driver

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

DM644x CCDC hw module

This is the hw module for DM644x CCDC. This registers with the
vpfe capture driver and provides a set of hw_ops to configure
CCDC for a specific decoder device connected to the VPFE

Module description, GPL and owner information MACROs added at the top

Reviewed by: Hans Verkuil 
Reviewed by: Laurent Pinchart 

Signed-off-by: Muralidharan Karicheri 
---
Applies to v4l-dvb repository

 drivers/media/video/davinci/dm644x_ccdc.c  |  878 
 drivers/media/video/davinci/dm644x_ccdc_regs.h |  145 
 include/media/davinci/dm644x_ccdc.h|  184 +
 3 files changed, 1207 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/dm644x_ccdc.c
 create mode 100644 drivers/media/video/davinci/dm644x_ccdc_regs.h
 create mode 100644 include/media/davinci/dm644x_ccdc.h

diff --git a/drivers/media/video/davinci/dm644x_ccdc.c 
b/drivers/media/video/davinci/dm644x_ccdc.c
new file mode 100644
index 000..2f19a91
--- /dev/null
+++ b/drivers/media/video/davinci/dm644x_ccdc.c
@@ -0,0 +1,878 @@
+/*
+ * Copyright (C) 2006-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * CCDC hardware module for DM6446
+ * --
+ *
+ * This module is for configuring CCD controller of DM6446 VPFE to capture
+ * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules
+ * such as Defect Pixel Correction, Color Space Conversion etc to
+ * pre-process the Raw Bayer RGB data, before writing it to SDRAM. This
+ * module also allows application to configure individual
+ * module parameters through VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL.
+ * To do so, application includes dm644x_ccdc.h and vpfe_capture.h header
+ * files.  The setparams() API is called by vpfe_capture driver
+ * to configure module parameters. This file is named DM644x so that other
+ * variants such DM6443 may be supported using the same module.
+ *
+ * TODO: Test Raw bayer parameter settings and bayer capture
+ *  Split module parameter structure to module specific ioctl structs
+ *  investigate if enum used for user space type definition
+ *  to be replaced by #defines or integer
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "dm644x_ccdc_regs.h"
+#include "ccdc_hw_device.h"
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("CCDC Driver for DM6446");
+MODULE_AUTHOR("Texas Instruments");
+
+static struct device *dev;
+
+/* Object for CCDC raw mode */
+static struct ccdc_params_raw ccdc_hw_params_raw = {
+   .pix_fmt = CCDC_PIXFMT_RAW,
+   .frm_fmt = CCDC_FRMFMT_PROGRESSIVE,
+   .win = CCDC_WIN_VGA,
+   .fid_pol = VPFE_PINPOL_POSITIVE,
+   .vd_pol = VPFE_PINPOL_POSITIVE,
+   .hd_pol = VPFE_PINPOL_POSITIVE,
+   .config_params = {
+   .data_sz = CCDC_DATA_10BITS,
+   },
+};
+
+/* Object for CCDC ycbcr mode */
+static struct ccdc_params_ycbcr ccdc_hw_params_ycbcr = {
+   .pix_fmt = CCDC_PIXFMT_YCBCR_8BIT,
+   .frm_fmt = CCDC_FRMFMT_INTERLACED,
+   .win = CCDC_WIN_PAL,
+   .fid_pol = VPFE_PINPOL_POSITIVE,
+   .vd_pol = VPFE_PINPOL_POSITIVE,
+   .hd_pol = VPFE_PINPOL_POSITIVE,
+   .bt656_enable = 1,
+   .pix_order = CCDC_PIXORDER_CBYCRY,
+   .buf_type = CCDC_BUFTYPE_FLD_INTERLEAVED
+};
+
+#define CCDC_MAX_RAW_YUV_FORMATS   2
+
+/* Raw Bayer formats */
+static u32 ccdc_raw_bayer_pix_formats[] =
+   {V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SBGGR16};
+
+/* Raw YUV formats */
+static u32 ccdc_raw_yuv_pix_formats[] =
+   {V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV};
+
+static void *__iomem ccdc_base_addr;
+static int ccdc_addr_size;
+static enum vpfe_hw_if_type ccdc_if_type;
+
+/* register access routines */
+static inline u32 regr(u32 offset)
+{
+   return __raw_readl(ccdc_base_addr + offset);
+}
+
+static inline void regw(u32 val, u32 offset)
+{
+   __raw_writel(val, ccdc_base_addr + offset);
+}
+
+static void ccdc_set_ccdc_base(void *addr, int size)
+{
+   ccdc_base_addr = addr;
+   ccdc_addr_size = size;
+}
+
+static void ccdc_enable(int flag)
+{
+   regw(flag, CCDC_PCR);
+}
+
+static void ccdc_enable_vport(int flag)
+{
+   if (flag)
+   /* enable video port */
+   regw(CCDC_ENABLE_VIDEO_PO

kernel NULL in fs_may_remount_ro with a 2.6.28 kernel

2009-06-17 Thread Craig Matsuura
We have recently moved to the 2.6.28 kernel on the DM64xx, While on a
jffs2 rootfs read-only I can remount the file system r/w copy a large
file to the file system and remount it r/o and get the following kernel
oops.

 

Is there anything with alignment or building with a gcc 4.3.2 toolchain
that might be causing this problem?   Is anyone aware of such issues in
the 2.6.28 kernel?

 

 

Unable to handle kernel NULL pointer dereference at virtual address
0009

pgd = c7fa4000


[0009] *pgd=875da031, *pte=, *ppte=


Internal error: Oops: 1 [#1]


Modules linked in: c4ts75 stac9758_fpga c4ac97 davinci_audio
davinci_audio_dma_intfc stac9758_plat fpdriver c4button c4irout c4irin
c4cntvid c4relay c4serial c4fpga zd1211b dsplinkk cmemk dspctrl(P)


CPU: 0Tainted: P(2.6.28.10-rc8.28 #rc8.28-hc500.1)


PC is at fs_may_remount_ro+0x18/0x68


LR is at do_remount_sb+0x11c/0x1a0

pc : []lr : []psr: 8013

sp : ce5d1ee8  ip : cf6b5d30  fp : ce5d1ef4

r10: cf5bb040  r9 : ce5d1f38  r8 : 8021

r7 :   r6 :   r5 : cf5bb000  r4 : 

r3 : 0001  r2 : c9d66cc0  r1 : cf085028  r0 : cf5bb08c

Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user

Control: 0005317f  Table: 87fa4000  DAC: 0015

Process mount (pid: 2814, stack limit = 0xce5d0268)

Stack: (0xce5d1ee8 to 0xce5d2000)

1ee0:   ce5d1f24 ce5d1ef8 c00d7d28 c00d6b40 ce5d1f14
8001

1f00: c02c14e8 8021 0040  cf5bb000 8021 ce5d1f6c
ce5d1f28

1f20: c00eb89c c00d7c1c ce5d1f44 ce5d1f38 c00b7118 c00b6cd8 cf562b00
cf006400

1f40: c00e9fc8  cf6a 00080b9c 8021 c0079f68 ce5d


1f60: ce5d1fa4 ce5d1f70 c00ebe04 c00eb6a0  ce5d1f80 c0080294
c75e6000

1f80: c75e7000   8021 be964cbc 0015 
ce5d1fa8

1fa0: c0079dc0 c00ebd88  8021 00080b9c 00080ba6 00080ba8
8021

1fc0:  8021 be964cbc 0015  be964e74 


1fe0:  be964bac 00052498 401335a4 6010 00080b9c 0f41e7da


Backtrace:

[] (fs_may_remount_ro+0x0/0x68) from []
(do_remount_sb+0x11c/0x1a0)

[] (do_remount_sb+0x0/0x1a0) from []
(do_mount+0x20c/0x6e8)

 r8:8021 r7:cf5bb000 r6: r5:0040 r4:8021

[] (do_mount+0x0/0x6e8) from []
(sys_mount+0x8c/0xd4)

[] (sys_mount+0x0/0xd4) from []
(ret_fast_syscall+0x0/0x2c)

 r7:0015 r6:be964cbc r5:8021 r4:

Code: e24cb004 e5b0208c ea0c e592300c (e5931008)

---[ end trace d4fec1d8aecbb54d ]---

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [RFC PATCH] adding support for setting bus parameters in sub device

2009-06-17 Thread Hans Verkuil
On Wednesday 17 June 2009 17:43:42 m-kariche...@ti.com wrote:
> From: Muralidharan Karicheri 
>
> This patch adds support for setting bus parameters such as bus type
> (Raw Bayer or Raw YUV image data bus), bus width (example 10 bit raw
> image data bus, 10 bit BT.656 etc.), and polarities (vsync, hsync, field
> etc) in sub device. This allows bridge driver to configure the sub device
> bus for a specific set of bus parameters through s_bus() function call.
> This also can be used to define platform specific bus parameters for
> host and sub-devices.
>
> Reviewed by: Hans Verkuil 
> Signed-off-by: Murali Karicheri 
> ---
> Applies to v4l-dvb repository
>
>  include/media/v4l2-subdev.h |   40
>  1 files changed, 40
> insertions(+), 0 deletions(-)
>
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 1785608..2f5ec98 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -37,6 +37,43 @@ struct v4l2_decode_vbi_line {
>   u32 type;   /* VBI service type (V4L2_SLICED_*). 0 if no 
> service found
> */ };
>
> +/*
> + * Some sub-devices are connected to the host/bridge device through a
> bus that + * carries the clock, vsync, hsync and data. Some interfaces
> such as BT.656 + * carries the sync embedded in the data where as others
> have separate line + * carrying the sync signals. The structure below is
> used to define bus + * configuration parameters for host as well as
> sub-device
> + */
> +enum v4l2_subdev_bus_type {
> + /* Raw YUV image data bus */
> + V4L2_SUBDEV_BUS_RAW_YUV,
> + /* Raw Bayer image data bus */
> + V4L2_SUBDEV_BUS_RAW_BAYER
> +};

Remove the _subdev prefix from the enum above.

> +
> +struct v4l2_bus_settings {
> + /* yuv or bayer image data bus */
> + enum v4l2_subdev_bus_type type;
> + /* subdev bus width */
> + u8 subdev_width;
> + /* host bus width */
> + u8 host_width;
> + /* embedded sync, set this when sync is embedded in the data stream */
> + unsigned embedded_sync:1;
> + /* master or slave */
> + unsigned host_is_master:1;
> + /* 0 - active low, 1 - active high */
> + unsigned pol_vsync:1;
> + /* 0 - active low, 1 - active high */
> + unsigned pol_hsync:1;
> + /* 0 - low to high , 1 - high to low */
> + unsigned pol_field:1;
> + /* 0 - sample at falling edge , 1 - sample at rising edge */
> + unsigned pol_pclock:1;

I'm not sure whether the pol_ prefix is correct here. Perhaps edge_pclock is 
a more appropriate name.

Regards,

Hans

> + /* 0 - active low , 1 - active high */
> + unsigned pol_data:1;
> +};
> +
>  /* Sub-devices are devices that are connected somehow to the main bridge
> device. These devices are usually audio/video
> muxers/encoders/decoders or sensors and webcam controllers.
> @@ -199,6 +236,8 @@ struct v4l2_subdev_audio_ops {
>
> s_routing: see s_routing in audio_ops, except this version is for
> video devices.
> +
> +   s_bus: set bus parameters in sub device to configure the bus
>   */
>  struct v4l2_subdev_video_ops {
>   int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32
> config); @@ -219,6 +258,7 @@ struct v4l2_subdev_video_ops {
>   int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
>   int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum
> *fsize); int (*enum_frameintervals)(struct v4l2_subdev *sd, struct
> v4l2_frmivalenum *fival); +   int (*s_bus)(struct v4l2_subdev *sd, const
> struct v4l2_bus_settings *bus); };
>
>  struct v4l2_subdev_ops {



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


Re: [PATCH 1/10 - v2] vpfe capture bridge driver for DM355 and DM6446

2009-06-17 Thread Hans Verkuil
On Wednesday 17 June 2009 17:02:01 Karicheri, Muralidharan wrote:
> >> 
> >
> >Can you post your latest proposal for the s_bus op?
> >
> >I propose a few changes: the name of the struct should be something like
> >v4l2_bus_settings, the master/slave bit should be renamed to something
> >like 'host_is_master', and we should have two widths: subdev_width and
> >host_width.
> >
> >That way the same structure can be used for both host and subdev, unless
> >some of the polarities are inverted. In that case you need to make two
> >structs, one for host and one for the subdev.
> >
> >It is possible to add info on inverters to the struct, but unless
> > inverters are used a lot more frequently than I expect I am inclined
> > not to do that at this time.
>
> [MK]Today I am planning to send my v3 version of the vpfe capture patch
> and also tvp514x patch since Vaibhav is pre-occupied with some other
> activities. I have discussed the changes with Vaibhav for this driver.
>
> For s_bus, I will try if I can send a patch today. BTW, do you expect me
> to add one bool for active high, one for active low etc as done in SoC
> camera ?

Since I remain opposed to autonegotiation, there is IMO no need for this.

Regards,

Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [RFC PATCH] adding support for setting bus parameters in sub device

2009-06-17 Thread Karicheri, Muralidharan
Hans,

Let me know if this has all changes that you are expecting. This is just for 
review. I will send the final one against the latest v4l-dvb kernel tree.

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
email: m-kariche...@ti.com

>-Original Message-
>From: Karicheri, Muralidharan
>Sent: Wednesday, June 17, 2009 11:44 AM
>To: linux-me...@vger.kernel.org
>Cc: davinci-linux-open-source@linux.davincidsp.com; Muralidharan Karicheri;
>Karicheri, Muralidharan
>Subject: [RFC PATCH] adding support for setting bus parameters in sub
>device
>
>From: Muralidharan Karicheri 
>
>This patch adds support for setting bus parameters such as bus type
>(Raw Bayer or Raw YUV image data bus), bus width (example 10 bit raw
>image data bus, 10 bit BT.656 etc.), and polarities (vsync, hsync, field
>etc) in sub device. This allows bridge driver to configure the sub device
>bus for a specific set of bus parameters through s_bus() function call.
>This also can be used to define platform specific bus parameters for
>host and sub-devices.
>
>Reviewed by: Hans Verkuil 
>Signed-off-by: Murali Karicheri 
>---
>Applies to v4l-dvb repository
>
> include/media/v4l2-subdev.h |   40
>
> 1 files changed, 40 insertions(+), 0 deletions(-)
>
>diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
>index 1785608..2f5ec98 100644
>--- a/include/media/v4l2-subdev.h
>+++ b/include/media/v4l2-subdev.h
>@@ -37,6 +37,43 @@ struct v4l2_decode_vbi_line {
>   u32 type;   /* VBI service type (V4L2_SLICED_*). 0 if no
>service found */
> };
>
>+/*
>+ * Some sub-devices are connected to the host/bridge device through a bus
>that
>+ * carries the clock, vsync, hsync and data. Some interfaces such as
>BT.656
>+ * carries the sync embedded in the data where as others have separate
>line
>+ * carrying the sync signals. The structure below is used to define bus
>+ * configuration parameters for host as well as sub-device
>+ */
>+enum v4l2_subdev_bus_type {
>+  /* Raw YUV image data bus */
>+  V4L2_SUBDEV_BUS_RAW_YUV,
>+  /* Raw Bayer image data bus */
>+  V4L2_SUBDEV_BUS_RAW_BAYER
>+};
>+
>+struct v4l2_bus_settings {
>+  /* yuv or bayer image data bus */
>+  enum v4l2_subdev_bus_type type;
>+  /* subdev bus width */
>+  u8 subdev_width;
>+  /* host bus width */
>+  u8 host_width;
>+  /* embedded sync, set this when sync is embedded in the data stream
>*/
>+  unsigned embedded_sync:1;
>+  /* master or slave */
>+  unsigned host_is_master:1;
>+  /* 0 - active low, 1 - active high */
>+  unsigned pol_vsync:1;
>+  /* 0 - active low, 1 - active high */
>+  unsigned pol_hsync:1;
>+  /* 0 - low to high , 1 - high to low */
>+  unsigned pol_field:1;
>+  /* 0 - sample at falling edge , 1 - sample at rising edge */
>+  unsigned pol_pclock:1;
>+  /* 0 - active low , 1 - active high */
>+  unsigned pol_data:1;
>+};
>+
> /* Sub-devices are devices that are connected somehow to the main bridge
>device. These devices are usually audio/video muxers/encoders/decoders
>or
>sensors and webcam controllers.
>@@ -199,6 +236,8 @@ struct v4l2_subdev_audio_ops {
>
>s_routing: see s_routing in audio_ops, except this version is for video
>   devices.
>+
>+   s_bus: set bus parameters in sub device to configure the bus
>  */
> struct v4l2_subdev_video_ops {
>   int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32
>config);
>@@ -219,6 +258,7 @@ struct v4l2_subdev_video_ops {
>   int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
>   int (*enum_framesizes)(struct v4l2_subdev *sd, struct
>v4l2_frmsizeenum *fsize);
>   int (*enum_frameintervals)(struct v4l2_subdev *sd, struct
>v4l2_frmivalenum *fival);
>+  int (*s_bus)(struct v4l2_subdev *sd, const struct v4l2_bus_settings
>*bus);
> };
>
> struct v4l2_subdev_ops {
>--
>1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[RFC PATCH] adding support for setting bus parameters in sub device

2009-06-17 Thread m-karicheri2
From: Muralidharan Karicheri 

This patch adds support for setting bus parameters such as bus type
(Raw Bayer or Raw YUV image data bus), bus width (example 10 bit raw
image data bus, 10 bit BT.656 etc.), and polarities (vsync, hsync, field
etc) in sub device. This allows bridge driver to configure the sub device
bus for a specific set of bus parameters through s_bus() function call.
This also can be used to define platform specific bus parameters for
host and sub-devices.

Reviewed by: Hans Verkuil 
Signed-off-by: Murali Karicheri 
---
Applies to v4l-dvb repository

 include/media/v4l2-subdev.h |   40 
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 1785608..2f5ec98 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -37,6 +37,43 @@ struct v4l2_decode_vbi_line {
u32 type;   /* VBI service type (V4L2_SLICED_*). 0 if no 
service found */
 };
 
+/*
+ * Some sub-devices are connected to the host/bridge device through a bus that
+ * carries the clock, vsync, hsync and data. Some interfaces such as BT.656
+ * carries the sync embedded in the data where as others have separate line
+ * carrying the sync signals. The structure below is used to define bus 
+ * configuration parameters for host as well as sub-device
+ */
+enum v4l2_subdev_bus_type {
+   /* Raw YUV image data bus */
+   V4L2_SUBDEV_BUS_RAW_YUV,
+   /* Raw Bayer image data bus */
+   V4L2_SUBDEV_BUS_RAW_BAYER
+};
+
+struct v4l2_bus_settings {
+   /* yuv or bayer image data bus */
+   enum v4l2_subdev_bus_type type;
+   /* subdev bus width */
+   u8 subdev_width;
+   /* host bus width */
+   u8 host_width;
+   /* embedded sync, set this when sync is embedded in the data stream */
+   unsigned embedded_sync:1;
+   /* master or slave */
+   unsigned host_is_master:1;
+   /* 0 - active low, 1 - active high */
+   unsigned pol_vsync:1;
+   /* 0 - active low, 1 - active high */
+   unsigned pol_hsync:1;
+   /* 0 - low to high , 1 - high to low */
+   unsigned pol_field:1;
+   /* 0 - sample at falling edge , 1 - sample at rising edge */
+   unsigned pol_pclock:1;
+   /* 0 - active low , 1 - active high */
+   unsigned pol_data:1;
+};
+
 /* Sub-devices are devices that are connected somehow to the main bridge
device. These devices are usually audio/video muxers/encoders/decoders or
sensors and webcam controllers.
@@ -199,6 +236,8 @@ struct v4l2_subdev_audio_ops {
 
s_routing: see s_routing in audio_ops, except this version is for video
devices.
+
+   s_bus: set bus parameters in sub device to configure the bus 
  */
 struct v4l2_subdev_video_ops {
int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 
config);
@@ -219,6 +258,7 @@ struct v4l2_subdev_video_ops {
int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum 
*fsize);
int (*enum_frameintervals)(struct v4l2_subdev *sd, struct 
v4l2_frmivalenum *fival);
+   int (*s_bus)(struct v4l2_subdev *sd, const struct v4l2_bus_settings 
*bus);
 };
 
 struct v4l2_subdev_ops {
-- 
1.6.0.4

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH 1/10 - v2] vpfe capture bridge driver for DM355 and DM6446

2009-06-17 Thread Karicheri, Muralidharan
>>
>> 
>
>Can you post your latest proposal for the s_bus op?
>
>I propose a few changes: the name of the struct should be something like
>v4l2_bus_settings, the master/slave bit should be renamed to something
>like 'host_is_master', and we should have two widths: subdev_width and
>host_width.
>
>That way the same structure can be used for both host and subdev, unless
>some of the polarities are inverted. In that case you need to make two
>structs, one for host and one for the subdev.
>
>It is possible to add info on inverters to the struct, but unless inverters
>are used a lot more frequently than I expect I am inclined not to do that
>at this time.
>
[MK]Today I am planning to send my v3 version of the vpfe capture patch and 
also tvp514x patch since Vaibhav is pre-occupied with some other activities. I 
have discussed the changes with Vaibhav for this driver.

For s_bus, I will try if I can send a patch today. BTW, do you expect me to add 
one bool for active high, one for active low etc as done in SoC camera ?

Murali 
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


[Resend] [PATCH] Frame Buffer driver for DA8XX

2009-06-17 Thread Rajashekhara, Sudhakar
Reseding the same patch with additional Signed-off information.

Adds LCD controller (LCDC) driver for TI's DA8xx/OMAP-L1xx architecture.
LCDC specifications can be found at http://www.ti.com/litv/pdf/sprufm0a.

LCDC on DA8xx consists of two independent controllers, the Raster Controller
and the LCD Interface Display Driver (LIDD) controller. LIDD further supports
character and graphic displays.

This patch adds support for the graphic display (Sharp LQ035Q3DG01) found on
the DA830 based EVM. The EVM details can be found at:
http://support.spectrumdigital.com/boards/dskda830/revc/.

Signed-off-by: Sudhakar Rajashekhara 
Signed-off-by: Pavel Kiryukhin 
Signed-off-by: Steve Chen 
---
 drivers/video/Kconfig|   11 +
 drivers/video/Makefile   |1 +
 drivers/video/da8xx-fb.c |  964 ++
 include/linux/da8xx-fb.h |  106 +
 4 files changed, 1082 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/da8xx-fb.c
 create mode 100644 include/linux/da8xx-fb.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 693fb4e..fc0c191 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1984,6 +1984,17 @@ config FB_DAVINCI
  hardware found on the TI DaVinci EVM.  If
  unsure, say N.
 
+config FB_DA8XX
+tristate "DA8xx/OMAP-L1xx Framebuffer support"
+depends on FB && ARCH_DAVINCI_DA830
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   ---help---
+  This is the frame buffer device driver for the TI LCD controller
+ found on DA8xx/OMAP-L1xx SoCs.
+  If unsure, say N.
+
 config FB_VIRTUAL
tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
depends on FB
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 902d199..e7a3e7d 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -136,6 +136,7 @@ obj-$(CONFIG_FB_BF54X_LQ043)  += bf54x-lq043fb.o
 obj-$(CONFIG_FB_BFIN_T350MCQB)   += bfin-t350mcqb-fb.o
 obj-$(CONFIG_FB_MX3) += mx3fb.o
 obj-$(CONFIG_FB_DAVINCI) += davincifb.o
+obj-$(CONFIG_FB_DA8XX)   += da8xx-fb.o
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)  += vfb.o
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
new file mode 100644
index 000..5e3b861
--- /dev/null
+++ b/drivers/video/da8xx-fb.c
@@ -0,0 +1,964 @@
+/*
+ * Copyright (C) 2008-2009 MontaVista Software Inc.
+ * Copyright (C) 2008-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "da8xx_lcdc"
+
+/* LCD Status Register */
+#define LCD_END_OF_FRAME0  BIT(8)
+#define LCD_FIFO_UNDERFLOW BIT(5)
+#define LCD_SYNC_LOST  BIT(2)
+
+/* LCD DMA Control Register */
+#define LCD_DMA_BURST_SIZE(x)  ((x) << 4)
+#define LCD_DMA_BURST_10x0
+#define LCD_DMA_BURST_20x1
+#define LCD_DMA_BURST_40x2
+#define LCD_DMA_BURST_80x3
+#define LCD_DMA_BURST_16   0x4
+#define LCD_END_OF_FRAME_INT_ENA   BIT(2)
+#define LCD_DUAL_FRAME_BUFFER_ENABLE   BIT(0)
+
+/* LCD Control Register */
+#define LCD_CLK_DIVISOR(x) ((x) << 8)
+#define LCD_RASTER_MODE0x01
+
+/* LCD Raster Control Register */
+#define LCD_PALETTE_LOAD_MODE(x)   ((x) << 20)
+#define PALETTE_AND_DATA   0x00
+#define PALETTE_ONLY   0x01
+
+#define LCD_MONO_8BIT_MODE BIT(9)
+#define LCD_RASTER_ORDER   BIT(8)
+#define LCD_TFT_MODE   BIT(7)
+#define LCD_UNDERFLOW_INT_ENA  BIT(6)
+#define LCD_MONOCHROME_MODEBIT(1)
+#define LCD_RASTER_ENABLE  BIT(0)
+#define LCD_TFT_ALT_ENABLE BIT(23)
+#define LCD_STN_565_ENABLE BIT(24)
+
+/* LCD Raster Timing 2 Register */
+#define LCD_AC_BIAS_TRANSITIONS_PER_INT(x) ((x) << 16)
+#define LCD_AC_BIAS_FREQUENCY(x)   ((x) << 8)
+#define LCD_SYNC_CTRL  BIT(25)
+#define LCD_

[PATCH] Frame Buffer driver for DA8XX

2009-06-17 Thread Rajashekhara, Sudhakar
Adds LCD controller (LCDC) driver for TI's DA8xx/OMAP-L1xx architecture.
LCDC specifications can be found at http://www.ti.com/litv/pdf/sprufm0a.

LCDC on DA8xx consists of two independent controllers, the Raster Controller
and the LCD Interface Display Driver (LIDD) controller. LIDD further supports
character and graphic displays.

This patch adds support for the graphic display (Sharp LQ035Q3DG01) found on
the DA830 based EVM. The EVM details can be found at:
http://support.spectrumdigital.com/boards/dskda830/revc/.

Signed-off-by: Sudhakar Rajashekhara 
---
 drivers/video/Kconfig|   11 +
 drivers/video/Makefile   |1 +
 drivers/video/da8xx-fb.c |  964 ++
 include/linux/da8xx-fb.h |  106 +
 4 files changed, 1082 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/da8xx-fb.c
 create mode 100644 include/linux/da8xx-fb.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 693fb4e..fc0c191 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1984,6 +1984,17 @@ config FB_DAVINCI
  hardware found on the TI DaVinci EVM.  If
  unsure, say N.
 
+config FB_DA8XX
+tristate "DA8xx/OMAP-L1xx Framebuffer support"
+depends on FB && ARCH_DAVINCI_DA830
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   ---help---
+  This is the frame buffer device driver for the TI LCD controller
+ found on DA8xx/OMAP-L1xx SoCs.
+  If unsure, say N.
+
 config FB_VIRTUAL
tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
depends on FB
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 902d199..e7a3e7d 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -136,6 +136,7 @@ obj-$(CONFIG_FB_BF54X_LQ043)  += bf54x-lq043fb.o
 obj-$(CONFIG_FB_BFIN_T350MCQB)   += bfin-t350mcqb-fb.o
 obj-$(CONFIG_FB_MX3) += mx3fb.o
 obj-$(CONFIG_FB_DAVINCI) += davincifb.o
+obj-$(CONFIG_FB_DA8XX)   += da8xx-fb.o
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)  += vfb.o
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
new file mode 100644
index 000..5e3b861
--- /dev/null
+++ b/drivers/video/da8xx-fb.c
@@ -0,0 +1,964 @@
+/*
+ * Copyright (C) 2008-2009 MontaVista Software Inc.
+ * Copyright (C) 2008-2009 Texas Instruments 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "da8xx_lcdc"
+
+/* LCD Status Register */
+#define LCD_END_OF_FRAME0  BIT(8)
+#define LCD_FIFO_UNDERFLOW BIT(5)
+#define LCD_SYNC_LOST  BIT(2)
+
+/* LCD DMA Control Register */
+#define LCD_DMA_BURST_SIZE(x)  ((x) << 4)
+#define LCD_DMA_BURST_10x0
+#define LCD_DMA_BURST_20x1
+#define LCD_DMA_BURST_40x2
+#define LCD_DMA_BURST_80x3
+#define LCD_DMA_BURST_16   0x4
+#define LCD_END_OF_FRAME_INT_ENA   BIT(2)
+#define LCD_DUAL_FRAME_BUFFER_ENABLE   BIT(0)
+
+/* LCD Control Register */
+#define LCD_CLK_DIVISOR(x) ((x) << 8)
+#define LCD_RASTER_MODE0x01
+
+/* LCD Raster Control Register */
+#define LCD_PALETTE_LOAD_MODE(x)   ((x) << 20)
+#define PALETTE_AND_DATA   0x00
+#define PALETTE_ONLY   0x01
+
+#define LCD_MONO_8BIT_MODE BIT(9)
+#define LCD_RASTER_ORDER   BIT(8)
+#define LCD_TFT_MODE   BIT(7)
+#define LCD_UNDERFLOW_INT_ENA  BIT(6)
+#define LCD_MONOCHROME_MODEBIT(1)
+#define LCD_RASTER_ENABLE  BIT(0)
+#define LCD_TFT_ALT_ENABLE BIT(23)
+#define LCD_STN_565_ENABLE BIT(24)
+
+/* LCD Raster Timing 2 Register */
+#define LCD_AC_BIAS_TRANSITIONS_PER_INT(x) ((x) << 16)
+#define LCD_AC_BIAS_FREQUENCY(x)   ((x) << 8)
+#define LCD_SYNC_CTRL  BIT(25)
+#define LCD_SYNC_EDGE  BIT(24)
+#define LCD_INVERT_PIXEL_CLOCK BIT(22)
+#define LCD_INVERT_LINE_

[PATCH] TI DaVinci EMAC : Fix rmmod error

2009-06-17 Thread Chaithrika U S
clk_disable was called twice in the remove function.
Correct this so that the driver module unloads without error.

Signed-off-by: Chaithrika U S 
---
Applies to Linus' kernel tree

 drivers/net/davinci_emac.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 0e9b9f9..2df8fb0 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2767,7 +2767,6 @@ static int __devexit davinci_emac_remove(struct 
platform_device *pdev)
 
dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n");
 
-   clk_disable(emac_clk);
platform_set_drvdata(pdev, NULL);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mdiobus_unregister(priv->mii_bus);
-- 
1.5.6

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: Re: DM6467 - Encoding in 1080i with DMAI

2009-06-17 Thread Robert Chen

We figured out the issue (turned out to be a buffer management
issue).  


  -Robert


-Original Message-
From: Robert Chen 
Sent: Tuesday, June 16, 2009 6:34 AM
To: 'davinci-linux-open-source@linux.davincidsp.com'
Subject: Re: DM6467 - Encoding in 1080i with DMAI


This is a follow-up to Marcelo's e-mail on this subject from 3/2/2009.

In subsequent discussion with TI we confirmed that the likely reason this 
didn't work was that the codec itself did not support 1080i encode.  For this 
reason, there are checks in the demo code that make sure > 720p is not allowed.

We did verify that Mahendra's changes do enable 1080i capture on our setup 
(thank you very much, Mahendra!).  Now we are running into a different issue -- 
it seems that the 1080i capture is running no faster than 15fps (even though 
the encoder we are running it with does run at > 15fps for 1080i).

We are in the process of trying to figure out if this is something inherent in 
the video driver or maybe something in the way the demo works.  Before diving 
into the ioctl code in davincihd_capture.c in the drivers directory, I thought 
I'd check to see if anyone else has run into this issue (or, alternately, were 
you able to get 30fps through these changes?).  

We are using DVSDK 2.00.01.15 for HD DaVinci (and the DMAI 1.18.00.01 that 
comes with it). 

If anyone has any thoughts / can shed some light on this, please let me know.  
Thank you!


 Sincerely,

 Robert Chen




Re: DM6467 - Encoding in 1080i with DMAI Marcelo Guedes Silva Mon, 02 Mar 2009 
11:29:13 -0800

Hi, it didn´t work.
I ran the new loadmodules.sh and received this message:

r...@10.0.0.100:/opt/dvsdk# ./loadmodules.sh
> ioremap_nocache(0x8780, 69206016)=0xc808 allocated heap buffer 
> 0xc808 of size 0x239000 cmem initialized 5 pools between 
> 0x8780 and 0x8ba0 DSPLINK Module (1.50) created on Date: Jan
> 3 2008 Time: 13:16:55
>

Seems to be right, but when I tried to run the encode program (with the 
modified capture.c), I received this error:

r...@10.0.0.100:/opt/dvsdk# ./encode -a audio.aac -v video.264
> Encode demo started.
> Error: Failed to create h264 video encoder


--

___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source