diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-06-12 05:40:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-06-21 05:59:43 -0400 |
commit | 3760e79450f48e31fde2b2dd49c5ab6a685c3ea8 (patch) | |
tree | 21704a8fb1d79fd7320056287229d7d9f6dc44f0 /arch | |
parent | 910c14d0b8f121df420a878cbd973ffa7d549393 (diff) |
ARM: shmobile: armadillo800eva: enable camera
This patch enable camera support on CON1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Simon Horman <horms@verge.net.au>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/configs/armadillo800eva_defconfig | 10 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-armadillo800eva.c | 111 |
2 files changed, 120 insertions, 1 deletions
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig index f6ebdde380ee..df1ce543cd7c 100644 --- a/arch/arm/configs/armadillo800eva_defconfig +++ b/arch/arm/configs/armadillo800eva_defconfig | |||
@@ -86,6 +86,16 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y | |||
86 | CONFIG_I2C=y | 86 | CONFIG_I2C=y |
87 | CONFIG_I2C_SH_MOBILE=y | 87 | CONFIG_I2C_SH_MOBILE=y |
88 | # CONFIG_HWMON is not set | 88 | # CONFIG_HWMON is not set |
89 | CONFIG_MEDIA_SUPPORT=y | ||
90 | CONFIG_VIDEO_DEV=y | ||
91 | # CONFIG_RC_CORE is not set | ||
92 | # CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set | ||
93 | # CONFIG_V4L_USB_DRIVERS is not set | ||
94 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
95 | CONFIG_SOC_CAMERA=y | ||
96 | CONFIG_SOC_CAMERA_MT9T112=y | ||
97 | CONFIG_VIDEO_SH_MOBILE_CEU=y | ||
98 | # CONFIG_RADIO_ADAPTERS is not set | ||
89 | CONFIG_FB=y | 99 | CONFIG_FB=y |
90 | CONFIG_FB_SH_MOBILE_LCDC=y | 100 | CONFIG_FB_SH_MOBILE_LCDC=y |
91 | CONFIG_FB_SH_MOBILE_HDMI=y | 101 | CONFIG_FB_SH_MOBILE_HDMI=y |
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 4e6893f9e0da..2cce28b2e40a 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -37,13 +37,16 @@ | |||
37 | #include <linux/mmc/sh_mobile_sdhi.h> | 37 | #include <linux/mmc/sh_mobile_sdhi.h> |
38 | #include <mach/common.h> | 38 | #include <mach/common.h> |
39 | #include <mach/irqs.h> | 39 | #include <mach/irqs.h> |
40 | #include <mach/r8a7740.h> | ||
41 | #include <media/mt9t112.h> | ||
42 | #include <media/sh_mobile_ceu.h> | ||
43 | #include <media/soc_camera.h> | ||
40 | #include <asm/page.h> | 44 | #include <asm/page.h> |
41 | #include <asm/mach-types.h> | 45 | #include <asm/mach-types.h> |
42 | #include <asm/mach/arch.h> | 46 | #include <asm/mach/arch.h> |
43 | #include <asm/mach/map.h> | 47 | #include <asm/mach/map.h> |
44 | #include <asm/mach/time.h> | 48 | #include <asm/mach/time.h> |
45 | #include <asm/hardware/cache-l2x0.h> | 49 | #include <asm/hardware/cache-l2x0.h> |
46 | #include <mach/r8a7740.h> | ||
47 | #include <video/sh_mobile_lcdc.h> | 50 | #include <video/sh_mobile_lcdc.h> |
48 | #include <video/sh_mobile_hdmi.h> | 51 | #include <video/sh_mobile_hdmi.h> |
49 | 52 | ||
@@ -630,6 +633,87 @@ static struct platform_device sh_mmcif_device = { | |||
630 | .resource = sh_mmcif_resources, | 633 | .resource = sh_mmcif_resources, |
631 | }; | 634 | }; |
632 | 635 | ||
636 | /* Camera */ | ||
637 | static int mt9t111_power(struct device *dev, int mode) | ||
638 | { | ||
639 | struct clk *mclk = clk_get(NULL, "video1"); | ||
640 | |||
641 | if (IS_ERR(mclk)) { | ||
642 | dev_err(dev, "can't get video1 clock\n"); | ||
643 | return -EINVAL; | ||
644 | } | ||
645 | |||
646 | if (mode) { | ||
647 | /* video1 (= CON1 camera) expect 24MHz */ | ||
648 | clk_set_rate(mclk, clk_round_rate(mclk, 24000000)); | ||
649 | clk_enable(mclk); | ||
650 | gpio_direction_output(GPIO_PORT158, 1); | ||
651 | } else { | ||
652 | gpio_direction_output(GPIO_PORT158, 0); | ||
653 | clk_disable(mclk); | ||
654 | } | ||
655 | |||
656 | clk_put(mclk); | ||
657 | |||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static struct i2c_board_info i2c_camera_mt9t111 = { | ||
662 | I2C_BOARD_INFO("mt9t112", 0x3d), | ||
663 | }; | ||
664 | |||
665 | static struct mt9t112_camera_info mt9t111_info = { | ||
666 | .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 }, | ||
667 | }; | ||
668 | |||
669 | static struct soc_camera_link mt9t111_link = { | ||
670 | .i2c_adapter_id = 0, | ||
671 | .bus_id = 0, | ||
672 | .board_info = &i2c_camera_mt9t111, | ||
673 | .power = mt9t111_power, | ||
674 | .priv = &mt9t111_info, | ||
675 | }; | ||
676 | |||
677 | static struct platform_device camera_device = { | ||
678 | .name = "soc-camera-pdrv", | ||
679 | .id = 0, | ||
680 | .dev = { | ||
681 | .platform_data = &mt9t111_link, | ||
682 | }, | ||
683 | }; | ||
684 | |||
685 | /* CEU0 */ | ||
686 | static struct sh_mobile_ceu_info sh_mobile_ceu0_info = { | ||
687 | .flags = SH_CEU_FLAG_LOWER_8BIT, | ||
688 | }; | ||
689 | |||
690 | static struct resource ceu0_resources[] = { | ||
691 | [0] = { | ||
692 | .name = "CEU", | ||
693 | .start = 0xfe910000, | ||
694 | .end = 0xfe91009f, | ||
695 | .flags = IORESOURCE_MEM, | ||
696 | }, | ||
697 | [1] = { | ||
698 | .start = intcs_evt2irq(0x0500), | ||
699 | .flags = IORESOURCE_IRQ, | ||
700 | }, | ||
701 | [2] = { | ||
702 | /* place holder for contiguous memory */ | ||
703 | }, | ||
704 | }; | ||
705 | |||
706 | static struct platform_device ceu0_device = { | ||
707 | .name = "sh_mobile_ceu", | ||
708 | .id = 0, | ||
709 | .num_resources = ARRAY_SIZE(ceu0_resources), | ||
710 | .resource = ceu0_resources, | ||
711 | .dev = { | ||
712 | .platform_data = &sh_mobile_ceu0_info, | ||
713 | .coherent_dma_mask = 0xffffffff, | ||
714 | }, | ||
715 | }; | ||
716 | |||
633 | /* I2C */ | 717 | /* I2C */ |
634 | static struct i2c_board_info i2c0_devices[] = { | 718 | static struct i2c_board_info i2c0_devices[] = { |
635 | { | 719 | { |
@@ -649,6 +733,8 @@ static struct platform_device *eva_devices[] __initdata = { | |||
649 | &sh_mmcif_device, | 733 | &sh_mmcif_device, |
650 | &hdmi_device, | 734 | &hdmi_device, |
651 | &hdmi_lcdc_device, | 735 | &hdmi_lcdc_device, |
736 | &camera_device, | ||
737 | &ceu0_device, | ||
652 | }; | 738 | }; |
653 | 739 | ||
654 | static void __init eva_clock_init(void) | 740 | static void __init eva_clock_init(void) |
@@ -807,6 +893,29 @@ static void __init eva_init(void) | |||
807 | gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL); | 893 | gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL); |
808 | gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL); | 894 | gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL); |
809 | 895 | ||
896 | /* CEU0 */ | ||
897 | gpio_request(GPIO_FN_VIO0_D7, NULL); | ||
898 | gpio_request(GPIO_FN_VIO0_D6, NULL); | ||
899 | gpio_request(GPIO_FN_VIO0_D5, NULL); | ||
900 | gpio_request(GPIO_FN_VIO0_D4, NULL); | ||
901 | gpio_request(GPIO_FN_VIO0_D3, NULL); | ||
902 | gpio_request(GPIO_FN_VIO0_D2, NULL); | ||
903 | gpio_request(GPIO_FN_VIO0_D1, NULL); | ||
904 | gpio_request(GPIO_FN_VIO0_D0, NULL); | ||
905 | gpio_request(GPIO_FN_VIO0_CLK, NULL); | ||
906 | gpio_request(GPIO_FN_VIO0_HD, NULL); | ||
907 | gpio_request(GPIO_FN_VIO0_VD, NULL); | ||
908 | gpio_request(GPIO_FN_VIO0_FIELD, NULL); | ||
909 | gpio_request(GPIO_FN_VIO_CKO, NULL); | ||
910 | |||
911 | /* CON1/CON15 Camera */ | ||
912 | gpio_request(GPIO_PORT173, NULL); /* STANDBY */ | ||
913 | gpio_request(GPIO_PORT172, NULL); /* RST */ | ||
914 | gpio_request(GPIO_PORT158, NULL); /* CAM_PON */ | ||
915 | gpio_direction_output(GPIO_PORT173, 0); | ||
916 | gpio_direction_output(GPIO_PORT172, 1); | ||
917 | gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */ | ||
918 | |||
810 | /* | 919 | /* |
811 | * CAUTION | 920 | * CAUTION |
812 | * | 921 | * |