> +static int dm644x_set_if_config(enum v4l2_mbus_pixelcode pixcode) > +{ > + unsigned int val = 0; > + int ret = 0; > + > + switch (pixcode) { > + case V4L2_MBUS_FMT_FIXED: > + /* Analog out.do nothing */ > + break; > + case V4L2_MBUS_FMT_YUYV8_2X8: > + /* BT656 */ > + val = (1<<12); > + /*set VDMD in VMOD */ > + dm644x_reg_modify(venc_vmod_reg, val, (7 << 12)); > + /* Set YCCTL */ > + dm644x_reg_modify(venc_ycctl_reg, 1, 1); > + break; > + case V4L2_MBUS_FMT_YUYV10_1X20: > + /* This was VPBE_DIGITAL_IF_YCC16.BT656.Replace the enum accordingly > + * when the right one gets into open source */ > + val = 0 << 12; > + dm644x_reg_modify(venc_vmod_reg, val, (7 << 12)); > + dm644x_reg_modify(venc_ycctl_reg, 1, 1); > + break; > + case V4L2_MBUS_FMT_SGRBG8_1X8: > + /* This was VPBE_DIGITAL_IF_PRGB/SRGB.Replace the enum accordingly > + * when the right one gets into open source */ > + val = 2 << 12; > + dm644x_reg_modify(venc_vmod_reg, val, (7 << 12)); > + break; > + default: > + ret = -EINVAL; > + break; > + } > + return ret; > +} The media bus format was added to sub device interface sometime back to configure the media data format (8 bit, 16 bit etc) and there is also a set of APIs to set the pad configuration (done by Laurent) which is being reviewed. In the context of that, I believe the venc VMOD configuration can be handled by implementing s_mbus_fmt() sub device API at venc. Currently OSD sub device has set_layer_config() which consists of setting the pixel format, frame format and sub-frame(crop). I think this can be replaced by s_mbus_fmt(). So on a board file, we could define the pad configuration which will include the mbus code such as V4L2_MBUS_FMT_YUYV8_2X8 + addition pad configurations such as embedded sync enabled etc. So once sub device is selected, vpbe controller will set the pad configuration (obtained from board file for each of the ?). The pad in this case is the link between venc lcd port to external encoder. When S_FMT/S_CROP is called on the video node, the controller calls s_mbus_fmt() on the osd and venc sub device to set the mbus formats. Since the external encoder support is a TBD, I am okay if you implement this after this patch series is merged to the tree. Murali > + > +static u64 vpbe_display_dma_mask = DMA_BIT_MASK(32); > + > +static struct resource dm644x_v4l2_disp_resources[] = { > + { > + .start = IRQ_VENCINT, > + .end = IRQ_VENCINT, > + .flags = IORESOURCE_IRQ, > + }, > + { > + .start = 0x01C72400, > + .end = 0x01C72400 + 0x180, > + .flags = IORESOURCE_MEM, > + }, > + > +}; > +static struct platform_device vpbe_v4l2_display = { > + .name = "vpbe-v4l2", > + .id = -1, > + .num_resources = ARRAY_SIZE(dm644x_v4l2_disp_resources), > + .resource = dm644x_v4l2_disp_resources, > + .dev = { > + .dma_mask = &vpbe_display_dma_mask, > + .coherent_dma_mask = DMA_BIT_MASK(32), > + }, > +}; > +struct venc_platform_data dm644x_venc_pdata = { > + .venc_type = DM644X_VPBE, > + .setup_pinmux = dm644x_vpbe_setup_pinmux, > + .setup_clock = dm644x_venc_setup_clock, > + .setup_if_config = dm644x_set_if_config, > +}; > + > +static struct platform_device dm644x_venc_dev = { > + .name = VPBE_VENC_SUBDEV_NAME, > + .id = -1, > + .num_resources = ARRAY_SIZE(dm644x_venc_resources), > + .resource = dm644x_venc_resources, > + .dev = { > + .dma_mask = &dm644x_venc_dma_mask, > + .coherent_dma_mask = DMA_BIT_MASK(32), > + .platform_data = (void *)&dm644x_venc_pdata, > + }, > +}; > + > +static u64 dm644x_vpbe_dma_mask = DMA_BIT_MASK(32); > + > +static struct platform_device dm644x_vpbe_dev = { > + .name = "vpbe_controller", > + .id = -1, > + .dev = { > + .dma_mask = &dm644x_vpbe_dma_mask, > + .coherent_dma_mask = DMA_BIT_MASK(32), > + }, > +}; > + > +void dm644x_set_vpbe_display_config(struct vpbe_display_config *cfg) > +{ > + dm644x_vpbe_dev.dev.platform_data = cfg; > +} > + > /*----------------------------------------------------------------------*/ > > static struct map_desc dm644x_io_desc[] = { > @@ -767,20 +977,36 @@ void __init dm644x_init(void) > davinci_common_init(&davinci_soc_info_dm644x); > } > > +static struct platform_device *dm644x_video_devices[] __initdata = { > + &dm644x_vpss_device, > + &dm644x_ccdc_dev, > + &vpfe_capture_dev, > + &dm644x_osd_dev, > + &dm644x_venc_dev, > + &dm644x_vpbe_dev, > + &vpbe_v4l2_display, > +}; > + > +static int __init dm644x_init_video(void) > +{ > + /* Add ccdc clock aliases */ > + clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); > + clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); > + vpss_clkctl_reg = ioremap_nocache(VPSS_CLKCTL, 4); > + platform_add_devices(dm644x_video_devices, > + ARRAY_SIZE(dm644x_video_devices)); > + return 0; > +} > + > static int __init dm644x_init_devices(void) > { > if (!cpu_is_davinci_dm644x()) > return 0; > > /* Add ccdc clock aliases */ > - clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); > - clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); > platform_device_register(&dm644x_edma_device); > platform_device_register(&dm644x_emac_device); > - platform_device_register(&dm644x_vpss_device); > - platform_device_register(&dm644x_ccdc_dev); > - platform_device_register(&vpfe_capture_dev); > - > + dm644x_init_video(); > return 0; > } > postcore_initcall(dm644x_init_devices); > diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h > index 6fca568..bf7adcd 100644 > --- a/arch/arm/mach-davinci/include/mach/dm644x.h > +++ b/arch/arm/mach-davinci/include/mach/dm644x.h > @@ -26,6 +26,9 @@ > #include <mach/hardware.h> > #include <mach/asp.h> > #include <media/davinci/vpfe_capture.h> > +#include <media/davinci/vpbe_types.h> > +#include <media/davinci/vpbe.h> > +#include <media/davinci/vpss.h> > > #define DM644X_EMAC_BASE (0x01C80000) > #define DM644X_EMAC_CNTRL_OFFSET (0x0000) > @@ -43,5 +46,6 @@ > void __init dm644x_init(void); > void __init dm644x_init_asp(struct snd_platform_data *pdata); > void dm644x_set_vpfe_config(struct vpfe_config *cfg); > +void dm644x_set_vpbe_display_config(struct vpbe_display_config *cfg); > > #endif /* __ASM_ARCH_DM644X_H */ > -- > 1.6.2.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Murali Karicheri mkaricheri@xxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html