blackfin: bf537: add capture support
Bob Liu [Thu, 5 Jan 2012 03:08:30 +0000 (11:08 +0800)]
Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>

arch/blackfin/mach-bf537/boards/stamp.c

index 1b34466..2221173 100644 (file)
@@ -1558,6 +1558,71 @@ static struct platform_device bfin_lq035q1_device = {
 };
 #endif
 
+#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
+       || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
+#include <linux/videodev2.h>
+#include <media/blackfin/bfin_capture.h>
+#include <media/blackfin/ppi.h>
+
+static const unsigned short ppi_req[] = {
+       P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
+       P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
+       P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
+       0,
+};
+
+static const struct ppi_info ppi_info = {
+       .type = PPI_TYPE_PPI,
+       .dma_ch = CH_PPI,
+       .irq_err = IRQ_PPI_ERROR,
+       .base = (void __iomem *)PPI_CONTROL,
+       .pin_req = ppi_req,
+};
+
+#if defined(CONFIG_VIDEO_VS6624) \
+       || defined(CONFIG_VIDEO_VS6624_MODULE)
+static struct v4l2_input vs6624_inputs[] = {
+       {
+               .index = 0,
+               .name = "Camera",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = V4L2_STD_UNKNOWN,
+       },
+};
+
+static struct bcap_route vs6624_routes[] = {
+       {
+               .input = 0,
+               .output = 0,
+       },
+};
+
+static const unsigned vs6624_ce_pin = GPIO_PF10;
+
+static struct bfin_capture_config bfin_capture_data = {
+       .card_name = "BF537",
+       .inputs = vs6624_inputs,
+       .num_inputs = ARRAY_SIZE(vs6624_inputs),
+       .routes = vs6624_routes,
+       .i2c_adapter_id = 0,
+       .board_info = {
+               .type = "vs6624",
+               .addr = 0x10,
+               .platform_data = (void *)&vs6624_ce_pin,
+       },
+       .ppi_info = &ppi_info,
+       .ppi_control = (PACK_EN | DLEN_8 | XFR_TYPE | 0x0020),
+};
+#endif
+
+static struct platform_device bfin_capture_device = {
+       .name = "bfin_capture",
+       .dev = {
+               .platform_data = &bfin_capture_data,
+       },
+};
+#endif
+
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 #ifdef CONFIG_SERIAL_BFIN_UART0
 static struct resource bfin_uart0_resources[] = {
@@ -2733,6 +2798,11 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_lq035q1_device,
 #endif
 
+#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
+       || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
+       &bfin_capture_device,
+#endif
+
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 #ifdef CONFIG_SERIAL_BFIN_UART0
        &bfin_uart0_device,