]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
gpu: ipu-v3: Add ipu_idmac_clear_buffer()
authorSteve Longerbeam <slongerbeam@gmail.com>
Thu, 26 Jun 2014 01:05:41 +0000 (18:05 -0700)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 2 Sep 2014 12:55:49 +0000 (14:55 +0200)
Add the reverse of ipu_idmac_select_buffer(), that is, clear a buffer
ready status in a channel.

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

index fec72c0d18ba6006c4ca8977c3a1e9996a8c34d8..773a2fc8fed4da4f511e023c405d2ba98a8a8cf5 100644 (file)
@@ -357,6 +357,34 @@ void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
 }
 EXPORT_SYMBOL_GPL(ipu_idmac_select_buffer);
 
+void ipu_idmac_clear_buffer(struct ipuv3_channel *channel, u32 buf_num)
+{
+       struct ipu_soc *ipu = channel->ipu;
+       unsigned int chno = channel->num;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ipu->lock, flags);
+
+       ipu_cm_write(ipu, 0xF0300000, IPU_GPR); /* write one to clear */
+       switch (buf_num) {
+       case 0:
+               ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF0_RDY(chno));
+               break;
+       case 1:
+               ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF1_RDY(chno));
+               break;
+       case 2:
+               ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF2_RDY(chno));
+               break;
+       default:
+               break;
+       }
+       ipu_cm_write(ipu, 0x0, IPU_GPR); /* write one to set */
+
+       spin_unlock_irqrestore(&ipu->lock, flags);
+}
+EXPORT_SYMBOL_GPL(ipu_idmac_clear_buffer);
+
 int ipu_idmac_enable_channel(struct ipuv3_channel *channel)
 {
        struct ipu_soc *ipu = channel->ipu;
index 10013378394e83800b045525738378c928edb484..ae44eb067f5bba0cf933f5c2747f3ce7b4c9d8bf 100644 (file)
@@ -167,6 +167,7 @@ void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
 int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
 bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num);
 void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
+void ipu_idmac_clear_buffer(struct ipuv3_channel *channel, u32 buf_num);
 
 /*
  * IPU Channel Parameter Memory (cpmem) functions