davinci: DM355 - platform changes for vpfe capture
authorMuralidharan Karicheri <m-karicheri2@ti.com>
Wed, 16 Sep 2009 16:02:50 +0000 (12:02 -0400)
committerKevin Hilman <khilman@deeprootsystems.com>
Wed, 16 Sep 2009 17:25:45 +0000 (10:25 -0700)
DM355 platform and board setup

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

Tested video capture on DM355 using tvp514x

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Reviewed-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/include/mach/dm355.h
arch/arm/mach-davinci/include/mach/mux.h

index 9f25fd8..77e8067 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/clk.h>
+#include <linux/videodev2.h>
+#include <media/tvp514x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
 
@@ -136,11 +138,11 @@ static void dm355evm_mmcsd_gpios(unsigned gpio)
 }
 
 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 */ },
+       },
+       /* { plus irq  }, */
        { I2C_BOARD_INFO("tlv320aic33", 0x1b), },
-       /* { I2C_BOARD_INFO("tvp5146", 0x5d), }, */
 };
 
 static void __init evm_init_i2c(void)
@@ -179,6 +181,72 @@ static struct platform_device dm355evm_dm9000 = {
        .num_resources  = ARRAY_SIZE(dm355evm_dm9000_rsrc),
 };
 
+static struct tvp514x_platform_data tvp5146_pdata = {
+       .clk_polarity = 0,
+       .hs_polarity = 1,
+       .vs_polarity = 1
+};
+
+#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,
+               },
+               .board_info = {
+                       I2C_BOARD_INFO("tvp5146", 0x5d),
+                       .platform_data = &tvp5146_pdata,
+               },
+       }
+};
+
+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,
@@ -190,6 +258,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();
 }
 
index 4f42169..0596700 100644 (file)
@@ -488,6 +488,14 @@ MUX_CFG(DM355,     VOUT_FIELD_G70, 1,   18,    3,    0,     false)
 MUX_CFG(DM355, VOUT_HVSYNC,    1,   16,    1,    0,     false)
 MUX_CFG(DM355, VOUT_COUTL_EN,  1,   0,     0xff, 0x55,  false)
 MUX_CFG(DM355, VOUT_COUTH_EN,  1,   8,     0xff, 0x55,  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,    0,   0,   0xff, 0x55,    false)
+MUX_CFG(DM355, VIN_CINH_EN,    0,   8,     3,    3,     false)
 #endif
 };
 
@@ -659,6 +667,67 @@ static struct platform_device dm355_asp1_device = {
        .resource       = dm355_asp1_resources,
 };
 
+static struct resource dm355_vpss_resources[] = {
+       {
+               /* VPSS BL Base address */
+               .name           = "vpss",
+               .start          = 0x01c70800,
+               .end            = 0x01c70800 + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               /* VPSS CLK Base address */
+               .name           = "vpss",
+               .start          = 0x01c70000,
+               .end            = 0x01c70000 + 0xf,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm355_vpss_device = {
+       .name                   = "vpss",
+       .id                     = -1,
+       .dev.platform_data      = "dm355_vpss",
+       .num_resources          = ARRAY_SIZE(dm355_vpss_resources),
+       .resource               = dm355_vpss_resources,
+};
+
+static struct resource vpfe_resources[] = {
+       {
+               .start          = IRQ_VDINT0,
+               .end            = IRQ_VDINT0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = IRQ_VDINT1,
+               .end            = IRQ_VDINT1,
+               .flags          = IORESOURCE_IRQ,
+       },
+       /* CCDC Base address */
+       {
+               .flags          = IORESOURCE_MEM,
+               .start          = 0x01c70600,
+               .end            = 0x01c70600 + 0x1ff,
+       },
+};
+
+static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct platform_device vpfe_capture_dev = {
+       .name           = CAPTURE_DRV_NAME,
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(vpfe_resources),
+       .resource       = vpfe_resources,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void dm355_set_vpfe_config(struct vpfe_config *cfg)
+{
+       vpfe_capture_dev.dev.platform_data = cfg;
+}
+
 /*----------------------------------------------------------------------*/
 
 static struct map_desc dm355_io_desc[] = {
@@ -792,6 +861,20 @@ static int __init dm355_init_devices(void)
 
        davinci_cfg_reg(DM355_INT_EDMA_CC);
        platform_device_register(&dm355_edma_device);
+       platform_device_register(&dm355_vpss_device);
+       /*
+        * setup Mux configuration for vpfe input and register
+        * vpfe capture platform device
+        */
+       davinci_cfg_reg(DM355_VIN_PCLK);
+       davinci_cfg_reg(DM355_VIN_CAM_WEN);
+       davinci_cfg_reg(DM355_VIN_CAM_VD);
+       davinci_cfg_reg(DM355_VIN_CAM_HD);
+       davinci_cfg_reg(DM355_VIN_YIN_EN);
+       davinci_cfg_reg(DM355_VIN_CINL_EN);
+       davinci_cfg_reg(DM355_VIN_CINH_EN);
+       platform_device_register(&vpfe_capture_dev);
+
        return 0;
 }
 postcore_initcall(dm355_init_devices);
index 03faaef..85536d8 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <mach/hardware.h>
 #include <mach/asp.h>
+#include <media/davinci/vpfe_capture.h>
 
 #define ASP1_TX_EVT_EN 1
 #define ASP1_RX_EVT_EN 2
@@ -23,5 +24,6 @@ void __init dm355_init(void);
 void dm355_init_spi0(unsigned chipselect_mask,
                struct spi_board_info *info, unsigned len);
 void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
+void dm355_set_vpfe_config(struct vpfe_config *cfg);
 
 #endif /* __ASM_ARCH_DM355_H */
index 7732832..bb84893 100644 (file)
@@ -161,6 +161,15 @@ enum davinci_dm355_index {
        DM355_VOUT_HVSYNC,
        DM355_VOUT_COUTL_EN,
        DM355_VOUT_COUTH_EN,
+
+       /* Video In Pin Mux */
+       DM355_VIN_PCLK,
+       DM355_VIN_CAM_WEN,
+       DM355_VIN_CAM_VD,
+       DM355_VIN_CAM_HD,
+       DM355_VIN_YIN_EN,
+       DM355_VIN_CINL_EN,
+       DM355_VIN_CINH_EN,
 };
 
 enum davinci_dm365_index {