diff options
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-common.c | 26 | ||||
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-prv.h | 1 | ||||
-rw-r--r-- | include/video/imx-ipu-v3.h | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c index 18563c240f10..fec72c0d18ba 100644 --- a/drivers/gpu/ipu-v3/ipu-common.c +++ b/drivers/gpu/ipu-v3/ipu-common.c | |||
@@ -232,7 +232,7 @@ void ipu_idmac_put(struct ipuv3_channel *channel) | |||
232 | } | 232 | } |
233 | EXPORT_SYMBOL_GPL(ipu_idmac_put); | 233 | EXPORT_SYMBOL_GPL(ipu_idmac_put); |
234 | 234 | ||
235 | #define idma_mask(ch) (1 << (ch & 0x1f)) | 235 | #define idma_mask(ch) (1 << ((ch) & 0x1f)) |
236 | 236 | ||
237 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, | 237 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, |
238 | bool doublebuffer) | 238 | bool doublebuffer) |
@@ -315,6 +315,30 @@ int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel) | |||
315 | } | 315 | } |
316 | EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer); | 316 | EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer); |
317 | 317 | ||
318 | bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num) | ||
319 | { | ||
320 | struct ipu_soc *ipu = channel->ipu; | ||
321 | unsigned long flags; | ||
322 | u32 reg = 0; | ||
323 | |||
324 | spin_lock_irqsave(&ipu->lock, flags); | ||
325 | switch (buf_num) { | ||
326 | case 0: | ||
327 | reg = ipu_cm_read(ipu, IPU_CHA_BUF0_RDY(channel->num)); | ||
328 | break; | ||
329 | case 1: | ||
330 | reg = ipu_cm_read(ipu, IPU_CHA_BUF1_RDY(channel->num)); | ||
331 | break; | ||
332 | case 2: | ||
333 | reg = ipu_cm_read(ipu, IPU_CHA_BUF2_RDY(channel->num)); | ||
334 | break; | ||
335 | } | ||
336 | spin_unlock_irqrestore(&ipu->lock, flags); | ||
337 | |||
338 | return ((reg & idma_mask(channel->num)) != 0); | ||
339 | } | ||
340 | EXPORT_SYMBOL_GPL(ipu_idmac_buffer_is_ready); | ||
341 | |||
318 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num) | 342 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num) |
319 | { | 343 | { |
320 | struct ipu_soc *ipu = channel->ipu; | 344 | struct ipu_soc *ipu = channel->ipu; |
diff --git a/drivers/gpu/ipu-v3/ipu-prv.h b/drivers/gpu/ipu-v3/ipu-prv.h index 7f08a461c929..bfb1e8a4483f 100644 --- a/drivers/gpu/ipu-v3/ipu-prv.h +++ b/drivers/gpu/ipu-v3/ipu-prv.h | |||
@@ -68,6 +68,7 @@ struct ipu_soc; | |||
68 | #define IPU_DISP_TASK_STAT IPU_CM_REG(0x0254) | 68 | #define IPU_DISP_TASK_STAT IPU_CM_REG(0x0254) |
69 | #define IPU_CHA_BUF0_RDY(ch) IPU_CM_REG(0x0268 + 4 * ((ch) / 32)) | 69 | #define IPU_CHA_BUF0_RDY(ch) IPU_CM_REG(0x0268 + 4 * ((ch) / 32)) |
70 | #define IPU_CHA_BUF1_RDY(ch) IPU_CM_REG(0x0270 + 4 * ((ch) / 32)) | 70 | #define IPU_CHA_BUF1_RDY(ch) IPU_CM_REG(0x0270 + 4 * ((ch) / 32)) |
71 | #define IPU_CHA_BUF2_RDY(ch) IPU_CM_REG(0x0288 + 4 * ((ch) / 32)) | ||
71 | #define IPU_ALT_CHA_BUF0_RDY(ch) IPU_CM_REG(0x0278 + 4 * ((ch) / 32)) | 72 | #define IPU_ALT_CHA_BUF0_RDY(ch) IPU_CM_REG(0x0278 + 4 * ((ch) / 32)) |
72 | #define IPU_ALT_CHA_BUF1_RDY(ch) IPU_CM_REG(0x0280 + 4 * ((ch) / 32)) | 73 | #define IPU_ALT_CHA_BUF1_RDY(ch) IPU_CM_REG(0x0280 + 4 * ((ch) / 32)) |
73 | 74 | ||
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index 2e9bfe24fb67..10013378394e 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h | |||
@@ -165,6 +165,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms); | |||
165 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, | 165 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, |
166 | bool doublebuffer); | 166 | bool doublebuffer); |
167 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); | 167 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); |
168 | bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num); | ||
168 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); | 169 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); |
169 | 170 | ||
170 | /* | 171 | /* |