ARM: davinci: da850/omap-l138: add support for VPIF driver
Subsystems (3)
cover ARM: davinci: da850/omap-l138: add support for VPIF driver
This patch series adds support for VPIF
capture and display driver on da850/omap-l138.
Enables SD capture and display.
This patch series is dependent on [1] pull request.
[1] http://patchwork.linuxtv.org/patch/13305/
Manjunath Hadli (2):
ARM: da850/omap-l138: Add SoC related definitions for VPIF
ARM: da850/omap-l138: Add EVM specific code for VPIF to work
arch/arm/mach-davinci/Kconfig | 9 + arch/arm/mach-davinci/board-da850-evm.c | 195 +++++++++++++++++++++ arch/arm/mach-davinci/da850.c | 256 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 11 ++ arch/arm/mach-davinci/include/mach/mux.h | 42 +++++ arch/arm/mach-davinci/include/mach/psc.h | 1 + 6 files changed, 514 insertions(+), 0 deletions(-)
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
From: Manjunath Hadli <[email protected]>
Add clock, pin mux definitions and registration function for VPIF capture and display driver on DA850/OMAP-L138 SoC.
--- arch/arm/mach-davinci/da850.c | 256 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 11 ++ arch/arm/mach-davinci/include/mach/mux.h | 42 +++++ arch/arm/mach-davinci/include/mach/psc.h | 1 + 4 files changed, 310 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +256 -0
@@ -347,6 +347,13 @@ static struct clk spi1_clk = { .flags = DA850_CLK_ASYNC3, }; +static struct clk vpif_clk = { + .name ="vpif" , + .parent = &pll0_sysclk2, + .lpsc =DA850_LPSC1_VPIF , + .gpsc =1 , +}; +static struct clk sata_clk = { .name ="sata" , .parent = &pll0_sysclk2,
@@ -397,6 +404,7 @@ static struct clk_lookup da850_clks[] = {CLK (NULL ,"usb20" , &usb20_clk),CLK ("spi_davinci.0" ,NULL , &spi0_clk),CLK ("spi_davinci.1" ,NULL , &spi1_clk), +CLK (NULL ,"vpif" , &vpif_clk),CLK ("ahci" ,NULL , &sata_clk), CLK(NULL, NULL, NULL), };
@@ -573,6 +581,46 @@ static const struct mux_config da850_pins[] = { MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false) MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)MUX_CFG (DA850 ,RTC_ALARM ,0 ,28 ,15 ,2 , false) + /* VPIF Capture */ + MUX_CFG(DA850, VPIF_DIN0, 15, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN1, 15, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN2, 14, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN3, 14, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN4, 14, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN5, 14, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN6, 14, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN7, 14, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN8, 16, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN9, 16, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN10, 15, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN11, 15, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN12, 15, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN13, 15, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN14, 15, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN15, 15, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN0, 14, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN1, 14, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN2, 19, 8, 15, 1, false) +MUX_CFG (DA850 ,VPIF_CLKIN3 ,19 ,16 ,15 ,1 , false) + /* VPIF Display */ + MUX_CFG(DA850, VPIF_DOUT0, 17, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT1, 17, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT2, 16, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT3, 16, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT4, 16, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT5, 16, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT6, 16, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT7, 16, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT8, 18, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT9, 18, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT10, 17, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT11, 17, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT12, 17, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT13, 17, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT14, 17, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT15, 17, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO2, 19, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO3, 19, 20, 15, 1, false)#endif };
@@ -595,6 +643,26 @@ const short da850_lcdcntl_pins[] __initdata = {-1 }; +const short da850_vpif_capture_pins[]__initdata = { +DA850_VPIF_DIN0 ,DA850_VPIF_DIN1 ,DA850_VPIF_DIN2 ,DA850_VPIF_DIN3 , +DA850_VPIF_DIN4 ,DA850_VPIF_DIN5 ,DA850_VPIF_DIN6 ,DA850_VPIF_DIN7 , +DA850_VPIF_DIN8 ,DA850_VPIF_DIN9 ,DA850_VPIF_DIN10 ,DA850_VPIF_DIN11 , +DA850_VPIF_DIN12 ,DA850_VPIF_DIN13 ,DA850_VPIF_DIN14 ,DA850_VPIF_DIN15 , +DA850_VPIF_CLKIN0 ,DA850_VPIF_CLKIN1 ,DA850_VPIF_CLKIN2 , +DA850_VPIF_CLKIN3 , +-1 +}; + +const short da850_vpif_display_pins[]__initdata = { +DA850_VPIF_DOUT0 ,DA850_VPIF_DOUT1 ,DA850_VPIF_DOUT2 ,DA850_VPIF_DOUT3 , +DA850_VPIF_DOUT4 ,DA850_VPIF_DOUT5 ,DA850_VPIF_DOUT6 ,DA850_VPIF_DOUT7 , +DA850_VPIF_DOUT8 ,DA850_VPIF_DOUT9 ,DA850_VPIF_DOUT10 , +DA850_VPIF_DOUT11 ,DA850_VPIF_DOUT12 ,DA850_VPIF_DOUT13 , +DA850_VPIF_DOUT14 ,DA850_VPIF_DOUT15 ,DA850_VPIF_CLKO2 , +DA850_VPIF_CLKO3 , +-1 +}; +/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ ] = { [IRQ_DA8XX_COMMTX ] =7 ,
@@ -1064,6 +1132,194 @@ no_ddrpll_mem:return ret; } +/* VPIF resource, platform data */ +static u64 da850_vpif_dma_mask =DMA_BIT_MASK (32 ); + +static struct resource da850_vpif_resource[] = { + { + .start =DA8XX_VPIF_BASE , + .end =DA8XX_VPIF_BASE +0xfff , + .flags =IORESOURCE_MEM , + } +}; + +static struct platform_device da850_vpif_dev = { + .name ="vpif" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, + .resource = da850_vpif_resource, + .num_resources =ARRAY_SIZE (da850_vpif_resource), +}; + +static unsigned long vpif_disp_cont_buf_offset; + +static int __init cfg_vpif_disp_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_buf_offset); +} +early_param ("vpif_disp_cont_buf_offset" , cfg_vpif_disp_cont_buf_offset); + +static unsigned long vpif_disp_cont_bufsize; + +static int __init cfg_vpif_disp_cont_bufsize (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_bufsize); +} +early_param ("vpif_disp_cont_bufsize" , cfg_vpif_disp_cont_bufsize); + +static unsigned long vpif_cap_cont_buf_offset; + +static int __init cfg_vpif_cap_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_cap_cont_buf_offset); +} +early_param ("vpif_cap_cont_buf_offset" , cfg_vpif_cap_cont_buf_offset); + +static unsigned long vpif_cap_cont_bufsize; + +static int __init cfg_vpif_cap_cont_bufsize (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_cap_cont_bufsize); +} +early_param ("vpif_cap_cont_bufsize" , cfg_vpif_cap_cont_bufsize); + +static struct platform_device da850_vpif_display_dev = { + .name ="vpif_display" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +static struct platform_device da850_vpif_capture_dev = { + .name ="vpif_capture" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +int __init da850_register_vpif (void ) +{ +return platform_device_register (&da850_vpif_dev); +} + +int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ; + } + ret =platform_device_add_resources (&da850_vpif_display_dev, + da850_vpif_display_resource, +ARRAY_SIZE (da850_vpif_display_resource)); +if (ret) +return -EINVAL ; + + da850_vpif_display_dev.dev.platform_data = display_config; +return platform_device_register (&da850_vpif_display_dev); +} + +int __init da850_register_vpif_capture (struct vpif_capture_config + *capture_config) +{ +static struct resource da850_vpif_capture_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_cap_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_cap_cont_buf_offset; + da850_vpif_capture_resource[2 ].start = phys_end_kernel; + da850_vpif_capture_resource[2 ].end = phys_end_kernel + + vpif_cap_cont_bufsize -1 ; + da850_vpif_capture_resource[2 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_capture_resource[2 ].start, +resource_size (&da850_vpif_capture_resource[2 ]), + da850_vpif_capture_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_capture_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_cap_cont_bufsize,DMA_MEMORY_MAP | +DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ; + } + ret =platform_device_add_resources (&da850_vpif_capture_dev, + da850_vpif_capture_resource, +ARRAY_SIZE (da850_vpif_capture_resource)); +if (ret) +return -EINVAL ; + + da850_vpif_capture_dev.dev.platform_data = capture_config; +return platform_device_register (&da850_vpif_capture_dev); +} +static struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num =ARRAY_SIZE (da850_io_desc),
arch/arm/mach-davinci/include/mach/da8xx.h +11 -0
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/davinci_emac.h> #include <linux/spi/spi.h> +#include <linux/videodev2.h> #include <mach/serial.h> #include <mach/edma.h>
@@ -26,6 +27,8 @@#include <mach/pm.h> #include <mach/spi.h> +#include <media/davinci/vpif_types.h> +extern void __iomem *da8xx_syscfg0_base;extern void __iomem *da8xx_syscfg1_base;
@@ -69,6 +72,7 @@ extern unsigned int da850_max_speed;#define DA8XX_AEMIF_CS3_BASE 0x62000000#define DA8XX_AEMIF_CTL_BASE 0x68000000#define DA8XX_ARM_RAM_BASE 0xffff0000 +#define DA8XX_VPIF_BASE 0x01e17000void __init da830_init (void );void __init da850_init (void );
@@ -92,6 +96,11 @@ int da8xx_register_cpuidle(void);void __iomem *__init da8xx_get_mem_ctlr (void );int da850_register_pm (struct platform_device *pdev);int __init da850_register_sata (unsigned long refclkpn); +int __init da850_register_vpif (void ); +int __init da850_register_vpif_display + (struct vpif_display_config *display_config); +int __init da850_register_vpif_capture + (struct vpif_capture_config *capture_config);void da8xx_restart (char mode,const char *cmd);extern struct platform_device da8xx_serial_device;
@@ -126,6 +135,8 @@ extern const short da830_ecap1_pins[];extern const short da830_ecap2_pins[];extern const short da830_eqep0_pins[];extern const short da830_eqep1_pins[]; +extern const short da850_vpif_capture_pins[]; +extern const short da850_vpif_display_pins[];extern const short da850_i2c0_pins[];extern const short da850_i2c1_pins[];
arch/arm/mach-davinci/include/mach/mux.h +42 -0
48 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/psc.h +1 -0
@@ -166,6 +166,7 @@#define DA830_LPSC1_McASP1 8#define DA850_LPSC1_SATA 8#define DA830_LPSC1_McASP2 9 +#define DA850_LPSC1_VPIF 9#define DA8XX_LPSC1_SPI1 10#define DA8XX_LPSC1_I2C 11#define DA8XX_LPSC1_UART1 12
Signature · 1 line
1.7.0.4
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hi Prabhakar,
Quoted 34 lines · Prabhakar Lad
From: Manjunath Hadli <[email protected]>
Add clock, pin mux definitions and registration function for VPIF capture and display driver on DA850/OMAP-L138 SoC.
Signed-off-by Manjunath Hadli <[email protected]>Signed-off-by Lad, Prabhakar <[email protected]>Cc Sekhar Nori <[email protected]>--- arch/arm/mach-davinci/da850.c | 256 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 11 ++ arch/arm/mach-davinci/include/mach/mux.h | 42 +++++ arch/arm/mach-davinci/include/mach/psc.h | 1 + 4 files changed, 310 insertions(+), 0 deletions(-)arch/arm/mach-davinci/da850.c +7
-0@@ -347,6 +347,13 @@ static struct clk spi1_clk = { .flags = DA850_CLK_ASYNC3, }; +static struct clk vpif_clk = { + .name ="vpif" , + .parent = &pll0_sysclk2, + .lpsc =DA850_LPSC1_VPIF , + .gpsc =1 , +}; +static struct clk sata_clk = { .name ="sata" , .parent = &pll0_sysclk2,
arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 407
Quoted 4 lines
arch/arm/mach-davinci/da850.c +1
-0@@ -397,6 +404,7 @@ static struct clk_lookup da850_clks[] = {CLK (NULL ,"usb20" , &usb20_clk),CLK ("spi_davinci.0" ,NULL , &spi0_clk),CLK ("spi_davinci.1" ,NULL , &spi1_clk), + CLK(NULL, "vpif", &vpif_clk),
You should dev_id for lookup instead of con_id. Looking at drivers/media/video/davinci/vpif.c, there is a single clock that VPIF needs, so con_id can actually be passed as NULL.
Quoted 136 lines
arch/arm/mach-davinci/da850.c +115
-0CLK ("ahci" ,NULL , &sata_clk), CLK(NULL, NULL, NULL), };@@ -573,6 +581,46 @@ static const struct mux_config da850_pins[] = { MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false) MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)MUX_CFG (DA850 ,RTC_ALARM ,0 ,28 ,15 ,2 , false) + /* VPIF Capture */ + MUX_CFG(DA850, VPIF_DIN0, 15, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN1, 15, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN2, 14, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN3, 14, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN4, 14, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN5, 14, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN6, 14, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN7, 14, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN8, 16, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN9, 16, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN10, 15, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN11, 15, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN12, 15, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN13, 15, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN14, 15, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN15, 15, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN0, 14, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN1, 14, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN2, 19, 8, 15, 1, false) +MUX_CFG (DA850 ,VPIF_CLKIN3 ,19 ,16 ,15 ,1 , false) + /* VPIF Display */ + MUX_CFG(DA850, VPIF_DOUT0, 17, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT1, 17, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT2, 16, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT3, 16, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT4, 16, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT5, 16, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT6, 16, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT7, 16, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT8, 18, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT9, 18, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT10, 17, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT11, 17, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT12, 17, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT13, 17, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT14, 17, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT15, 17, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO2, 19, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO3, 19, 20, 15, 1, false)#endif };@@ -595,6 +643,26 @@ const short da850_lcdcntl_pins[] __initdata = {-1 }; +const short da850_vpif_capture_pins[]__initdata = { +DA850_VPIF_DIN0 ,DA850_VPIF_DIN1 ,DA850_VPIF_DIN2 ,DA850_VPIF_DIN3 , +DA850_VPIF_DIN4 ,DA850_VPIF_DIN5 ,DA850_VPIF_DIN6 ,DA850_VPIF_DIN7 , +DA850_VPIF_DIN8 ,DA850_VPIF_DIN9 ,DA850_VPIF_DIN10 ,DA850_VPIF_DIN11 , +DA850_VPIF_DIN12 ,DA850_VPIF_DIN13 ,DA850_VPIF_DIN14 ,DA850_VPIF_DIN15 , +DA850_VPIF_CLKIN0 ,DA850_VPIF_CLKIN1 ,DA850_VPIF_CLKIN2 , +DA850_VPIF_CLKIN3 , +-1 +}; + +const short da850_vpif_display_pins[]__initdata = { +DA850_VPIF_DOUT0 ,DA850_VPIF_DOUT1 ,DA850_VPIF_DOUT2 ,DA850_VPIF_DOUT3 , +DA850_VPIF_DOUT4 ,DA850_VPIF_DOUT5 ,DA850_VPIF_DOUT6 ,DA850_VPIF_DOUT7 , +DA850_VPIF_DOUT8 ,DA850_VPIF_DOUT9 ,DA850_VPIF_DOUT10 , +DA850_VPIF_DOUT11 ,DA850_VPIF_DOUT12 ,DA850_VPIF_DOUT13 , +DA850_VPIF_DOUT14 ,DA850_VPIF_DOUT15 ,DA850_VPIF_CLKO2 , +DA850_VPIF_CLKO3 , +-1 +}; +/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ ] = { [IRQ_DA8XX_COMMTX ] =7 ,@@ -1064,6 +1132,194 @@ no_ddrpll_mem:return ret; } +/* VPIF resource, platform data */ +static u64 da850_vpif_dma_mask =DMA_BIT_MASK (32 ); + +static struct resource da850_vpif_resource[] = { + { + .start =DA8XX_VPIF_BASE , + .end =DA8XX_VPIF_BASE +0xfff , + .flags =IORESOURCE_MEM , + } +}; + +static struct platform_device da850_vpif_dev = { + .name ="vpif" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, + .resource = da850_vpif_resource, + .num_resources =ARRAY_SIZE (da850_vpif_resource), +}; + +static unsigned long vpif_disp_cont_buf_offset; + +static int __init cfg_vpif_disp_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_buf_offset); +} +early_param ("vpif_disp_cont_buf_offset" , cfg_vpif_disp_cont_buf_offset); + +static unsigned long vpif_disp_cont_bufsize; + +static int __init cfg_vpif_disp_cont_bufsize (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_bufsize); +} +early_param ("vpif_disp_cont_bufsize" , cfg_vpif_disp_cont_bufsize); + +static unsigned long vpif_cap_cont_buf_offset; + +static int __init cfg_vpif_cap_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_cap_cont_buf_offset); +} +early_param ("vpif_cap_cont_buf_offset" , cfg_vpif_cap_cont_buf_offset); +
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1199
Quoted 10 lines
arch/arm/mach-davinci/da850.c +10
-0+static unsigned long vpif_cap_cont_bufsize; + +static int __init cfg_vpif_cap_cont_bufsize (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_cap_cont_bufsize); +} +early_param ("vpif_cap_cont_bufsize" , cfg_vpif_cap_cont_bufsize);
All these kernel parameters will need to be documented in Documentation/kernel-parameters.txt. I suspect they should rather be module parameters?
Quoted 54 lines
arch/arm/mach-davinci/da850.c +54
-0+ +static struct platform_device da850_vpif_display_dev = { + .name ="vpif_display" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +static struct platform_device da850_vpif_capture_dev = { + .name ="vpif_capture" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +int __init da850_register_vpif (void ) +{ +return platform_device_register (&da850_vpif_dev); +} + +int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret = dma_declare_coherent_memory(&da850_vpif_display_dev.dev,
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 10 lines
arch/arm/mach-davinci/da850.c +10
-0+ phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); + +if (!ret) +return -ENOMEM ; + } + ret =platform_device_add_resources (&da850_vpif_display_dev, + da850_vpif_display_resource, +ARRAY_SIZE (da850_vpif_display_resource));
You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (include/linux/dma-contiguous.h)
Quoted 42 lines
arch/arm/mach-davinci/da850.c +42
-0+if (ret) +return -EINVAL ; + + da850_vpif_display_dev.dev.platform_data = display_config; +return platform_device_register (&da850_vpif_display_dev); +} + +int __init da850_register_vpif_capture (struct vpif_capture_config + *capture_config) +{ +static struct resource da850_vpif_capture_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_cap_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_cap_cont_buf_offset; + da850_vpif_capture_resource[2 ].start = phys_end_kernel; + da850_vpif_capture_resource[2 ].end = phys_end_kernel + + vpif_cap_cont_bufsize -1 ; + da850_vpif_capture_resource[2 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_capture_resource[2 ].start, +resource_size (&da850_vpif_capture_resource[2 ]), + da850_vpif_capture_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret = dma_declare_coherent_memory(&da850_vpif_capture_dev.dev,
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1315
Quoted 10 lines
arch/arm/mach-davinci/da850.c +10
-0+ phys_end_kernel, phys_end_kernel, + vpif_cap_cont_bufsize,DMA_MEMORY_MAP | + DMA_MEMORY_EXCLUSIVE); + +if (!ret) +return -ENOMEM ; + } + ret =platform_device_add_resources (&da850_vpif_capture_dev, + da850_vpif_capture_resource, +ARRAY_SIZE (da850_vpif_capture_resource));
The capture has the same problems as the display part above.
Quoted 32 lines
arch/arm/mach-davinci/da850.c +7
-0+if (ret) +return -EINVAL ; + + da850_vpif_capture_dev.dev.platform_data = capture_config; +return platform_device_register (&da850_vpif_capture_dev); +} +static struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num =ARRAY_SIZE (da850_io_desc),arch/arm/mach-davinci/include/mach/da8xx.h +3
-0@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/davinci_emac.h> #include <linux/spi/spi.h> +#include <linux/videodev2.h> #include <mach/serial.h> #include <mach/edma.h> @@ -26,6 +27,8 @@#include <mach/pm.h> #include <mach/spi.h> +#include <media/davinci/vpif_types.h> +extern void __iomem *da8xx_syscfg0_base;extern void __iomem *da8xx_syscfg1_base;
arch/arm/mach-davinci/include/mach/da8xx.h extern unsigned int da850_max_speed; · line 75
Quoted 4 lines
arch/arm/mach-davinci/include/mach/da8xx.h +1
-0@@ -69,6 +72,7 @@ extern unsigned int da850_max_speed;#define DA8XX_AEMIF_CS3_BASE 0x62000000#define DA8XX_AEMIF_CTL_BASE 0x68000000#define DA8XX_ARM_RAM_BASE 0xffff0000 +#define DA8XX_VPIF_BASE 0x01e17000
These are sorted in increasing order of address. This helps avoid duplicates.
Thanks,
Sekhar
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hi Sekhar,
Thanks for the review. My comments are inlined.
Quoted 37 lines · Sekhar Nori
Hi Prabhakar,
Quoted 34 lines · Prabhakar Lad
From: Manjunath Hadli <[email protected]>
Add clock, pin mux definitions and registration function for VPIF capture and display driver on DA850/OMAP-L138 SoC.
Signed-off-by Manjunath Hadli <[email protected]>Signed-off-by Lad, Prabhakar <[email protected]>Cc Sekhar Nori <[email protected]>--- arch/arm/mach-davinci/da850.c | 256 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 11 ++ arch/arm/mach-davinci/include/mach/mux.h | 42 +++++ arch/arm/mach-davinci/include/mach/psc.h | 1 + 4 files changed, 310 insertions(+), 0 deletions(-)arch/arm/mach-davinci/da850.c +7
-0@@ -347,6 +347,13 @@ static struct clk spi1_clk = { .flags = DA850_CLK_ASYNC3, }; +static struct clk vpif_clk = { + .name ="vpif" , + .parent = &pll0_sysclk2, + .lpsc =DA850_LPSC1_VPIF , + .gpsc =1 , +}; +static struct clk sata_clk = { .name ="sata" , .parent = &pll0_sysclk2,@@ -397,6 +404,7 @@ static struct clk_lookup da850_clks[] = {
Quoted 9 lines
arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 407
Quoted 4 lines
arch/arm/mach-davinci/da850.c +1
-0CLK (NULL ,"usb20" , &usb20_clk),CLK ("spi_davinci.0" ,NULL , &spi0_clk),CLK ("spi_davinci.1" ,NULL , &spi1_clk), + CLK(NULL, "vpif", &vpif_clk),You should
dev_idfor lookup instead ofcon_id. Looking atdrivers/media/video/davinci/vpif.c, there is a single clock that VPIF needs, socon_idcan actually be passed as NULL.
Ok I'll use dev_id.
Quoted 143 lines
Quoted 143 lines
arch/arm/mach-davinci/da850.c +122
-0CLK ("ahci" ,NULL , &sata_clk), CLK(NULL, NULL, NULL), };@@ -573,6 +581,46 @@ static const struct mux_config da850_pins[] = { MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false) MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)MUX_CFG (DA850 ,RTC_ALARM ,0 ,28 ,15 ,2 , false) + /* VPIF Capture */ + MUX_CFG(DA850, VPIF_DIN0, 15, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN1, 15, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN2, 14, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN3, 14, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN4, 14, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN5, 14, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN6, 14, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN7, 14, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN8, 16, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN9, 16, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN10, 15, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN11, 15, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN12, 15, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN13, 15, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN14, 15, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DIN15, 15, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN0, 14, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN1, 14, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKIN2, 19, 8, 15, 1, false) +MUX_CFG (DA850 ,VPIF_CLKIN3 ,19 ,16 ,15 ,1 , false) + /* VPIF Display */ + MUX_CFG(DA850, VPIF_DOUT0, 17, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT1, 17, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT2, 16, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT3, 16, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT4, 16, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT5, 16, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT6, 16, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT7, 16, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT8, 18, 4, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT9, 18, 0, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT10, 17, 28, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT11, 17, 24, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT12, 17, 20, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT13, 17, 16, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT14, 17, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_DOUT15, 17, 8, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO2, 19, 12, 15, 1, false) + MUX_CFG(DA850, VPIF_CLKO3, 19, 20, 15, 1, false)#endif };@@ -595,6 +643,26 @@ const short da850_lcdcntl_pins[] __initdata = {-1 }; +const short da850_vpif_capture_pins[]__initdata = { +DA850_VPIF_DIN0 ,DA850_VPIF_DIN1 ,DA850_VPIF_DIN2 ,DA850_VPIF_DIN3 , +DA850_VPIF_DIN4 ,DA850_VPIF_DIN5 ,DA850_VPIF_DIN6 ,DA850_VPIF_DIN7 , +DA850_VPIF_DIN8 ,DA850_VPIF_DIN9 ,DA850_VPIF_DIN10 ,DA850_VPIF_DIN11 , +DA850_VPIF_DIN12 ,DA850_VPIF_DIN13 ,DA850_VPIF_DIN14 ,DA850_VPIF_DIN15 , +DA850_VPIF_CLKIN0 ,DA850_VPIF_CLKIN1 ,DA850_VPIF_CLKIN2 , +DA850_VPIF_CLKIN3 , +-1 +}; + +const short da850_vpif_display_pins[]__initdata = { +DA850_VPIF_DOUT0 ,DA850_VPIF_DOUT1 ,DA850_VPIF_DOUT2 ,DA850_VPIF_DOUT3 , +DA850_VPIF_DOUT4 ,DA850_VPIF_DOUT5 ,DA850_VPIF_DOUT6 ,DA850_VPIF_DOUT7 , +DA850_VPIF_DOUT8 ,DA850_VPIF_DOUT9 ,DA850_VPIF_DOUT10 , +DA850_VPIF_DOUT11 ,DA850_VPIF_DOUT12 ,DA850_VPIF_DOUT13 , +DA850_VPIF_DOUT14 ,DA850_VPIF_DOUT15 ,DA850_VPIF_CLKO2 , +DA850_VPIF_CLKO3 , +-1 +}; +/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ ] = { [IRQ_DA8XX_COMMTX ] =7 ,@@ -1064,6 +1132,194 @@ no_ddrpll_mem:return ret; } +/* VPIF resource, platform data */ +static u64 da850_vpif_dma_mask =DMA_BIT_MASK (32 ); + +static struct resource da850_vpif_resource[] = { + { + .start =DA8XX_VPIF_BASE , + .end =DA8XX_VPIF_BASE +0xfff , + .flags =IORESOURCE_MEM , + } +}; + +static struct platform_device da850_vpif_dev = { + .name ="vpif" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, + .resource = da850_vpif_resource, + .num_resources =ARRAY_SIZE (da850_vpif_resource), +}; + +static unsigned long vpif_disp_cont_buf_offset; + +static int __init cfg_vpif_disp_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_buf_offset); +} +early_param ("vpif_disp_cont_buf_offset" , cfg_vpif_disp_cont_buf_offset); + +static unsigned long vpif_disp_cont_bufsize; + +static int __init cfg_vpif_disp_cont_bufsize (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_disp_cont_bufsize); +} +early_param ("vpif_disp_cont_bufsize" , cfg_vpif_disp_cont_bufsize); + +static unsigned long vpif_cap_cont_buf_offset; + +static int __init cfg_vpif_cap_cont_buf_offset (char *p) +{ +if (!p) +return 0 ; + +return kstrtoul (p,10 , &vpif_cap_cont_buf_offset); +} +early_param ("vpif_cap_cont_buf_offset" , cfg_vpif_cap_cont_buf_offset); + +static unsigned long vpif_cap_cont_bufsize; + +static int __init cfg_vpif_cap_cont_bufsize (char *p) +{ +if (!p) +return 0 ; +
Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1199
Quoted 3 lines
arch/arm/mach-davinci/da850.c +3
-0+return kstrtoul (p,10 , &vpif_cap_cont_bufsize); +} +early_param ("vpif_cap_cont_bufsize" , cfg_vpif_cap_cont_bufsize);All these kernel parameters will need to be documented in
Documentation/kernel-parameters.txt. I suspect they should rather be module parameters?
This was added since dma_declare_coherent() should be done in the machine file. This was discussed over this thread,
http://linux.omap.com/pipermail/davinci-linux-open-source/2012-May/024165.html.
Quoted 60 lines
Quoted 60 lines
arch/arm/mach-davinci/da850.c +60
-0+ +static struct platform_device da850_vpif_display_dev = { + .name ="vpif_display" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +static struct platform_device da850_vpif_capture_dev = { + .name ="vpif_capture" , + .id =-1 , + .dev = { + .dma_mask = &da850_vpif_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, +}; + +int __init da850_register_vpif (void ) +{ +return platform_device_register (&da850_vpif_dev); +} + +int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ;
Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 4 lines
arch/arm/mach-davinci/da850.c +4
-0+ } + ret =platform_device_add_resources (&da850_vpif_display_dev, + da850_vpif_display_resource, +ARRAY_SIZE (da850_vpif_display_resource));You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (
include/linux/dma-contiguous.h)
Ok. But looks like CMA is enabled for CPU_V6/V6K/V7. If CMA is enabled for ARM926 too than we can use the global CMA itself rather then doing it for each device, then three will be no need to do the above and all the kernel parameters can be removed too.
Quoted 46 lines
Quoted 46 lines
arch/arm/mach-davinci/da850.c +46
-0+if (ret) +return -EINVAL ; + + da850_vpif_display_dev.dev.platform_data = display_config; +return platform_device_register (&da850_vpif_display_dev); +} + +int __init da850_register_vpif_capture (struct vpif_capture_config + *capture_config) +{ +static struct resource da850_vpif_capture_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_cap_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_cap_cont_buf_offset; + da850_vpif_capture_resource[2 ].start = phys_end_kernel; + da850_vpif_capture_resource[2 ].end = phys_end_kernel + + vpif_cap_cont_bufsize -1 ; + da850_vpif_capture_resource[2 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_capture_resource[2 ].start, +resource_size (&da850_vpif_capture_resource[2 ]), + da850_vpif_capture_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_capture_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_cap_cont_bufsize,DMA_MEMORY_MAP | +DMA_MEMORY_EXCLUSIVE ); +
Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1315
Quoted 6 lines
arch/arm/mach-davinci/da850.c +6
-0+if (!ret) +return -ENOMEM ; + } + ret =platform_device_add_resources (&da850_vpif_capture_dev, + da850_vpif_capture_resource, +ARRAY_SIZE (da850_vpif_capture_resource));The capture has the same problems as the display part above.
ditto
Quoted 31 lines
Quoted 31 lines
arch/arm/mach-davinci/da850.c +7
-0+if (ret) +return -EINVAL ; + + da850_vpif_capture_dev.dev.platform_data = capture_config; +return platform_device_register (&da850_vpif_capture_dev); +} +static struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num =ARRAY_SIZE (da850_io_desc),arch/arm/mach-davinci/include/mach/da8xx.h +3
-0@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/davinci_emac.h> #include <linux/spi/spi.h> +#include <linux/videodev2.h> #include <mach/serial.h> #include <mach/edma.h> @@ -26,6 +27,8 @@#include <mach/pm.h> #include <mach/spi.h> +#include <media/davinci/vpif_types.h> +extern void __iomem *da8xx_syscfg0_base;extern void __iomem *da8xx_syscfg1_base;
Quoted 9 lines
arch/arm/mach-davinci/include/mach/da8xx.h extern unsigned int da850_max_speed; · line 75
Quoted 5 lines
arch/arm/mach-davinci/include/mach/da8xx.h +1
-0@@ -69,6 +72,7 @@ extern unsigned int da850_max_speed;#define DA8XX_AEMIF_CS3_BASE 0x62000000#define DA8XX_AEMIF_CTL_BASE 0x68000000#define DA8XX_ARM_RAM_BASE 0xffff0000 +#define DA8XX_VPIF_BASE 0x01e17000These are sorted in increasing order of address. This helps avoid duplicates.
Ok I'll keep them sorted.
Thx,
--Prabhakar
Quoted 3 lines
Thanks,
Sekhar
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hi Prabhakar,
Quoted 1 line · Prabhakar Lad
On Tuesday 14 August 2012 05:58 PM, Sekhar Nori wrote:
[...]
Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
arch/arm/mach-davinci/da850.c +36
-0+int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ;Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 4 lines
arch/arm/mach-davinci/da850.c +4
-0+ } + ret =platform_device_add_resources (&da850_vpif_display_dev, + da850_vpif_display_resource, +ARRAY_SIZE (da850_vpif_display_resource));You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (
include/linux/dma-contiguous.h)
Quoted 4 lines
Ok. But looks like CMA is enabled for CPU_V6/V6K/V7. If CMA is enabled for ARM926 too than we can use the global CMA itself rather then doing it for each device, then three will be no need to do the above and all the kernel parameters can be removed too.
I hadn't followed the CMA development closely so I am not sure of the reasons behind restricting it to v6+. The patch that added this doesn't really talk about why it should be restricted to v6+. I am copying Marek here to see if he can quickly clarify, but may be you can even start a new thread asking about this.
Thanks,
Sekhar
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hello,
Quoted 55 lines · Sekhar Nori
Quoted 1 line · Prabhakar Lad
On Tuesday 14 August 2012 05:58 PM, Sekhar Nori wrote:
[...]
Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
arch/arm/mach-davinci/da850.c +36
-0+int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ;Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 4 lines
arch/arm/mach-davinci/da850.c +4
-0+ } + ret =platform_device_add_resources (&da850_vpif_display_dev, + da850_vpif_display_resource, +ARRAY_SIZE (da850_vpif_display_resource));You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (
include/linux/dma-contiguous.h)Quoted 4 lines
Ok. But looks like CMA is enabled for CPU_V6/V6K/V7. If CMA is enabled for ARM926 too than we can use the global CMA itself rather then doing it for each device, then three will be no need to do the above and all the kernel parameters can be removed too.
Quoted 5 lines
I hadn't followed the CMA development closely so I am not sure of the reasons behind restricting it to v6+. The patch that added this doesn't really talk about why it should be restricted to v6+. I am copying Marek here to see if he can quickly clarify, but may be you can even start a new thread asking about this.
Frankly, this is a leftover from some earlier suggestions that CMA should solve the aliasing of coherent mappings, which might be a problem on v6+. If it works correctly on pre-v6, then this dependency should be removed. Feel free to submit a patch and I will take it to my fixes branch.
Best regards
Signature · 2 lines
Marek Szyprowski Samsung Poland R&D Center
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hi Marek,
Quoted 65 lines · Marek Szyprowski
Hello,
Quoted 55 lines · Sekhar Nori
Quoted 1 line · Prabhakar Lad
On Tuesday 14 August 2012 05:58 PM, Sekhar Nori wrote:
[...]
Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
arch/arm/mach-davinci/da850.c +36
-0+int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ;Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 4 lines
+ }
+ ret = platform_device_add_resources(&da850_vpif_display_dev,arch/arm/mach-davinci/da850.c +2
-0+ da850_vpif_display_resource, + ARRAY_SIZE(da850_vpif_display_resource));You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (
include/linux/dma-contiguous.h)Quoted 4 lines
Ok. But looks like CMA is enabled for CPU_V6/V6K/V7. If CMA is enabled for ARM926 too than we can use the global CMA itself rather then doing it for each device, then three will be no need to do the above and all the kernel parameters can be removed too.
Quoted 5 lines
I hadn't followed the CMA development closely so I am not sure of the reasons behind restricting it to v6+. The patch that added this doesn't really talk about why it should be restricted to v6+. I am copying Marek here to see if he can quickly clarify, but may be you can even start a new thread asking about this.
Quoted 5 lines
Frankly, this is a leftover from some earlier suggestions that CMA should solve the aliasing of coherent mappings, which might be a problem on v6+. If it works correctly on pre-v6, then this dependency should be removed. Feel free to submit a patch and I will take it to my fixes branch.
I have created a patch for enabling CMA on CPU32_v5 [1], and also tested it works.
Soon posting this patch.
Thanks and Regards,
--Prabhakar Lad
Quoted 11 lines
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/2 ARM: da850/omap-l138: Add SoC related definitions for VPIF
Hi Prabhakar,
Quoted 73 lines · Prabhakar Lad
Quoted 65 lines · Marek Szyprowski
Hello,
Quoted 55 lines · Sekhar Nori
Quoted 1 line · Prabhakar Lad
On Tuesday 14 August 2012 05:58 PM, Sekhar Nori wrote:
[...]
Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
arch/arm/mach-davinci/da850.c +36
-0+int __init da850_register_vpif_display (struct vpif_display_config + *display_config) +{ +struct resource da850_vpif_display_resource[] = { + { + .start =IRQ_DA850_VPIFINT , + .end =IRQ_DA850_VPIFINT , + .flags =IORESOURCE_IRQ , + }, + {}, + }; +unsigned long phys_end_kernel; +int ret; + +if (vpif_disp_cont_bufsize) { + phys_end_kernel =virt_to_phys ((void *)PAGE_OFFSET ) + + (num_physpages <<PAGE_SHIFT ); + phys_end_kernel += vpif_disp_cont_buf_offset; + da850_vpif_display_resource[1 ].start = phys_end_kernel; + da850_vpif_display_resource[1 ].end = phys_end_kernel + + vpif_disp_cont_bufsize -1 ; + da850_vpif_display_resource[1 ].flags =IORESOURCE_MEM ; + +if (!request_mem_region (da850_vpif_display_resource[1 ].start, +resource_size (&da850_vpif_display_resource[1 ]), + da850_vpif_display_dev.name)) { +pr_err ("region already claimed.\n" ); +return -EBUSY ; + } + ret =dma_declare_coherent_memory (&da850_vpif_display_dev.dev, + phys_end_kernel, phys_end_kernel, + vpif_disp_cont_bufsize, +DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); + +if (!ret) +return -ENOMEM ;Quoted 9 lines
arch/arm/mach-davinci/da850.c no_ddrpll_mem: · line 1263
Quoted 4 lines
+ }
+ ret = platform_device_add_resources(&da850_vpif_display_dev,arch/arm/mach-davinci/da850.c +2
-0+ da850_vpif_display_resource, + ARRAY_SIZE(da850_vpif_display_resource));You are taking memory at the end of RAM and passing it as a IO resource to the driver. This is not correct. For contiguous memory needs can you look at the recently merged CMA framework (
include/linux/dma-contiguous.h)Quoted 4 lines
Ok. But looks like CMA is enabled for CPU_V6/V6K/V7. If CMA is enabled for ARM926 too than we can use the global CMA itself rather then doing it for each device, then three will be no need to do the above and all the kernel parameters can be removed too.
Quoted 5 lines
I hadn't followed the CMA development closely so I am not sure of the reasons behind restricting it to v6+. The patch that added this doesn't really talk about why it should be restricted to v6+. I am copying Marek here to see if he can quickly clarify, but may be you can even start a new thread asking about this.
Quoted 5 lines
Frankly, this is a leftover from some earlier suggestions that CMA should solve the aliasing of coherent mappings, which might be a problem on v6+. If it works correctly on pre-v6, then this dependency should be removed. Feel free to submit a patch and I will take it to my fixes branch.
Quoted 7 lines
I have created a patch for enabling CMA on
CPU32_v5[1], and also tested it works.
Soon posting this patch.[1] http://git.linuxtv.org/mhadli/v4l-dvb-
davinci_devices.git/commitdiff/e940a1b9262bde96eec4b18971a6307f24262667?hp=2f30ae4ee373fe4c69ab1606373538dcc99ed283
I've taken a look at this issue and realized that the dependency on enabled MMU is much better idea instead of listing possible CPU versions, so I've posted a new patch:
http://lists.linaro.org/pipermail/linaro-mm-sig/2012-August/002374.html
Best regards
Signature · 2 lines
Marek Szyprowski Samsung Poland R&D Center
PATCH 2/2 ARM: da850/omap-l138: Add EVM specific code for VPIF to work
In reply to Prabhakar LadFrom: Manjunath Hadli <[email protected]>
Include the expander settings to select VPIF peripheral on UI card and add registration call in EVM init. Also add platform data to configure display and capture devices.
--- arch/arm/mach-davinci/Kconfig | 9 ++ arch/arm/mach-davinci/board-da850-evm.c | 195 +++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/Kconfig +9 -0
@@ -190,6 +190,15 @@ config DA850_UI_RMII NOTE: Please take care while choosing this option, MII PHY will not be functional if RMII mode is selected. +config DA850_UI_SD_VIDEO_PORT + bool "Video Port Interface" + help + Say Y if you want to use Video Port Interface (VPIF) on the + DA850/OMAP-L138 EVM. The Video decoders/encoders are found on the + UI daughter card that is supplied with the EVM. + NOTE: Please make sure to disable RMII and CLCD options when you + select Video Port Interface. + endchoice config DA850_WL12XX
arch/arm/mach-davinci/board-da850-evm.c +195 -0
231 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/2 ARM: da850/omap-l138: Add EVM specific code for VPIF to work
Hi Prabhakar,
Quoted 20 lines · Prabhakar Lad
From: Manjunath Hadli <[email protected]>
Include the expander settings to select VPIF peripheral on UI card and add registration call in EVM init. Also add platform data to configure display and capture devices.
Signed-off-by Manjunath Hadli <[email protected]>Signed-off-by Lad, Prabhakar <[email protected]>Cc Sekhar Nori <[email protected]>--- arch/arm/mach-davinci/Kconfig | 9 ++ arch/arm/mach-davinci/board-da850-evm.c | 195 +++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 0 deletions(-)arch/arm/mach-davinci/Kconfig +0
-0@@ -190,6 +190,15 @@ config DA850_UI_RMII NOTE: Please take care while choosing this option, MII PHY will
arch/arm/mach-davinci/Kconfig config DA850_UI_RMII · line 200
Quoted 10 lines
arch/arm/mach-davinci/Kconfig +8
-0not be functional if RMII mode is selected. +config DA850_UI_SD_VIDEO_PORT + bool "Video Port Interface" + help + Say Y if you want to use Video Port Interface (VPIF) on the + DA850/OMAP-L138 EVM. The Video decoders/encoders are found on the + UI daughter card that is supplied with the EVM. + NOTE: Please make sure to disable RMII and CLCD options when you + select Video Port Interface.
RMII is in the same choice block as this so it is not possible to have RMII enabled along with video port selection. On the CLCD, it will be good to register only one of CLCD or video and print a warning if user enabled both. davinci_evm_init() in arch/arm/mach-davinci/board-dm644x-evm.c has an example of this.
Quoted 64 lines
arch/arm/mach-davinci/Kconfig +1
-0+ endchoice config DA850_WL12XXarch/arm/mach-davinci/board-da850-evm.c +24
-0@@ -45,6 +45,8 @@#include <mach/aemif.h> #include <mach/spi.h> +#include <media/tvp514x.h> +#define DA850_EVM_PHY_ID "davinci_mdio-0:00"#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)@@ -121,6 +123,12 @@ static struct spi_board_info da850evm_spi_info[] = { }, }; +#define TVP5147_CH0 "tvp514x-0" +#define TVP5147_CH1 "tvp514x-1" + +#define VPIF_STATUS 0x002c +#define VPIF_STATUS_CLR 0x0030 +#ifdef CONFIG_MTD static void da850_evm_m25p80_notify_add (struct mtd_info *mtd) {@@ -452,6 +460,15 @@ static void da850_evm_ui_keys_init(unsigned gpio) } } +#ifdef CONFIG_DA850_UI_SD_VIDEO_PORT +static inline void da850_evm_setup_video_port (int video_sel) +{ +gpio_set_value_cansleep (video_sel,0 ); +} +#else +static inline void da850_evm_setup_video_port (int video_sel) { } +#endif +static int da850_evm_ui_expander_setup (struct i2c_client *client,unsigned gpio,unsigned ngpio,void *c) {@@ -497,6 +514,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,da850_evm_setup_emac_rmii (sel_a); +da850_evm_setup_video_port (sel_c); +return 0 ; exp_setup_keys_fail:@@ -1149,6 +1168,151 @@ static __init int da850_evm_init_cpufreq(void)static __init int da850_evm_init_cpufreq (void ) {return 0 ; }#endif +/* Retaining these APIs, since the VPIF drivers do not check NULL handlers */ +static int da850_set_vpif_clock (int mux_mode,int hd) +{ +return 0 ; +}
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1185
Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +10
-0+ +static int da850_setup_vpif_input_channel_mode (int mux_mode) +{ +return 0 ; +} + +int da850_vpif_setup_input_path (int ch,const char *name) +{ +return 0 ; +}
Why not enhance the VPIF driver to handle NULL values for these instead?
Quoted 4 lines
arch/arm/mach-davinci/board-da850-evm.c +4
-0+ +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT ) +/* VPIF capture configuration */ +static struct tvp514x_platform_data tvp5146_pdata = {
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1199
Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +10
-0+ .clk_polarity = 0, + .hs_polarity = 1, + .vs_polarity =1 +}; +#endif + +#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) + +static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT )
Why not just continue with the previous #ifdefCONFIG_DA850_UI_SD_VIDEO_PORT?
Quoted 55 lines
arch/arm/mach-davinci/board-da850-evm.c +55
-0+ { + .name = TVP5147_CH0, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5d), + .platform_data = &tvp5146_pdata, + }, + .input = INPUT_CVBS_VI2B, + .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .can_route = 1, + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, + { + .name = TVP5147_CH1, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5c), + .platform_data = &tvp5146_pdata, + }, + .input = INPUT_SVIDEO_VI2C_VI1C, + .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .can_route = 1, + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, +#endif +}; + +static const struct vpif_input da850_ch0_inputs[] = { + { + .input = { + .index = 0, + .name = "Composite", + .type = V4L2_INPUT_TYPE_CAMERA, + .std = TVP514X_STD_ALL, + }, + .subdev_name = TVP5147_CH0, + }, +}; + +static const struct vpif_input da850_ch1_inputs[] = { + { + .input = { + .index = 0, + .name = "S-Video", + .type = V4L2_INPUT_TYPE_CAMERA, + .std = TVP514X_STD_ALL, + },
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1264
Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +10
-0+ .subdev_name = TVP5147_CH1, + }, +}; + +static struct vpif_capture_config da850_vpif_capture_config = { + .setup_input_channel_mode = da850_setup_vpif_input_channel_mode, + .setup_input_path = da850_vpif_setup_input_path, + .subdev_info = da850_vpif_capture_sdev_info, + .subdev_count =ARRAY_SIZE (da850_vpif_capture_sdev_info), +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
Same here.
Quoted 65 lines
arch/arm/mach-davinci/board-da850-evm.c +58
-0+ .chan_config[0] = { + .inputs = da850_ch0_inputs, + .input_count = ARRAY_SIZE(da850_ch0_inputs), + }, + .chan_config[1] = { + .inputs = da850_ch1_inputs, + .input_count = ARRAY_SIZE(da850_ch1_inputs), + }, +#endif + .card_name = "DA850/OMAP-L138 Video Capture", +}; + +/* VPIF display configuration */ +static struct vpif_subdev_info da850_vpif_subdev[] = { + { + .name ="adv7343" , + .board_info = { +I2C_BOARD_INFO ("adv7343" ,0x2a ), + }, + }, +}; + +static const char const *vpif_output[] = { +"Composite" , +"Component" , +"S-Video" , +}; + +static struct vpif_display_config da850_vpif_display_config = { + .set_clock = da850_set_vpif_clock, + .subdevinfo = da850_vpif_subdev, + .subdev_count =ARRAY_SIZE (da850_vpif_subdev), + .output = vpif_output, + .output_count =ARRAY_SIZE (vpif_output), + .card_name ="DA850/OMAP-L138 Video Display" , +}; + +#if defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY ) ||\ + defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY_MODULE ) +#define HAS_VPIF_DISPLAY 1 +#else +#define HAS_VPIF_DISPLAY 0 +#endif + +#if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE ) ||\ + defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE ) +#define HAS_VPIF_CAPTURE 1 +#else +#define HAS_VPIF_CAPTURE 0 +#endif +#ifdef CONFIG_DA850_WL12XX static void wl12xx_set_power (int index,bool power_on)@@ -1375,6 +1539,37 @@ static __init void da850_evm_init(void)pr_warning ("da850_evm_init: suspend registration failed: %d\n" , ret); +if (HAS_VPIF_DISPLAY ||HAS_VPIF_CAPTURE ) { + ret =da850_register_vpif (); +if (ret) +pr_warn ("da850_evm_init: VPIF setup failed: %d\n" , + ret); + } +
arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1558
Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +10
-0+if (HAS_VPIF_CAPTURE ) { + ret =davinci_cfg_reg_list (da850_vpif_capture_pins); +if (ret) +pr_warn ("da850_evm_init: VPIF capture mux failed:%d\n" , + ret); + + ret =da850_register_vpif_capture (&da850_vpif_capture_config); +if (ret) +pr_warn ("da850_evm_init: VPIF capture setup" \ +" failed: %d\n" , ret);
Please don't break print messages.
arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1570
Quoted 12 lines
arch/arm/mach-davinci/board-da850-evm.c +12
-0+ } + +if (HAS_VPIF_DISPLAY ) { + ret =davinci_cfg_reg_list (da850_vpif_display_pins); +if (ret) +pr_warn ("da850_evm_init : VPIF capture mux failed" \ +": %d\n" , ret); + + ret =da850_register_vpif_display (&da850_vpif_display_config); +if (ret) +pr_warn ("da850_evm_init: VPIF display setup" \ +" failed: %d\n" , ret);
Same here.
Thanks,
Sekhar
PATCH 2/2 ARM: da850/omap-l138: Add EVM specific code for VPIF to work
Hi Sekhar,
Thanks for the review.
Quoted 25 lines · Sekhar Nori
Hi Prabhakar,
Quoted 22 lines · Prabhakar Lad
From: Manjunath Hadli <[email protected]>
Include the expander settings to select VPIF peripheral on UI card and add registration call in EVM init. Also add platform data to configure display and capture devices.
Signed-off-by Manjunath Hadli <[email protected]>Signed-off-by Lad, Prabhakar <[email protected]>Cc Sekhar Nori <[email protected]>--- arch/arm/mach-davinci/Kconfig | 9 ++ arch/arm/mach-davinci/board-da850-evm.c | 195 +++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 0 deletions(-)arch/arm/mach-davinci/Kconfig +0
-0@@ -190,6 +190,15 @@ config DA850_UI_RMII NOTE: Please take care while choosing this option, MII PHY will not be functional if RMII mode is selected.
Quoted 15 lines
arch/arm/mach-davinci/Kconfig config DA850_UI_RMII · line 200
Quoted 8 lines
arch/arm/mach-davinci/Kconfig +8
-0+config DA850_UI_SD_VIDEO_PORT + bool "Video Port Interface" + help + Say Y if you want to use Video Port Interface (VPIF) on the + DA850/OMAP-L138 EVM. The Video decoders/encoders are found on the + UI daughter card that is supplied with the EVM. + NOTE: Please make sure to disable RMII and CLCD options when you + select Video Port Interface.RMII is in the same choice block as this so it is not possible to have RMII enabled along with video port selection. On the CLCD, it will be good to register only one of CLCD or video and print a warning if user enabled both.
davinci_evm_init()inarch/arm/mach-davinci/board-dm644x-evm.chas an example of this.
The CLCD support is not in mainlined yet, if it is the option to enable
the CLCD will also come in the same choice block if I am not wrong. So by any means the user can select only one of them.
Quoted 68 lines
Quoted 68 lines
arch/arm/mach-davinci/Kconfig +1
-0+ endchoice config DA850_WL12XXarch/arm/mach-davinci/board-da850-evm.c +28
-0@@ -45,6 +45,8 @@#include <mach/aemif.h> #include <mach/spi.h> +#include <media/tvp514x.h> +#define DA850_EVM_PHY_ID "davinci_mdio-0:00"#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)@@ -121,6 +123,12 @@ static struct spi_board_info da850evm_spi_info[] = { }, }; +#define TVP5147_CH0 "tvp514x-0" +#define TVP5147_CH1 "tvp514x-1" + +#define VPIF_STATUS 0x002c +#define VPIF_STATUS_CLR 0x0030 +#ifdef CONFIG_MTD static void da850_evm_m25p80_notify_add (struct mtd_info *mtd) {@@ -452,6 +460,15 @@ static void da850_evm_ui_keys_init(unsigned gpio) } } +#ifdef CONFIG_DA850_UI_SD_VIDEO_PORT +static inline void da850_evm_setup_video_port (int video_sel) +{ +gpio_set_value_cansleep (video_sel,0 ); +} +#else +static inline void da850_evm_setup_video_port (int video_sel) { } +#endif +static int da850_evm_ui_expander_setup (struct i2c_client *client,unsigned gpio,unsigned ngpio,void *c) {@@ -497,6 +514,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,da850_evm_setup_emac_rmii (sel_a); +da850_evm_setup_video_port (sel_c); +return 0 ; exp_setup_keys_fail:@@ -1149,6 +1168,151 @@ static __init int da850_evm_init_cpufreq(void)static __init int da850_evm_init_cpufreq (void ) {return 0 ; }#endif +/* Retaining these APIs, since the VPIF drivers do not check NULL handlers */ +static int da850_set_vpif_clock (int mux_mode,int hd) +{ +return 0 ; +} + +static int da850_setup_vpif_input_channel_mode (int mux_mode) +{ +return 0 ;
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1185
Quoted 6 lines
arch/arm/mach-davinci/board-da850-evm.c +6
-0+} + +int da850_vpif_setup_input_path (int ch,const char *name) +{ +return 0 ; +}Why not enhance the VPIF driver to handle NULL values for these instead?
Ok can be done.
Quoted 9 lines
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c +9
-0+ +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT ) +/* VPIF capture configuration */ +static struct tvp514x_platform_data tvp5146_pdata = { + .clk_polarity =0 , + .hs_polarity =1 , + .vs_polarity =1 +}; +#endif
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1199
Quoted 5 lines
arch/arm/mach-davinci/board-da850-evm.c +5
-0+ +#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) + +static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT )Why not just continue with the previous #ifdef
CONFIG_DA850_UI_SD_VIDEO_PORT?
Ok
Quoted 59 lines
Quoted 59 lines
arch/arm/mach-davinci/board-da850-evm.c +59
-0+ { + .name = TVP5147_CH0, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5d), + .platform_data = &tvp5146_pdata, + }, + .input = INPUT_CVBS_VI2B, + .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .can_route = 1, + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, + { + .name = TVP5147_CH1, + .board_info = { + I2C_BOARD_INFO("tvp5146", 0x5c), + .platform_data = &tvp5146_pdata, + }, + .input = INPUT_SVIDEO_VI2C_VI1C, + .output = OUTPUT_10BIT_422_EMBEDDED_SYNC, + .can_route = 1, + .vpif_if = { + .if_type = VPIF_IF_BT656, + .hd_pol = 1, + .vd_pol = 1, + .fid_pol = 0, + }, + }, +#endif +}; + +static const struct vpif_input da850_ch0_inputs[] = { + { + .input = { + .index = 0, + .name = "Composite", + .type = V4L2_INPUT_TYPE_CAMERA, + .std = TVP514X_STD_ALL, + }, + .subdev_name = TVP5147_CH0, + }, +}; + +static const struct vpif_input da850_ch1_inputs[] = { + { + .input = { + .index = 0, + .name = "S-Video", + .type = V4L2_INPUT_TYPE_CAMERA, + .std = TVP514X_STD_ALL, + }, + .subdev_name = TVP5147_CH1, + }, +}; +
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1264
Quoted 6 lines
arch/arm/mach-davinci/board-da850-evm.c +6
-0+static struct vpif_capture_config da850_vpif_capture_config = { + .setup_input_channel_mode = da850_setup_vpif_input_channel_mode, + .setup_input_path = da850_vpif_setup_input_path, + .subdev_info = da850_vpif_capture_sdev_info, + .subdev_count =ARRAY_SIZE (da850_vpif_capture_sdev_info), +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)Same here.
Ok
Quoted 69 lines
Quoted 69 lines
arch/arm/mach-davinci/board-da850-evm.c +62
-0+ .chan_config[0] = { + .inputs = da850_ch0_inputs, + .input_count = ARRAY_SIZE(da850_ch0_inputs), + }, + .chan_config[1] = { + .inputs = da850_ch1_inputs, + .input_count = ARRAY_SIZE(da850_ch1_inputs), + }, +#endif + .card_name = "DA850/OMAP-L138 Video Capture", +}; + +/* VPIF display configuration */ +static struct vpif_subdev_info da850_vpif_subdev[] = { + { + .name ="adv7343" , + .board_info = { +I2C_BOARD_INFO ("adv7343" ,0x2a ), + }, + }, +}; + +static const char const *vpif_output[] = { +"Composite" , +"Component" , +"S-Video" , +}; + +static struct vpif_display_config da850_vpif_display_config = { + .set_clock = da850_set_vpif_clock, + .subdevinfo = da850_vpif_subdev, + .subdev_count =ARRAY_SIZE (da850_vpif_subdev), + .output = vpif_output, + .output_count =ARRAY_SIZE (vpif_output), + .card_name ="DA850/OMAP-L138 Video Display" , +}; + +#if defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY ) ||\ + defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY_MODULE ) +#define HAS_VPIF_DISPLAY 1 +#else +#define HAS_VPIF_DISPLAY 0 +#endif + +#if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE ) ||\ + defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE ) +#define HAS_VPIF_CAPTURE 1 +#else +#define HAS_VPIF_CAPTURE 0 +#endif +#ifdef CONFIG_DA850_WL12XX static void wl12xx_set_power (int index,bool power_on)@@ -1375,6 +1539,37 @@ static __init void da850_evm_init(void)pr_warning ("da850_evm_init: suspend registration failed: %d\n" , ret); +if (HAS_VPIF_DISPLAY ||HAS_VPIF_CAPTURE ) { + ret =da850_register_vpif (); +if (ret) +pr_warn ("da850_evm_init: VPIF setup failed: %d\n" , + ret); + } + +if (HAS_VPIF_CAPTURE ) { + ret =davinci_cfg_reg_list (da850_vpif_capture_pins); +if (ret) + pr_warn("da850_evm_init: VPIF capture mux failed:%d\n",
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1558
Quoted 6 lines
arch/arm/mach-davinci/board-da850-evm.c +6
-0+ ret); + + ret =da850_register_vpif_capture (&da850_vpif_capture_config); +if (ret) +pr_warn ("da850_evm_init: VPIF capture setup" \ +" failed: %d\n" , ret);Please don't break print messages.
Ok.
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-davinci/board-da850-evm.c +6
-0+ } + +if (HAS_VPIF_DISPLAY ) { + ret =davinci_cfg_reg_list (da850_vpif_display_pins); +if (ret) + pr_warn("da850_evm_init : VPIF capture mux failed" \
Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1570
Quoted 6 lines
arch/arm/mach-davinci/board-da850-evm.c +6
-0+ ": %d\n", ret); + + ret =da850_register_vpif_display (&da850_vpif_display_config); +if (ret) +pr_warn ("da850_evm_init: VPIF display setup" \ +" failed: %d\n" , ret);Same here.
Ok.
Thx,
--Prabhakar
Quoted 3 lines
Thanks,
Sekhar