[media] davinci/vpss: add helper functions for setting hw params
authorManjunath Hadli <manjunath.hadli@ti.com>
Tue, 21 Aug 2012 08:56:21 +0000 (05:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Dec 2012 16:07:20 +0000 (14:07 -0200)
Add vpss helper functions to be used in the main driver for setting
hardware parameters.

Add interface functions to set sync polarity, interrupt completion and
pageframe size in vpss to be used by the main driver.

Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/davinci/vpss.c
include/media/davinci/vpss.h

index e4ad63d152657c7a747f97d9aea86736bd097b65..d945f94053a8802836f0a98cd4709f2e7138c895 100644 (file)
@@ -111,6 +111,12 @@ struct vpss_hw_ops {
        void (*select_ccdc_source)(enum vpss_ccdc_source_sel src_sel);
        /* clear wbl overflow bit */
        int (*clear_wbl_overflow)(enum vpss_wbl_sel wbl_sel);
+       /* set sync polarity */
+       void (*set_sync_pol)(struct vpss_sync_pol);
+       /* set the PG_FRAME_SIZE register*/
+       void (*set_pg_frame_size)(struct vpss_pg_frame_size);
+       /* check and clear interrupt if occured */
+       int (*dma_complete_interrupt)(void);
 };
 
 /* vpss configuration */
@@ -175,6 +181,14 @@ static void dm355_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
        bl_regw(src_sel << VPSS_HSSISEL_SHIFT, DM355_VPSSBL_CCDCMUX);
 }
 
+int vpss_dma_complete_interrupt(void)
+{
+       if (!oper_cfg.hw_ops.dma_complete_interrupt)
+               return 2;
+       return oper_cfg.hw_ops.dma_complete_interrupt();
+}
+EXPORT_SYMBOL(vpss_dma_complete_interrupt);
+
 int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel)
 {
        if (!oper_cfg.hw_ops.select_ccdc_source)
@@ -200,6 +214,15 @@ static int dm644x_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
        return 0;
 }
 
+void vpss_set_sync_pol(struct vpss_sync_pol sync)
+{
+       if (!oper_cfg.hw_ops.set_sync_pol)
+               return;
+
+       oper_cfg.hw_ops.set_sync_pol(sync);
+}
+EXPORT_SYMBOL(vpss_set_sync_pol);
+
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel)
 {
        if (!oper_cfg.hw_ops.clear_wbl_overflow)
@@ -365,6 +388,15 @@ void dm365_vpss_set_sync_pol(struct vpss_sync_pol sync)
 }
 EXPORT_SYMBOL(dm365_vpss_set_sync_pol);
 
+void vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
+{
+       if (!oper_cfg.hw_ops.set_pg_frame_size)
+               return;
+
+       oper_cfg.hw_ops.set_pg_frame_size(frame_size);
+}
+EXPORT_SYMBOL(vpss_set_pg_frame_size);
+
 void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
 {
        int current_reg = ((frame_size.hlpfr >> 1) - 1) << 16;
index b586495bcd53cfa9d676847415431e1914d6dfbd..153473daaa32fc9d559ef47661692e3668074f05 100644 (file)
@@ -105,4 +105,20 @@ enum vpss_wbl_sel {
 };
 /* clear wbl overflow flag for DM6446 */
 int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
+
+/* set sync polarity*/
+void vpss_set_sync_pol(struct vpss_sync_pol sync);
+/* set the PG_FRAME_SIZE register */
+void vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size);
+/*
+ * vpss_check_and_clear_interrupt - check and clear interrupt
+ * @irq - common enumerator for IRQ
+ *
+ * Following return values used:-
+ * 0 - interrupt occurred and cleared
+ * 1 - interrupt not occurred
+ * 2 - interrupt status not available
+ */
+int vpss_dma_complete_interrupt(void);
+
 #endif