diff options
author | Muralidharan Karicheri <m-karicheri2@ti.com> | 2009-09-16 12:02:50 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-09-16 13:25:45 -0400 |
commit | 51e68e27d310034332b67a6762914af9589b3db5 (patch) | |
tree | c59651f3b5a1509ff6217ea3b9fbf6e27316c687 /arch/arm | |
parent | ab8e8df87421574fe053bf1770353af5b24a2bbb (diff) |
davinci: DM355 - platform changes for vpfe capture
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>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-davinci/board-dm355-evm.c | 76 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm355.c | 83 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/dm355.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/mux.h | 9 |
4 files changed, 167 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 9f25fd8ca4a9..77e806798822 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/videodev2.h> | ||
24 | #include <media/tvp514x.h> | ||
23 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
24 | #include <linux/spi/eeprom.h> | 26 | #include <linux/spi/eeprom.h> |
25 | 27 | ||
@@ -136,11 +138,11 @@ static void dm355evm_mmcsd_gpios(unsigned gpio) | |||
136 | } | 138 | } |
137 | 139 | ||
138 | static struct i2c_board_info dm355evm_i2c_info[] = { | 140 | static struct i2c_board_info dm355evm_i2c_info[] = { |
139 | { I2C_BOARD_INFO("dm355evm_msp", 0x25), | 141 | { I2C_BOARD_INFO("dm355evm_msp", 0x25), |
140 | .platform_data = dm355evm_mmcsd_gpios, | 142 | .platform_data = dm355evm_mmcsd_gpios, |
141 | /* plus irq */ }, | 143 | }, |
144 | /* { plus irq }, */ | ||
142 | { I2C_BOARD_INFO("tlv320aic33", 0x1b), }, | 145 | { I2C_BOARD_INFO("tlv320aic33", 0x1b), }, |
143 | /* { I2C_BOARD_INFO("tvp5146", 0x5d), }, */ | ||
144 | }; | 146 | }; |
145 | 147 | ||
146 | static void __init evm_init_i2c(void) | 148 | static void __init evm_init_i2c(void) |
@@ -179,6 +181,72 @@ static struct platform_device dm355evm_dm9000 = { | |||
179 | .num_resources = ARRAY_SIZE(dm355evm_dm9000_rsrc), | 181 | .num_resources = ARRAY_SIZE(dm355evm_dm9000_rsrc), |
180 | }; | 182 | }; |
181 | 183 | ||
184 | static struct tvp514x_platform_data tvp5146_pdata = { | ||
185 | .clk_polarity = 0, | ||
186 | .hs_polarity = 1, | ||
187 | .vs_polarity = 1 | ||
188 | }; | ||
189 | |||
190 | #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) | ||
191 | /* Inputs available at the TVP5146 */ | ||
192 | static struct v4l2_input tvp5146_inputs[] = { | ||
193 | { | ||
194 | .index = 0, | ||
195 | .name = "Composite", | ||
196 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
197 | .std = TVP514X_STD_ALL, | ||
198 | }, | ||
199 | { | ||
200 | .index = 1, | ||
201 | .name = "S-Video", | ||
202 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
203 | .std = TVP514X_STD_ALL, | ||
204 | }, | ||
205 | }; | ||
206 | |||
207 | /* | ||
208 | * this is the route info for connecting each input to decoder | ||
209 | * ouput that goes to vpfe. There is a one to one correspondence | ||
210 | * with tvp5146_inputs | ||
211 | */ | ||
212 | static struct vpfe_route tvp5146_routes[] = { | ||
213 | { | ||
214 | .input = INPUT_CVBS_VI2B, | ||
215 | .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, | ||
216 | }, | ||
217 | { | ||
218 | .input = INPUT_SVIDEO_VI2C_VI1C, | ||
219 | .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, | ||
220 | }, | ||
221 | }; | ||
222 | |||
223 | static struct vpfe_subdev_info vpfe_sub_devs[] = { | ||
224 | { | ||
225 | .name = "tvp5146", | ||
226 | .grp_id = 0, | ||
227 | .num_inputs = ARRAY_SIZE(tvp5146_inputs), | ||
228 | .inputs = tvp5146_inputs, | ||
229 | .routes = tvp5146_routes, | ||
230 | .can_route = 1, | ||
231 | .ccdc_if_params = { | ||
232 | .if_type = VPFE_BT656, | ||
233 | .hdpol = VPFE_PINPOL_POSITIVE, | ||
234 | .vdpol = VPFE_PINPOL_POSITIVE, | ||
235 | }, | ||
236 | .board_info = { | ||
237 | I2C_BOARD_INFO("tvp5146", 0x5d), | ||
238 | .platform_data = &tvp5146_pdata, | ||
239 | }, | ||
240 | } | ||
241 | }; | ||
242 | |||
243 | static struct vpfe_config vpfe_cfg = { | ||
244 | .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), | ||
245 | .sub_devs = vpfe_sub_devs, | ||
246 | .card_name = "DM355 EVM", | ||
247 | .ccdc = "DM355 CCDC", | ||
248 | }; | ||
249 | |||
182 | static struct platform_device *davinci_evm_devices[] __initdata = { | 250 | static struct platform_device *davinci_evm_devices[] __initdata = { |
183 | &dm355evm_dm9000, | 251 | &dm355evm_dm9000, |
184 | &davinci_nand_device, | 252 | &davinci_nand_device, |
@@ -190,6 +258,8 @@ static struct davinci_uart_config uart_config __initdata = { | |||
190 | 258 | ||
191 | static void __init dm355_evm_map_io(void) | 259 | static void __init dm355_evm_map_io(void) |
192 | { | 260 | { |
261 | /* setup input configuration for VPFE input devices */ | ||
262 | dm355_set_vpfe_config(&vpfe_cfg); | ||
193 | dm355_init(); | 263 | dm355_init(); |
194 | } | 264 | } |
195 | 265 | ||
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 4f42169c029c..059670018aff 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
@@ -488,6 +488,14 @@ MUX_CFG(DM355, VOUT_FIELD_G70, 1, 18, 3, 0, false) | |||
488 | MUX_CFG(DM355, VOUT_HVSYNC, 1, 16, 1, 0, false) | 488 | MUX_CFG(DM355, VOUT_HVSYNC, 1, 16, 1, 0, false) |
489 | MUX_CFG(DM355, VOUT_COUTL_EN, 1, 0, 0xff, 0x55, false) | 489 | MUX_CFG(DM355, VOUT_COUTL_EN, 1, 0, 0xff, 0x55, false) |
490 | MUX_CFG(DM355, VOUT_COUTH_EN, 1, 8, 0xff, 0x55, false) | 490 | MUX_CFG(DM355, VOUT_COUTH_EN, 1, 8, 0xff, 0x55, false) |
491 | |||
492 | MUX_CFG(DM355, VIN_PCLK, 0, 14, 1, 1, false) | ||
493 | MUX_CFG(DM355, VIN_CAM_WEN, 0, 13, 1, 1, false) | ||
494 | MUX_CFG(DM355, VIN_CAM_VD, 0, 12, 1, 1, false) | ||
495 | MUX_CFG(DM355, VIN_CAM_HD, 0, 11, 1, 1, false) | ||
496 | MUX_CFG(DM355, VIN_YIN_EN, 0, 10, 1, 1, false) | ||
497 | MUX_CFG(DM355, VIN_CINL_EN, 0, 0, 0xff, 0x55, false) | ||
498 | MUX_CFG(DM355, VIN_CINH_EN, 0, 8, 3, 3, false) | ||
491 | #endif | 499 | #endif |
492 | }; | 500 | }; |
493 | 501 | ||
@@ -659,6 +667,67 @@ static struct platform_device dm355_asp1_device = { | |||
659 | .resource = dm355_asp1_resources, | 667 | .resource = dm355_asp1_resources, |
660 | }; | 668 | }; |
661 | 669 | ||
670 | static struct resource dm355_vpss_resources[] = { | ||
671 | { | ||
672 | /* VPSS BL Base address */ | ||
673 | .name = "vpss", | ||
674 | .start = 0x01c70800, | ||
675 | .end = 0x01c70800 + 0xff, | ||
676 | .flags = IORESOURCE_MEM, | ||
677 | }, | ||
678 | { | ||
679 | /* VPSS CLK Base address */ | ||
680 | .name = "vpss", | ||
681 | .start = 0x01c70000, | ||
682 | .end = 0x01c70000 + 0xf, | ||
683 | .flags = IORESOURCE_MEM, | ||
684 | }, | ||
685 | }; | ||
686 | |||
687 | static struct platform_device dm355_vpss_device = { | ||
688 | .name = "vpss", | ||
689 | .id = -1, | ||
690 | .dev.platform_data = "dm355_vpss", | ||
691 | .num_resources = ARRAY_SIZE(dm355_vpss_resources), | ||
692 | .resource = dm355_vpss_resources, | ||
693 | }; | ||
694 | |||
695 | static struct resource vpfe_resources[] = { | ||
696 | { | ||
697 | .start = IRQ_VDINT0, | ||
698 | .end = IRQ_VDINT0, | ||
699 | .flags = IORESOURCE_IRQ, | ||
700 | }, | ||
701 | { | ||
702 | .start = IRQ_VDINT1, | ||
703 | .end = IRQ_VDINT1, | ||
704 | .flags = IORESOURCE_IRQ, | ||
705 | }, | ||
706 | /* CCDC Base address */ | ||
707 | { | ||
708 | .flags = IORESOURCE_MEM, | ||
709 | .start = 0x01c70600, | ||
710 | .end = 0x01c70600 + 0x1ff, | ||
711 | }, | ||
712 | }; | ||
713 | |||
714 | static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32); | ||
715 | static struct platform_device vpfe_capture_dev = { | ||
716 | .name = CAPTURE_DRV_NAME, | ||
717 | .id = -1, | ||
718 | .num_resources = ARRAY_SIZE(vpfe_resources), | ||
719 | .resource = vpfe_resources, | ||
720 | .dev = { | ||
721 | .dma_mask = &vpfe_capture_dma_mask, | ||
722 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
723 | }, | ||
724 | }; | ||
725 | |||
726 | void dm355_set_vpfe_config(struct vpfe_config *cfg) | ||
727 | { | ||
728 | vpfe_capture_dev.dev.platform_data = cfg; | ||
729 | } | ||
730 | |||
662 | /*----------------------------------------------------------------------*/ | 731 | /*----------------------------------------------------------------------*/ |
663 | 732 | ||
664 | static struct map_desc dm355_io_desc[] = { | 733 | static struct map_desc dm355_io_desc[] = { |
@@ -792,6 +861,20 @@ static int __init dm355_init_devices(void) | |||
792 | 861 | ||
793 | davinci_cfg_reg(DM355_INT_EDMA_CC); | 862 | davinci_cfg_reg(DM355_INT_EDMA_CC); |
794 | platform_device_register(&dm355_edma_device); | 863 | platform_device_register(&dm355_edma_device); |
864 | platform_device_register(&dm355_vpss_device); | ||
865 | /* | ||
866 | * setup Mux configuration for vpfe input and register | ||
867 | * vpfe capture platform device | ||
868 | */ | ||
869 | davinci_cfg_reg(DM355_VIN_PCLK); | ||
870 | davinci_cfg_reg(DM355_VIN_CAM_WEN); | ||
871 | davinci_cfg_reg(DM355_VIN_CAM_VD); | ||
872 | davinci_cfg_reg(DM355_VIN_CAM_HD); | ||
873 | davinci_cfg_reg(DM355_VIN_YIN_EN); | ||
874 | davinci_cfg_reg(DM355_VIN_CINL_EN); | ||
875 | davinci_cfg_reg(DM355_VIN_CINH_EN); | ||
876 | platform_device_register(&vpfe_capture_dev); | ||
877 | |||
795 | return 0; | 878 | return 0; |
796 | } | 879 | } |
797 | postcore_initcall(dm355_init_devices); | 880 | postcore_initcall(dm355_init_devices); |
diff --git a/arch/arm/mach-davinci/include/mach/dm355.h b/arch/arm/mach-davinci/include/mach/dm355.h index 03faaef95a9a..85536d8e8336 100644 --- a/arch/arm/mach-davinci/include/mach/dm355.h +++ b/arch/arm/mach-davinci/include/mach/dm355.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <mach/hardware.h> | 14 | #include <mach/hardware.h> |
15 | #include <mach/asp.h> | 15 | #include <mach/asp.h> |
16 | #include <media/davinci/vpfe_capture.h> | ||
16 | 17 | ||
17 | #define ASP1_TX_EVT_EN 1 | 18 | #define ASP1_TX_EVT_EN 1 |
18 | #define ASP1_RX_EVT_EN 2 | 19 | #define ASP1_RX_EVT_EN 2 |
@@ -23,5 +24,6 @@ void __init dm355_init(void); | |||
23 | void dm355_init_spi0(unsigned chipselect_mask, | 24 | void dm355_init_spi0(unsigned chipselect_mask, |
24 | struct spi_board_info *info, unsigned len); | 25 | struct spi_board_info *info, unsigned len); |
25 | void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); | 26 | void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); |
27 | void dm355_set_vpfe_config(struct vpfe_config *cfg); | ||
26 | 28 | ||
27 | #endif /* __ASM_ARCH_DM355_H */ | 29 | #endif /* __ASM_ARCH_DM355_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index 773283281be8..bb84893a4e83 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h | |||
@@ -161,6 +161,15 @@ enum davinci_dm355_index { | |||
161 | DM355_VOUT_HVSYNC, | 161 | DM355_VOUT_HVSYNC, |
162 | DM355_VOUT_COUTL_EN, | 162 | DM355_VOUT_COUTL_EN, |
163 | DM355_VOUT_COUTH_EN, | 163 | DM355_VOUT_COUTH_EN, |
164 | |||
165 | /* Video In Pin Mux */ | ||
166 | DM355_VIN_PCLK, | ||
167 | DM355_VIN_CAM_WEN, | ||
168 | DM355_VIN_CAM_VD, | ||
169 | DM355_VIN_CAM_HD, | ||
170 | DM355_VIN_YIN_EN, | ||
171 | DM355_VIN_CINL_EN, | ||
172 | DM355_VIN_CINH_EN, | ||
164 | }; | 173 | }; |
165 | 174 | ||
166 | enum davinci_dm365_index { | 175 | enum davinci_dm365_index { |