Skip to content

Commit e904609

Browse files
committed
gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
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>
1 parent 35de925 commit e904609

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎drivers/gpu/ipu-v3/ipu-common.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,15 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
661661
}
662662
EXPORT_SYMBOL_GPL(ipu_module_disable);
663663

664+
int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
665+
{
666+
struct ipu_soc *ipu = channel->ipu;
667+
unsigned int chno = channel->num;
668+
669+
return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0;
670+
}
671+
EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
672+
664673
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
665674
{
666675
struct ipu_soc *ipu = channel->ipu;

‎include/video/imx-ipu-v3.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
103103

104104
void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
105105
bool doublebuffer);
106+
int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
106107
void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
107108

108109
/*

0 commit comments

Comments
 (0)