gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 16 May 2012 15:28:29 +0000 (17:28 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 4 Jun 2014 09:07:11 +0000 (11:07 +0200)
This function returns the currently active buffer (0 or 1)
of a double buffered IDMAC channel. It is to be used by the
CSI driver.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-common.c
include/video/imx-ipu-v3.h

index 2aecc474c4783f8c98b4ba6b2838e712c1c715c7..9459f4091a274ef9e3847e397c5df4839407ceea 100644 (file)
@@ -661,6 +661,15 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
 }
 EXPORT_SYMBOL_GPL(ipu_module_disable);
 
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
+{
+       struct ipu_soc *ipu = channel->ipu;
+       unsigned int chno = channel->num;
+
+       return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
+
 void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
 {
        struct ipu_soc *ipu = channel->ipu;
index e639387eee3f5533d8097cf29fdca8489009f619..f3714301d74005b46f7d1d3f151c32fedffbf77d 100644 (file)
@@ -103,6 +103,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
 
 void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
                bool doublebuffer);
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
 void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
 
 /*
This page took 0.034975 seconds and 5 git commands to generate.