Skip to content

Commit a30d674

Browse files
Murali KaricheriMauro Carvalho Chehab
authored andcommitted
V4L/DVB: DaVinci - Adding platform & board changes for vpfe capture on DM365
This patch adds following changes:- 1) add sub device configuration data for TVP5146 used by vpfe capture 2) registers platform devices for vpfe_capture, isif and vpss 3) defines hardware resources for the devices listed under 2) 4) defines clock aliase for isif driver 5) adding setup_pinmux() for isif Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Murali Karicheri <mkaricheri@gmail.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent fb64022 commit a30d674

3 files changed

Lines changed: 174 additions & 1 deletion

File tree

‎arch/arm/mach-davinci/board-dm365-evm.c‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include <mach/nand.h>
3838
#include <mach/keyscan.h>
3939

40+
#include <media/tvp514x.h>
41+
4042
static inline int have_imager(void)
4143
{
4244
/* REVISIT when it's supported, trigger via Kconfig */
@@ -306,6 +308,73 @@ static void dm365evm_mmc_configure(void)
306308
davinci_cfg_reg(DM365_SD1_DATA0);
307309
}
308310

311+
static struct tvp514x_platform_data tvp5146_pdata = {
312+
.clk_polarity = 0,
313+
.hs_polarity = 1,
314+
.vs_polarity = 1
315+
};
316+
317+
#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
318+
/* Inputs available at the TVP5146 */
319+
static struct v4l2_input tvp5146_inputs[] = {
320+
{
321+
.index = 0,
322+
.name = "Composite",
323+
.type = V4L2_INPUT_TYPE_CAMERA,
324+
.std = TVP514X_STD_ALL,
325+
},
326+
{
327+
.index = 1,
328+
.name = "S-Video",
329+
.type = V4L2_INPUT_TYPE_CAMERA,
330+
.std = TVP514X_STD_ALL,
331+
},
332+
};
333+
334+
/*
335+
* this is the route info for connecting each input to decoder
336+
* ouput that goes to vpfe. There is a one to one correspondence
337+
* with tvp5146_inputs
338+
*/
339+
static struct vpfe_route tvp5146_routes[] = {
340+
{
341+
.input = INPUT_CVBS_VI2B,
342+
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
343+
},
344+
{
345+
.input = INPUT_SVIDEO_VI2C_VI1C,
346+
.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
347+
},
348+
};
349+
350+
static struct vpfe_subdev_info vpfe_sub_devs[] = {
351+
{
352+
.name = "tvp5146",
353+
.grp_id = 0,
354+
.num_inputs = ARRAY_SIZE(tvp5146_inputs),
355+
.inputs = tvp5146_inputs,
356+
.routes = tvp5146_routes,
357+
.can_route = 1,
358+
.ccdc_if_params = {
359+
.if_type = VPFE_BT656,
360+
.hdpol = VPFE_PINPOL_POSITIVE,
361+
.vdpol = VPFE_PINPOL_POSITIVE,
362+
},
363+
.board_info = {
364+
I2C_BOARD_INFO("tvp5146", 0x5d),
365+
.platform_data = &tvp5146_pdata,
366+
},
367+
},
368+
};
369+
370+
static struct vpfe_config vpfe_cfg = {
371+
.num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
372+
.sub_devs = vpfe_sub_devs,
373+
.i2c_adapter_id = 1,
374+
.card_name = "DM365 EVM",
375+
.ccdc = "ISIF",
376+
};
377+
309378
static void __init evm_init_i2c(void)
310379
{
311380
davinci_init_i2c(&i2c_pdata);
@@ -497,6 +566,8 @@ static struct davinci_uart_config uart_config __initdata = {
497566

498567
static void __init dm365_evm_map_io(void)
499568
{
569+
/* setup input configuration for VPFE input devices */
570+
dm365_set_vpfe_config(&vpfe_cfg);
500571
dm365_init();
501572
}
502573

‎arch/arm/mach-davinci/dm365.c‎

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,97 @@ void __init dm365_init(void)
10081008
davinci_common_init(&davinci_soc_info_dm365);
10091009
}
10101010

1011+
static struct resource dm365_vpss_resources[] = {
1012+
{
1013+
/* VPSS ISP5 Base address */
1014+
.name = "isp5",
1015+
.start = 0x01c70000,
1016+
.end = 0x01c70000 + 0xff,
1017+
.flags = IORESOURCE_MEM,
1018+
},
1019+
{
1020+
/* VPSS CLK Base address */
1021+
.name = "vpss",
1022+
.start = 0x01c70200,
1023+
.end = 0x01c70200 + 0xff,
1024+
.flags = IORESOURCE_MEM,
1025+
},
1026+
};
1027+
1028+
static struct platform_device dm365_vpss_device = {
1029+
.name = "vpss",
1030+
.id = -1,
1031+
.dev.platform_data = "dm365_vpss",
1032+
.num_resources = ARRAY_SIZE(dm365_vpss_resources),
1033+
.resource = dm365_vpss_resources,
1034+
};
1035+
1036+
static struct resource vpfe_resources[] = {
1037+
{
1038+
.start = IRQ_VDINT0,
1039+
.end = IRQ_VDINT0,
1040+
.flags = IORESOURCE_IRQ,
1041+
},
1042+
{
1043+
.start = IRQ_VDINT1,
1044+
.end = IRQ_VDINT1,
1045+
.flags = IORESOURCE_IRQ,
1046+
},
1047+
};
1048+
1049+
static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
1050+
static struct platform_device vpfe_capture_dev = {
1051+
.name = CAPTURE_DRV_NAME,
1052+
.id = -1,
1053+
.num_resources = ARRAY_SIZE(vpfe_resources),
1054+
.resource = vpfe_resources,
1055+
.dev = {
1056+
.dma_mask = &vpfe_capture_dma_mask,
1057+
.coherent_dma_mask = DMA_BIT_MASK(32),
1058+
},
1059+
};
1060+
1061+
static void dm365_isif_setup_pinmux(void)
1062+
{
1063+
davinci_cfg_reg(DM365_VIN_CAM_WEN);
1064+
davinci_cfg_reg(DM365_VIN_CAM_VD);
1065+
davinci_cfg_reg(DM365_VIN_CAM_HD);
1066+
davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
1067+
davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
1068+
}
1069+
1070+
static struct resource isif_resource[] = {
1071+
/* ISIF Base address */
1072+
{
1073+
.start = 0x01c71000,
1074+
.end = 0x01c71000 + 0x1ff,
1075+
.flags = IORESOURCE_MEM,
1076+
},
1077+
/* ISIF Linearization table 0 */
1078+
{
1079+
.start = 0x1C7C000,
1080+
.end = 0x1C7C000 + 0x2ff,
1081+
.flags = IORESOURCE_MEM,
1082+
},
1083+
/* ISIF Linearization table 1 */
1084+
{
1085+
.start = 0x1C7C400,
1086+
.end = 0x1C7C400 + 0x2ff,
1087+
.flags = IORESOURCE_MEM,
1088+
},
1089+
};
1090+
static struct platform_device dm365_isif_dev = {
1091+
.name = "isif",
1092+
.id = -1,
1093+
.num_resources = ARRAY_SIZE(isif_resource),
1094+
.resource = isif_resource,
1095+
.dev = {
1096+
.dma_mask = &vpfe_capture_dma_mask,
1097+
.coherent_dma_mask = DMA_BIT_MASK(32),
1098+
.platform_data = dm365_isif_setup_pinmux,
1099+
},
1100+
};
1101+
10111102
static int __init dm365_init_devices(void)
10121103
{
10131104
if (!cpu_is_davinci_dm365())
@@ -1016,7 +1107,16 @@ static int __init dm365_init_devices(void)
10161107
davinci_cfg_reg(DM365_INT_EDMA_CC);
10171108
platform_device_register(&dm365_edma_device);
10181109
platform_device_register(&dm365_emac_device);
1019-
1110+
/* Add isif clock alias */
1111+
clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
1112+
platform_device_register(&dm365_vpss_device);
1113+
platform_device_register(&dm365_isif_dev);
1114+
platform_device_register(&vpfe_capture_dev);
10201115
return 0;
10211116
}
10221117
postcore_initcall(dm365_init_devices);
1118+
1119+
void dm365_set_vpfe_config(struct vpfe_config *cfg)
1120+
{
1121+
vpfe_capture_dev.dev.platform_data = cfg;
1122+
}

‎arch/arm/mach-davinci/include/mach/dm365.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <mach/emac.h>
1919
#include <mach/asp.h>
2020
#include <mach/keyscan.h>
21+
#include <media/davinci/vpfe_capture.h>
2122

2223
#define DM365_EMAC_BASE (0x01D07000)
2324
#define DM365_EMAC_CNTRL_OFFSET (0x0000)
@@ -36,4 +37,5 @@ void __init dm365_init_asp(struct snd_platform_data *pdata);
3637
void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
3738
void __init dm365_init_rtc(void);
3839

40+
void dm365_set_vpfe_config(struct vpfe_config *cfg);
3941
#endif /* __ASM_ARCH_DM365_H */

0 commit comments

Comments
 (0)