diff options
author | Magnus Damm <damm@opensource.se> | 2010-12-22 09:47:40 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-05 03:04:33 -0500 |
commit | ae37c8de74734f640f757be64ddb85f19f042626 (patch) | |
tree | 668ea3ae416fa2b9102392080b8212f13d9cab35 /arch/arm/mach-shmobile/board-mackerel.c | |
parent | 354e4157d9e1529cf71c7041a22fde2fd113642b (diff) |
ARM: mach-shmobile: Mackerel VGA camera support
Add VGA camera support to the Mackerel board
using soc_camera_platform.
The VGA camera module is hooked up using the
8-bit CEU bus, and it is constantly bursting
out frames in fixed video mode setting. The
camera module does not allow any I2C control.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-mackerel.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 126 |
1 files changed, 125 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index c0d18cb74a98..cbaf840e00ed 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -44,7 +44,9 @@ | |||
44 | #include <linux/usb/r8a66597.h> | 44 | #include <linux/usb/r8a66597.h> |
45 | 45 | ||
46 | #include <video/sh_mobile_lcdc.h> | 46 | #include <video/sh_mobile_lcdc.h> |
47 | 47 | #include <media/sh_mobile_ceu.h> | |
48 | #include <media/soc_camera.h> | ||
49 | #include <media/soc_camera_platform.h> | ||
48 | #include <sound/sh_fsi.h> | 50 | #include <sound/sh_fsi.h> |
49 | 51 | ||
50 | #include <mach/common.h> | 52 | #include <mach/common.h> |
@@ -595,6 +597,111 @@ static struct platform_device sh_mmcif_device = { | |||
595 | .resource = sh_mmcif_resources, | 597 | .resource = sh_mmcif_resources, |
596 | }; | 598 | }; |
597 | 599 | ||
600 | |||
601 | static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev); | ||
602 | static void mackerel_camera_del(struct soc_camera_link *icl); | ||
603 | |||
604 | static int camera_set_capture(struct soc_camera_platform_info *info, | ||
605 | int enable) | ||
606 | { | ||
607 | return 0; /* camera sensor always enabled */ | ||
608 | } | ||
609 | |||
610 | static struct soc_camera_platform_info camera_info = { | ||
611 | .format_name = "UYVY", | ||
612 | .format_depth = 16, | ||
613 | .format = { | ||
614 | .code = V4L2_MBUS_FMT_UYVY8_2X8, | ||
615 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | ||
616 | .field = V4L2_FIELD_NONE, | ||
617 | .width = 640, | ||
618 | .height = 480, | ||
619 | }, | ||
620 | .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | | ||
621 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 | | ||
622 | SOCAM_DATA_ACTIVE_HIGH, | ||
623 | .set_capture = camera_set_capture, | ||
624 | }; | ||
625 | |||
626 | static struct soc_camera_link camera_link = { | ||
627 | .bus_id = 0, | ||
628 | .add_device = mackerel_camera_add, | ||
629 | .del_device = mackerel_camera_del, | ||
630 | .module_name = "soc_camera_platform", | ||
631 | .priv = &camera_info, | ||
632 | }; | ||
633 | |||
634 | static void dummy_release(struct device *dev) | ||
635 | { | ||
636 | } | ||
637 | |||
638 | static struct platform_device camera_device = { | ||
639 | .name = "soc_camera_platform", | ||
640 | .dev = { | ||
641 | .platform_data = &camera_info, | ||
642 | .release = dummy_release, | ||
643 | }, | ||
644 | }; | ||
645 | |||
646 | static int mackerel_camera_add(struct soc_camera_link *icl, | ||
647 | struct device *dev) | ||
648 | { | ||
649 | if (icl != &camera_link) | ||
650 | return -ENODEV; | ||
651 | |||
652 | camera_info.dev = dev; | ||
653 | |||
654 | return platform_device_register(&camera_device); | ||
655 | } | ||
656 | |||
657 | static void mackerel_camera_del(struct soc_camera_link *icl) | ||
658 | { | ||
659 | if (icl != &camera_link) | ||
660 | return; | ||
661 | |||
662 | platform_device_unregister(&camera_device); | ||
663 | memset(&camera_device.dev.kobj, 0, | ||
664 | sizeof(camera_device.dev.kobj)); | ||
665 | } | ||
666 | |||
667 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | ||
668 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, | ||
669 | }; | ||
670 | |||
671 | static struct resource ceu_resources[] = { | ||
672 | [0] = { | ||
673 | .name = "CEU", | ||
674 | .start = 0xfe910000, | ||
675 | .end = 0xfe91009f, | ||
676 | .flags = IORESOURCE_MEM, | ||
677 | }, | ||
678 | [1] = { | ||
679 | .start = intcs_evt2irq(0x880), | ||
680 | .flags = IORESOURCE_IRQ, | ||
681 | }, | ||
682 | [2] = { | ||
683 | /* place holder for contiguous memory */ | ||
684 | }, | ||
685 | }; | ||
686 | |||
687 | static struct platform_device ceu_device = { | ||
688 | .name = "sh_mobile_ceu", | ||
689 | .id = 0, /* "ceu0" clock */ | ||
690 | .num_resources = ARRAY_SIZE(ceu_resources), | ||
691 | .resource = ceu_resources, | ||
692 | .dev = { | ||
693 | .platform_data = &sh_mobile_ceu_info, | ||
694 | }, | ||
695 | }; | ||
696 | |||
697 | static struct platform_device mackerel_camera = { | ||
698 | .name = "soc-camera-pdrv", | ||
699 | .id = 0, | ||
700 | .dev = { | ||
701 | .platform_data = &camera_link, | ||
702 | }, | ||
703 | }; | ||
704 | |||
598 | static struct platform_device *mackerel_devices[] __initdata = { | 705 | static struct platform_device *mackerel_devices[] __initdata = { |
599 | &nor_flash_device, | 706 | &nor_flash_device, |
600 | &smc911x_device, | 707 | &smc911x_device, |
@@ -609,6 +716,8 @@ static struct platform_device *mackerel_devices[] __initdata = { | |||
609 | #endif | 716 | #endif |
610 | &sdhi2_device, | 717 | &sdhi2_device, |
611 | &sh_mmcif_device, | 718 | &sh_mmcif_device, |
719 | &ceu_device, | ||
720 | &mackerel_camera, | ||
612 | }; | 721 | }; |
613 | 722 | ||
614 | /* Keypad Initialization */ | 723 | /* Keypad Initialization */ |
@@ -811,6 +920,21 @@ static void __init mackerel_init(void) | |||
811 | gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); | 920 | gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); |
812 | gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); | 921 | gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); |
813 | 922 | ||
923 | /* CEU */ | ||
924 | gpio_request(GPIO_FN_VIO_CLK, NULL); | ||
925 | gpio_request(GPIO_FN_VIO_VD, NULL); | ||
926 | gpio_request(GPIO_FN_VIO_HD, NULL); | ||
927 | gpio_request(GPIO_FN_VIO_FIELD, NULL); | ||
928 | gpio_request(GPIO_FN_VIO_CKO, NULL); | ||
929 | gpio_request(GPIO_FN_VIO_D7, NULL); | ||
930 | gpio_request(GPIO_FN_VIO_D6, NULL); | ||
931 | gpio_request(GPIO_FN_VIO_D5, NULL); | ||
932 | gpio_request(GPIO_FN_VIO_D4, NULL); | ||
933 | gpio_request(GPIO_FN_VIO_D3, NULL); | ||
934 | gpio_request(GPIO_FN_VIO_D2, NULL); | ||
935 | gpio_request(GPIO_FN_VIO_D1, NULL); | ||
936 | gpio_request(GPIO_FN_VIO_D0, NULL); | ||
937 | |||
814 | i2c_register_board_info(0, i2c0_devices, | 938 | i2c_register_board_info(0, i2c0_devices, |
815 | ARRAY_SIZE(i2c0_devices)); | 939 | ARRAY_SIZE(i2c0_devices)); |
816 | i2c_register_board_info(1, i2c1_devices, | 940 | i2c_register_board_info(1, i2c1_devices, |