blackfin: bf561: add adv7183 capture support
authorBob Liu <lliubbo@gmail.com>
Thu, 5 Jan 2012 03:11:20 +0000 (11:11 +0800)
committerBob Liu <lliubbo@gmail.com>
Mon, 9 Jan 2012 02:26:17 +0000 (10:26 +0800)
Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
arch/blackfin/mach-bf561/boards/ezkit.c

index c60638fb2e0138160e426fb1486549564f5ad7be..838978808a15a4414410301b2ba464604eae5f36 100644 (file)
@@ -422,6 +422,96 @@ static struct platform_device bfin_dpmc = {
        },
 };
 
+#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_PPI0,
+       .irq_err = IRQ_PPI1_ERROR,
+       .base = (void __iomem *)PPI0_CONTROL,
+       .pin_req = ppi_req,
+};
+
+#if defined(CONFIG_VIDEO_ADV7183) \
+       || defined(CONFIG_VIDEO_ADV7183_MODULE)
+#include <media/adv7183.h>
+static struct v4l2_input adv7183_inputs[] = {
+       {
+               .index = 0,
+               .name = "Composite",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = V4L2_STD_ALL,
+       },
+       {
+               .index = 1,
+               .name = "S-Video",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = V4L2_STD_ALL,
+       },
+       {
+               .index = 2,
+               .name = "Component",
+               .type = V4L2_INPUT_TYPE_CAMERA,
+               .std = V4L2_STD_ALL,
+       },
+};
+
+static struct bcap_route adv7183_routes[] = {
+       {
+               .input = ADV7183_COMPOSITE4,
+               .output = ADV7183_8BIT_OUT,
+       },
+       {
+               .input = ADV7183_SVIDEO0,
+               .output = ADV7183_8BIT_OUT,
+       },
+       {
+               .input = ADV7183_COMPONENT0,
+               .output = ADV7183_8BIT_OUT,
+       },
+};
+
+
+static const unsigned adv7183_gpio[] = {
+       GPIO_PF13, /* reset pin */
+       GPIO_PF2,  /* output enable pin */
+};
+
+static struct bfin_capture_config bfin_capture_data = {
+       .card_name = "BF561",
+       .inputs = adv7183_inputs,
+       .num_inputs = ARRAY_SIZE(adv7183_inputs),
+       .routes = adv7183_routes,
+       .i2c_adapter_id = 0,
+       .board_info = {
+               .type = "adv7183",
+               .addr = 0x20,
+               .platform_data = (void *)adv7183_gpio,
+       },
+       .ppi_info = &ppi_info,
+       .ppi_control = (PACK_EN | DLEN_8 | DMA32 | FLD_SEL),
+};
+#endif
+
+static struct platform_device bfin_capture_device = {
+       .name = "bfin_capture",
+       .dev = {
+               .platform_data = &bfin_capture_data,
+       },
+};
+#endif
+
 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
 static struct platform_device bfin_i2s = {
        .name = "bfin-i2s",
@@ -494,6 +584,11 @@ static struct platform_device *ezkit_devices[] __initdata = {
        &ezkit_flash_device,
 #endif
 
+#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
+       || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
+       &bfin_capture_device,
+#endif
+
 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
        &bfin_i2s,
 #endif